summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/elfutils-0.168
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2017-02-06 04:34:46 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-15 20:06:42 -0800
commitf0a300c44ddcc44fd81a6362944411f138d96aa9 (patch)
tree79da36efe6d558a3a3ea3afe82d5ecfed2879647 /meta/recipes-devtools/elfutils/elfutils-0.168
parentedd51e8659ca03a8f7a06f563e90fb4f0e5aa060 (diff)
downloadpoky-f0a300c44ddcc44fd81a6362944411f138d96aa9.tar.gz
elfutils: 0.166 -> 0.168
- Backport patches from debian to 0.168 and add US tags. - Rebase 0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch to support libc musl (From OE-Core rev: 13e5819dc4ef44d99d0f22686365fd3c988d6bce) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/elfutils/elfutils-0.168')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch1051
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch35
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/0001-fix-a-stack-usage-warning.patch28
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/0001-remove-the-unneed-checking.patch38
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/aarch64_uio.patch47
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch35
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch171
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/0003-Add-mips-n64-relocation-format-hack.patch229
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/arm_backend.diff603
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/hppa_backend.diff802
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/hurd_path.patch17
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/ignore_strmerge.diff14
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/kfreebsd_path.patch20
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_backend.diff686
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_readelf_w.patch25
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/debian/testsuite-ignore-elflint.diff42
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/fixheadercheck.patch23
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.168/shadow.patch23
18 files changed, 3889 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
new file mode 100644
index 0000000000..020ffa141b
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -0,0 +1,1051 @@
1From 054fedda5ab9b84160d40d90cb967f2f5822b889 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
7Upstream-Status: Pending
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Rebase to 0.68
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12---
13 Makefile.am | 2 +-
14 lib/color.c | 3 ++-
15 lib/crc32_file.c | 1 +
16 lib/fixedsizehash.h | 1 -
17 lib/system.h | 10 ++++++++++
18 lib/xmalloc.c | 2 +-
19 libasm/asm_end.c | 2 +-
20 libasm/asm_newscn.c | 2 +-
21 libcpu/i386_gendis.c | 2 +-
22 libcpu/i386_lex.c | 2 +-
23 libcpu/i386_parse.c | 2 +-
24 libdw/Makefile.am | 4 +++-
25 libdw/libdw_alloc.c | 2 +-
26 libdwfl/dwfl_build_id_find_elf.c | 3 ++-
27 libdwfl/dwfl_error.c | 4 +++-
28 libdwfl/dwfl_module_getdwarf.c | 1 +
29 libdwfl/find-debuginfo.c | 2 +-
30 libdwfl/libdwfl_crc32_file.c | 10 ++++++++++
31 libdwfl/linux-kernel-modules.c | 1 +
32 libebl/eblopenbackend.c | 2 +-
33 libelf/elf.h | 8 ++++++--
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/nm.c | 2 +-
44 src/objdump.c | 2 +-
45 src/ranlib.c | 2 +-
46 src/readelf.c | 2 +-
47 src/size.c | 2 +-
48 src/stack.c | 2 +-
49 src/strings.c | 2 +-
50 src/strip.c | 2 +-
51 src/unstrip.c | 2 +-
52 tests/addrscopes.c | 2 +-
53 tests/allregs.c | 2 +-
54 tests/backtrace-data.c | 2 +-
55 tests/backtrace-dwarf.c | 2 +-
56 tests/backtrace.c | 2 +-
57 tests/buildid.c | 2 +-
58 tests/debugaltlink.c | 2 +-
59 tests/debuglink.c | 2 +-
60 tests/deleted.c | 2 +-
61 tests/dwfl-addr-sect.c | 2 +-
62 tests/dwfl-bug-addr-overflow.c | 2 +-
63 tests/dwfl-bug-fd-leak.c | 2 +-
64 tests/dwfl-bug-getmodules.c | 2 +-
65 tests/dwfl-report-elf-align.c | 2 +-
66 tests/dwfllines.c | 2 +-
67 tests/dwflmodtest.c | 2 +-
68 tests/dwflsyms.c | 2 +-
69 tests/early-offscn.c | 2 +-
70 tests/ecp.c | 2 +-
71 tests/find-prologues.c | 2 +-
72 tests/funcretval.c | 2 +-
73 tests/funcscopes.c | 2 +-
74 tests/getsrc_die.c | 2 +-
75 tests/line2addr.c | 2 +-
76 tests/low_high_pc.c | 2 +-
77 tests/md5-sha1-test.c | 2 +-
78 tests/rdwrmmap.c | 2 +-
79 tests/saridx.c | 2 +-
80 tests/sectiondump.c | 2 +-
81 tests/varlocs.c | 2 +-
82 tests/vdsosyms.c | 2 +-
83 70 files changed, 98 insertions(+), 64 deletions(-)
84
85diff --git a/Makefile.am b/Makefile.am
86index 2ff444e..41f77df 100644
87--- a/Makefile.am
88+++ b/Makefile.am
89@@ -28,7 +28,7 @@ pkginclude_HEADERS = version.h
90
91 # Add doc back when we have some real content.
92 SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
93- backends src po tests
94+ backends po tests
95
96 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
97 COPYING COPYING-GPLV2 COPYING-LGPLV3
98diff --git a/lib/color.c b/lib/color.c
99index fde2d9d..73292ac 100644
100--- a/lib/color.c
101+++ b/lib/color.c
102@@ -32,12 +32,13 @@
103 #endif
104
105 #include <argp.h>
106-#include <error.h>
107+#include <err.h>
108 #include <libintl.h>
109 #include <stdlib.h>
110 #include <string.h>
111 #include <unistd.h>
112 #include "libeu.h"
113+#include "system.h"
114
115
116 /* Prototype for option handler. */
117diff --git a/lib/crc32_file.c b/lib/crc32_file.c
118index a8434d4..57e4298 100644
119--- a/lib/crc32_file.c
120+++ b/lib/crc32_file.c
121@@ -35,6 +35,7 @@
122 #include <unistd.h>
123 #include <sys/stat.h>
124 #include <sys/mman.h>
125+#include "system.h"
126
127 int
128 crc32_file (int fd, uint32_t *resp)
129diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
130index dac2a5f..43016fc 100644
131--- a/lib/fixedsizehash.h
132+++ b/lib/fixedsizehash.h
133@@ -30,7 +30,6 @@
134 #include <errno.h>
135 #include <stdlib.h>
136 #include <string.h>
137-#include <sys/cdefs.h>
138
139 #include <system.h>
140
141diff --git a/lib/system.h b/lib/system.h
142index ccd99d6..0e93e60 100644
143--- a/lib/system.h
144+++ b/lib/system.h
145@@ -55,6 +55,16 @@
146 #else
147 # error "Unknown byte order"
148 #endif
149+#ifndef TEMP_FAILURE_RETRY
150+#define TEMP_FAILURE_RETRY(expression) \
151+ (__extension__ \
152+ ({ long int __result; \
153+ do __result = (long int) (expression); \
154+ while (__result == -1L && errno == EINTR); \
155+ __result; }))
156+#endif
157+
158+#define error(status, errno, ...) err(status, __VA_ARGS__)
159
160 #ifndef MAX
161 #define MAX(m, n) ((m) < (n) ? (n) : (m))
162diff --git a/lib/xmalloc.c b/lib/xmalloc.c
163index 0cde384..217b054 100644
164--- a/lib/xmalloc.c
165+++ b/lib/xmalloc.c
166@@ -30,7 +30,7 @@
167 # include <config.h>
168 #endif
169
170-#include <error.h>
171+#include <err.h>
172 #include <libintl.h>
173 #include <stddef.h>
174 #include <stdlib.h>
175diff --git a/libasm/asm_end.c b/libasm/asm_end.c
176index 191a535..bf5ab06 100644
177--- a/libasm/asm_end.c
178+++ b/libasm/asm_end.c
179@@ -32,7 +32,7 @@
180 #endif
181
182 #include <assert.h>
183-#include <error.h>
184+#include <err.h>
185 #include <libintl.h>
186 #include <stdio.h>
187 #include <stdlib.h>
188diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
189index ddbb25d..74a598d 100644
190--- a/libasm/asm_newscn.c
191+++ b/libasm/asm_newscn.c
192@@ -32,7 +32,7 @@
193 #endif
194
195 #include <assert.h>
196-#include <error.h>
197+#include <err.h>
198 #include <libintl.h>
199 #include <stdlib.h>
200 #include <string.h>
201diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
202index aae5eae..6d76016 100644
203--- a/libcpu/i386_gendis.c
204+++ b/libcpu/i386_gendis.c
205@@ -31,7 +31,7 @@
206 # include <config.h>
207 #endif
208
209-#include <error.h>
210+#include <err.h>
211 #include <errno.h>
212 #include <stdio.h>
213 #include <stdlib.h>
214diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
215index b670608..b842c25 100644
216--- a/libcpu/i386_lex.c
217+++ b/libcpu/i386_lex.c
218@@ -592,7 +592,7 @@ char *i386_text;
219 #endif
220
221 #include <ctype.h>
222-#include <error.h>
223+#include <err.h>
224 #include <libintl.h>
225
226 #include <libeu.h>
227diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
228index 724addf..5b67802 100644
229--- a/libcpu/i386_parse.c
230+++ b/libcpu/i386_parse.c
231@@ -107,7 +107,7 @@
232 #include <assert.h>
233 #include <ctype.h>
234 #include <errno.h>
235-#include <error.h>
236+#include <err.h>
237 #include <inttypes.h>
238 #include <libintl.h>
239 #include <math.h>
240diff --git a/libdw/Makefile.am b/libdw/Makefile.am
241index 082d96c..51cbea0 100644
242--- a/libdw/Makefile.am
243+++ b/libdw/Makefile.am
244@@ -102,6 +102,8 @@ endif
245 libdw_pic_a_SOURCES =
246 am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
247
248+fts_LDADD = -lfts
249+
250 libdw_so_SOURCES =
251 libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
252 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
253@@ -112,7 +114,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
254 -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
255 -Wl,--version-script,$<,--no-undefined \
256 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
257- -ldl -lz $(argp_LDADD) $(zip_LIBS)
258+ -ldl -lz $(argp_LDADD) $(zip_LIBS) $(fts_LDADD)
259 @$(textrel_check)
260 $(AM_V_at)ln -fs $@ $@.$(VERSION)
261
262diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
263index 28a8cf6..29aeb3f 100644
264--- a/libdw/libdw_alloc.c
265+++ b/libdw/libdw_alloc.c
266@@ -31,7 +31,7 @@
267 # include <config.h>
268 #endif
269
270-#include <error.h>
271+#include <err.h>
272 #include <errno.h>
273 #include <stdlib.h>
274 #include "libdwP.h"
275diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
276index 903e193..b00d10c 100644
277--- a/libdwfl/dwfl_build_id_find_elf.c
278+++ b/libdwfl/dwfl_build_id_find_elf.c
279@@ -27,6 +27,7 @@
280 not, see <http://www.gnu.org/licenses/>. */
281
282 #include "libdwflP.h"
283+#include "system.h"
284 #include <inttypes.h>
285 #include <fcntl.h>
286 #include <unistd.h>
287@@ -94,7 +95,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
288 {
289 if (*file_name != NULL)
290 free (*file_name);
291- *file_name = canonicalize_file_name (name);
292+ *file_name = realpath (name, NULL);
293 if (*file_name == NULL)
294 {
295 *file_name = name;
296diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
297index 7bcf61c..c345797 100644
298--- a/libdwfl/dwfl_error.c
299+++ b/libdwfl/dwfl_error.c
300@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
301 const char *
302 dwfl_errmsg (int error)
303 {
304+ static __thread char s[64] = "";
305 if (error == 0 || error == -1)
306 {
307 int last_error = global_error;
308@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
309 switch (error &~ 0xffff)
310 {
311 case OTHER_ERROR (ERRNO):
312- return strerror_r (error & 0xffff, "bad", 0);
313+ strerror_r (error & 0xffff, s, sizeof(s));
314+ return s;
315 case OTHER_ERROR (LIBELF):
316 return elf_errmsg (error & 0xffff);
317 case OTHER_ERROR (LIBDW):
318diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
319index 0e8810b..82ad665 100644
320--- a/libdwfl/dwfl_module_getdwarf.c
321+++ b/libdwfl/dwfl_module_getdwarf.c
322@@ -31,6 +31,7 @@
323 #include <fcntl.h>
324 #include <string.h>
325 #include <unistd.h>
326+#include "system.h"
327 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
328 #include "../libelf/libelfP.h"
329
330diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
331index 80515db..80b0148 100644
332--- a/libdwfl/find-debuginfo.c
333+++ b/libdwfl/find-debuginfo.c
334@@ -385,7 +385,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
335 /* If FILE_NAME is a symlink, the debug file might be associated
336 with the symlink target name instead. */
337
338- char *canon = canonicalize_file_name (file_name);
339+ char *canon = realpath (file_name, NULL);
340 if (canon != NULL && strcmp (file_name, canon))
341 fd = find_debuginfo_in_path (mod, canon,
342 debuglink_file, debuglink_crc,
343diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
344index 6b6b7d3..debc4a4 100644
345--- a/libdwfl/libdwfl_crc32_file.c
346+++ b/libdwfl/libdwfl_crc32_file.c
347@@ -31,6 +31,16 @@
348
349 #define crc32_file attribute_hidden __libdwfl_crc32_file
350 #define crc32 __libdwfl_crc32
351+
352+#ifndef TEMP_FAILURE_RETRY
353+#define TEMP_FAILURE_RETRY(expression) \
354+ (__extension__ \
355+ ({ long int __result; \
356+ do __result = (long int) (expression); \
357+ while (__result == -1L && errno == EINTR); \
358+ __result; }))
359+#endif
360+
361 #define LIB_SYSTEM_H 1
362 #include <libdwflP.h>
363 #include "../lib/crc32_file.c"
364diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
365index 9cd8ea9..4dbf4c5 100644
366--- a/libdwfl/linux-kernel-modules.c
367+++ b/libdwfl/linux-kernel-modules.c
368@@ -36,6 +36,7 @@
369 #include <config.h>
370
371 #include "libdwflP.h"
372+#include "system.h"
373 #include <inttypes.h>
374 #include <errno.h>
375 #include <stdio.h>
376diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
377index 34d439a..56d2345 100644
378--- a/libebl/eblopenbackend.c
379+++ b/libebl/eblopenbackend.c
380@@ -32,7 +32,7 @@
381
382 #include <assert.h>
383 #include <dlfcn.h>
384-#include <error.h>
385+#include <err.h>
386 #include <libelfP.h>
387 #include <dwarf.h>
388 #include <stdlib.h>
389diff --git a/libelf/elf.h b/libelf/elf.h
390index 74654d6..81eee8b 100644
391--- a/libelf/elf.h
392+++ b/libelf/elf.h
393@@ -21,7 +21,9 @@
394
395 #include <features.h>
396
397-__BEGIN_DECLS
398+#ifdef __cplusplus
399+extern "C" {
400+#endif
401
402 /* Standard ELF types. */
403
404@@ -3704,6 +3706,8 @@ enum
405 #define R_BPF_NONE 0 /* No reloc */
406 #define R_BPF_MAP_FD 1 /* Map fd to pointer */
407
408-__END_DECLS
409+#ifdef __cplusplus
410+}
411+#endif
412
413 #endif /* elf.h */
414diff --git a/libelf/libelf.h b/libelf/libelf.h
415index c0d6389..38a68fd 100644
416--- a/libelf/libelf.h
417+++ b/libelf/libelf.h
418@@ -29,6 +29,7 @@
419 #ifndef _LIBELF_H
420 #define _LIBELF_H 1
421
422+#include <fcntl.h>
423 #include <stdint.h>
424 #include <sys/types.h>
425
426diff --git a/libelf/libelfP.h b/libelf/libelfP.h
427index 4459982..1296f20 100644
428--- a/libelf/libelfP.h
429+++ b/libelf/libelfP.h
430@@ -36,6 +36,7 @@
431
432 #include <ar.h>
433 #include <gelf.h>
434+#include <libelf.h>
435
436 #include <errno.h>
437 #include <stdbool.h>
438diff --git a/src/addr2line.c b/src/addr2line.c
439index 0222088..cd6a9a6 100644
440--- a/src/addr2line.c
441+++ b/src/addr2line.c
442@@ -23,7 +23,7 @@
443 #include <argp.h>
444 #include <assert.h>
445 #include <errno.h>
446-#include <error.h>
447+#include <err.h>
448 #include <fcntl.h>
449 #include <inttypes.h>
450 #include <libdwfl.h>
451diff --git a/src/ar.c b/src/ar.c
452index f2f322b..6e70031 100644
453--- a/src/ar.c
454+++ b/src/ar.c
455@@ -22,7 +22,7 @@
456
457 #include <argp.h>
458 #include <assert.h>
459-#include <error.h>
460+#include <err.h>
461 #include <fcntl.h>
462 #include <gelf.h>
463 #include <libintl.h>
464diff --git a/src/arlib.c b/src/arlib.c
465index e0839aa..1143658 100644
466--- a/src/arlib.c
467+++ b/src/arlib.c
468@@ -21,7 +21,7 @@
469 #endif
470
471 #include <assert.h>
472-#include <error.h>
473+#include <err.h>
474 #include <gelf.h>
475 #include <inttypes.h>
476 #include <libintl.h>
477diff --git a/src/arlib2.c b/src/arlib2.c
478index 553fc57..46443d0 100644
479--- a/src/arlib2.c
480+++ b/src/arlib2.c
481@@ -20,7 +20,7 @@
482 # include <config.h>
483 #endif
484
485-#include <error.h>
486+#include <err.h>
487 #include <libintl.h>
488 #include <limits.h>
489 #include <string.h>
490diff --git a/src/elfcmp.c b/src/elfcmp.c
491index 401ab31..873d253 100644
492--- a/src/elfcmp.c
493+++ b/src/elfcmp.c
494@@ -23,7 +23,7 @@
495 #include <argp.h>
496 #include <assert.h>
497 #include <errno.h>
498-#include <error.h>
499+#include <err.h>
500 #include <fcntl.h>
501 #include <locale.h>
502 #include <libintl.h>
503diff --git a/src/elflint.c b/src/elflint.c
504index 7d3f227..074d21c 100644
505--- a/src/elflint.c
506+++ b/src/elflint.c
507@@ -24,7 +24,7 @@
508 #include <assert.h>
509 #include <byteswap.h>
510 #include <endian.h>
511-#include <error.h>
512+#include <err.h>
513 #include <fcntl.h>
514 #include <gelf.h>
515 #include <inttypes.h>
516diff --git a/src/findtextrel.c b/src/findtextrel.c
517index dc41502..325888c 100644
518--- a/src/findtextrel.c
519+++ b/src/findtextrel.c
520@@ -23,7 +23,7 @@
521 #include <argp.h>
522 #include <assert.h>
523 #include <errno.h>
524-#include <error.h>
525+#include <err.h>
526 #include <fcntl.h>
527 #include <gelf.h>
528 #include <libdw.h>
529diff --git a/src/nm.c b/src/nm.c
530index c54e96f..9e031d9 100644
531--- a/src/nm.c
532+++ b/src/nm.c
533@@ -26,7 +26,7 @@
534 #include <ctype.h>
535 #include <dwarf.h>
536 #include <errno.h>
537-#include <error.h>
538+#include <err.h>
539 #include <fcntl.h>
540 #include <gelf.h>
541 #include <inttypes.h>
542diff --git a/src/objdump.c b/src/objdump.c
543index fff4b81..4b1f966 100644
544--- a/src/objdump.c
545+++ b/src/objdump.c
546@@ -21,7 +21,7 @@
547 #endif
548
549 #include <argp.h>
550-#include <error.h>
551+#include <err.h>
552 #include <fcntl.h>
553 #include <inttypes.h>
554 #include <libintl.h>
555diff --git a/src/ranlib.c b/src/ranlib.c
556index 41a3bcf..0c7da2c 100644
557--- a/src/ranlib.c
558+++ b/src/ranlib.c
559@@ -24,7 +24,7 @@
560 #include <argp.h>
561 #include <assert.h>
562 #include <errno.h>
563-#include <error.h>
564+#include <err.h>
565 #include <fcntl.h>
566 #include <gelf.h>
567 #include <libintl.h>
568diff --git a/src/readelf.c b/src/readelf.c
569index d18a4b7..a6cfb35 100644
570--- a/src/readelf.c
571+++ b/src/readelf.c
572@@ -25,7 +25,7 @@
573 #include <ctype.h>
574 #include <dwarf.h>
575 #include <errno.h>
576-#include <error.h>
577+#include <err.h>
578 #include <fcntl.h>
579 #include <gelf.h>
580 #include <inttypes.h>
581diff --git a/src/size.c b/src/size.c
582index de0d791..4639d42 100644
583--- a/src/size.c
584+++ b/src/size.c
585@@ -21,7 +21,7 @@
586 #endif
587
588 #include <argp.h>
589-#include <error.h>
590+#include <err.h>
591 #include <fcntl.h>
592 #include <gelf.h>
593 #include <inttypes.h>
594diff --git a/src/stack.c b/src/stack.c
595index a5a7beb..4c075bc 100644
596--- a/src/stack.c
597+++ b/src/stack.c
598@@ -18,7 +18,7 @@
599 #include <config.h>
600 #include <assert.h>
601 #include <argp.h>
602-#include <error.h>
603+#include <err.h>
604 #include <stdlib.h>
605 #include <inttypes.h>
606 #include <stdio.h>
607diff --git a/src/strings.c b/src/strings.c
608index 49aab8b..09d5b1c 100644
609--- a/src/strings.c
610+++ b/src/strings.c
611@@ -25,7 +25,7 @@
612 #include <ctype.h>
613 #include <endian.h>
614 #include <errno.h>
615-#include <error.h>
616+#include <err.h>
617 #include <fcntl.h>
618 #include <gelf.h>
619 #include <inttypes.h>
620diff --git a/src/strip.c b/src/strip.c
621index a875ddf..fd76f7f 100644
622--- a/src/strip.c
623+++ b/src/strip.c
624@@ -24,7 +24,7 @@
625 #include <assert.h>
626 #include <byteswap.h>
627 #include <endian.h>
628-#include <error.h>
629+#include <err.h>
630 #include <fcntl.h>
631 #include <gelf.h>
632 #include <libelf.h>
633diff --git a/src/unstrip.c b/src/unstrip.c
634index d838ae9..0108272 100644
635--- a/src/unstrip.c
636+++ b/src/unstrip.c
637@@ -31,7 +31,7 @@
638 #include <argp.h>
639 #include <assert.h>
640 #include <errno.h>
641-#include <error.h>
642+#include <err.h>
643 #include <fcntl.h>
644 #include <fnmatch.h>
645 #include <libintl.h>
646diff --git a/tests/addrscopes.c b/tests/addrscopes.c
647index 791569f..54f4311 100644
648--- a/tests/addrscopes.c
649+++ b/tests/addrscopes.c
650@@ -25,7 +25,7 @@
651 #include <stdio_ext.h>
652 #include <locale.h>
653 #include <stdlib.h>
654-#include <error.h>
655+#include <err.h>
656 #include <string.h>
657
658
659diff --git a/tests/allregs.c b/tests/allregs.c
660index 286f7e3..c9de089 100644
661--- a/tests/allregs.c
662+++ b/tests/allregs.c
663@@ -21,7 +21,7 @@
664 #include <stdio.h>
665 #include <stdlib.h>
666 #include <string.h>
667-#include <error.h>
668+#include <err.h>
669 #include <locale.h>
670 #include <argp.h>
671 #include <assert.h>
672diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
673index b7158da..354fa6a 100644
674--- a/tests/backtrace-data.c
675+++ b/tests/backtrace-data.c
676@@ -27,7 +27,7 @@
677 #include <dirent.h>
678 #include <stdlib.h>
679 #include <errno.h>
680-#include <error.h>
681+#include <err.h>
682 #include <unistd.h>
683 #include <dwarf.h>
684 #if defined(__x86_64__) && defined(__linux__)
685diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
686index a644c8a..b8cbe27 100644
687--- a/tests/backtrace-dwarf.c
688+++ b/tests/backtrace-dwarf.c
689@@ -22,7 +22,7 @@
690 #include <stdio_ext.h>
691 #include <locale.h>
692 #include <errno.h>
693-#include <error.h>
694+#include <err.h>
695 #include <unistd.h>
696 #include <sys/ptrace.h>
697 #include <sys/types.h>
698diff --git a/tests/backtrace.c b/tests/backtrace.c
699index 1ff6353..47e3f7b 100644
700--- a/tests/backtrace.c
701+++ b/tests/backtrace.c
702@@ -24,7 +24,7 @@
703 #include <dirent.h>
704 #include <stdlib.h>
705 #include <errno.h>
706-#include <error.h>
707+#include <err.h>
708 #include <unistd.h>
709 #include <dwarf.h>
710 #ifdef __linux__
711diff --git a/tests/buildid.c b/tests/buildid.c
712index 87c1877..2953e6b 100644
713--- a/tests/buildid.c
714+++ b/tests/buildid.c
715@@ -23,7 +23,7 @@
716 #include ELFUTILS_HEADER(elf)
717 #include ELFUTILS_HEADER(dwelf)
718 #include <stdio.h>
719-#include <error.h>
720+#include <err.h>
721 #include <string.h>
722 #include <stdlib.h>
723 #include <sys/types.h>
724diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
725index 6d97d50..ee7e559 100644
726--- a/tests/debugaltlink.c
727+++ b/tests/debugaltlink.c
728@@ -23,7 +23,7 @@
729 #include ELFUTILS_HEADER(dw)
730 #include ELFUTILS_HEADER(dwelf)
731 #include <stdio.h>
732-#include <error.h>
733+#include <err.h>
734 #include <string.h>
735 #include <stdlib.h>
736 #include <sys/types.h>
737diff --git a/tests/debuglink.c b/tests/debuglink.c
738index 935d102..741cb81 100644
739--- a/tests/debuglink.c
740+++ b/tests/debuglink.c
741@@ -21,7 +21,7 @@
742 #include <errno.h>
743 #include ELFUTILS_HEADER(dwelf)
744 #include <stdio.h>
745-#include <error.h>
746+#include <err.h>
747 #include <string.h>
748 #include <stdlib.h>
749 #include <sys/types.h>
750diff --git a/tests/deleted.c b/tests/deleted.c
751index 6be35bc..0190711 100644
752--- a/tests/deleted.c
753+++ b/tests/deleted.c
754@@ -21,7 +21,7 @@
755 #include <unistd.h>
756 #include <assert.h>
757 #include <stdio.h>
758-#include <error.h>
759+#include <err.h>
760 #include <errno.h>
761 #ifdef __linux__
762 #include <sys/prctl.h>
763diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
764index 21e470a..1ea1e3b 100644
765--- a/tests/dwfl-addr-sect.c
766+++ b/tests/dwfl-addr-sect.c
767@@ -23,7 +23,7 @@
768 #include <stdio_ext.h>
769 #include <stdlib.h>
770 #include <string.h>
771-#include <error.h>
772+#include <err.h>
773 #include <locale.h>
774 #include <argp.h>
775 #include ELFUTILS_HEADER(dwfl)
776diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
777index aa8030e..02c8bef 100644
778--- a/tests/dwfl-bug-addr-overflow.c
779+++ b/tests/dwfl-bug-addr-overflow.c
780@@ -20,7 +20,7 @@
781 #include <inttypes.h>
782 #include <stdio.h>
783 #include <stdio_ext.h>
784-#include <error.h>
785+#include <err.h>
786 #include <locale.h>
787 #include ELFUTILS_HEADER(dwfl)
788
789diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
790index 689cdd7..5973da3 100644
791--- a/tests/dwfl-bug-fd-leak.c
792+++ b/tests/dwfl-bug-fd-leak.c
793@@ -24,7 +24,7 @@
794 #include <dirent.h>
795 #include <stdlib.h>
796 #include <errno.h>
797-#include <error.h>
798+#include <err.h>
799 #include <unistd.h>
800 #include <dwarf.h>
801
802diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
803index 1ee989f..fd62e65 100644
804--- a/tests/dwfl-bug-getmodules.c
805+++ b/tests/dwfl-bug-getmodules.c
806@@ -18,7 +18,7 @@
807 #include <config.h>
808 #include ELFUTILS_HEADER(dwfl)
809
810-#include <error.h>
811+#include <err.h>
812
813 static const Dwfl_Callbacks callbacks =
814 {
815diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
816index a4e97d3..f471587 100644
817--- a/tests/dwfl-report-elf-align.c
818+++ b/tests/dwfl-report-elf-align.c
819@@ -20,7 +20,7 @@
820 #include <inttypes.h>
821 #include <stdio.h>
822 #include <stdio_ext.h>
823-#include <error.h>
824+#include <err.h>
825 #include <locale.h>
826 #include <string.h>
827 #include <stdlib.h>
828diff --git a/tests/dwfllines.c b/tests/dwfllines.c
829index 90379dd..cbdf6c4 100644
830--- a/tests/dwfllines.c
831+++ b/tests/dwfllines.c
832@@ -27,7 +27,7 @@
833 #include <stdio.h>
834 #include <stdlib.h>
835 #include <string.h>
836-#include <error.h>
837+#include <err.h>
838
839 int
840 main (int argc, char *argv[])
841diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
842index 0027f96..e68d3bc 100644
843--- a/tests/dwflmodtest.c
844+++ b/tests/dwflmodtest.c
845@@ -23,7 +23,7 @@
846 #include <stdio_ext.h>
847 #include <stdlib.h>
848 #include <string.h>
849-#include <error.h>
850+#include <err.h>
851 #include <locale.h>
852 #include <argp.h>
853 #include ELFUTILS_HEADER(dwfl)
854diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
855index 49ac334..cf07830 100644
856--- a/tests/dwflsyms.c
857+++ b/tests/dwflsyms.c
858@@ -25,7 +25,7 @@
859 #include <stdio.h>
860 #include <stdio_ext.h>
861 #include <stdlib.h>
862-#include <error.h>
863+#include <err.h>
864 #include <string.h>
865
866 static const char *
867diff --git a/tests/early-offscn.c b/tests/early-offscn.c
868index 924cb9e..6f60d5a 100644
869--- a/tests/early-offscn.c
870+++ b/tests/early-offscn.c
871@@ -19,7 +19,7 @@
872 #endif
873
874 #include <errno.h>
875-#include <error.h>
876+#include <err.h>
877 #include <fcntl.h>
878 #include <gelf.h>
879 #include <stdio.h>
880diff --git a/tests/ecp.c b/tests/ecp.c
881index 38a6859..743cea5 100644
882--- a/tests/ecp.c
883+++ b/tests/ecp.c
884@@ -20,7 +20,7 @@
885 #endif
886
887 #include <errno.h>
888-#include <error.h>
889+#include <err.h>
890 #include <fcntl.h>
891 #include <gelf.h>
892 #include <stdlib.h>
893diff --git a/tests/find-prologues.c b/tests/find-prologues.c
894index ba8ae37..76f5f04 100644
895--- a/tests/find-prologues.c
896+++ b/tests/find-prologues.c
897@@ -25,7 +25,7 @@
898 #include <stdio_ext.h>
899 #include <locale.h>
900 #include <stdlib.h>
901-#include <error.h>
902+#include <err.h>
903 #include <string.h>
904 #include <fnmatch.h>
905
906diff --git a/tests/funcretval.c b/tests/funcretval.c
907index 8d19d11..c8aaa93 100644
908--- a/tests/funcretval.c
909+++ b/tests/funcretval.c
910@@ -25,7 +25,7 @@
911 #include <stdio_ext.h>
912 #include <locale.h>
913 #include <stdlib.h>
914-#include <error.h>
915+#include <err.h>
916 #include <string.h>
917 #include <fnmatch.h>
918
919diff --git a/tests/funcscopes.c b/tests/funcscopes.c
920index 9c90185..dbccb89 100644
921--- a/tests/funcscopes.c
922+++ b/tests/funcscopes.c
923@@ -25,7 +25,7 @@
924 #include <stdio_ext.h>
925 #include <locale.h>
926 #include <stdlib.h>
927-#include <error.h>
928+#include <err.h>
929 #include <string.h>
930 #include <fnmatch.h>
931
932diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
933index 055aede..9c394dd 100644
934--- a/tests/getsrc_die.c
935+++ b/tests/getsrc_die.c
936@@ -19,7 +19,7 @@
937 #endif
938
939 #include <errno.h>
940-#include <error.h>
941+#include <err.h>
942 #include <fcntl.h>
943 #include <inttypes.h>
944 #include <libelf.h>
945diff --git a/tests/line2addr.c b/tests/line2addr.c
946index e0d65d3..9bf0023 100644
947--- a/tests/line2addr.c
948+++ b/tests/line2addr.c
949@@ -26,7 +26,7 @@
950 #include <locale.h>
951 #include <stdlib.h>
952 #include <string.h>
953-#include <error.h>
954+#include <err.h>
955
956
957 static void
958diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
959index d0f4302..8da4fbd 100644
960--- a/tests/low_high_pc.c
961+++ b/tests/low_high_pc.c
962@@ -25,7 +25,7 @@
963 #include <stdio_ext.h>
964 #include <locale.h>
965 #include <stdlib.h>
966-#include <error.h>
967+#include <err.h>
968 #include <string.h>
969 #include <fnmatch.h>
970
971diff --git a/tests/md5-sha1-test.c b/tests/md5-sha1-test.c
972index d50355e..3c41f40 100644
973--- a/tests/md5-sha1-test.c
974+++ b/tests/md5-sha1-test.c
975@@ -19,7 +19,7 @@
976 #endif
977
978 #include <string.h>
979-#include <error.h>
980+#include <err.h>
981
982 #include "md5.h"
983 #include "sha1.h"
984diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
985index 6f027df..1ce5e6e 100644
986--- a/tests/rdwrmmap.c
987+++ b/tests/rdwrmmap.c
988@@ -19,7 +19,7 @@
989 #endif
990
991 #include <errno.h>
992-#include <error.h>
993+#include <err.h>
994 #include <stdio.h>
995 #include <fcntl.h>
996 #include <unistd.h>
997diff --git a/tests/saridx.c b/tests/saridx.c
998index 8a450d8..b387801 100644
999--- a/tests/saridx.c
1000+++ b/tests/saridx.c
1001@@ -17,7 +17,7 @@
1002
1003 #include <config.h>
1004
1005-#include <error.h>
1006+#include <err.h>
1007 #include <fcntl.h>
1008 #include <gelf.h>
1009 #include <stdio.h>
1010diff --git a/tests/sectiondump.c b/tests/sectiondump.c
1011index 3033fed..8e888db 100644
1012--- a/tests/sectiondump.c
1013+++ b/tests/sectiondump.c
1014@@ -18,7 +18,7 @@
1015 #include <config.h>
1016
1017 #include <errno.h>
1018-#include <error.h>
1019+#include <err.h>
1020 #include <fcntl.h>
1021 #include <gelf.h>
1022 #include <inttypes.h>
1023diff --git a/tests/varlocs.c b/tests/varlocs.c
1024index c3fba89..e043ea2 100644
1025--- a/tests/varlocs.c
1026+++ b/tests/varlocs.c
1027@@ -25,7 +25,7 @@
1028 #include <dwarf.h>
1029 #include <stdio.h>
1030 #include <stdlib.h>
1031-#include <error.h>
1032+#include <err.h>
1033 #include <string.h>
1034 #include <sys/types.h>
1035 #include <sys/stat.h>
1036diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
1037index b876c10..afb2823 100644
1038--- a/tests/vdsosyms.c
1039+++ b/tests/vdsosyms.c
1040@@ -18,7 +18,7 @@
1041 #include <config.h>
1042 #include <assert.h>
1043 #include <errno.h>
1044-#include <error.h>
1045+#include <err.h>
1046 #include <inttypes.h>
1047 #include <stdio.h>
1048 #include <string.h>
1049--
10502.8.1
1051
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/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.168/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.168/0001-fix-a-stack-usage-warning.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/0001-fix-a-stack-usage-warning.patch
new file mode 100644
index 0000000000..6923bf7053
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/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.168/0001-remove-the-unneed-checking.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/0001-remove-the-unneed-checking.patch
new file mode 100644
index 0000000000..5be92d705a
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/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.168/aarch64_uio.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/aarch64_uio.patch
new file mode 100644
index 0000000000..38dc57befc
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/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.168/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch
new file mode 100644
index 0000000000..e0291b4cf3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch
@@ -0,0 +1,35 @@
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
12Upstream-Status: Backport [from debian]
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14
15---
16 backends/mips_init.c | 6 +-----
17 1 file changed, 1 insertion(+), 5 deletions(-)
18
19Index: b/backends/mips_init.c
20===================================================================
21--- a/backends/mips_init.c
22+++ b/backends/mips_init.c
23@@ -45,11 +45,7 @@ mips_init (Elf *elf __attribute__ ((unus
24 return NULL;
25
26 /* We handle it. */
27- if (machine == EM_MIPS)
28- eh->name = "MIPS R3000 big-endian";
29- else if (machine == EM_MIPS_RS3_LE)
30- eh->name = "MIPS R3000 little-endian";
31-
32+ eh->name = "MIPS";
33 mips_init_reloc (eh);
34 HOOK (eh, reloc_simple_type);
35 HOOK (eh, return_value_location);
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch
new file mode 100644
index 0000000000..b17498f5fa
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch
@@ -0,0 +1,171 @@
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
8Upstream-Status: Backport [from debian]
9Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
10---
11 backends/mips_retval.c | 104 ++++++++++++++++++++++++++++++++++++++++++++-----
12 1 file changed, 94 insertions(+), 10 deletions(-)
13
14diff --git a/backends/mips_retval.c b/backends/mips_retval.c
15index 33f12a7..d5c6ef0 100644
16--- a/backends/mips_retval.c
17+++ b/backends/mips_retval.c
18@@ -91,6 +91,8 @@ enum mips_abi find_mips_abi(Elf *elf)
19 default:
20 if ((elf_flags & EF_MIPS_ABI2))
21 return MIPS_ABI_N32;
22+ else if ((ehdr->e_ident[EI_CLASS] == ELFCLASS64))
23+ return MIPS_ABI_N64;
24 }
25
26 /* GCC creates a pseudo-section whose name describes the ABI. */
27@@ -195,6 +197,57 @@ static const Dwarf_Op loc_aggregate[] =
28 };
29 #define nloc_aggregate 1
30
31+/* Test if a struct member is a float */
32+static int is_float_child(Dwarf_Die *childdie)
33+{
34+ /* Test if this is actually a struct member */
35+ if (dwarf_tag(childdie) != DW_TAG_member)
36+ return 0;
37+
38+ /* Get type of member */
39+ Dwarf_Attribute attr_mem;
40+ Dwarf_Die child_type_mem;
41+ Dwarf_Die *child_typedie =
42+ dwarf_formref_die(dwarf_attr_integrate(childdie,
43+ DW_AT_type,
44+ &attr_mem), &child_type_mem);
45+
46+ if (dwarf_tag(child_typedie) != DW_TAG_base_type)
47+ return 0;
48+
49+ /* Get base subtype */
50+ Dwarf_Word encoding;
51+ if (dwarf_formudata (dwarf_attr_integrate (child_typedie,
52+ DW_AT_encoding,
53+ &attr_mem), &encoding) != 0)
54+ return 0;
55+
56+ return encoding == DW_ATE_float;
57+}
58+
59+/* Returns the number of fpregs which can be returned in the given struct */
60+static int get_struct_fpregs(Dwarf_Die *structtypedie)
61+{
62+ Dwarf_Die child_mem;
63+ int fpregs = 0;
64+
65+ /* Get first structure member */
66+ if (dwarf_child(structtypedie, &child_mem) != 0)
67+ return 0;
68+
69+ do
70+ {
71+ /* Ensure this register is a float */
72+ if (!is_float_child(&child_mem))
73+ return 0;
74+
75+ fpregs++;
76+ }
77+ while (dwarf_siblingof (&child_mem, &child_mem) == 0);
78+
79+ return fpregs;
80+}
81+
82 int
83 mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
84 {
85@@ -240,6 +293,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
86 tag = dwarf_tag (typedie);
87 }
88
89+ Dwarf_Word size;
90 switch (tag)
91 {
92 case -1:
93@@ -258,8 +312,6 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
94 case DW_TAG_enumeration_type:
95 case DW_TAG_pointer_type:
96 case DW_TAG_ptr_to_member_type:
97- {
98- Dwarf_Word size;
99 if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
100 &attr_mem), &size) != 0)
101 {
102@@ -289,7 +341,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
103 if (size <= 4*regsize && abi == MIPS_ABI_O32)
104 return nloc_fpregquad;
105
106- goto aggregate;
107+ goto large;
108 }
109 }
110 *locp = ABI_LOC(loc_intreg, regsize);
111@@ -298,18 +350,50 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
112 if (size <= 2*regsize)
113 return nloc_intregpair;
114
115- /* Else fall through. Shouldn't happen though (at least with gcc) */
116- }
117+ /* Else pass in memory. Shouldn't happen though (at least with gcc) */
118+ goto large;
119
120 case DW_TAG_structure_type:
121 case DW_TAG_class_type:
122 case DW_TAG_union_type:
123- case DW_TAG_array_type:
124- aggregate:
125- /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
126- if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
127- return -2;
128+ /* Handle special cases for structures <= 128 bytes in newer ABIs */
129+ if (abi == MIPS_ABI_EABI32 || abi == MIPS_ABI_EABI64 ||
130+ abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)
131+ {
132+ if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 16)
133+ {
134+ /*
135+ * Special case in N64 / N32 -
136+ * structures containing only floats are returned in fp regs.
137+ * Everything else is returned in integer regs.
138+ */
139+ if (tag != DW_TAG_union_type &&
140+ (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64))
141+ {
142+ int num_fpregs = get_struct_fpregs(typedie);
143+ if (num_fpregs == 1 || num_fpregs == 2)
144+ {
145+ *locp = loc_fpreg;
146+ if (num_fpregs == 1)
147+ return nloc_fpreg;
148+ else
149+ return nloc_fpregpair;
150+ }
151+ }
152+
153+ *locp = loc_intreg;
154+ if (size <= 8)
155+ return nloc_intreg;
156+ else
157+ return nloc_intregpair;
158+ }
159+ }
160+
161+ /* Fallthrough to handle large types */
162
163+ case DW_TAG_array_type:
164+ large:
165+ /* Return large structures in memory */
166 *locp = loc_aggregate;
167 return nloc_aggregate;
168 }
169--
1702.1.4
171
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0003-Add-mips-n64-relocation-format-hack.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0003-Add-mips-n64-relocation-format-hack.patch
new file mode 100644
index 0000000000..2a5f8628d9
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/0003-Add-mips-n64-relocation-format-hack.patch
@@ -0,0 +1,229 @@
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
16Upstream-Status: Backport [from debian]
17Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
18---
19 libelf/gelf_getrel.c | 25 +++++++++++++++++++++++--
20 libelf/gelf_getrela.c | 25 +++++++++++++++++++++++--
21 libelf/gelf_update_rel.c | 20 +++++++++++++++++++-
22 libelf/gelf_update_rela.c | 20 +++++++++++++++++++-
23 src/strip.c | 17 +++++++++++++++++
24 5 files changed, 101 insertions(+), 6 deletions(-)
25
26Index: b/libelf/gelf_getrel.c
27===================================================================
28--- a/libelf/gelf_getrel.c
29+++ b/libelf/gelf_getrel.c
30@@ -36,6 +36,7 @@
31
32 #include "libelfP.h"
33
34+#define EF_MIPS_ABI 0x0000F000
35
36 GElf_Rel *
37 gelf_getrel (Elf_Data *data, int ndx, GElf_Rel *dst)
38@@ -89,8 +90,28 @@ gelf_getrel (Elf_Data *data, int ndx, GE
39 result = NULL;
40 }
41 else
42- result = memcpy (dst, &((Elf64_Rel *) data_scn->d.d_buf)[ndx],
43- sizeof (Elf64_Rel));
44+ {
45+ GElf_Ehdr hdr;
46+ result = memcpy (dst, &((Elf64_Rel *) data_scn->d.d_buf)[ndx],
47+ sizeof (Elf64_Rel));
48+
49+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
50+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
51+ hdr.e_machine == EM_MIPS &&
52+ (hdr.e_flags & EF_MIPS_ABI) == 0)
53+ {
54+ /*
55+ * The relocation format is mangled on MIPSEL N64
56+ * We'll adjust it so at least R_SYM will work on it
57+ */
58+ GElf_Xword r_info = dst->r_info;
59+ dst->r_info = (r_info << 32) |
60+ ((r_info >> 8) & 0xFF000000) |
61+ ((r_info >> 24) & 0x00FF0000) |
62+ ((r_info >> 40) & 0x0000FF00) |
63+ ((r_info >> 56) & 0x000000FF);
64+ }
65+ }
66 }
67
68 rwlock_unlock (scn->elf->lock);
69Index: b/libelf/gelf_getrela.c
70===================================================================
71--- a/libelf/gelf_getrela.c
72+++ b/libelf/gelf_getrela.c
73@@ -36,6 +36,7 @@
74
75 #include "libelfP.h"
76
77+#define EF_MIPS_ABI 0x0000F000
78
79 GElf_Rela *
80 gelf_getrela (Elf_Data *data, int ndx, GElf_Rela *dst)
81@@ -90,8 +91,28 @@ gelf_getrela (Elf_Data *data, int ndx, G
82 result = NULL;
83 }
84 else
85- result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx],
86- sizeof (Elf64_Rela));
87+ {
88+ GElf_Ehdr hdr;
89+ result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx],
90+ sizeof (Elf64_Rela));
91+
92+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
93+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
94+ hdr.e_machine == EM_MIPS &&
95+ (hdr.e_flags & EF_MIPS_ABI) == 0)
96+ {
97+ /*
98+ * The relocation format is mangled on MIPSEL N64
99+ * We'll adjust it so at least R_SYM will work on it
100+ */
101+ GElf_Xword r_info = dst->r_info;
102+ dst->r_info = (r_info << 32) |
103+ ((r_info >> 8) & 0xFF000000) |
104+ ((r_info >> 24) & 0x00FF0000) |
105+ ((r_info >> 40) & 0x0000FF00) |
106+ ((r_info >> 56) & 0x000000FF);
107+ }
108+ }
109 }
110
111 rwlock_unlock (scn->elf->lock);
112Index: b/libelf/gelf_update_rel.c
113===================================================================
114--- a/libelf/gelf_update_rel.c
115+++ b/libelf/gelf_update_rel.c
116@@ -36,6 +36,7 @@
117
118 #include "libelfP.h"
119
120+#define EF_MIPS_ABI 0x0000F000
121
122 int
123 gelf_update_rel (Elf_Data *dst, int ndx, GElf_Rel *src)
124@@ -86,6 +87,9 @@ gelf_update_rel (Elf_Data *dst, int ndx,
125 }
126 else
127 {
128+ GElf_Ehdr hdr;
129+ GElf_Rel value = *src;
130+
131 /* Check whether we have to resize the data buffer. */
132 if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d))
133 {
134@@ -93,7 +97,21 @@ gelf_update_rel (Elf_Data *dst, int ndx,
135 goto out;
136 }
137
138- ((Elf64_Rel *) data_scn->d.d_buf)[ndx] = *src;
139+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
140+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
141+ hdr.e_machine == EM_MIPS &&
142+ (hdr.e_flags & EF_MIPS_ABI) == 0)
143+ {
144+ /* Undo the MIPSEL N64 hack from gelf_getrel */
145+ GElf_Xword r_info = value.r_info;
146+ value.r_info = (r_info >> 32) |
147+ ((r_info << 8) & 0x000000FF00000000) |
148+ ((r_info << 24) & 0x0000FF0000000000) |
149+ ((r_info << 40) & 0x00FF000000000000) |
150+ ((r_info << 56) & 0xFF00000000000000);
151+ }
152+
153+ ((Elf64_Rel *) data_scn->d.d_buf)[ndx] = value;
154 }
155
156 result = 1;
157Index: b/libelf/gelf_update_rela.c
158===================================================================
159--- a/libelf/gelf_update_rela.c
160+++ b/libelf/gelf_update_rela.c
161@@ -36,6 +36,7 @@
162
163 #include "libelfP.h"
164
165+#define EF_MIPS_ABI 0x0000F000
166
167 int
168 gelf_update_rela (Elf_Data *dst, int ndx, GElf_Rela *src)
169@@ -89,6 +90,9 @@ gelf_update_rela (Elf_Data *dst, int ndx
170 }
171 else
172 {
173+ GElf_Ehdr hdr;
174+ GElf_Rela value = *src;
175+
176 /* Check whether we have to resize the data buffer. */
177 if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d))
178 {
179@@ -96,7 +100,21 @@ gelf_update_rela (Elf_Data *dst, int ndx
180 goto out;
181 }
182
183- ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = *src;
184+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
185+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
186+ hdr.e_machine == EM_MIPS &&
187+ (hdr.e_flags & EF_MIPS_ABI) == 0)
188+ {
189+ /* Undo the MIPSEL N64 hack from gelf_getrel */
190+ GElf_Xword r_info = value.r_info;
191+ value.r_info = (r_info >> 32) |
192+ ((r_info << 8) & 0x000000FF00000000) |
193+ ((r_info << 24) & 0x0000FF0000000000) |
194+ ((r_info << 40) & 0x00FF000000000000) |
195+ ((r_info << 56) & 0xFF00000000000000);
196+ }
197+
198+ ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = value;
199 }
200
201 result = 1;
202Index: b/src/strip.c
203===================================================================
204--- a/src/strip.c
205+++ b/src/strip.c
206@@ -532,6 +532,23 @@ handle_elf (int fd, Elf *elf, const char
207 goto fail;
208 }
209
210+ /* Copy identity part of the ELF header now */
211+ newehdr = gelf_getehdr (newelf, &newehdr_mem);
212+ if (newehdr == NULL)
213+ INTERNAL_ERROR (fname);
214+
215+ memcpy (newehdr->e_ident, ehdr->e_ident, EI_NIDENT);
216+ newehdr->e_type = ehdr->e_type;
217+ newehdr->e_machine = ehdr->e_machine;
218+ newehdr->e_version = ehdr->e_version;
219+
220+ if (gelf_update_ehdr (newelf, newehdr) == 0)
221+ {
222+ error (0, 0, gettext ("%s: error while creating ELF header: %s"),
223+ fname, elf_errmsg (-1));
224+ return 1;
225+ }
226+
227 /* Copy over the old program header if needed. */
228 if (ehdr->e_type != ET_REL)
229 for (cnt = 0; cnt < phnum; ++cnt)
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/arm_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/arm_backend.diff
new file mode 100644
index 0000000000..50f4b059e3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/arm_backend.diff
@@ -0,0 +1,603 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: b/backends/arm_init.c
5===================================================================
6--- a/backends/arm_init.c
7+++ b/backends/arm_init.c
8@@ -35,20 +35,31 @@
9 #define RELOC_PREFIX R_ARM_
10 #include "libebl_CPU.h"
11
12+#include "libebl_arm.h"
13+
14 /* This defines the common reloc hooks based on arm_reloc.def. */
15 #include "common-reloc.c"
16
17
18 const char *
19-arm_init (Elf *elf __attribute__ ((unused)),
20+arm_init (Elf *elf,
21 GElf_Half machine __attribute__ ((unused)),
22 Ebl *eh,
23 size_t ehlen)
24 {
25+ int soft_float = 0;
26+
27 /* Check whether the Elf_BH object has a sufficent size. */
28 if (ehlen < sizeof (Ebl))
29 return NULL;
30
31+ if (elf) {
32+ GElf_Ehdr ehdr_mem;
33+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
34+ if (ehdr && (ehdr->e_flags & EF_ARM_SOFT_FLOAT))
35+ soft_float = 1;
36+ }
37+
38 /* We handle it. */
39 eh->name = "ARM";
40 arm_init_reloc (eh);
41@@ -60,7 +71,10 @@ arm_init (Elf *elf __attribute__ ((unuse
42 HOOK (eh, core_note);
43 HOOK (eh, auxv_info);
44 HOOK (eh, check_object_attribute);
45- HOOK (eh, return_value_location);
46+ if (soft_float)
47+ eh->return_value_location = arm_return_value_location_soft;
48+ else
49+ eh->return_value_location = arm_return_value_location_hard;
50 HOOK (eh, abi_cfi);
51 HOOK (eh, check_reloc_target_type);
52 HOOK (eh, symbol_type_name);
53Index: b/backends/arm_regs.c
54===================================================================
55--- a/backends/arm_regs.c
56+++ b/backends/arm_regs.c
57@@ -31,6 +31,7 @@
58 #endif
59
60 #include <string.h>
61+#include <stdio.h>
62 #include <dwarf.h>
63
64 #define BACKEND arm_
65@@ -76,6 +77,9 @@ arm_register_info (Ebl *ebl __attribute_
66 break;
67
68 case 16 + 0 ... 16 + 7:
69+ /* AADWARF says that there are no registers in that range,
70+ * but gcc maps FPA registers here
71+ */
72 regno += 96 - 16;
73 /* Fall through. */
74 case 96 + 0 ... 96 + 7:
75@@ -87,11 +91,139 @@ arm_register_info (Ebl *ebl __attribute_
76 namelen = 2;
77 break;
78
79+ case 64 + 0 ... 64 + 9:
80+ *setname = "VFP";
81+ *bits = 32;
82+ *type = DW_ATE_float;
83+ name[0] = 's';
84+ name[1] = regno - 64 + '0';
85+ namelen = 2;
86+ break;
87+
88+ case 64 + 10 ... 64 + 31:
89+ *setname = "VFP";
90+ *bits = 32;
91+ *type = DW_ATE_float;
92+ name[0] = 's';
93+ name[1] = (regno - 64) / 10 + '0';
94+ name[2] = (regno - 64) % 10 + '0';
95+ namelen = 3;
96+ break;
97+
98+ case 104 + 0 ... 104 + 7:
99+ /* XXX TODO:
100+ * This can be either intel wireless MMX general purpose/control
101+ * registers or xscale accumulator, which have different usage.
102+ * We only have the intel wireless MMX here now.
103+ * The name needs to be changed for the xscale accumulator too. */
104+ *setname = "MMX";
105+ *type = DW_ATE_unsigned;
106+ *bits = 32;
107+ memcpy(name, "wcgr", 4);
108+ name[4] = regno - 104 + '0';
109+ namelen = 5;
110+ break;
111+
112+ case 112 + 0 ... 112 + 9:
113+ *setname = "MMX";
114+ *type = DW_ATE_unsigned;
115+ *bits = 64;
116+ name[0] = 'w';
117+ name[1] = 'r';
118+ name[2] = regno - 112 + '0';
119+ namelen = 3;
120+ break;
121+
122+ case 112 + 10 ... 112 + 15:
123+ *setname = "MMX";
124+ *type = DW_ATE_unsigned;
125+ *bits = 64;
126+ name[0] = 'w';
127+ name[1] = 'r';
128+ name[2] = '1';
129+ name[3] = regno - 112 - 10 + '0';
130+ namelen = 4;
131+ break;
132+
133 case 128:
134+ *setname = "state";
135 *type = DW_ATE_unsigned;
136 return stpcpy (name, "spsr") + 1 - name;
137
138+ case 129:
139+ *setname = "state";
140+ *type = DW_ATE_unsigned;
141+ return stpcpy(name, "spsr_fiq") + 1 - name;
142+
143+ case 130:
144+ *setname = "state";
145+ *type = DW_ATE_unsigned;
146+ return stpcpy(name, "spsr_irq") + 1 - name;
147+
148+ case 131:
149+ *setname = "state";
150+ *type = DW_ATE_unsigned;
151+ return stpcpy(name, "spsr_abt") + 1 - name;
152+
153+ case 132:
154+ *setname = "state";
155+ *type = DW_ATE_unsigned;
156+ return stpcpy(name, "spsr_und") + 1 - name;
157+
158+ case 133:
159+ *setname = "state";
160+ *type = DW_ATE_unsigned;
161+ return stpcpy(name, "spsr_svc") + 1 - name;
162+
163+ case 144 ... 150:
164+ *setname = "integer";
165+ *type = DW_ATE_signed;
166+ *bits = 32;
167+ return sprintf(name, "r%d_usr", regno - 144 + 8) + 1;
168+
169+ case 151 ... 157:
170+ *setname = "integer";
171+ *type = DW_ATE_signed;
172+ *bits = 32;
173+ return sprintf(name, "r%d_fiq", regno - 151 + 8) + 1;
174+
175+ case 158 ... 159:
176+ *setname = "integer";
177+ *type = DW_ATE_signed;
178+ *bits = 32;
179+ return sprintf(name, "r%d_irq", regno - 158 + 13) + 1;
180+
181+ case 160 ... 161:
182+ *setname = "integer";
183+ *type = DW_ATE_signed;
184+ *bits = 32;
185+ return sprintf(name, "r%d_abt", regno - 160 + 13) + 1;
186+
187+ case 162 ... 163:
188+ *setname = "integer";
189+ *type = DW_ATE_signed;
190+ *bits = 32;
191+ return sprintf(name, "r%d_und", regno - 162 + 13) + 1;
192+
193+ case 164 ... 165:
194+ *setname = "integer";
195+ *type = DW_ATE_signed;
196+ *bits = 32;
197+ return sprintf(name, "r%d_svc", regno - 164 + 13) + 1;
198+
199+ case 192 ... 199:
200+ *setname = "MMX";
201+ *bits = 32;
202+ *type = DW_ATE_unsigned;
203+ name[0] = 'w';
204+ name[1] = 'c';
205+ name[2] = regno - 192 + '0';
206+ namelen = 3;
207+ break;
208+
209 case 256 + 0 ... 256 + 9:
210+ /* XXX TODO: Neon also uses those registers and can contain
211+ * both float and integers */
212 *setname = "VFP";
213 *type = DW_ATE_float;
214 *bits = 64;
215Index: b/backends/arm_retval.c
216===================================================================
217--- a/backends/arm_retval.c
218+++ b/backends/arm_retval.c
219@@ -48,6 +48,13 @@ static const Dwarf_Op loc_intreg[] =
220 #define nloc_intreg 1
221 #define nloc_intregs(n) (2 * (n))
222
223+/* f1 */ /* XXX TODO: f0 can also have number 96 if program was compiled with -mabi=aapcs */
224+static const Dwarf_Op loc_fpreg[] =
225+ {
226+ { .atom = DW_OP_reg16 },
227+ };
228+#define nloc_fpreg 1
229+
230 /* The return value is a structure and is actually stored in stack space
231 passed in a hidden argument by the caller. But, the compiler
232 helpfully returns the address of that space in r0. */
233@@ -58,8 +65,9 @@ static const Dwarf_Op loc_aggregate[] =
234 #define nloc_aggregate 1
235
236
237-int
238-arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
239+static int
240+arm_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp,
241+ int soft_float)
242 {
243 /* Start with the function's type, and get the DW_AT_type attribute,
244 which is the type of the return value. */
245@@ -98,6 +106,21 @@ arm_return_value_location (Dwarf_Die *fu
246 else
247 return -1;
248 }
249+ if (tag == DW_TAG_base_type)
250+ {
251+ Dwarf_Word encoding;
252+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
253+ &attr_mem), &encoding) != 0)
254+ return -1;
255+
256+ if ((encoding == DW_ATE_float) && !soft_float)
257+ {
258+ *locp = loc_fpreg;
259+ if (size <= 8)
260+ return nloc_fpreg;
261+ goto aggregate;
262+ }
263+ }
264 if (size <= 16)
265 {
266 intreg:
267@@ -106,6 +129,7 @@ arm_return_value_location (Dwarf_Die *fu
268 }
269
270 aggregate:
271+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
272 *locp = loc_aggregate;
273 return nloc_aggregate;
274 }
275@@ -125,3 +149,18 @@ arm_return_value_location (Dwarf_Die *fu
276 DWARF and might be valid. */
277 return -2;
278 }
279+
280+/* return location for -mabi=apcs-gnu -msoft-float */
281+int
282+arm_return_value_location_soft (Dwarf_Die *functypedie, const Dwarf_Op **locp)
283+{
284+ return arm_return_value_location_ (functypedie, locp, 1);
285+}
286+
287+/* return location for -mabi=apcs-gnu -mhard-float (current default) */
288+int
289+arm_return_value_location_hard (Dwarf_Die *functypedie, const Dwarf_Op **locp)
290+{
291+ return arm_return_value_location_ (functypedie, locp, 0);
292+}
293+
294Index: b/libelf/elf.h
295===================================================================
296--- a/libelf/elf.h
297+++ b/libelf/elf.h
298@@ -2593,6 +2593,9 @@ enum
299 #define EF_ARM_EABI_VER4 0x04000000
300 #define EF_ARM_EABI_VER5 0x05000000
301
302+/* EI_OSABI values */
303+#define ELFOSABI_ARM_AEABI 64 /* Contains symbol versioning. */
304+
305 /* Additional symbol types for Thumb. */
306 #define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
307 #define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
308@@ -2610,12 +2613,19 @@ enum
309
310 /* Processor specific values for the Phdr p_type field. */
311 #define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
312+#define PT_ARM_UNWIND PT_ARM_EXIDX
313
314 /* Processor specific values for the Shdr sh_type field. */
315 #define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
316 #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
317 #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
318
319+/* Processor specific values for the Dyn d_tag field. */
320+#define DT_ARM_RESERVED1 (DT_LOPROC + 0)
321+#define DT_ARM_SYMTABSZ (DT_LOPROC + 1)
322+#define DT_ARM_PREEMTMAB (DT_LOPROC + 2)
323+#define DT_ARM_RESERVED2 (DT_LOPROC + 3)
324+#define DT_ARM_NUM 4
325
326 /* AArch64 relocs. */
327
328@@ -2908,6 +2918,7 @@ enum
329 TLS block (LDR, STR). */
330 #define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
331 to GOT origin (LDR). */
332+/* 112 - 127 private range */
333 #define R_ARM_ME_TOO 128 /* Obsolete. */
334 #define R_ARM_THM_TLS_DESCSEQ 129
335 #define R_ARM_THM_TLS_DESCSEQ16 129
336Index: b/backends/libebl_arm.h
337===================================================================
338--- /dev/null
339+++ b/backends/libebl_arm.h
340@@ -0,0 +1,9 @@
341+#ifndef _LIBEBL_ARM_H
342+#define _LIBEBL_ARM_H 1
343+
344+#include <libdw.h>
345+
346+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
347+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
348+
349+#endif
350Index: b/tests/run-allregs.sh
351===================================================================
352--- a/tests/run-allregs.sh
353+++ b/tests/run-allregs.sh
354@@ -2672,7 +2672,28 @@ integer registers:
355 13: sp (sp), address 32 bits
356 14: lr (lr), address 32 bits
357 15: pc (pc), address 32 bits
358- 128: spsr (spsr), unsigned 32 bits
359+ 144: r8_usr (r8_usr), signed 32 bits
360+ 145: r9_usr (r9_usr), signed 32 bits
361+ 146: r10_usr (r10_usr), signed 32 bits
362+ 147: r11_usr (r11_usr), signed 32 bits
363+ 148: r12_usr (r12_usr), signed 32 bits
364+ 149: r13_usr (r13_usr), signed 32 bits
365+ 150: r14_usr (r14_usr), signed 32 bits
366+ 151: r8_fiq (r8_fiq), signed 32 bits
367+ 152: r9_fiq (r9_fiq), signed 32 bits
368+ 153: r10_fiq (r10_fiq), signed 32 bits
369+ 154: r11_fiq (r11_fiq), signed 32 bits
370+ 155: r12_fiq (r12_fiq), signed 32 bits
371+ 156: r13_fiq (r13_fiq), signed 32 bits
372+ 157: r14_fiq (r14_fiq), signed 32 bits
373+ 158: r13_irq (r13_irq), signed 32 bits
374+ 159: r14_irq (r14_irq), signed 32 bits
375+ 160: r13_abt (r13_abt), signed 32 bits
376+ 161: r14_abt (r14_abt), signed 32 bits
377+ 162: r13_und (r13_und), signed 32 bits
378+ 163: r14_und (r14_und), signed 32 bits
379+ 164: r13_svc (r13_svc), signed 32 bits
380+ 165: r14_svc (r14_svc), signed 32 bits
381 FPA registers:
382 16: f0 (f0), float 96 bits
383 17: f1 (f1), float 96 bits
384@@ -2690,7 +2711,72 @@ FPA registers:
385 101: f5 (f5), float 96 bits
386 102: f6 (f6), float 96 bits
387 103: f7 (f7), float 96 bits
388+MMX registers:
389+ 104: wcgr0 (wcgr0), unsigned 32 bits
390+ 105: wcgr1 (wcgr1), unsigned 32 bits
391+ 106: wcgr2 (wcgr2), unsigned 32 bits
392+ 107: wcgr3 (wcgr3), unsigned 32 bits
393+ 108: wcgr4 (wcgr4), unsigned 32 bits
394+ 109: wcgr5 (wcgr5), unsigned 32 bits
395+ 110: wcgr6 (wcgr6), unsigned 32 bits
396+ 111: wcgr7 (wcgr7), unsigned 32 bits
397+ 112: wr0 (wr0), unsigned 64 bits
398+ 113: wr1 (wr1), unsigned 64 bits
399+ 114: wr2 (wr2), unsigned 64 bits
400+ 115: wr3 (wr3), unsigned 64 bits
401+ 116: wr4 (wr4), unsigned 64 bits
402+ 117: wr5 (wr5), unsigned 64 bits
403+ 118: wr6 (wr6), unsigned 64 bits
404+ 119: wr7 (wr7), unsigned 64 bits
405+ 120: wr8 (wr8), unsigned 64 bits
406+ 121: wr9 (wr9), unsigned 64 bits
407+ 122: wr10 (wr10), unsigned 64 bits
408+ 123: wr11 (wr11), unsigned 64 bits
409+ 124: wr12 (wr12), unsigned 64 bits
410+ 125: wr13 (wr13), unsigned 64 bits
411+ 126: wr14 (wr14), unsigned 64 bits
412+ 127: wr15 (wr15), unsigned 64 bits
413+ 192: wc0 (wc0), unsigned 32 bits
414+ 193: wc1 (wc1), unsigned 32 bits
415+ 194: wc2 (wc2), unsigned 32 bits
416+ 195: wc3 (wc3), unsigned 32 bits
417+ 196: wc4 (wc4), unsigned 32 bits
418+ 197: wc5 (wc5), unsigned 32 bits
419+ 198: wc6 (wc6), unsigned 32 bits
420+ 199: wc7 (wc7), unsigned 32 bits
421 VFP registers:
422+ 64: s0 (s0), float 32 bits
423+ 65: s1 (s1), float 32 bits
424+ 66: s2 (s2), float 32 bits
425+ 67: s3 (s3), float 32 bits
426+ 68: s4 (s4), float 32 bits
427+ 69: s5 (s5), float 32 bits
428+ 70: s6 (s6), float 32 bits
429+ 71: s7 (s7), float 32 bits
430+ 72: s8 (s8), float 32 bits
431+ 73: s9 (s9), float 32 bits
432+ 74: s10 (s10), float 32 bits
433+ 75: s11 (s11), float 32 bits
434+ 76: s12 (s12), float 32 bits
435+ 77: s13 (s13), float 32 bits
436+ 78: s14 (s14), float 32 bits
437+ 79: s15 (s15), float 32 bits
438+ 80: s16 (s16), float 32 bits
439+ 81: s17 (s17), float 32 bits
440+ 82: s18 (s18), float 32 bits
441+ 83: s19 (s19), float 32 bits
442+ 84: s20 (s20), float 32 bits
443+ 85: s21 (s21), float 32 bits
444+ 86: s22 (s22), float 32 bits
445+ 87: s23 (s23), float 32 bits
446+ 88: s24 (s24), float 32 bits
447+ 89: s25 (s25), float 32 bits
448+ 90: s26 (s26), float 32 bits
449+ 91: s27 (s27), float 32 bits
450+ 92: s28 (s28), float 32 bits
451+ 93: s29 (s29), float 32 bits
452+ 94: s30 (s30), float 32 bits
453+ 95: s31 (s31), float 32 bits
454 256: d0 (d0), float 64 bits
455 257: d1 (d1), float 64 bits
456 258: d2 (d2), float 64 bits
457@@ -2723,6 +2809,13 @@ VFP registers:
458 285: d29 (d29), float 64 bits
459 286: d30 (d30), float 64 bits
460 287: d31 (d31), float 64 bits
461+state registers:
462+ 128: spsr (spsr), unsigned 32 bits
463+ 129: spsr_fiq (spsr_fiq), unsigned 32 bits
464+ 130: spsr_irq (spsr_irq), unsigned 32 bits
465+ 131: spsr_abt (spsr_abt), unsigned 32 bits
466+ 132: spsr_und (spsr_und), unsigned 32 bits
467+ 133: spsr_svc (spsr_svc), unsigned 32 bits
468 EOF
469
470 # See run-readelf-mixed-corenote.sh for instructions to regenerate
471Index: b/tests/run-readelf-mixed-corenote.sh
472===================================================================
473--- a/tests/run-readelf-mixed-corenote.sh
474+++ b/tests/run-readelf-mixed-corenote.sh
475@@ -31,12 +31,11 @@ Note segment of 892 bytes at offset 0x27
476 pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
477 utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
478 orig_r0: -1, fpvalid: 1
479- r0: 1 r1: -1091672508 r2: -1091672500
480- r3: 0 r4: 0 r5: 0
481- r6: 33728 r7: 0 r8: 0
482- r9: 0 r10: -1225703496 r11: -1091672844
483- r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48
484- pc: 0x00008500 spsr: 0x60000010
485+ r0: 1 r1: -1091672508 r2: -1091672500 r3: 0
486+ r4: 0 r5: 0 r6: 33728 r7: 0
487+ r8: 0 r9: 0 r10: -1225703496 r11: -1091672844
488+ r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48 pc: 0x00008500
489+ spsr: 0x60000010
490 CORE 124 PRPSINFO
491 state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400500
492 uid: 0, gid: 0, pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
493Index: b/tests/run-addrcfi.sh
494===================================================================
495--- a/tests/run-addrcfi.sh
496+++ b/tests/run-addrcfi.sh
497@@ -3554,6 +3554,38 @@ dwarf_cfi_addrframe (.eh_frame): no matc
498 FPA reg21 (f5): undefined
499 FPA reg22 (f6): undefined
500 FPA reg23 (f7): undefined
501+ VFP reg64 (s0): undefined
502+ VFP reg65 (s1): undefined
503+ VFP reg66 (s2): undefined
504+ VFP reg67 (s3): undefined
505+ VFP reg68 (s4): undefined
506+ VFP reg69 (s5): undefined
507+ VFP reg70 (s6): undefined
508+ VFP reg71 (s7): undefined
509+ VFP reg72 (s8): undefined
510+ VFP reg73 (s9): undefined
511+ VFP reg74 (s10): undefined
512+ VFP reg75 (s11): undefined
513+ VFP reg76 (s12): undefined
514+ VFP reg77 (s13): undefined
515+ VFP reg78 (s14): undefined
516+ VFP reg79 (s15): undefined
517+ VFP reg80 (s16): undefined
518+ VFP reg81 (s17): undefined
519+ VFP reg82 (s18): undefined
520+ VFP reg83 (s19): undefined
521+ VFP reg84 (s20): undefined
522+ VFP reg85 (s21): undefined
523+ VFP reg86 (s22): undefined
524+ VFP reg87 (s23): undefined
525+ VFP reg88 (s24): undefined
526+ VFP reg89 (s25): undefined
527+ VFP reg90 (s26): undefined
528+ VFP reg91 (s27): undefined
529+ VFP reg92 (s28): undefined
530+ VFP reg93 (s29): undefined
531+ VFP reg94 (s30): undefined
532+ VFP reg95 (s31): undefined
533 FPA reg96 (f0): undefined
534 FPA reg97 (f1): undefined
535 FPA reg98 (f2): undefined
536@@ -3562,7 +3594,66 @@ dwarf_cfi_addrframe (.eh_frame): no matc
537 FPA reg101 (f5): undefined
538 FPA reg102 (f6): undefined
539 FPA reg103 (f7): undefined
540- integer reg128 (spsr): undefined
541+ MMX reg104 (wcgr0): undefined
542+ MMX reg105 (wcgr1): undefined
543+ MMX reg106 (wcgr2): undefined
544+ MMX reg107 (wcgr3): undefined
545+ MMX reg108 (wcgr4): undefined
546+ MMX reg109 (wcgr5): undefined
547+ MMX reg110 (wcgr6): undefined
548+ MMX reg111 (wcgr7): undefined
549+ MMX reg112 (wr0): undefined
550+ MMX reg113 (wr1): undefined
551+ MMX reg114 (wr2): undefined
552+ MMX reg115 (wr3): undefined
553+ MMX reg116 (wr4): undefined
554+ MMX reg117 (wr5): undefined
555+ MMX reg118 (wr6): undefined
556+ MMX reg119 (wr7): undefined
557+ MMX reg120 (wr8): undefined
558+ MMX reg121 (wr9): undefined
559+ MMX reg122 (wr10): undefined
560+ MMX reg123 (wr11): undefined
561+ MMX reg124 (wr12): undefined
562+ MMX reg125 (wr13): undefined
563+ MMX reg126 (wr14): undefined
564+ MMX reg127 (wr15): undefined
565+ state reg128 (spsr): undefined
566+ state reg129 (spsr_fiq): undefined
567+ state reg130 (spsr_irq): undefined
568+ state reg131 (spsr_abt): undefined
569+ state reg132 (spsr_und): undefined
570+ state reg133 (spsr_svc): undefined
571+ integer reg144 (r8_usr): undefined
572+ integer reg145 (r9_usr): undefined
573+ integer reg146 (r10_usr): undefined
574+ integer reg147 (r11_usr): undefined
575+ integer reg148 (r12_usr): undefined
576+ integer reg149 (r13_usr): undefined
577+ integer reg150 (r14_usr): undefined
578+ integer reg151 (r8_fiq): undefined
579+ integer reg152 (r9_fiq): undefined
580+ integer reg153 (r10_fiq): undefined
581+ integer reg154 (r11_fiq): undefined
582+ integer reg155 (r12_fiq): undefined
583+ integer reg156 (r13_fiq): undefined
584+ integer reg157 (r14_fiq): undefined
585+ integer reg158 (r13_irq): undefined
586+ integer reg159 (r14_irq): undefined
587+ integer reg160 (r13_abt): undefined
588+ integer reg161 (r14_abt): undefined
589+ integer reg162 (r13_und): undefined
590+ integer reg163 (r14_und): undefined
591+ integer reg164 (r13_svc): undefined
592+ integer reg165 (r14_svc): undefined
593+ MMX reg192 (wc0): undefined
594+ MMX reg193 (wc1): undefined
595+ MMX reg194 (wc2): undefined
596+ MMX reg195 (wc3): undefined
597+ MMX reg196 (wc4): undefined
598+ MMX reg197 (wc5): undefined
599+ MMX reg198 (wc6): undefined
600+ MMX reg199 (wc7): undefined
601 VFP reg256 (d0): undefined
602 VFP reg257 (d1): undefined
603 VFP reg258 (d2): undefined
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hppa_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hppa_backend.diff
new file mode 100644
index 0000000000..44fda7f305
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hppa_backend.diff
@@ -0,0 +1,802 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: b/backends/parisc_init.c
5===================================================================
6--- /dev/null
7+++ b/backends/parisc_init.c
8@@ -0,0 +1,73 @@
9+/* Initialization of PA-RISC specific backend library.
10+ Copyright (C) 2002, 2005, 2006 Red Hat, Inc.
11+ This file is part of Red Hat elfutils.
12+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
13+
14+ Red Hat elfutils is free software; you can redistribute it and/or modify
15+ it under the terms of the GNU General Public License as published by the
16+ Free Software Foundation; version 2 of the License.
17+
18+ Red Hat elfutils is distributed in the hope that it will be useful, but
19+ WITHOUT ANY WARRANTY; without even the implied warranty of
20+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+ General Public License for more details.
22+
23+ You should have received a copy of the GNU General Public License along
24+ with Red Hat elfutils; if not, write to the Free Software Foundation,
25+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
26+
27+ Red Hat elfutils is an included package of the Open Invention Network.
28+ An included package of the Open Invention Network is a package for which
29+ Open Invention Network licensees cross-license their patents. No patent
30+ license is granted, either expressly or impliedly, by designation as an
31+ included package. Should you wish to participate in the Open Invention
32+ Network licensing program, please visit www.openinventionnetwork.com
33+ <http://www.openinventionnetwork.com>. */
34+
35+#ifdef HAVE_CONFIG_H
36+# include <config.h>
37+#endif
38+
39+#define BACKEND parisc_
40+#define RELOC_PREFIX R_PARISC_
41+#include "libebl_CPU.h"
42+#include "libebl_parisc.h"
43+
44+/* This defines the common reloc hooks based on parisc_reloc.def. */
45+#include "common-reloc.c"
46+
47+
48+const char *
49+parisc_init (Elf *elf __attribute__ ((unused)),
50+ GElf_Half machine __attribute__ ((unused)),
51+ Ebl *eh,
52+ size_t ehlen)
53+{
54+ int pa64 = 0;
55+
56+ /* Check whether the Elf_BH object has a sufficent size. */
57+ if (ehlen < sizeof (Ebl))
58+ return NULL;
59+
60+ if (elf) {
61+ GElf_Ehdr ehdr_mem;
62+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
63+ if (ehdr && (ehdr->e_flags & EF_PARISC_WIDE))
64+ pa64 = 1;
65+ }
66+ /* We handle it. */
67+ eh->name = "PA-RISC";
68+ parisc_init_reloc (eh);
69+ HOOK (eh, reloc_simple_type);
70+ HOOK (eh, machine_flag_check);
71+ HOOK (eh, symbol_type_name);
72+ HOOK (eh, segment_type_name);
73+ HOOK (eh, section_type_name);
74+ HOOK (eh, register_info);
75+ if (pa64)
76+ eh->return_value_location = parisc_return_value_location_64;
77+ else
78+ eh->return_value_location = parisc_return_value_location_32;
79+
80+ return MODVERSION;
81+}
82Index: b/backends/parisc_regs.c
83===================================================================
84--- /dev/null
85+++ b/backends/parisc_regs.c
86@@ -0,0 +1,159 @@
87+/* Register names and numbers for PA-RISC DWARF.
88+ Copyright (C) 2005, 2006 Red Hat, Inc.
89+ This file is part of Red Hat elfutils.
90+
91+ Red Hat elfutils is free software; you can redistribute it and/or modify
92+ it under the terms of the GNU General Public License as published by the
93+ Free Software Foundation; version 2 of the License.
94+
95+ Red Hat elfutils is distributed in the hope that it will be useful, but
96+ WITHOUT ANY WARRANTY; without even the implied warranty of
97+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
98+ General Public License for more details.
99+
100+ You should have received a copy of the GNU General Public License along
101+ with Red Hat elfutils; if not, write to the Free Software Foundation,
102+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
103+
104+ Red Hat elfutils is an included package of the Open Invention Network.
105+ An included package of the Open Invention Network is a package for which
106+ Open Invention Network licensees cross-license their patents. No patent
107+ license is granted, either expressly or impliedly, by designation as an
108+ included package. Should you wish to participate in the Open Invention
109+ Network licensing program, please visit www.openinventionnetwork.com
110+ <http://www.openinventionnetwork.com>. */
111+
112+#ifdef HAVE_CONFIG_H
113+# include <config.h>
114+#endif
115+
116+#include <string.h>
117+#include <dwarf.h>
118+
119+#define BACKEND parisc_
120+#include "libebl_CPU.h"
121+
122+ssize_t
123+parisc_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
124+ const char **prefix, const char **setname,
125+ int *bits, int *type)
126+{
127+ int pa64 = 0;
128+
129+ if (ebl->elf) {
130+ GElf_Ehdr ehdr_mem;
131+ GElf_Ehdr *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem);
132+ if (ehdr->e_flags & EF_PARISC_WIDE)
133+ pa64 = 1;
134+ }
135+
136+ int nregs = pa64 ? 127 : 128;
137+
138+ if (name == NULL)
139+ return nregs;
140+
141+ if (regno < 0 || regno >= nregs || namelen < 6)
142+ return -1;
143+
144+ *prefix = "%";
145+
146+ if (regno < 32)
147+ {
148+ *setname = "integer";
149+ *type = DW_ATE_signed;
150+ if (pa64)
151+ {
152+ *bits = 64;
153+ }
154+ else
155+ {
156+ *bits = 32;
157+ }
158+ }
159+ else if (regno == 32)
160+ {
161+ *setname = "special";
162+ if (pa64)
163+ {
164+ *bits = 6;
165+ }
166+ else
167+ {
168+ *bits = 5;
169+ }
170+ *type = DW_ATE_unsigned;
171+ }
172+ else
173+ {
174+ *setname = "FPU";
175+ *type = DW_ATE_float;
176+ if (pa64)
177+ {
178+ *bits = 64;
179+ }
180+ else
181+ {
182+ *bits = 32;
183+ }
184+ }
185+
186+ if (regno < 33) {
187+ switch (regno)
188+ {
189+ case 0 ... 9:
190+ name[0] = 'r';
191+ name[1] = regno + '0';
192+ namelen = 2;
193+ break;
194+ case 10 ... 31:
195+ name[0] = 'r';
196+ name[1] = regno / 10 + '0';
197+ name[2] = regno % 10 + '0';
198+ namelen = 3;
199+ break;
200+ case 32:
201+ *prefix = NULL;
202+ name[0] = 'S';
203+ name[1] = 'A';
204+ name[2] = 'R';
205+ namelen = 3;
206+ break;
207+ }
208+ }
209+ else {
210+ if (pa64 && ((regno - 72) % 2)) {
211+ *setname = NULL;
212+ return 0;
213+ }
214+
215+ switch (regno)
216+ {
217+ case 72 + 0 ... 72 + 11:
218+ name[0] = 'f';
219+ name[1] = 'r';
220+ name[2] = (regno + 8 - 72) / 2 + '0';
221+ namelen = 3;
222+ if ((regno + 8 - 72) % 2) {
223+ name[3] = 'R';
224+ namelen++;
225+ }
226+ break;
227+ case 72 + 12 ... 72 + 55:
228+ name[0] = 'f';
229+ name[1] = 'r';
230+ name[2] = (regno + 8 - 72) / 2 / 10 + '0';
231+ name[3] = (regno + 8 - 72) / 2 % 10 + '0';
232+ namelen = 4;
233+ if ((regno + 8 - 72) % 2) {
234+ name[4] = 'R';
235+ namelen++;
236+ }
237+ break;
238+ default:
239+ *setname = NULL;
240+ return 0;
241+ }
242+ }
243+ name[namelen++] = '\0';
244+ return namelen;
245+}
246Index: b/backends/parisc_reloc.def
247===================================================================
248--- /dev/null
249+++ b/backends/parisc_reloc.def
250@@ -0,0 +1,128 @@
251+/* List the relocation types for PA-RISC. -*- C -*-
252+ Copyright (C) 2005 Red Hat, Inc.
253+ This file is part of Red Hat elfutils.
254+
255+ Red Hat elfutils is free software; you can redistribute it and/or modify
256+ it under the terms of the GNU General Public License as published by the
257+ Free Software Foundation; version 2 of the License.
258+
259+ Red Hat elfutils is distributed in the hope that it will be useful, but
260+ WITHOUT ANY WARRANTY; without even the implied warranty of
261+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
262+ General Public License for more details.
263+
264+ You should have received a copy of the GNU General Public License along
265+ with Red Hat elfutils; if not, write to the Free Software Foundation,
266+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
267+
268+ Red Hat elfutils is an included package of the Open Invention Network.
269+ An included package of the Open Invention Network is a package for which
270+ Open Invention Network licensees cross-license their patents. No patent
271+ license is granted, either expressly or impliedly, by designation as an
272+ included package. Should you wish to participate in the Open Invention
273+ Network licensing program, please visit www.openinventionnetwork.com
274+ <http://www.openinventionnetwork.com>. */
275+
276+/* NAME, REL|EXEC|DYN */
277+
278+RELOC_TYPE (NONE, EXEC|DYN)
279+RELOC_TYPE (DIR32, REL|EXEC|DYN)
280+RELOC_TYPE (DIR21L, REL|EXEC|DYN)
281+RELOC_TYPE (DIR17R, REL)
282+RELOC_TYPE (DIR17F, REL)
283+RELOC_TYPE (DIR14R, REL|DYN)
284+RELOC_TYPE (PCREL32, REL)
285+RELOC_TYPE (PCREL21L, REL)
286+RELOC_TYPE (PCREL17R, REL)
287+RELOC_TYPE (PCREL17F, REL)
288+RELOC_TYPE (PCREL14R, REL|EXEC)
289+RELOC_TYPE (DPREL21L, REL)
290+RELOC_TYPE (DPREL14WR, REL)
291+RELOC_TYPE (DPREL14DR, REL)
292+RELOC_TYPE (DPREL14R, REL)
293+RELOC_TYPE (GPREL21L, 0)
294+RELOC_TYPE (GPREL14R, 0)
295+RELOC_TYPE (LTOFF21L, REL)
296+RELOC_TYPE (LTOFF14R, REL)
297+RELOC_TYPE (DLTIND14F, 0)
298+RELOC_TYPE (SETBASE, 0)
299+RELOC_TYPE (SECREL32, REL)
300+RELOC_TYPE (BASEREL21L, 0)
301+RELOC_TYPE (BASEREL17R, 0)
302+RELOC_TYPE (BASEREL14R, 0)
303+RELOC_TYPE (SEGBASE, 0)
304+RELOC_TYPE (SEGREL32, REL)
305+RELOC_TYPE (PLTOFF21L, 0)
306+RELOC_TYPE (PLTOFF14R, 0)
307+RELOC_TYPE (PLTOFF14F, 0)
308+RELOC_TYPE (LTOFF_FPTR32, 0)
309+RELOC_TYPE (LTOFF_FPTR21L, 0)
310+RELOC_TYPE (LTOFF_FPTR14R, 0)
311+RELOC_TYPE (FPTR64, 0)
312+RELOC_TYPE (PLABEL32, REL|DYN)
313+RELOC_TYPE (PCREL64, 0)
314+RELOC_TYPE (PCREL22C, 0)
315+RELOC_TYPE (PCREL22F, 0)
316+RELOC_TYPE (PCREL14WR, 0)
317+RELOC_TYPE (PCREL14DR, 0)
318+RELOC_TYPE (PCREL16F, 0)
319+RELOC_TYPE (PCREL16WF, 0)
320+RELOC_TYPE (PCREL16DF, 0)
321+RELOC_TYPE (DIR64, REL|DYN)
322+RELOC_TYPE (DIR14WR, REL)
323+RELOC_TYPE (DIR14DR, REL)
324+RELOC_TYPE (DIR16F, REL)
325+RELOC_TYPE (DIR16WF, REL)
326+RELOC_TYPE (DIR16DF, REL)
327+RELOC_TYPE (GPREL64, 0)
328+RELOC_TYPE (GPREL14WR, 0)
329+RELOC_TYPE (GPREL14DR, 0)
330+RELOC_TYPE (GPREL16F, 0)
331+RELOC_TYPE (GPREL16WF, 0)
332+RELOC_TYPE (GPREL16DF, 0)
333+RELOC_TYPE (LTOFF64, 0)
334+RELOC_TYPE (LTOFF14WR, 0)
335+RELOC_TYPE (LTOFF14DR, 0)
336+RELOC_TYPE (LTOFF16F, 0)
337+RELOC_TYPE (LTOFF16WF, 0)
338+RELOC_TYPE (LTOFF16DF, 0)
339+RELOC_TYPE (SECREL64, 0)
340+RELOC_TYPE (BASEREL14WR, 0)
341+RELOC_TYPE (BASEREL14DR, 0)
342+RELOC_TYPE (SEGREL64, 0)
343+RELOC_TYPE (PLTOFF14WR, 0)
344+RELOC_TYPE (PLTOFF14DR, 0)
345+RELOC_TYPE (PLTOFF16F, 0)
346+RELOC_TYPE (PLTOFF16WF, 0)
347+RELOC_TYPE (PLTOFF16DF, 0)
348+RELOC_TYPE (LTOFF_FPTR64, 0)
349+RELOC_TYPE (LTOFF_FPTR14WR, 0)
350+RELOC_TYPE (LTOFF_FPTR14DR, 0)
351+RELOC_TYPE (LTOFF_FPTR16F, 0)
352+RELOC_TYPE (LTOFF_FPTR16WF, 0)
353+RELOC_TYPE (LTOFF_FPTR16DF, 0)
354+RELOC_TYPE (COPY, EXEC)
355+RELOC_TYPE (IPLT, EXEC|DYN)
356+RELOC_TYPE (EPLT, 0)
357+RELOC_TYPE (TPREL32, DYN)
358+RELOC_TYPE (TPREL21L, 0)
359+RELOC_TYPE (TPREL14R, 0)
360+RELOC_TYPE (LTOFF_TP21L, 0)
361+RELOC_TYPE (LTOFF_TP14R, 0)
362+RELOC_TYPE (LTOFF_TP14F, 0)
363+RELOC_TYPE (TPREL64, 0)
364+RELOC_TYPE (TPREL14WR, 0)
365+RELOC_TYPE (TPREL14DR, 0)
366+RELOC_TYPE (TPREL16F, 0)
367+RELOC_TYPE (TPREL16WF, 0)
368+RELOC_TYPE (TPREL16DF, 0)
369+RELOC_TYPE (LTOFF_TP64, 0)
370+RELOC_TYPE (LTOFF_TP14WR, 0)
371+RELOC_TYPE (LTOFF_TP14DR, 0)
372+RELOC_TYPE (LTOFF_TP16F, 0)
373+RELOC_TYPE (LTOFF_TP16WF, 0)
374+RELOC_TYPE (LTOFF_TP16DF, 0)
375+RELOC_TYPE (TLS_DTPMOD32, DYN)
376+RELOC_TYPE (TLS_DTPMOD64, DYN)
377+
378+#define NO_RELATIVE_RELOC 1
379Index: b/backends/parisc_retval.c
380===================================================================
381--- /dev/null
382+++ b/backends/parisc_retval.c
383@@ -0,0 +1,213 @@
384+/* Function return value location for Linux/PA-RISC ABI.
385+ Copyright (C) 2005 Red Hat, Inc.
386+ This file is part of Red Hat elfutils.
387+
388+ Red Hat elfutils is free software; you can redistribute it and/or modify
389+ it under the terms of the GNU General Public License as published by the
390+ Free Software Foundation; version 2 of the License.
391+
392+ Red Hat elfutils is distributed in the hope that it will be useful, but
393+ WITHOUT ANY WARRANTY; without even the implied warranty of
394+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
395+ General Public License for more details.
396+
397+ You should have received a copy of the GNU General Public License along
398+ with Red Hat elfutils; if not, write to the Free Software Foundation,
399+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
400+
401+ Red Hat elfutils is an included package of the Open Invention Network.
402+ An included package of the Open Invention Network is a package for which
403+ Open Invention Network licensees cross-license their patents. No patent
404+ license is granted, either expressly or impliedly, by designation as an
405+ included package. Should you wish to participate in the Open Invention
406+ Network licensing program, please visit www.openinventionnetwork.com
407+ <http://www.openinventionnetwork.com>. */
408+
409+#ifdef HAVE_CONFIG_H
410+# include <config.h>
411+#endif
412+
413+#include <assert.h>
414+#include <dwarf.h>
415+
416+#define BACKEND parisc_
417+#include "libebl_CPU.h"
418+#include "libebl_parisc.h"
419+
420+/* %r28, or pair %r28, %r29. */
421+static const Dwarf_Op loc_intreg32[] =
422+ {
423+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 4 },
424+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 4 },
425+ };
426+
427+static const Dwarf_Op loc_intreg[] =
428+ {
429+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 8 },
430+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 8 },
431+ };
432+#define nloc_intreg 1
433+#define nloc_intregpair 4
434+
435+/* %fr4L, or pair %fr4L, %fr4R on pa-32 */
436+static const Dwarf_Op loc_fpreg32[] =
437+ {
438+ { .atom = DW_OP_regx, .number = 72 }, { .atom = DW_OP_piece, .number = 4 },
439+ { .atom = DW_OP_regx, .number = 73 }, { .atom = DW_OP_piece, .number = 4 },
440+ };
441+#define nloc_fpreg32 2
442+#define nloc_fpregpair32 4
443+
444+/* $fr4 */
445+static const Dwarf_Op loc_fpreg[] =
446+ {
447+ { .atom = DW_OP_regx, .number = 72 },
448+ };
449+#define nloc_fpreg 1
450+
451+#if 0
452+/* The return value is a structure and is actually stored in stack space
453+ passed in a hidden argument by the caller. Address of the location is stored
454+ in %r28 before function call, but it may be changed by function. */
455+static const Dwarf_Op loc_aggregate[] =
456+ {
457+ { .atom = DW_OP_breg28 },
458+ };
459+#define nloc_aggregate 1
460+#endif
461+
462+static int
463+parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, int pa64)
464+{
465+ Dwarf_Word regsize = pa64 ? 8 : 4;
466+
467+ /* Start with the function's type, and get the DW_AT_type attribute,
468+ which is the type of the return value. */
469+
470+ Dwarf_Attribute attr_mem;
471+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
472+ if (attr == NULL)
473+ /* The function has no return value, like a `void' function in C. */
474+ return 0;
475+
476+ Dwarf_Die die_mem;
477+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
478+ int tag = dwarf_tag (typedie);
479+
480+ /* Follow typedefs and qualifiers to get to the actual type. */
481+ while (tag == DW_TAG_typedef
482+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
483+ || tag == DW_TAG_restrict_type)
484+ {
485+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
486+ typedie = dwarf_formref_die (attr, &die_mem);
487+ tag = dwarf_tag (typedie);
488+ }
489+
490+ switch (tag)
491+ {
492+ case -1:
493+ return -1;
494+
495+ case DW_TAG_subrange_type:
496+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
497+ {
498+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
499+ typedie = dwarf_formref_die (attr, &die_mem);
500+ tag = dwarf_tag (typedie);
501+ }
502+ /* Fall through. */
503+
504+ case DW_TAG_base_type:
505+ case DW_TAG_enumeration_type:
506+ case DW_TAG_pointer_type:
507+ case DW_TAG_ptr_to_member_type:
508+ {
509+ Dwarf_Word size;
510+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
511+ &attr_mem), &size) != 0)
512+ {
513+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
514+ size = 4;
515+ else
516+ return -1;
517+ }
518+ if (tag == DW_TAG_base_type)
519+ {
520+ Dwarf_Word encoding;
521+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
522+ &attr_mem), &encoding) != 0)
523+ return -1;
524+
525+ if (encoding == DW_ATE_float)
526+ {
527+ if (pa64) {
528+ *locp = loc_fpreg;
529+ if (size <= 8)
530+ return nloc_fpreg;
531+ }
532+ else {
533+ *locp = loc_fpreg32;
534+ if (size <= 4)
535+ return nloc_fpreg32;
536+ else if (size <= 8)
537+ return nloc_fpregpair32;
538+ }
539+ goto aggregate;
540+ }
541+ }
542+ if (pa64)
543+ *locp = loc_intreg;
544+ else
545+ *locp = loc_intreg32;
546+ if (size <= regsize)
547+ return nloc_intreg;
548+ if (size <= 2 * regsize)
549+ return nloc_intregpair;
550+
551+ /* Else fall through. */
552+ }
553+
554+ case DW_TAG_structure_type:
555+ case DW_TAG_class_type:
556+ case DW_TAG_union_type:
557+ case DW_TAG_array_type:
558+ aggregate: {
559+ Dwarf_Word size;
560+ if (dwarf_aggregate_size (typedie, &size) != 0)
561+ return -1;
562+ if (pa64)
563+ *locp = loc_intreg;
564+ else
565+ *locp = loc_intreg32;
566+ if (size <= regsize)
567+ return nloc_intreg;
568+ if (size <= 2 * regsize)
569+ return nloc_intregpair;
570+#if 0
571+ /* there should be some way to know this location... But I do not see it. */
572+ *locp = loc_aggregate;
573+ return nloc_aggregate;
574+#endif
575+ /* fall through. */
576+ }
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+}
584+
585+int
586+parisc_return_value_location_32 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
587+{
588+ return parisc_return_value_location_ (functypedie, locp, 0);
589+}
590+
591+int
592+parisc_return_value_location_64 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
593+{
594+ return parisc_return_value_location_ (functypedie, locp, 1);
595+}
596+
597Index: b/backends/parisc_symbol.c
598===================================================================
599--- /dev/null
600+++ b/backends/parisc_symbol.c
601@@ -0,0 +1,112 @@
602+/* PA-RISC specific symbolic name handling.
603+ Copyright (C) 2002, 2005 Red Hat, Inc.
604+ This file is part of Red Hat elfutils.
605+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
606+
607+ Red Hat elfutils is free software; you can redistribute it and/or modify
608+ it under the terms of the GNU General Public License as published by the
609+ Free Software Foundation; version 2 of the License.
610+
611+ Red Hat elfutils is distributed in the hope that it will be useful, but
612+ WITHOUT ANY WARRANTY; without even the implied warranty of
613+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
614+ General Public License for more details.
615+
616+ You should have received a copy of the GNU General Public License along
617+ with Red Hat elfutils; if not, write to the Free Software Foundation,
618+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
619+
620+ Red Hat elfutils is an included package of the Open Invention Network.
621+ An included package of the Open Invention Network is a package for which
622+ Open Invention Network licensees cross-license their patents. No patent
623+ license is granted, either expressly or impliedly, by designation as an
624+ included package. Should you wish to participate in the Open Invention
625+ Network licensing program, please visit www.openinventionnetwork.com
626+ <http://www.openinventionnetwork.com>. */
627+
628+#ifdef HAVE_CONFIG_H
629+# include <config.h>
630+#endif
631+
632+#include <elf.h>
633+#include <stddef.h>
634+
635+#define BACKEND parisc_
636+#include "libebl_CPU.h"
637+
638+const char *
639+parisc_segment_type_name (int segment, char *buf __attribute__ ((unused)),
640+ size_t len __attribute__ ((unused)))
641+{
642+ switch (segment)
643+ {
644+ case PT_PARISC_ARCHEXT:
645+ return "PARISC_ARCHEXT";
646+ case PT_PARISC_UNWIND:
647+ return "PARISC_UNWIND";
648+ default:
649+ break;
650+ }
651+ return NULL;
652+}
653+
654+/* Return symbolic representation of symbol type. */
655+const char *
656+parisc_symbol_type_name(int symbol, char *buf __attribute__ ((unused)),
657+ size_t len __attribute__ ((unused)))
658+{
659+ if (symbol == STT_PARISC_MILLICODE)
660+ return "PARISC_MILLI";
661+ return NULL;
662+}
663+
664+/* Return symbolic representation of section type. */
665+const char *
666+parisc_section_type_name (int type,
667+ char *buf __attribute__ ((unused)),
668+ size_t len __attribute__ ((unused)))
669+{
670+ switch (type)
671+ {
672+ case SHT_PARISC_EXT:
673+ return "PARISC_EXT";
674+ case SHT_PARISC_UNWIND:
675+ return "PARISC_UNWIND";
676+ case SHT_PARISC_DOC:
677+ return "PARISC_DOC";
678+ }
679+
680+ return NULL;
681+}
682+
683+/* Check whether machine flags are valid. */
684+bool
685+parisc_machine_flag_check (GElf_Word flags)
686+{
687+ if (flags &~ (EF_PARISC_TRAPNIL | EF_PARISC_EXT | EF_PARISC_LSB |
688+ EF_PARISC_WIDE | EF_PARISC_NO_KABP |
689+ EF_PARISC_LAZYSWAP | EF_PARISC_ARCH))
690+ return 0;
691+
692+ GElf_Word arch = flags & EF_PARISC_ARCH;
693+
694+ return ((arch == EFA_PARISC_1_0) || (arch == EFA_PARISC_1_1) ||
695+ (arch == EFA_PARISC_2_0));
696+}
697+
698+/* Check for the simple reloc types. */
699+Elf_Type
700+parisc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
701+{
702+ switch (type)
703+ {
704+ case R_PARISC_DIR64:
705+ case R_PARISC_SECREL64:
706+ return ELF_T_XWORD;
707+ case R_PARISC_DIR32:
708+ case R_PARISC_SECREL32:
709+ return ELF_T_WORD;
710+ default:
711+ return ELF_T_NUM;
712+ }
713+}
714Index: b/backends/libebl_parisc.h
715===================================================================
716--- /dev/null
717+++ b/backends/libebl_parisc.h
718@@ -0,0 +1,9 @@
719+#ifndef _LIBEBL_HPPA_H
720+#define _LIBEBL_HPPA_H 1
721+
722+#include <libdw.h>
723+
724+extern int parisc_return_value_location_32(Dwarf_Die *, const Dwarf_Op **locp);
725+extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp);
726+
727+#endif
728Index: b/backends/Makefile.am
729===================================================================
730--- a/backends/Makefile.am
731+++ b/backends/Makefile.am
732@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
733
734
735 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
736- tilegx m68k bpf
737+ tilegx m68k bpf parisc
738 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
739 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
740 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
741 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
742- libebl_m68k_pic.a libebl_bpf_pic.a
743+ libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a
744 noinst_LIBRARIES = $(libebl_pic)
745 noinst_DATA = $(libebl_pic:_pic.a=.so)
746
747@@ -128,6 +128,9 @@ endif
748 libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
749 am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
750
751+parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
752+libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
753+am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
754
755 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
756 @rm -f $(@:.so=.map)
757Index: b/libelf/elf.h
758===================================================================
759--- a/libelf/elf.h
760+++ b/libelf/elf.h
761@@ -2055,16 +2055,24 @@ enum
762 #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
763 #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
764 #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
765+#define R_PARISC_DPREL14WR 19
766+#define R_PARISC_DPREL14DR 20
767 #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
768 #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
769 #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
770 #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
771 #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
772+#define R_PARISC_DLTIND14F 39
773+#define R_PARISC_SETBASE 40
774 #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
775+#define R_PARISC_BASEREL21L 42
776+#define R_PARISC_BASEREL17R 43
777+#define R_PARISC_BASEREL14R 46
778 #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
779 #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
780 #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
781 #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
782+#define R_PARISC_PLTOFF14F 55
783 #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
784 #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
785 #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
786@@ -2073,6 +2081,7 @@ enum
787 #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
788 #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
789 #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
790+#define R_PARISC_PCREL22C 73
791 #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
792 #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
793 #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
794@@ -2098,6 +2107,8 @@ enum
795 #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
796 #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
797 #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
798+#define R_PARISC_BASEREL14WR 107
799+#define R_PARISC_BASEREL14DR 108
800 #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
801 #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
802 #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hurd_path.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hurd_path.patch
new file mode 100644
index 0000000000..a4d568b084
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/hurd_path.patch
@@ -0,0 +1,17 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: elfutils-0.165/tests/run-native-test.sh
5===================================================================
6--- elfutils-0.165.orig/tests/run-native-test.sh
7+++ elfutils-0.165/tests/run-native-test.sh
8@@ -83,6 +83,9 @@ native_test()
9 # "cannot attach to process: Function not implemented".
10 [ "$(uname)" = "GNU/kFreeBSD" ] && exit 77
11
12+# hurd's /proc/$PID/maps does not give paths yet.
13+[ "$(uname)" = "GNU" ] && exit 77
14+
15 native_test ${abs_builddir}/allregs
16 native_test ${abs_builddir}/funcretval
17
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/ignore_strmerge.diff b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/ignore_strmerge.diff
new file mode 100644
index 0000000000..3570deca9e
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/ignore_strmerge.diff
@@ -0,0 +1,14 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4--- elfutils-0.165.orig/tests/run-strip-strmerge.sh
5+++ elfutils-0.165/tests/run-strip-strmerge.sh
6@@ -30,7 +30,7 @@ remerged=remerged.elf
7 tempfiles $merged $stripped $debugfile $remerged
8
9 echo elflint $input
10-testrun ${abs_top_builddir}/src/elflint --gnu $input
11+testrun_on_self_skip ${abs_top_builddir}/src/elflint --gnu $input
12 echo elfstrmerge
13 testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
14 echo elflint $merged
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/kfreebsd_path.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/kfreebsd_path.patch
new file mode 100644
index 0000000000..49085d1c86
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/kfreebsd_path.patch
@@ -0,0 +1,20 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: b/tests/run-native-test.sh
5===================================================================
6--- a/tests/run-native-test.sh
7+++ b/tests/run-native-test.sh
8@@ -77,6 +77,12 @@ native_test()
9 test $native -eq 0 || testrun "$@" -p $native > /dev/null
10 }
11
12+# On the Debian buildds, GNU/kFreeBSD linprocfs /proc/$PID/maps does
13+# not give absolute paths due to sbuild's bind mounts (bug #570805)
14+# therefore the next two test programs are expected to fail with
15+# "cannot attach to process: Function not implemented".
16+[ "$(uname)" = "GNU/kFreeBSD" ] && exit 77
17+
18 native_test ${abs_builddir}/allregs
19 native_test ${abs_builddir}/funcretval
20
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_backend.diff
new file mode 100644
index 0000000000..a5e76dda4a
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_backend.diff
@@ -0,0 +1,686 @@
1Upstream-Status: Backport [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: b/backends/mips_init.c
5===================================================================
6--- /dev/null
7+++ b/backends/mips_init.c
8@@ -0,0 +1,59 @@
9+/* Initialization of mips specific backend library.
10+ Copyright (C) 2006 Red Hat, Inc.
11+ This file is part of Red Hat elfutils.
12+
13+ Red Hat elfutils is free software; you can redistribute it and/or modify
14+ it under the terms of the GNU General Public License as published by the
15+ Free Software Foundation; version 2 of the License.
16+
17+ Red Hat elfutils is distributed in the hope that it will be useful, but
18+ WITHOUT ANY WARRANTY; without even the implied warranty of
19+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20+ General Public License for more details.
21+
22+ You should have received a copy of the GNU General Public License along
23+ with Red Hat elfutils; if not, write to the Free Software Foundation,
24+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
25+
26+ Red Hat elfutils is an included package of the Open Invention Network.
27+ An included package of the Open Invention Network is a package for which
28+ Open Invention Network licensees cross-license their patents. No patent
29+ license is granted, either expressly or impliedly, by designation as an
30+ included package. Should you wish to participate in the Open Invention
31+ Network licensing program, please visit www.openinventionnetwork.com
32+ <http://www.openinventionnetwork.com>. */
33+
34+#ifdef HAVE_CONFIG_H
35+# include <config.h>
36+#endif
37+
38+#define BACKEND mips_
39+#define RELOC_PREFIX R_MIPS_
40+#include "libebl_CPU.h"
41+
42+/* This defines the common reloc hooks based on mips_reloc.def. */
43+#include "common-reloc.c"
44+
45+const char *
46+mips_init (Elf *elf __attribute__ ((unused)),
47+ GElf_Half machine __attribute__ ((unused)),
48+ Ebl *eh,
49+ size_t ehlen)
50+{
51+ /* Check whether the Elf_BH object has a sufficent size. */
52+ if (ehlen < sizeof (Ebl))
53+ return NULL;
54+
55+ /* We handle it. */
56+ if (machine == EM_MIPS)
57+ eh->name = "MIPS R3000 big-endian";
58+ else if (machine == EM_MIPS_RS3_LE)
59+ eh->name = "MIPS R3000 little-endian";
60+
61+ mips_init_reloc (eh);
62+ HOOK (eh, reloc_simple_type);
63+ HOOK (eh, return_value_location);
64+ HOOK (eh, register_info);
65+
66+ return MODVERSION;
67+}
68Index: b/backends/mips_regs.c
69===================================================================
70--- /dev/null
71+++ b/backends/mips_regs.c
72@@ -0,0 +1,104 @@
73+/* Register names and numbers for MIPS DWARF.
74+ Copyright (C) 2006 Red Hat, Inc.
75+ This file is part of Red Hat elfutils.
76+
77+ Red Hat elfutils is free software; you can redistribute it and/or modify
78+ it under the terms of the GNU General Public License as published by the
79+ Free Software Foundation; version 2 of the License.
80+
81+ Red Hat elfutils is distributed in the hope that it will be useful, but
82+ WITHOUT ANY WARRANTY; without even the implied warranty of
83+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84+ General Public License for more details.
85+
86+ You should have received a copy of the GNU General Public License along
87+ with Red Hat elfutils; if not, write to the Free Software Foundation,
88+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
89+
90+ Red Hat elfutils is an included package of the Open Invention Network.
91+ An included package of the Open Invention Network is a package for which
92+ Open Invention Network licensees cross-license their patents. No patent
93+ license is granted, either expressly or impliedly, by designation as an
94+ included package. Should you wish to participate in the Open Invention
95+ Network licensing program, please visit www.openinventionnetwork.com
96+ <http://www.openinventionnetwork.com>. */
97+
98+#ifdef HAVE_CONFIG_H
99+# include <config.h>
100+#endif
101+
102+#include <string.h>
103+#include <dwarf.h>
104+
105+#define BACKEND mips_
106+#include "libebl_CPU.h"
107+
108+ssize_t
109+mips_register_info (Ebl *ebl __attribute__((unused)),
110+ int regno, char *name, size_t namelen,
111+ const char **prefix, const char **setname,
112+ int *bits, int *type)
113+{
114+ if (name == NULL)
115+ return 66;
116+
117+ if (regno < 0 || regno > 65 || namelen < 4)
118+ return -1;
119+
120+ *prefix = "$";
121+
122+ if (regno < 32)
123+ {
124+ *setname = "integer";
125+ *type = DW_ATE_signed;
126+ *bits = 32;
127+ if (regno < 32 + 10)
128+ {
129+ name[0] = regno + '0';
130+ namelen = 1;
131+ }
132+ else
133+ {
134+ name[0] = (regno / 10) + '0';
135+ name[1] = (regno % 10) + '0';
136+ namelen = 2;
137+ }
138+ }
139+ else if (regno < 64)
140+ {
141+ *setname = "FPU";
142+ *type = DW_ATE_float;
143+ *bits = 32;
144+ name[0] = 'f';
145+ if (regno < 32 + 10)
146+ {
147+ name[1] = (regno - 32) + '0';
148+ namelen = 2;
149+ }
150+ else
151+ {
152+ name[1] = (regno - 32) / 10 + '0';
153+ name[2] = (regno - 32) % 10 + '0';
154+ namelen = 3;
155+ }
156+ }
157+ else if (regno == 64)
158+ {
159+ *type = DW_ATE_signed;
160+ *bits = 32;
161+ name[0] = 'h';
162+ name[1] = 'i';
163+ namelen = 2;
164+ }
165+ else
166+ {
167+ *type = DW_ATE_signed;
168+ *bits = 32;
169+ name[0] = 'l';
170+ name[1] = 'o';
171+ namelen = 2;
172+ }
173+
174+ name[namelen++] = '\0';
175+ return namelen;
176+}
177Index: b/backends/mips_reloc.def
178===================================================================
179--- /dev/null
180+++ b/backends/mips_reloc.def
181@@ -0,0 +1,79 @@
182+/* List the relocation types for mips. -*- C -*-
183+ Copyright (C) 2006 Red Hat, Inc.
184+ This file is part of Red Hat elfutils.
185+
186+ Red Hat elfutils is free software; you can redistribute it and/or modify
187+ it under the terms of the GNU General Public License as published by the
188+ Free Software Foundation; version 2 of the License.
189+
190+ Red Hat elfutils is distributed in the hope that it will be useful, but
191+ WITHOUT ANY WARRANTY; without even the implied warranty of
192+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
193+ General Public License for more details.
194+
195+ You should have received a copy of the GNU General Public License along
196+ with Red Hat elfutils; if not, write to the Free Software Foundation,
197+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
198+
199+ Red Hat elfutils is an included package of the Open Invention Network.
200+ An included package of the Open Invention Network is a package for which
201+ Open Invention Network licensees cross-license their patents. No patent
202+ license is granted, either expressly or impliedly, by designation as an
203+ included package. Should you wish to participate in the Open Invention
204+ Network licensing program, please visit www.openinventionnetwork.com
205+ <http://www.openinventionnetwork.com>. */
206+
207+/* NAME, REL|EXEC|DYN */
208+
209+RELOC_TYPE (NONE, 0)
210+RELOC_TYPE (16, 0)
211+RELOC_TYPE (32, 0)
212+RELOC_TYPE (REL32, 0)
213+RELOC_TYPE (26, 0)
214+RELOC_TYPE (HI16, 0)
215+RELOC_TYPE (LO16, 0)
216+RELOC_TYPE (GPREL16, 0)
217+RELOC_TYPE (LITERAL, 0)
218+RELOC_TYPE (GOT16, 0)
219+RELOC_TYPE (PC16, 0)
220+RELOC_TYPE (CALL16, 0)
221+RELOC_TYPE (GPREL32, 0)
222+
223+RELOC_TYPE (SHIFT5, 0)
224+RELOC_TYPE (SHIFT6, 0)
225+RELOC_TYPE (64, 0)
226+RELOC_TYPE (GOT_DISP, 0)
227+RELOC_TYPE (GOT_PAGE, 0)
228+RELOC_TYPE (GOT_OFST, 0)
229+RELOC_TYPE (GOT_HI16, 0)
230+RELOC_TYPE (GOT_LO16, 0)
231+RELOC_TYPE (SUB, 0)
232+RELOC_TYPE (INSERT_A, 0)
233+RELOC_TYPE (INSERT_B, 0)
234+RELOC_TYPE (DELETE, 0)
235+RELOC_TYPE (HIGHER, 0)
236+RELOC_TYPE (HIGHEST, 0)
237+RELOC_TYPE (CALL_HI16, 0)
238+RELOC_TYPE (CALL_LO16, 0)
239+RELOC_TYPE (SCN_DISP, 0)
240+RELOC_TYPE (REL16, 0)
241+RELOC_TYPE (ADD_IMMEDIATE, 0)
242+RELOC_TYPE (PJUMP, 0)
243+RELOC_TYPE (RELGOT, 0)
244+RELOC_TYPE (JALR, 0)
245+RELOC_TYPE (TLS_DTPMOD32, 0)
246+RELOC_TYPE (TLS_DTPREL32, 0)
247+RELOC_TYPE (TLS_DTPMOD64, 0)
248+RELOC_TYPE (TLS_DTPREL64, 0)
249+RELOC_TYPE (TLS_GD, 0)
250+RELOC_TYPE (TLS_LDM, 0)
251+RELOC_TYPE (TLS_DTPREL_HI16, 0)
252+RELOC_TYPE (TLS_DTPREL_LO16, 0)
253+RELOC_TYPE (TLS_GOTTPREL, 0)
254+RELOC_TYPE (TLS_TPREL32, 0)
255+RELOC_TYPE (TLS_TPREL64, 0)
256+RELOC_TYPE (TLS_TPREL_HI16, 0)
257+RELOC_TYPE (TLS_TPREL_LO16, 0)
258+
259+#define NO_COPY_RELOC 1
260+#define NO_RELATIVE_RELOC 1
261Index: b/backends/mips_retval.c
262===================================================================
263--- /dev/null
264+++ b/backends/mips_retval.c
265@@ -0,0 +1,321 @@
266+/* Function return value location for Linux/mips ABI.
267+ Copyright (C) 2005 Red Hat, Inc.
268+ This file is part of Red Hat elfutils.
269+
270+ Red Hat elfutils is free software; you can redistribute it and/or modify
271+ it under the terms of the GNU General Public License as published by the
272+ Free Software Foundation; version 2 of the License.
273+
274+ Red Hat elfutils is distributed in the hope that it will be useful, but
275+ WITHOUT ANY WARRANTY; without even the implied warranty of
276+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
277+ General Public License for more details.
278+
279+ You should have received a copy of the GNU General Public License along
280+ with Red Hat elfutils; if not, write to the Free Software Foundation,
281+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
282+
283+ Red Hat elfutils is an included package of the Open Invention Network.
284+ An included package of the Open Invention Network is a package for which
285+ Open Invention Network licensees cross-license their patents. No patent
286+ license is granted, either expressly or impliedly, by designation as an
287+ included package. Should you wish to participate in the Open Invention
288+ Network licensing program, please visit www.openinventionnetwork.com
289+ <http://www.openinventionnetwork.com>. */
290+
291+#ifdef HAVE_CONFIG_H
292+# include <config.h>
293+#endif
294+
295+#include <string.h>
296+#include <assert.h>
297+#include <dwarf.h>
298+#include <elf.h>
299+
300+#include "../libebl/libeblP.h"
301+#include "../libdw/libdwP.h"
302+
303+#define BACKEND mips_
304+#include "libebl_CPU.h"
305+
306+/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
307+#define EF_MIPS_ABI 0x0000F000
308+
309+/* The original o32 abi. */
310+#define E_MIPS_ABI_O32 0x00001000
311+
312+/* O32 extended to work on 64 bit architectures */
313+#define E_MIPS_ABI_O64 0x00002000
314+
315+/* EABI in 32 bit mode */
316+#define E_MIPS_ABI_EABI32 0x00003000
317+
318+/* EABI in 64 bit mode */
319+#define E_MIPS_ABI_EABI64 0x00004000
320+
321+/* All the possible MIPS ABIs. */
322+enum mips_abi
323+ {
324+ MIPS_ABI_UNKNOWN = 0,
325+ MIPS_ABI_N32,
326+ MIPS_ABI_O32,
327+ MIPS_ABI_N64,
328+ MIPS_ABI_O64,
329+ MIPS_ABI_EABI32,
330+ MIPS_ABI_EABI64,
331+ MIPS_ABI_LAST
332+ };
333+
334+/* Find the mips ABI of the current file */
335+enum mips_abi find_mips_abi(Elf *elf)
336+{
337+ GElf_Ehdr ehdr_mem;
338+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
339+
340+ if (ehdr == NULL)
341+ return MIPS_ABI_LAST;
342+
343+ GElf_Word elf_flags = ehdr->e_flags;
344+
345+ /* Check elf_flags to see if it specifies the ABI being used. */
346+ switch ((elf_flags & EF_MIPS_ABI))
347+ {
348+ case E_MIPS_ABI_O32:
349+ return MIPS_ABI_O32;
350+ case E_MIPS_ABI_O64:
351+ return MIPS_ABI_O64;
352+ case E_MIPS_ABI_EABI32:
353+ return MIPS_ABI_EABI32;
354+ case E_MIPS_ABI_EABI64:
355+ return MIPS_ABI_EABI64;
356+ default:
357+ if ((elf_flags & EF_MIPS_ABI2))
358+ return MIPS_ABI_N32;
359+ }
360+
361+ /* GCC creates a pseudo-section whose name describes the ABI. */
362+ size_t shstrndx;
363+ if (elf_getshdrstrndx (elf, &shstrndx) < 0)
364+ return MIPS_ABI_LAST;
365+
366+ const char *name;
367+ Elf_Scn *scn = NULL;
368+ while ((scn = elf_nextscn (elf, scn)) != NULL)
369+ {
370+ GElf_Shdr shdr_mem;
371+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
372+ if (shdr == NULL)
373+ return MIPS_ABI_LAST;
374+
375+ name = elf_strptr (elf, shstrndx, shdr->sh_name) ?: "";
376+ if (strncmp (name, ".mdebug.", 8) != 0)
377+ continue;
378+
379+ if (strcmp (name, ".mdebug.abi32") == 0)
380+ return MIPS_ABI_O32;
381+ else if (strcmp (name, ".mdebug.abiN32") == 0)
382+ return MIPS_ABI_N32;
383+ else if (strcmp (name, ".mdebug.abi64") == 0)
384+ return MIPS_ABI_N64;
385+ else if (strcmp (name, ".mdebug.abiO64") == 0)
386+ return MIPS_ABI_O64;
387+ else if (strcmp (name, ".mdebug.eabi32") == 0)
388+ return MIPS_ABI_EABI32;
389+ else if (strcmp (name, ".mdebug.eabi64") == 0)
390+ return MIPS_ABI_EABI64;
391+ else
392+ return MIPS_ABI_UNKNOWN;
393+ }
394+
395+ return MIPS_ABI_UNKNOWN;
396+}
397+
398+unsigned int
399+mips_abi_regsize (enum mips_abi abi)
400+{
401+ switch (abi)
402+ {
403+ case MIPS_ABI_EABI32:
404+ case MIPS_ABI_O32:
405+ return 4;
406+ case MIPS_ABI_N32:
407+ case MIPS_ABI_N64:
408+ case MIPS_ABI_O64:
409+ case MIPS_ABI_EABI64:
410+ return 8;
411+ case MIPS_ABI_UNKNOWN:
412+ case MIPS_ABI_LAST:
413+ default:
414+ return 0;
415+ }
416+}
417+
418+
419+/* $v0 or pair $v0, $v1 */
420+static const Dwarf_Op loc_intreg_o32[] =
421+ {
422+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
423+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
424+ };
425+
426+static const Dwarf_Op loc_intreg[] =
427+ {
428+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 8 },
429+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 8 },
430+ };
431+#define nloc_intreg 1
432+#define nloc_intregpair 4
433+
434+/* $f0 (float), or pair $f0, $f1 (double).
435+ * f2/f3 are used for COMPLEX (= 2 doubles) returns in Fortran */
436+static const Dwarf_Op loc_fpreg_o32[] =
437+ {
438+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
439+ { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
440+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 },
441+ { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 },
442+ };
443+
444+/* $f0, or pair $f0, $f2. */
445+static const Dwarf_Op loc_fpreg[] =
446+ {
447+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 8 },
448+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 },
449+ };
450+#define nloc_fpreg 1
451+#define nloc_fpregpair 4
452+#define nloc_fpregquad 8
453+
454+/* The return value is a structure and is actually stored in stack space
455+ passed in a hidden argument by the caller. But, the compiler
456+ helpfully returns the address of that space in $v0. */
457+static const Dwarf_Op loc_aggregate[] =
458+ {
459+ { .atom = DW_OP_breg2, .number = 0 }
460+ };
461+#define nloc_aggregate 1
462+
463+int
464+mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
465+{
466+ /* First find the ABI used by the elf object */
467+ enum mips_abi abi = find_mips_abi(functypedie->cu->dbg->elf);
468+
469+ /* Something went seriously wrong while trying to figure out the ABI */
470+ if (abi == MIPS_ABI_LAST)
471+ return -1;
472+
473+ /* We couldn't identify the ABI, but the file seems valid */
474+ if (abi == MIPS_ABI_UNKNOWN)
475+ return -2;
476+
477+ /* Can't handle EABI variants */
478+ if ((abi == MIPS_ABI_EABI32) || (abi == MIPS_ABI_EABI64))
479+ return -2;
480+
481+ unsigned int regsize = mips_abi_regsize (abi);
482+ if (!regsize)
483+ return -2;
484+
485+ /* Start with the function's type, and get the DW_AT_type attribute,
486+ which is the type of the return value. */
487+
488+ Dwarf_Attribute attr_mem;
489+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
490+ if (attr == NULL)
491+ /* The function has no return value, like a `void' function in C. */
492+ return 0;
493+
494+ Dwarf_Die die_mem;
495+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
496+ int tag = dwarf_tag (typedie);
497+
498+ /* Follow typedefs and qualifiers to get to the actual type. */
499+ while (tag == DW_TAG_typedef
500+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
501+ || tag == DW_TAG_restrict_type)
502+ {
503+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
504+ typedie = dwarf_formref_die (attr, &die_mem);
505+ tag = dwarf_tag (typedie);
506+ }
507+
508+ switch (tag)
509+ {
510+ case -1:
511+ return -1;
512+
513+ case DW_TAG_subrange_type:
514+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
515+ {
516+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
517+ typedie = dwarf_formref_die (attr, &die_mem);
518+ tag = dwarf_tag (typedie);
519+ }
520+ /* Fall through. */
521+
522+ case DW_TAG_base_type:
523+ case DW_TAG_enumeration_type:
524+ case DW_TAG_pointer_type:
525+ case DW_TAG_ptr_to_member_type:
526+ {
527+ Dwarf_Word size;
528+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
529+ &attr_mem), &size) != 0)
530+ {
531+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
532+ size = regsize;
533+ else
534+ return -1;
535+ }
536+ if (tag == DW_TAG_base_type)
537+ {
538+ Dwarf_Word encoding;
539+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
540+ &attr_mem), &encoding) != 0)
541+ return -1;
542+
543+#define ABI_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc))
544+
545+ if (encoding == DW_ATE_float)
546+ {
547+ *locp = ABI_LOC(loc_fpreg, regsize);
548+ if (size <= regsize)
549+ return nloc_fpreg;
550+
551+ if (size <= 2*regsize)
552+ return nloc_fpregpair;
553+
554+ if (size <= 4*regsize && abi == MIPS_ABI_O32)
555+ return nloc_fpregquad;
556+
557+ goto aggregate;
558+ }
559+ }
560+ *locp = ABI_LOC(loc_intreg, regsize);
561+ if (size <= regsize)
562+ return nloc_intreg;
563+ if (size <= 2*regsize)
564+ return nloc_intregpair;
565+
566+ /* Else fall through. Shouldn't happen though (at least with gcc) */
567+ }
568+
569+ case DW_TAG_structure_type:
570+ case DW_TAG_class_type:
571+ case DW_TAG_union_type:
572+ case DW_TAG_array_type:
573+ aggregate:
574+ /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
575+ if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
576+ return -2;
577+
578+ *locp = loc_aggregate;
579+ return nloc_aggregate;
580+ }
581+
582+ /* XXX We don't have a good way to return specific errors from ebl calls.
583+ This value means we do not understand the type, but it is well-formed
584+ DWARF and might be valid. */
585+ return -2;
586+}
587Index: b/backends/mips_symbol.c
588===================================================================
589--- /dev/null
590+++ b/backends/mips_symbol.c
591@@ -0,0 +1,52 @@
592+/* MIPS specific symbolic name handling.
593+ Copyright (C) 2002, 2003, 2005 Red Hat, Inc.
594+ This file is part of Red Hat elfutils.
595+ Written by Jakub Jelinek <jakub@redhat.com>, 2002.
596+
597+ Red Hat elfutils is free software; you can redistribute it and/or modify
598+ it under the terms of the GNU General Public License as published by the
599+ Free Software Foundation; version 2 of the License.
600+
601+ Red Hat elfutils is distributed in the hope that it will be useful, but
602+ WITHOUT ANY WARRANTY; without even the implied warranty of
603+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
604+ General Public License for more details.
605+
606+ You should have received a copy of the GNU General Public License along
607+ with Red Hat elfutils; if not, write to the Free Software Foundation,
608+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
609+
610+ Red Hat elfutils is an included package of the Open Invention Network.
611+ An included package of the Open Invention Network is a package for which
612+ Open Invention Network licensees cross-license their patents. No patent
613+ license is granted, either expressly or impliedly, by designation as an
614+ included package. Should you wish to participate in the Open Invention
615+ Network licensing program, please visit www.openinventionnetwork.com
616+ <http://www.openinventionnetwork.com>. */
617+
618+#ifdef HAVE_CONFIG_H
619+# include <config.h>
620+#endif
621+
622+#include <elf.h>
623+#include <stddef.h>
624+
625+#define BACKEND mips_
626+#include "libebl_CPU.h"
627+
628+/* Check for the simple reloc types. */
629+Elf_Type
630+mips_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
631+{
632+ switch (type)
633+ {
634+ case R_MIPS_16:
635+ return ELF_T_HALF;
636+ case R_MIPS_32:
637+ return ELF_T_WORD;
638+ case R_MIPS_64:
639+ return ELF_T_XWORD;
640+ default:
641+ return ELF_T_NUM;
642+ }
643+}
644Index: b/libebl/eblopenbackend.c
645===================================================================
646--- a/libebl/eblopenbackend.c
647+++ b/libebl/eblopenbackend.c
648@@ -71,6 +71,8 @@ static const struct
649 { "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
650 { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
651 { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
652+ { "mips", "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
653+ { "mips", "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 },
654
655 { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
656 { "m68k", "elf_m68k", "m68k", 4, EM_68K, ELFCLASS32, ELFDATA2MSB },
657Index: b/backends/Makefile.am
658===================================================================
659--- a/backends/Makefile.am
660+++ b/backends/Makefile.am
661@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
662
663
664 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
665- tilegx m68k bpf parisc
666+ tilegx m68k bpf parisc mips
667 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
668 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
669 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
670 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
671- libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a
672+ libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a libebl_mips_pic.a
673 noinst_LIBRARIES = $(libebl_pic)
674 noinst_DATA = $(libebl_pic:_pic.a=.so)
675
676@@ -132,6 +132,10 @@ parisc_SRCS = parisc_init.c parisc_symbo
677 libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
678 am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
679
680+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
681+libebl_mips_pic_a_SOURCES = $(mips_SRCS)
682+am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
683+
684 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
685 @rm -f $(@:.so=.map)
686 $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_readelf_w.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_readelf_w.patch
new file mode 100644
index 0000000000..790930cf35
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/mips_readelf_w.patch
@@ -0,0 +1,25 @@
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
9Upstream-Status: Backport [from debian]
10Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
11
12Index: b/src/readelf.c
13===================================================================
14--- a/src/readelf.c
15+++ b/src/readelf.c
16@@ -8343,7 +8343,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
17 GElf_Shdr shdr_mem;
18 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
19
20- if (shdr != NULL && shdr->sh_type == SHT_PROGBITS)
21+ if (shdr != NULL && (
22+ (shdr->sh_type == SHT_PROGBITS) || (shdr->sh_type == SHT_MIPS_DWARF)))
23 {
24 static const struct
25 {
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/debian/testsuite-ignore-elflint.diff b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/testsuite-ignore-elflint.diff
new file mode 100644
index 0000000000..3df35768b7
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/debian/testsuite-ignore-elflint.diff
@@ -0,0 +1,42 @@
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
7Upstream-Status: Backport [from debian]
8Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
9
10Index: b/tests/run-elflint-self.sh
11===================================================================
12--- a/tests/run-elflint-self.sh
13+++ b/tests/run-elflint-self.sh
14@@ -18,4 +18,4 @@
15
16 . $srcdir/test-subr.sh
17
18-testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
19+testrun_on_self_skip ${abs_top_builddir}/src/elflint --quiet --gnu-ld
20Index: b/tests/test-subr.sh
21===================================================================
22--- a/tests/test-subr.sh
23+++ b/tests/test-subr.sh
24@@ -152,3 +152,18 @@ testrun_on_self_quiet()
25 # Only exit if something failed
26 if test $exit_status != 0; then exit $exit_status; fi
27 }
28+
29+# Same as testrun_on_self(), but skip on failure.
30+testrun_on_self_skip()
31+{
32+ exit_status=0
33+
34+ for file in $self_test_files; do
35+ testrun $* $file \
36+ || { echo "*** failure in $* $file"; exit_status=77; }
37+ done
38+
39+ # Only exit if something failed
40+ if test $exit_status != 0; then exit $exit_status; fi
41+}
42+
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/fixheadercheck.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/fixheadercheck.patch
new file mode 100644
index 0000000000..5de3b24c85
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/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.168/shadow.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/shadow.patch
new file mode 100644
index 0000000000..d31961f94f
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.168/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 }