summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/files
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2017-08-16 04:31:18 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-18 10:40:26 +0100
commit70de26076f36205b914be1b1911e5fc0afd65edb (patch)
tree8462c68ee795e2ac168c81db0ed52fae670f554a /meta/recipes-devtools/elfutils/files
parenta02826add027f71d1fca56547b2b72db28b1005f (diff)
downloadpoky-70de26076f36205b914be1b1911e5fc0afd65edb.tar.gz
elfutils: 0.168 -> 0.170
The 0.170 Fixed CVE issues - CVE-2017-7608 - CVE-2017-7612 - CVE-2017-7611 - CVE-2017-7610 - CVE-2016-10255 - CVE-2017-7613 - CVE-2017-7609 - CVE-2016-10254 - CVE-2017-7607 Rebase patches to 0.170 - dso-link-change.patch -> 0001 - Fix_elf_cvt_gunhash.patch -> 0002 - fixheadercheck.patch -> 0003 - 0001-remove-the-unneed-checking.patch -> 0004 - 0001-fix-a-stack-usage-warning.patch -> 0005 - aarch64_uio.patch -> 0006 - shadow.patch -> 0007 - 0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch -> 0008 - debian/mips_backend.diff -> debian/mips_backend.patch Drop obsolete patches - 0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch Upstream fixed it https://sourceware.org/git/?p=elfutils.git;a=commit;h=7114c513fbebcca8b76796b7f64b57447ba383e1 - Fix_one_GCC7_warning.patch It is a backported patch https://sourceware.org/git/?p=elfutils.git;a=commit;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95 - Drop debian patches, they modify test case. debian/testsuite-ignore-elflint.diff debian/kfreebsd_path.patch debian/hurd_path.patch debian/ignore_strmerge.diff (From OE-Core rev: 4ca17f9275c81f27498b7ac07d9fe7e8193fdd71) 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/files')
-rw-r--r--meta/recipes-devtools/elfutils/files/0001-dso-link-change.patch52
-rw-r--r--meta/recipes-devtools/elfutils/files/0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch42
-rw-r--r--meta/recipes-devtools/elfutils/files/0003-fixheadercheck.patch40
-rw-r--r--meta/recipes-devtools/elfutils/files/0004-Disable-the-test-to-convert-euc-jp.patch44
-rw-r--r--meta/recipes-devtools/elfutils/files/0005-fix-a-stack-usage-warning.patch35
-rw-r--r--meta/recipes-devtools/elfutils/files/0006-Fix-build-on-aarch64-musl.patch61
-rw-r--r--meta/recipes-devtools/elfutils/files/0007-Fix-control-path-where-we-have-str-as-uninitialized-.patch45
-rw-r--r--meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch1031
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch35
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch171
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/0003-Add-mips-n64-relocation-format-hack.patch229
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/arm_backend.diff603
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/fallthrough.patch36
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff802
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/mips_backend.patch715
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch25
16 files changed, 3966 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/files/0001-dso-link-change.patch b/meta/recipes-devtools/elfutils/files/0001-dso-link-change.patch
new file mode 100644
index 0000000000..28c57f236c
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0001-dso-link-change.patch
@@ -0,0 +1,52 @@
1From 0a69a26c9f7487daca900db87cd1195857a4603f Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:10:57 +0800
4Subject: [PATCH 1/7] dso link change
5
6Upstream-Status: Pending
7
8This patch makes the link to the dependencies of libdw explicit, as
9recent ld no longer implicitly links them. See
10http://lists.fedoraproject.org/pipermail/devel/2010-March/133601.html
11as a similar example of the error message you can encounter without this
12patch, and https://fedoraproject.org/wiki/UnderstandingDSOLinkChange and
13https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking for
14more details.
15
16Rebase to 0.170
17
18Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
19---
20 src/Makefile.am | 2 +-
21 tests/Makefile.am | 2 +-
22 2 files changed, 2 insertions(+), 2 deletions(-)
23
24diff --git a/src/Makefile.am b/src/Makefile.am
25index 2b1c0dc..9305b84 100644
26--- a/src/Makefile.am
27+++ b/src/Makefile.am
28@@ -44,7 +44,7 @@ libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl
29 libelf = ../libelf/libelf.a -lz
30 else
31 libasm = ../libasm/libasm.so
32-libdw = ../libdw/libdw.so
33+libdw = ../libdw/libdw.so $(zip_LIBS) $(libelf) $(libebl) -ldl
34 libelf = ../libelf/libelf.so
35 endif
36 libebl = ../libebl/libebl.a
37diff --git a/tests/Makefile.am b/tests/Makefile.am
38index 3735084..528615d 100644
39--- a/tests/Makefile.am
40+++ b/tests/Makefile.am
41@@ -400,7 +400,7 @@ libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl
42 libelf = ../libelf/libelf.a -lz
43 libasm = ../libasm/libasm.a
44 else
45-libdw = ../libdw/libdw.so
46+libdw = ../libdw/libdw.so $(zip_LIBS) $(libelf) $(libebl) -ldl
47 libelf = ../libelf/libelf.so
48 libasm = ../libasm/libasm.so
49 endif
50--
511.8.3.1
52
diff --git a/meta/recipes-devtools/elfutils/files/0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch b/meta/recipes-devtools/elfutils/files/0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch
new file mode 100644
index 0000000000..2f718eb827
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch
@@ -0,0 +1,42 @@
1From e98670f7c7b4c73fb65534949716fd8d043960d5 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:13:59 +0800
4Subject: [PATCH 2/7] Fix elf_cvt_gunhash if dest and src are same.
5
6Upstream-Status: Pending
7
8The 'dest' and 'src' can be same, we need to save the value of src32[2]
9before swaping it.
10
11Signed-off-by: Baoshan Pang <BaoShan.Pang@windriver.com>
12
13Rebase to 0.170
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 libelf/gnuhash_xlate.h | 3 ++-
17 1 file changed, 2 insertions(+), 1 deletion(-)
18
19diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h
20index 6faf113..04d9ca1 100644
21--- a/libelf/gnuhash_xlate.h
22+++ b/libelf/gnuhash_xlate.h
23@@ -40,6 +40,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
24 words. We must detangle them here. */
25 Elf32_Word *dest32 = dest;
26 const Elf32_Word *src32 = src;
27+ Elf32_Word save_src32_2 = src32[2]; // dest could be equal to src
28
29 /* First four control words, 32 bits. */
30 for (unsigned int cnt = 0; cnt < 4; ++cnt)
31@@ -50,7 +51,7 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
32 len -= 4;
33 }
34
35- Elf32_Word bitmask_words = encode ? src32[2] : dest32[2];
36+ Elf32_Word bitmask_words = encode ? save_src32_2 : dest32[2];
37
38 /* Now the 64 bit words. */
39 Elf64_Xword *dest64 = (Elf64_Xword *) &dest32[4];
40--
411.8.3.1
42
diff --git a/meta/recipes-devtools/elfutils/files/0003-fixheadercheck.patch b/meta/recipes-devtools/elfutils/files/0003-fixheadercheck.patch
new file mode 100644
index 0000000000..7c49fced10
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0003-fixheadercheck.patch
@@ -0,0 +1,40 @@
1From 565d5935abf5b58773f9c8385c00189221980d98 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:17:20 +0800
4Subject: [PATCH 3/7] fixheadercheck
5
6For some binaries we can get a invalid section alignment, for example if
7sh_align = 1 and sh_addralign is 0. In the case of a zero size section
8like
9".note.GNU-stack", this is irrelavent as far as I can tell and we
10shouldn't
11error in this case.
12
13RP 2014/6/11
14
15Upstream-Status: Pending
16
17Rebase to 0.170
18Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
19---
20 libelf/elf32_updatenull.c | 4 ++--
21 1 file changed, 2 insertions(+), 2 deletions(-)
22
23diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
24index d83c0b3..a51bf70 100644
25--- a/libelf/elf32_updatenull.c
26+++ b/libelf/elf32_updatenull.c
27@@ -339,8 +339,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
28 we test for the alignment of the section being large
29 enough for the largest alignment required by a data
30 block. */
31- if (unlikely (! powerof2 (shdr->sh_addralign))
32- || unlikely ((shdr->sh_addralign ?: 1) < sh_align))
33+ if (shdr->sh_size && (unlikely (! powerof2 (shdr->sh_addralign))
34+ || unlikely ((shdr->sh_addralign ?: 1) < sh_align)))
35 {
36 __libelf_seterrno (ELF_E_INVALID_ALIGN);
37 return -1;
38--
391.8.3.1
40
diff --git a/meta/recipes-devtools/elfutils/files/0004-Disable-the-test-to-convert-euc-jp.patch b/meta/recipes-devtools/elfutils/files/0004-Disable-the-test-to-convert-euc-jp.patch
new file mode 100644
index 0000000000..d893ad68f6
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0004-Disable-the-test-to-convert-euc-jp.patch
@@ -0,0 +1,44 @@
1From bb7ed11950101798aae82f7fda8b3dcb05f755c5 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:24:06 +0800
4Subject: [PATCH 4/7] Disable the test to convert euc-jp
5
6Remove the test "Test against HP-UX 11.11 bug:
7No converter from EUC-JP to UTF-8 is provided"
8since we don't support HP-UX and if the euc-jp is not
9installed on the host, the dependence will be built without
10iconv support and will cause guild-native building fail.
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Roy Li <rongqing.li@windriver.com>
15
16Rebase to 0.170
17Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
18---
19 m4/iconv.m4 | 2 ++
20 1 file changed, 2 insertions(+)
21
22diff --git a/m4/iconv.m4 b/m4/iconv.m4
23index a503646..299f1eb 100644
24--- a/m4/iconv.m4
25+++ b/m4/iconv.m4
26@@ -159,6 +159,7 @@ int main ()
27 }
28 }
29 #endif
30+#if 0
31 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
32 provided. */
33 if (/* Try standardized names. */
34@@ -170,6 +171,7 @@ int main ()
35 /* Try HP-UX names. */
36 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
37 result |= 16;
38+#endif
39 return result;
40 }]])],
41 [am_cv_func_iconv_works=yes],
42--
431.8.3.1
44
diff --git a/meta/recipes-devtools/elfutils/files/0005-fix-a-stack-usage-warning.patch b/meta/recipes-devtools/elfutils/files/0005-fix-a-stack-usage-warning.patch
new file mode 100644
index 0000000000..22a01cfa71
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0005-fix-a-stack-usage-warning.patch
@@ -0,0 +1,35 @@
1From dd6dbf6af396519380f48c0ef1ce6cf4dd77f6d7 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:25:16 +0800
4Subject: [PATCH 5/7] fix a stack-usage warning
5
6Upstream-Status: Pending
7
8not use a variable to as a array size, otherwise the warning to error
9that
10stack usage might be unbounded [-Werror=stack-usage=] will happen
11
12Signed-off-by: Roy Li <rongqing.li@windriver.com>
13
14Rebase to 0.170
15Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
16---
17 backends/ppc_initreg.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c
21index 69d623b..de41dec 100644
22--- a/backends/ppc_initreg.c
23+++ b/backends/ppc_initreg.c
24@@ -93,7 +93,7 @@ ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
25 return false;
26 }
27 const size_t gprs = sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr);
28- Dwarf_Word dwarf_regs[gprs];
29+ Dwarf_Word dwarf_regs[sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr)];
30 for (unsigned gpr = 0; gpr < gprs; gpr++)
31 dwarf_regs[gpr] = user_regs.r.gpr[gpr];
32 if (! setfunc (0, gprs, dwarf_regs, arg))
33--
341.8.3.1
35
diff --git a/meta/recipes-devtools/elfutils/files/0006-Fix-build-on-aarch64-musl.patch b/meta/recipes-devtools/elfutils/files/0006-Fix-build-on-aarch64-musl.patch
new file mode 100644
index 0000000000..5f29a03759
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0006-Fix-build-on-aarch64-musl.patch
@@ -0,0 +1,61 @@
1From e57ad47fc8549353ca80c23b9b4f38f31fde13e5 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:27:30 +0800
4Subject: [PATCH 6/7] Fix build on aarch64/musl
5
6Errors
7
8invalid operands to binary & (have 'long double' and 'unsigned int')
9
10error: redefinition
11 of 'struct iovec'
12 struct iovec { void *iov_base; size_t iov_len; };
13 ^
14Upstream-Status: Pending
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Rebase to 0.170
18Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
19---
20 backends/aarch64_initreg.c | 4 ++--
21 backends/arm_initreg.c | 2 +-
22 2 files changed, 3 insertions(+), 3 deletions(-)
23
24diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c
25index daf6f37..6445276 100644
26--- a/backends/aarch64_initreg.c
27+++ b/backends/aarch64_initreg.c
28@@ -33,7 +33,7 @@
29 #include "system.h"
30 #include <assert.h>
31 #if defined(__aarch64__) && defined(__linux__)
32-# include <linux/uio.h>
33+# include <sys/uio.h>
34 # include <sys/user.h>
35 # include <sys/ptrace.h>
36 /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
37@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
38
39 Dwarf_Word dwarf_fregs[32];
40 for (int r = 0; r < 32; r++)
41- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
42+ dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF;
43
44 if (! setfunc (64, 32, dwarf_fregs, arg))
45 return false;
46diff --git a/backends/arm_initreg.c b/backends/arm_initreg.c
47index efcabaf..062bb9e 100644
48--- a/backends/arm_initreg.c
49+++ b/backends/arm_initreg.c
50@@ -38,7 +38,7 @@
51 #endif
52
53 #ifdef __aarch64__
54-# include <linux/uio.h>
55+# include <sys/uio.h>
56 # include <sys/user.h>
57 # include <sys/ptrace.h>
58 /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
59--
601.8.3.1
61
diff --git a/meta/recipes-devtools/elfutils/files/0007-Fix-control-path-where-we-have-str-as-uninitialized-.patch b/meta/recipes-devtools/elfutils/files/0007-Fix-control-path-where-we-have-str-as-uninitialized-.patch
new file mode 100644
index 0000000000..224770478d
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0007-Fix-control-path-where-we-have-str-as-uninitialized-.patch
@@ -0,0 +1,45 @@
1From 1e91c1d4e37c05cf95058b4b3c3f352d72886f58 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 15 Aug 2017 17:31:38 +0800
4Subject: [PATCH 7/7] Fix control path where we have str as uninitialized
5 string
6
7|
8/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:
9In function 'i386_disasm':
10|
11/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:
12error: 'str' may be used uninitialized in this function
13[-Werror=maybe-uninitialized]
14| memcpy (buf + bufcnt, _str, _len); \
15| ^
16|
17/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:
18note: 'str' was declared here
19| const char *str;
20
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Upstream-Status: Pending
23
24Rebase to 0.170
25
26Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
27---
28 libcpu/i386_disasm.c | 1 +
29 1 file changed, 1 insertion(+)
30
31diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
32index 831afbe..60fd6d4 100644
33--- a/libcpu/i386_disasm.c
34+++ b/libcpu/i386_disasm.c
35@@ -821,6 +821,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
36 }
37 /* Fallthrough */
38 default:
39+ str = "";
40 assert (! "INVALID not handled");
41 }
42 }
43--
441.8.3.1
45
diff --git a/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
new file mode 100644
index 0000000000..8864d44369
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -0,0 +1,1031 @@
1From 010b0c57e748440eb1ceb3d977875f2488d2b4ce Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Aug 2017 10:06:26 +0800
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.170
11
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 Makefile.am | 2 +-
15 lib/color.c | 3 ++-
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 | 3 ++-
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 | 9 +++++++++
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 69 files changed, 95 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 f62389d..a2a84b4 100644
100--- a/lib/color.c
101+++ b/lib/color.c
102@@ -32,13 +32,14 @@
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 "color.h"
114+#include "system.h"
115
116 /* Prototype for option handler. */
117 static error_t parse_opt (int key, char *arg, struct argp_state *state);
118diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
119index dac2a5f..43016fc 100644
120--- a/lib/fixedsizehash.h
121+++ b/lib/fixedsizehash.h
122@@ -30,7 +30,6 @@
123 #include <errno.h>
124 #include <stdlib.h>
125 #include <string.h>
126-#include <sys/cdefs.h>
127
128 #include <system.h>
129
130diff --git a/lib/system.h b/lib/system.h
131index 9203335..1a60131 100644
132--- a/lib/system.h
133+++ b/lib/system.h
134@@ -50,6 +50,16 @@
135 #else
136 # error "Unknown byte order"
137 #endif
138+#ifndef TEMP_FAILURE_RETRY
139+#define TEMP_FAILURE_RETRY(expression) \
140+ (__extension__ \
141+ ({ long int __result; \
142+ do __result = (long int) (expression); \
143+ while (__result == -1L && errno == EINTR); \
144+ __result; }))
145+#endif
146+
147+#define error(status, errno, ...) err(status, __VA_ARGS__)
148
149 #ifndef MAX
150 #define MAX(m, n) ((m) < (n) ? (n) : (m))
151diff --git a/lib/xmalloc.c b/lib/xmalloc.c
152index 0cde384..217b054 100644
153--- a/lib/xmalloc.c
154+++ b/lib/xmalloc.c
155@@ -30,7 +30,7 @@
156 # include <config.h>
157 #endif
158
159-#include <error.h>
160+#include <err.h>
161 #include <libintl.h>
162 #include <stddef.h>
163 #include <stdlib.h>
164diff --git a/libasm/asm_end.c b/libasm/asm_end.c
165index ced24f5..4ad918c 100644
166--- a/libasm/asm_end.c
167+++ b/libasm/asm_end.c
168@@ -32,7 +32,7 @@
169 #endif
170
171 #include <assert.h>
172-#include <error.h>
173+#include <err.h>
174 #include <libintl.h>
175 #include <stdio.h>
176 #include <stdlib.h>
177diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
178index ddbb25d..74a598d 100644
179--- a/libasm/asm_newscn.c
180+++ b/libasm/asm_newscn.c
181@@ -32,7 +32,7 @@
182 #endif
183
184 #include <assert.h>
185-#include <error.h>
186+#include <err.h>
187 #include <libintl.h>
188 #include <stdlib.h>
189 #include <string.h>
190diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
191index aae5eae..6d76016 100644
192--- a/libcpu/i386_gendis.c
193+++ b/libcpu/i386_gendis.c
194@@ -31,7 +31,7 @@
195 # include <config.h>
196 #endif
197
198-#include <error.h>
199+#include <err.h>
200 #include <errno.h>
201 #include <stdio.h>
202 #include <stdlib.h>
203diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
204index ba5f4aa..b1e4191 100644
205--- a/libcpu/i386_lex.c
206+++ b/libcpu/i386_lex.c
207@@ -577,7 +577,7 @@ char *i386_text;
208 #endif
209
210 #include <ctype.h>
211-#include <error.h>
212+#include <err.h>
213 #include <libintl.h>
214
215 #include <libeu.h>
216diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
217index ef1ac35..48f2e64 100644
218--- a/libcpu/i386_parse.c
219+++ b/libcpu/i386_parse.c
220@@ -107,7 +107,7 @@
221 #include <assert.h>
222 #include <ctype.h>
223 #include <errno.h>
224-#include <error.h>
225+#include <err.h>
226 #include <inttypes.h>
227 #include <libintl.h>
228 #include <math.h>
229diff --git a/libdw/Makefile.am b/libdw/Makefile.am
230index ff8c291..89e792a 100644
231--- a/libdw/Makefile.am
232+++ b/libdw/Makefile.am
233@@ -105,7 +105,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
234 libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
235 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
236 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
237-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
238+fts_LDADD = -lfts
239+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) $(fts_LDADD)
240 libdw_so_SOURCES =
241 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
242 # The rpath is necessary for libebl because its $ORIGIN use will
243diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
244index 28a8cf6..29aeb3f 100644
245--- a/libdw/libdw_alloc.c
246+++ b/libdw/libdw_alloc.c
247@@ -31,7 +31,7 @@
248 # include <config.h>
249 #endif
250
251-#include <error.h>
252+#include <err.h>
253 #include <errno.h>
254 #include <stdlib.h>
255 #include "libdwP.h"
256diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
257index ee0c164..b06ab59 100644
258--- a/libdwfl/dwfl_build_id_find_elf.c
259+++ b/libdwfl/dwfl_build_id_find_elf.c
260@@ -31,6 +31,7 @@
261 #endif
262
263 #include "libdwflP.h"
264+#include "system.h"
265 #include <inttypes.h>
266 #include <fcntl.h>
267 #include <unistd.h>
268@@ -99,7 +100,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
269 {
270 if (*file_name != NULL)
271 free (*file_name);
272- *file_name = canonicalize_file_name (name);
273+ *file_name = realpath (name, NULL);
274 if (*file_name == NULL)
275 {
276 *file_name = name;
277diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
278index 7bcf61c..c345797 100644
279--- a/libdwfl/dwfl_error.c
280+++ b/libdwfl/dwfl_error.c
281@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
282 const char *
283 dwfl_errmsg (int error)
284 {
285+ static __thread char s[64] = "";
286 if (error == 0 || error == -1)
287 {
288 int last_error = global_error;
289@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
290 switch (error &~ 0xffff)
291 {
292 case OTHER_ERROR (ERRNO):
293- return strerror_r (error & 0xffff, "bad", 0);
294+ strerror_r (error & 0xffff, s, sizeof(s));
295+ return s;
296 case OTHER_ERROR (LIBELF):
297 return elf_errmsg (error & 0xffff);
298 case OTHER_ERROR (LIBDW):
299diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
300index 9775ace..511c4a6 100644
301--- a/libdwfl/dwfl_module_getdwarf.c
302+++ b/libdwfl/dwfl_module_getdwarf.c
303@@ -35,6 +35,7 @@
304 #include <fcntl.h>
305 #include <string.h>
306 #include <unistd.h>
307+#include "system.h"
308 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
309 #include "../libelf/libelfP.h"
310 #include "system.h"
311diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
312index 6d5a42a..9267788 100644
313--- a/libdwfl/find-debuginfo.c
314+++ b/libdwfl/find-debuginfo.c
315@@ -389,7 +389,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
316 /* If FILE_NAME is a symlink, the debug file might be associated
317 with the symlink target name instead. */
318
319- char *canon = canonicalize_file_name (file_name);
320+ char *canon = realpath (file_name, NULL);
321 if (canon != NULL && strcmp (file_name, canon))
322 fd = find_debuginfo_in_path (mod, canon,
323 debuglink_file, debuglink_crc,
324diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
325index f849128..6f0aca1 100644
326--- a/libdwfl/libdwfl_crc32_file.c
327+++ b/libdwfl/libdwfl_crc32_file.c
328@@ -29,6 +29,15 @@
329 # include <config.h>
330 #endif
331
332+#ifndef TEMP_FAILURE_RETRY
333+#define TEMP_FAILURE_RETRY(expression) \
334+ (__extension__ \
335+ ({ long int __result; \
336+ do __result = (long int) (expression); \
337+ while (__result == -1L && errno == EINTR); \
338+ __result; }))
339+#endif
340+
341 #define crc32_file attribute_hidden __libdwfl_crc32_file
342 #define crc32 __libdwfl_crc32
343 #include <libdwflP.h>
344diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
345index 9d0fef2..9fc09b8 100644
346--- a/libdwfl/linux-kernel-modules.c
347+++ b/libdwfl/linux-kernel-modules.c
348@@ -40,6 +40,7 @@
349 #include <system.h>
350
351 #include "libdwflP.h"
352+#include "system.h"
353 #include <inttypes.h>
354 #include <errno.h>
355 #include <stdio.h>
356diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
357index 5371396..2e66dfd 100644
358--- a/libebl/eblopenbackend.c
359+++ b/libebl/eblopenbackend.c
360@@ -32,7 +32,7 @@
361
362 #include <assert.h>
363 #include <dlfcn.h>
364-#include <error.h>
365+#include <err.h>
366 #include <libelfP.h>
367 #include <dwarf.h>
368 #include <stdlib.h>
369diff --git a/libelf/elf.h b/libelf/elf.h
370index 5cf2b93..990b3af 100644
371--- a/libelf/elf.h
372+++ b/libelf/elf.h
373@@ -21,7 +21,9 @@
374
375 #include <features.h>
376
377-__BEGIN_DECLS
378+#ifdef __cplusplus
379+extern "C" {
380+#endif
381
382 /* Standard ELF types. */
383
384@@ -3705,6 +3707,8 @@ enum
385 #define R_BPF_NONE 0 /* No reloc */
386 #define R_BPF_MAP_FD 1 /* Map fd to pointer */
387
388-__END_DECLS
389+#ifdef __cplusplus
390+}
391+#endif
392
393 #endif /* elf.h */
394diff --git a/libelf/libelf.h b/libelf/libelf.h
395index 547c0f5..dd78799 100644
396--- a/libelf/libelf.h
397+++ b/libelf/libelf.h
398@@ -29,6 +29,7 @@
399 #ifndef _LIBELF_H
400 #define _LIBELF_H 1
401
402+#include <fcntl.h>
403 #include <stdint.h>
404 #include <sys/types.h>
405
406diff --git a/libelf/libelfP.h b/libelf/libelfP.h
407index 7ee6625..5840899 100644
408--- a/libelf/libelfP.h
409+++ b/libelf/libelfP.h
410@@ -32,6 +32,7 @@
411
412 #include <ar.h>
413 #include <gelf.h>
414+#include <libelf.h>
415
416 #include <errno.h>
417 #include <stdbool.h>
418diff --git a/src/addr2line.c b/src/addr2line.c
419index ba414a7..04b7116 100644
420--- a/src/addr2line.c
421+++ b/src/addr2line.c
422@@ -23,7 +23,7 @@
423 #include <argp.h>
424 #include <assert.h>
425 #include <errno.h>
426-#include <error.h>
427+#include <err.h>
428 #include <fcntl.h>
429 #include <inttypes.h>
430 #include <libdwfl.h>
431diff --git a/src/ar.c b/src/ar.c
432index ec32cee..4efd729 100644
433--- a/src/ar.c
434+++ b/src/ar.c
435@@ -22,7 +22,7 @@
436
437 #include <argp.h>
438 #include <assert.h>
439-#include <error.h>
440+#include <err.h>
441 #include <fcntl.h>
442 #include <gelf.h>
443 #include <libintl.h>
444diff --git a/src/arlib.c b/src/arlib.c
445index e0839aa..1143658 100644
446--- a/src/arlib.c
447+++ b/src/arlib.c
448@@ -21,7 +21,7 @@
449 #endif
450
451 #include <assert.h>
452-#include <error.h>
453+#include <err.h>
454 #include <gelf.h>
455 #include <inttypes.h>
456 #include <libintl.h>
457diff --git a/src/arlib2.c b/src/arlib2.c
458index 553fc57..46443d0 100644
459--- a/src/arlib2.c
460+++ b/src/arlib2.c
461@@ -20,7 +20,7 @@
462 # include <config.h>
463 #endif
464
465-#include <error.h>
466+#include <err.h>
467 #include <libintl.h>
468 #include <limits.h>
469 #include <string.h>
470diff --git a/src/elfcmp.c b/src/elfcmp.c
471index 5046420..cff183f 100644
472--- a/src/elfcmp.c
473+++ b/src/elfcmp.c
474@@ -23,7 +23,7 @@
475 #include <argp.h>
476 #include <assert.h>
477 #include <errno.h>
478-#include <error.h>
479+#include <err.h>
480 #include <fcntl.h>
481 #include <locale.h>
482 #include <libintl.h>
483diff --git a/src/elflint.c b/src/elflint.c
484index 51e53c2..da0b0dc 100644
485--- a/src/elflint.c
486+++ b/src/elflint.c
487@@ -24,7 +24,7 @@
488 #include <assert.h>
489 #include <byteswap.h>
490 #include <endian.h>
491-#include <error.h>
492+#include <err.h>
493 #include <fcntl.h>
494 #include <gelf.h>
495 #include <inttypes.h>
496diff --git a/src/findtextrel.c b/src/findtextrel.c
497index 8f1e239..71463af 100644
498--- a/src/findtextrel.c
499+++ b/src/findtextrel.c
500@@ -23,7 +23,7 @@
501 #include <argp.h>
502 #include <assert.h>
503 #include <errno.h>
504-#include <error.h>
505+#include <err.h>
506 #include <fcntl.h>
507 #include <gelf.h>
508 #include <libdw.h>
509diff --git a/src/nm.c b/src/nm.c
510index 969c6d3..3113c04 100644
511--- a/src/nm.c
512+++ b/src/nm.c
513@@ -26,7 +26,7 @@
514 #include <ctype.h>
515 #include <dwarf.h>
516 #include <errno.h>
517-#include <error.h>
518+#include <err.h>
519 #include <fcntl.h>
520 #include <gelf.h>
521 #include <inttypes.h>
522diff --git a/src/objdump.c b/src/objdump.c
523index 860cfac..61e67bf 100644
524--- a/src/objdump.c
525+++ b/src/objdump.c
526@@ -21,7 +21,7 @@
527 #endif
528
529 #include <argp.h>
530-#include <error.h>
531+#include <err.h>
532 #include <fcntl.h>
533 #include <inttypes.h>
534 #include <libintl.h>
535diff --git a/src/ranlib.c b/src/ranlib.c
536index cc0ee23..ae851e4 100644
537--- a/src/ranlib.c
538+++ b/src/ranlib.c
539@@ -24,7 +24,7 @@
540 #include <argp.h>
541 #include <assert.h>
542 #include <errno.h>
543-#include <error.h>
544+#include <err.h>
545 #include <fcntl.h>
546 #include <gelf.h>
547 #include <libintl.h>
548diff --git a/src/readelf.c b/src/readelf.c
549index 346eccd..c831aa8 100644
550--- a/src/readelf.c
551+++ b/src/readelf.c
552@@ -25,7 +25,7 @@
553 #include <ctype.h>
554 #include <dwarf.h>
555 #include <errno.h>
556-#include <error.h>
557+#include <err.h>
558 #include <fcntl.h>
559 #include <gelf.h>
560 #include <inttypes.h>
561diff --git a/src/size.c b/src/size.c
562index ad8dbcb..fd83be0 100644
563--- a/src/size.c
564+++ b/src/size.c
565@@ -21,7 +21,7 @@
566 #endif
567
568 #include <argp.h>
569-#include <error.h>
570+#include <err.h>
571 #include <fcntl.h>
572 #include <gelf.h>
573 #include <inttypes.h>
574diff --git a/src/stack.c b/src/stack.c
575index 6f2ff69..6da0243 100644
576--- a/src/stack.c
577+++ b/src/stack.c
578@@ -18,7 +18,7 @@
579 #include <config.h>
580 #include <assert.h>
581 #include <argp.h>
582-#include <error.h>
583+#include <err.h>
584 #include <stdlib.h>
585 #include <inttypes.h>
586 #include <stdio.h>
587diff --git a/src/strings.c b/src/strings.c
588index d214356..76cb26b 100644
589--- a/src/strings.c
590+++ b/src/strings.c
591@@ -25,7 +25,7 @@
592 #include <ctype.h>
593 #include <endian.h>
594 #include <errno.h>
595-#include <error.h>
596+#include <err.h>
597 #include <fcntl.h>
598 #include <gelf.h>
599 #include <inttypes.h>
600diff --git a/src/strip.c b/src/strip.c
601index c7830ec..0d7f148 100644
602--- a/src/strip.c
603+++ b/src/strip.c
604@@ -24,7 +24,7 @@
605 #include <assert.h>
606 #include <byteswap.h>
607 #include <endian.h>
608-#include <error.h>
609+#include <err.h>
610 #include <fcntl.h>
611 #include <fnmatch.h>
612 #include <gelf.h>
613diff --git a/src/unstrip.c b/src/unstrip.c
614index 5074909..3d4f952 100644
615--- a/src/unstrip.c
616+++ b/src/unstrip.c
617@@ -31,7 +31,7 @@
618 #include <argp.h>
619 #include <assert.h>
620 #include <errno.h>
621-#include <error.h>
622+#include <err.h>
623 #include <fcntl.h>
624 #include <fnmatch.h>
625 #include <libintl.h>
626diff --git a/tests/addrscopes.c b/tests/addrscopes.c
627index 791569f..54f4311 100644
628--- a/tests/addrscopes.c
629+++ b/tests/addrscopes.c
630@@ -25,7 +25,7 @@
631 #include <stdio_ext.h>
632 #include <locale.h>
633 #include <stdlib.h>
634-#include <error.h>
635+#include <err.h>
636 #include <string.h>
637
638
639diff --git a/tests/allregs.c b/tests/allregs.c
640index 286f7e3..c9de089 100644
641--- a/tests/allregs.c
642+++ b/tests/allregs.c
643@@ -21,7 +21,7 @@
644 #include <stdio.h>
645 #include <stdlib.h>
646 #include <string.h>
647-#include <error.h>
648+#include <err.h>
649 #include <locale.h>
650 #include <argp.h>
651 #include <assert.h>
652diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
653index a387d8f..955c27d 100644
654--- a/tests/backtrace-data.c
655+++ b/tests/backtrace-data.c
656@@ -27,7 +27,7 @@
657 #include <dirent.h>
658 #include <stdlib.h>
659 #include <errno.h>
660-#include <error.h>
661+#include <err.h>
662 #include <unistd.h>
663 #include <dwarf.h>
664 #if defined(__x86_64__) && defined(__linux__)
665diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
666index 2dc8a9a..24ca7fb 100644
667--- a/tests/backtrace-dwarf.c
668+++ b/tests/backtrace-dwarf.c
669@@ -22,7 +22,7 @@
670 #include <stdio_ext.h>
671 #include <locale.h>
672 #include <errno.h>
673-#include <error.h>
674+#include <err.h>
675 #include <unistd.h>
676 #include <sys/types.h>
677 #include <sys/wait.h>
678diff --git a/tests/backtrace.c b/tests/backtrace.c
679index 21abe8a..d733248 100644
680--- a/tests/backtrace.c
681+++ b/tests/backtrace.c
682@@ -24,7 +24,7 @@
683 #include <dirent.h>
684 #include <stdlib.h>
685 #include <errno.h>
686-#include <error.h>
687+#include <err.h>
688 #include <unistd.h>
689 #include <dwarf.h>
690 #ifdef __linux__
691diff --git a/tests/buildid.c b/tests/buildid.c
692index 87c1877..2953e6b 100644
693--- a/tests/buildid.c
694+++ b/tests/buildid.c
695@@ -23,7 +23,7 @@
696 #include ELFUTILS_HEADER(elf)
697 #include ELFUTILS_HEADER(dwelf)
698 #include <stdio.h>
699-#include <error.h>
700+#include <err.h>
701 #include <string.h>
702 #include <stdlib.h>
703 #include <sys/types.h>
704diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
705index 6d97d50..ee7e559 100644
706--- a/tests/debugaltlink.c
707+++ b/tests/debugaltlink.c
708@@ -23,7 +23,7 @@
709 #include ELFUTILS_HEADER(dw)
710 #include ELFUTILS_HEADER(dwelf)
711 #include <stdio.h>
712-#include <error.h>
713+#include <err.h>
714 #include <string.h>
715 #include <stdlib.h>
716 #include <sys/types.h>
717diff --git a/tests/debuglink.c b/tests/debuglink.c
718index 935d102..741cb81 100644
719--- a/tests/debuglink.c
720+++ b/tests/debuglink.c
721@@ -21,7 +21,7 @@
722 #include <errno.h>
723 #include ELFUTILS_HEADER(dwelf)
724 #include <stdio.h>
725-#include <error.h>
726+#include <err.h>
727 #include <string.h>
728 #include <stdlib.h>
729 #include <sys/types.h>
730diff --git a/tests/deleted.c b/tests/deleted.c
731index 6be35bc..0190711 100644
732--- a/tests/deleted.c
733+++ b/tests/deleted.c
734@@ -21,7 +21,7 @@
735 #include <unistd.h>
736 #include <assert.h>
737 #include <stdio.h>
738-#include <error.h>
739+#include <err.h>
740 #include <errno.h>
741 #ifdef __linux__
742 #include <sys/prctl.h>
743diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
744index 21e470a..1ea1e3b 100644
745--- a/tests/dwfl-addr-sect.c
746+++ b/tests/dwfl-addr-sect.c
747@@ -23,7 +23,7 @@
748 #include <stdio_ext.h>
749 #include <stdlib.h>
750 #include <string.h>
751-#include <error.h>
752+#include <err.h>
753 #include <locale.h>
754 #include <argp.h>
755 #include ELFUTILS_HEADER(dwfl)
756diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
757index aa8030e..02c8bef 100644
758--- a/tests/dwfl-bug-addr-overflow.c
759+++ b/tests/dwfl-bug-addr-overflow.c
760@@ -20,7 +20,7 @@
761 #include <inttypes.h>
762 #include <stdio.h>
763 #include <stdio_ext.h>
764-#include <error.h>
765+#include <err.h>
766 #include <locale.h>
767 #include ELFUTILS_HEADER(dwfl)
768
769diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
770index 689cdd7..5973da3 100644
771--- a/tests/dwfl-bug-fd-leak.c
772+++ b/tests/dwfl-bug-fd-leak.c
773@@ -24,7 +24,7 @@
774 #include <dirent.h>
775 #include <stdlib.h>
776 #include <errno.h>
777-#include <error.h>
778+#include <err.h>
779 #include <unistd.h>
780 #include <dwarf.h>
781
782diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
783index 1ee989f..fd62e65 100644
784--- a/tests/dwfl-bug-getmodules.c
785+++ b/tests/dwfl-bug-getmodules.c
786@@ -18,7 +18,7 @@
787 #include <config.h>
788 #include ELFUTILS_HEADER(dwfl)
789
790-#include <error.h>
791+#include <err.h>
792
793 static const Dwfl_Callbacks callbacks =
794 {
795diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
796index a4e97d3..f471587 100644
797--- a/tests/dwfl-report-elf-align.c
798+++ b/tests/dwfl-report-elf-align.c
799@@ -20,7 +20,7 @@
800 #include <inttypes.h>
801 #include <stdio.h>
802 #include <stdio_ext.h>
803-#include <error.h>
804+#include <err.h>
805 #include <locale.h>
806 #include <string.h>
807 #include <stdlib.h>
808diff --git a/tests/dwfllines.c b/tests/dwfllines.c
809index 90379dd..cbdf6c4 100644
810--- a/tests/dwfllines.c
811+++ b/tests/dwfllines.c
812@@ -27,7 +27,7 @@
813 #include <stdio.h>
814 #include <stdlib.h>
815 #include <string.h>
816-#include <error.h>
817+#include <err.h>
818
819 int
820 main (int argc, char *argv[])
821diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
822index 0027f96..e68d3bc 100644
823--- a/tests/dwflmodtest.c
824+++ b/tests/dwflmodtest.c
825@@ -23,7 +23,7 @@
826 #include <stdio_ext.h>
827 #include <stdlib.h>
828 #include <string.h>
829-#include <error.h>
830+#include <err.h>
831 #include <locale.h>
832 #include <argp.h>
833 #include ELFUTILS_HEADER(dwfl)
834diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
835index 49ac334..cf07830 100644
836--- a/tests/dwflsyms.c
837+++ b/tests/dwflsyms.c
838@@ -25,7 +25,7 @@
839 #include <stdio.h>
840 #include <stdio_ext.h>
841 #include <stdlib.h>
842-#include <error.h>
843+#include <err.h>
844 #include <string.h>
845
846 static const char *
847diff --git a/tests/early-offscn.c b/tests/early-offscn.c
848index 924cb9e..6f60d5a 100644
849--- a/tests/early-offscn.c
850+++ b/tests/early-offscn.c
851@@ -19,7 +19,7 @@
852 #endif
853
854 #include <errno.h>
855-#include <error.h>
856+#include <err.h>
857 #include <fcntl.h>
858 #include <gelf.h>
859 #include <stdio.h>
860diff --git a/tests/ecp.c b/tests/ecp.c
861index 38a6859..743cea5 100644
862--- a/tests/ecp.c
863+++ b/tests/ecp.c
864@@ -20,7 +20,7 @@
865 #endif
866
867 #include <errno.h>
868-#include <error.h>
869+#include <err.h>
870 #include <fcntl.h>
871 #include <gelf.h>
872 #include <stdlib.h>
873diff --git a/tests/find-prologues.c b/tests/find-prologues.c
874index ba8ae37..76f5f04 100644
875--- a/tests/find-prologues.c
876+++ b/tests/find-prologues.c
877@@ -25,7 +25,7 @@
878 #include <stdio_ext.h>
879 #include <locale.h>
880 #include <stdlib.h>
881-#include <error.h>
882+#include <err.h>
883 #include <string.h>
884 #include <fnmatch.h>
885
886diff --git a/tests/funcretval.c b/tests/funcretval.c
887index 8d19d11..c8aaa93 100644
888--- a/tests/funcretval.c
889+++ b/tests/funcretval.c
890@@ -25,7 +25,7 @@
891 #include <stdio_ext.h>
892 #include <locale.h>
893 #include <stdlib.h>
894-#include <error.h>
895+#include <err.h>
896 #include <string.h>
897 #include <fnmatch.h>
898
899diff --git a/tests/funcscopes.c b/tests/funcscopes.c
900index 9c90185..dbccb89 100644
901--- a/tests/funcscopes.c
902+++ b/tests/funcscopes.c
903@@ -25,7 +25,7 @@
904 #include <stdio_ext.h>
905 #include <locale.h>
906 #include <stdlib.h>
907-#include <error.h>
908+#include <err.h>
909 #include <string.h>
910 #include <fnmatch.h>
911
912diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
913index 055aede..9c394dd 100644
914--- a/tests/getsrc_die.c
915+++ b/tests/getsrc_die.c
916@@ -19,7 +19,7 @@
917 #endif
918
919 #include <errno.h>
920-#include <error.h>
921+#include <err.h>
922 #include <fcntl.h>
923 #include <inttypes.h>
924 #include <libelf.h>
925diff --git a/tests/line2addr.c b/tests/line2addr.c
926index e0d65d3..9bf0023 100644
927--- a/tests/line2addr.c
928+++ b/tests/line2addr.c
929@@ -26,7 +26,7 @@
930 #include <locale.h>
931 #include <stdlib.h>
932 #include <string.h>
933-#include <error.h>
934+#include <err.h>
935
936
937 static void
938diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
939index d0f4302..8da4fbd 100644
940--- a/tests/low_high_pc.c
941+++ b/tests/low_high_pc.c
942@@ -25,7 +25,7 @@
943 #include <stdio_ext.h>
944 #include <locale.h>
945 #include <stdlib.h>
946-#include <error.h>
947+#include <err.h>
948 #include <string.h>
949 #include <fnmatch.h>
950
951diff --git a/tests/md5-sha1-test.c b/tests/md5-sha1-test.c
952index d50355e..3c41f40 100644
953--- a/tests/md5-sha1-test.c
954+++ b/tests/md5-sha1-test.c
955@@ -19,7 +19,7 @@
956 #endif
957
958 #include <string.h>
959-#include <error.h>
960+#include <err.h>
961
962 #include "md5.h"
963 #include "sha1.h"
964diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
965index 6f027df..1ce5e6e 100644
966--- a/tests/rdwrmmap.c
967+++ b/tests/rdwrmmap.c
968@@ -19,7 +19,7 @@
969 #endif
970
971 #include <errno.h>
972-#include <error.h>
973+#include <err.h>
974 #include <stdio.h>
975 #include <fcntl.h>
976 #include <unistd.h>
977diff --git a/tests/saridx.c b/tests/saridx.c
978index 8a450d8..b387801 100644
979--- a/tests/saridx.c
980+++ b/tests/saridx.c
981@@ -17,7 +17,7 @@
982
983 #include <config.h>
984
985-#include <error.h>
986+#include <err.h>
987 #include <fcntl.h>
988 #include <gelf.h>
989 #include <stdio.h>
990diff --git a/tests/sectiondump.c b/tests/sectiondump.c
991index 3033fed..8e888db 100644
992--- a/tests/sectiondump.c
993+++ b/tests/sectiondump.c
994@@ -18,7 +18,7 @@
995 #include <config.h>
996
997 #include <errno.h>
998-#include <error.h>
999+#include <err.h>
1000 #include <fcntl.h>
1001 #include <gelf.h>
1002 #include <inttypes.h>
1003diff --git a/tests/varlocs.c b/tests/varlocs.c
1004index c3fba89..e043ea2 100644
1005--- a/tests/varlocs.c
1006+++ b/tests/varlocs.c
1007@@ -25,7 +25,7 @@
1008 #include <dwarf.h>
1009 #include <stdio.h>
1010 #include <stdlib.h>
1011-#include <error.h>
1012+#include <err.h>
1013 #include <string.h>
1014 #include <sys/types.h>
1015 #include <sys/stat.h>
1016diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
1017index b876c10..afb2823 100644
1018--- a/tests/vdsosyms.c
1019+++ b/tests/vdsosyms.c
1020@@ -18,7 +18,7 @@
1021 #include <config.h>
1022 #include <assert.h>
1023 #include <errno.h>
1024-#include <error.h>
1025+#include <err.h>
1026 #include <inttypes.h>
1027 #include <stdio.h>
1028 #include <string.h>
1029--
10301.8.3.1
1031
diff --git a/meta/recipes-devtools/elfutils/files/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch b/meta/recipes-devtools/elfutils/files/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch
new file mode 100644
index 0000000000..e0291b4cf3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/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/files/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch b/meta/recipes-devtools/elfutils/files/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/files/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/files/debian/0003-Add-mips-n64-relocation-format-hack.patch b/meta/recipes-devtools/elfutils/files/debian/0003-Add-mips-n64-relocation-format-hack.patch
new file mode 100644
index 0000000000..2a5f8628d9
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/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/files/debian/arm_backend.diff b/meta/recipes-devtools/elfutils/files/debian/arm_backend.diff
new file mode 100644
index 0000000000..50f4b059e3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/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/files/debian/fallthrough.patch b/meta/recipes-devtools/elfutils/files/debian/fallthrough.patch
new file mode 100644
index 0000000000..b2623f9d2e
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/debian/fallthrough.patch
@@ -0,0 +1,36 @@
1GCC7 adds -Wimplicit-fallthrough to warn when a switch case falls through,
2however this causes warnings (which are promoted to errors) with the elfutils
3patches from Debian for mips and parisc, which use fallthrough's by design.
4
5Explicitly mark the intentional fallthrough switch cases with a comment to
6disable the warnings where the fallthrough behaviour is desired.
7
8Upstream-Status: Pending [debian]
9Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
10
11Index: elfutils-0.168/backends/parisc_retval.c
12===================================================================
13--- elfutils-0.168.orig/backends/parisc_retval.c
14+++ elfutils-0.168/backends/parisc_retval.c
15@@ -166,7 +166,7 @@ parisc_return_value_location_ (Dwarf_Die
16 return nloc_intregpair;
17
18 /* Else fall through. */
19- }
20+ } // fallthrough
21
22 case DW_TAG_structure_type:
23 case DW_TAG_class_type:
24Index: elfutils-0.168/backends/mips_retval.c
25===================================================================
26--- elfutils-0.168.orig/backends/mips_retval.c
27+++ elfutils-0.168/backends/mips_retval.c
28@@ -387,7 +387,7 @@ mips_return_value_location (Dwarf_Die *f
29 else
30 return nloc_intregpair;
31 }
32- }
33+ } // fallthrough
34
35 /* Fallthrough to handle large types */
36
diff --git a/meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff b/meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff
new file mode 100644
index 0000000000..44fda7f305
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/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/files/debian/mips_backend.patch b/meta/recipes-devtools/elfutils/files/debian/mips_backend.patch
new file mode 100644
index 0000000000..2e0e54b0c7
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/debian/mips_backend.patch
@@ -0,0 +1,715 @@
1From 46d0d0ca718093486eeeedf1b44134e9e29b56f7 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 16 Aug 2017 09:18:59 +0800
4Subject: [PATCH] mips backends
5
6Upstream-Status: Backport [from debian]
7
8Rebase to 0.170
9Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
10---
11 backends/Makefile.am | 8 +-
12 backends/mips_init.c | 59 +++++++++
13 backends/mips_regs.c | 104 ++++++++++++++++
14 backends/mips_reloc.def | 79 ++++++++++++
15 backends/mips_retval.c | 321 ++++++++++++++++++++++++++++++++++++++++++++++++
16 backends/mips_symbol.c | 52 ++++++++
17 libebl/eblopenbackend.c | 2 +
18 7 files changed, 623 insertions(+), 2 deletions(-)
19 create mode 100644 backends/mips_init.c
20 create mode 100644 backends/mips_regs.c
21 create mode 100644 backends/mips_reloc.def
22 create mode 100644 backends/mips_retval.c
23 create mode 100644 backends/mips_symbol.c
24
25diff --git a/backends/Makefile.am b/backends/Makefile.am
26index 7f1f5d4..91baf6e 100644
27--- a/backends/Makefile.am
28+++ b/backends/Makefile.am
29@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
30
31
32 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
33- tilegx m68k bpf parisc
34+ tilegx m68k bpf parisc mips
35 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
36 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
37 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
38 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
39- libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a
40+ libebl_m68k_pic.a libebl_bpf_pic.a libebl_parisc_pic.a libebl_mips_pic.a
41 noinst_LIBRARIES = $(libebl_pic)
42 noinst_DATA = $(libebl_pic:_pic.a=.so)
43
44@@ -128,6 +128,10 @@ parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
45 libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
46 am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
47
48+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
49+libebl_mips_pic_a_SOURCES = $(mips_SRCS)
50+am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
51+
52 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libeu)
53 @rm -f $(@:.so=.map)
54 $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
55diff --git a/backends/mips_init.c b/backends/mips_init.c
56new file mode 100644
57index 0000000..975c04e
58--- /dev/null
59+++ b/backends/mips_init.c
60@@ -0,0 +1,59 @@
61+/* Initialization of mips specific backend library.
62+ Copyright (C) 2006 Red Hat, Inc.
63+ This file is part of Red Hat elfutils.
64+
65+ Red Hat elfutils is free software; you can redistribute it and/or modify
66+ it under the terms of the GNU General Public License as published by the
67+ Free Software Foundation; version 2 of the License.
68+
69+ Red Hat elfutils is distributed in the hope that it will be useful, but
70+ WITHOUT ANY WARRANTY; without even the implied warranty of
71+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72+ General Public License for more details.
73+
74+ You should have received a copy of the GNU General Public License along
75+ with Red Hat elfutils; if not, write to the Free Software Foundation,
76+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
77+
78+ Red Hat elfutils is an included package of the Open Invention Network.
79+ An included package of the Open Invention Network is a package for which
80+ Open Invention Network licensees cross-license their patents. No patent
81+ license is granted, either expressly or impliedly, by designation as an
82+ included package. Should you wish to participate in the Open Invention
83+ Network licensing program, please visit www.openinventionnetwork.com
84+ <http://www.openinventionnetwork.com>. */
85+
86+#ifdef HAVE_CONFIG_H
87+# include <config.h>
88+#endif
89+
90+#define BACKEND mips_
91+#define RELOC_PREFIX R_MIPS_
92+#include "libebl_CPU.h"
93+
94+/* This defines the common reloc hooks based on mips_reloc.def. */
95+#include "common-reloc.c"
96+
97+const char *
98+mips_init (Elf *elf __attribute__ ((unused)),
99+ GElf_Half machine __attribute__ ((unused)),
100+ Ebl *eh,
101+ size_t ehlen)
102+{
103+ /* Check whether the Elf_BH object has a sufficent size. */
104+ if (ehlen < sizeof (Ebl))
105+ return NULL;
106+
107+ /* We handle it. */
108+ if (machine == EM_MIPS)
109+ eh->name = "MIPS R3000 big-endian";
110+ else if (machine == EM_MIPS_RS3_LE)
111+ eh->name = "MIPS R3000 little-endian";
112+
113+ mips_init_reloc (eh);
114+ HOOK (eh, reloc_simple_type);
115+ HOOK (eh, return_value_location);
116+ HOOK (eh, register_info);
117+
118+ return MODVERSION;
119+}
120diff --git a/backends/mips_regs.c b/backends/mips_regs.c
121new file mode 100644
122index 0000000..44f86cb
123--- /dev/null
124+++ b/backends/mips_regs.c
125@@ -0,0 +1,104 @@
126+/* Register names and numbers for MIPS DWARF.
127+ Copyright (C) 2006 Red Hat, Inc.
128+ This file is part of Red Hat elfutils.
129+
130+ Red Hat elfutils is free software; you can redistribute it and/or modify
131+ it under the terms of the GNU General Public License as published by the
132+ Free Software Foundation; version 2 of the License.
133+
134+ Red Hat elfutils is distributed in the hope that it will be useful, but
135+ WITHOUT ANY WARRANTY; without even the implied warranty of
136+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
137+ General Public License for more details.
138+
139+ You should have received a copy of the GNU General Public License along
140+ with Red Hat elfutils; if not, write to the Free Software Foundation,
141+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
142+
143+ Red Hat elfutils is an included package of the Open Invention Network.
144+ An included package of the Open Invention Network is a package for which
145+ Open Invention Network licensees cross-license their patents. No patent
146+ license is granted, either expressly or impliedly, by designation as an
147+ included package. Should you wish to participate in the Open Invention
148+ Network licensing program, please visit www.openinventionnetwork.com
149+ <http://www.openinventionnetwork.com>. */
150+
151+#ifdef HAVE_CONFIG_H
152+# include <config.h>
153+#endif
154+
155+#include <string.h>
156+#include <dwarf.h>
157+
158+#define BACKEND mips_
159+#include "libebl_CPU.h"
160+
161+ssize_t
162+mips_register_info (Ebl *ebl __attribute__((unused)),
163+ int regno, char *name, size_t namelen,
164+ const char **prefix, const char **setname,
165+ int *bits, int *type)
166+{
167+ if (name == NULL)
168+ return 66;
169+
170+ if (regno < 0 || regno > 65 || namelen < 4)
171+ return -1;
172+
173+ *prefix = "$";
174+
175+ if (regno < 32)
176+ {
177+ *setname = "integer";
178+ *type = DW_ATE_signed;
179+ *bits = 32;
180+ if (regno < 32 + 10)
181+ {
182+ name[0] = regno + '0';
183+ namelen = 1;
184+ }
185+ else
186+ {
187+ name[0] = (regno / 10) + '0';
188+ name[1] = (regno % 10) + '0';
189+ namelen = 2;
190+ }
191+ }
192+ else if (regno < 64)
193+ {
194+ *setname = "FPU";
195+ *type = DW_ATE_float;
196+ *bits = 32;
197+ name[0] = 'f';
198+ if (regno < 32 + 10)
199+ {
200+ name[1] = (regno - 32) + '0';
201+ namelen = 2;
202+ }
203+ else
204+ {
205+ name[1] = (regno - 32) / 10 + '0';
206+ name[2] = (regno - 32) % 10 + '0';
207+ namelen = 3;
208+ }
209+ }
210+ else if (regno == 64)
211+ {
212+ *type = DW_ATE_signed;
213+ *bits = 32;
214+ name[0] = 'h';
215+ name[1] = 'i';
216+ namelen = 2;
217+ }
218+ else
219+ {
220+ *type = DW_ATE_signed;
221+ *bits = 32;
222+ name[0] = 'l';
223+ name[1] = 'o';
224+ namelen = 2;
225+ }
226+
227+ name[namelen++] = '\0';
228+ return namelen;
229+}
230diff --git a/backends/mips_reloc.def b/backends/mips_reloc.def
231new file mode 100644
232index 0000000..4579970
233--- /dev/null
234+++ b/backends/mips_reloc.def
235@@ -0,0 +1,79 @@
236+/* List the relocation types for mips. -*- C -*-
237+ Copyright (C) 2006 Red Hat, Inc.
238+ This file is part of Red Hat elfutils.
239+
240+ Red Hat elfutils is free software; you can redistribute it and/or modify
241+ it under the terms of the GNU General Public License as published by the
242+ Free Software Foundation; version 2 of the License.
243+
244+ Red Hat elfutils is distributed in the hope that it will be useful, but
245+ WITHOUT ANY WARRANTY; without even the implied warranty of
246+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
247+ General Public License for more details.
248+
249+ You should have received a copy of the GNU General Public License along
250+ with Red Hat elfutils; if not, write to the Free Software Foundation,
251+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
252+
253+ Red Hat elfutils is an included package of the Open Invention Network.
254+ An included package of the Open Invention Network is a package for which
255+ Open Invention Network licensees cross-license their patents. No patent
256+ license is granted, either expressly or impliedly, by designation as an
257+ included package. Should you wish to participate in the Open Invention
258+ Network licensing program, please visit www.openinventionnetwork.com
259+ <http://www.openinventionnetwork.com>. */
260+
261+/* NAME, REL|EXEC|DYN */
262+
263+RELOC_TYPE (NONE, 0)
264+RELOC_TYPE (16, 0)
265+RELOC_TYPE (32, 0)
266+RELOC_TYPE (REL32, 0)
267+RELOC_TYPE (26, 0)
268+RELOC_TYPE (HI16, 0)
269+RELOC_TYPE (LO16, 0)
270+RELOC_TYPE (GPREL16, 0)
271+RELOC_TYPE (LITERAL, 0)
272+RELOC_TYPE (GOT16, 0)
273+RELOC_TYPE (PC16, 0)
274+RELOC_TYPE (CALL16, 0)
275+RELOC_TYPE (GPREL32, 0)
276+
277+RELOC_TYPE (SHIFT5, 0)
278+RELOC_TYPE (SHIFT6, 0)
279+RELOC_TYPE (64, 0)
280+RELOC_TYPE (GOT_DISP, 0)
281+RELOC_TYPE (GOT_PAGE, 0)
282+RELOC_TYPE (GOT_OFST, 0)
283+RELOC_TYPE (GOT_HI16, 0)
284+RELOC_TYPE (GOT_LO16, 0)
285+RELOC_TYPE (SUB, 0)
286+RELOC_TYPE (INSERT_A, 0)
287+RELOC_TYPE (INSERT_B, 0)
288+RELOC_TYPE (DELETE, 0)
289+RELOC_TYPE (HIGHER, 0)
290+RELOC_TYPE (HIGHEST, 0)
291+RELOC_TYPE (CALL_HI16, 0)
292+RELOC_TYPE (CALL_LO16, 0)
293+RELOC_TYPE (SCN_DISP, 0)
294+RELOC_TYPE (REL16, 0)
295+RELOC_TYPE (ADD_IMMEDIATE, 0)
296+RELOC_TYPE (PJUMP, 0)
297+RELOC_TYPE (RELGOT, 0)
298+RELOC_TYPE (JALR, 0)
299+RELOC_TYPE (TLS_DTPMOD32, 0)
300+RELOC_TYPE (TLS_DTPREL32, 0)
301+RELOC_TYPE (TLS_DTPMOD64, 0)
302+RELOC_TYPE (TLS_DTPREL64, 0)
303+RELOC_TYPE (TLS_GD, 0)
304+RELOC_TYPE (TLS_LDM, 0)
305+RELOC_TYPE (TLS_DTPREL_HI16, 0)
306+RELOC_TYPE (TLS_DTPREL_LO16, 0)
307+RELOC_TYPE (TLS_GOTTPREL, 0)
308+RELOC_TYPE (TLS_TPREL32, 0)
309+RELOC_TYPE (TLS_TPREL64, 0)
310+RELOC_TYPE (TLS_TPREL_HI16, 0)
311+RELOC_TYPE (TLS_TPREL_LO16, 0)
312+
313+#define NO_COPY_RELOC 1
314+#define NO_RELATIVE_RELOC 1
315diff --git a/backends/mips_retval.c b/backends/mips_retval.c
316new file mode 100644
317index 0000000..656cd1f
318--- /dev/null
319+++ b/backends/mips_retval.c
320@@ -0,0 +1,321 @@
321+/* Function return value location for Linux/mips ABI.
322+ Copyright (C) 2005 Red Hat, Inc.
323+ This file is part of Red Hat elfutils.
324+
325+ Red Hat elfutils is free software; you can redistribute it and/or modify
326+ it under the terms of the GNU General Public License as published by the
327+ Free Software Foundation; version 2 of the License.
328+
329+ Red Hat elfutils is distributed in the hope that it will be useful, but
330+ WITHOUT ANY WARRANTY; without even the implied warranty of
331+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
332+ General Public License for more details.
333+
334+ You should have received a copy of the GNU General Public License along
335+ with Red Hat elfutils; if not, write to the Free Software Foundation,
336+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
337+
338+ Red Hat elfutils is an included package of the Open Invention Network.
339+ An included package of the Open Invention Network is a package for which
340+ Open Invention Network licensees cross-license their patents. No patent
341+ license is granted, either expressly or impliedly, by designation as an
342+ included package. Should you wish to participate in the Open Invention
343+ Network licensing program, please visit www.openinventionnetwork.com
344+ <http://www.openinventionnetwork.com>. */
345+
346+#ifdef HAVE_CONFIG_H
347+# include <config.h>
348+#endif
349+
350+#include <string.h>
351+#include <assert.h>
352+#include <dwarf.h>
353+#include <elf.h>
354+
355+#include "../libebl/libeblP.h"
356+#include "../libdw/libdwP.h"
357+
358+#define BACKEND mips_
359+#include "libebl_CPU.h"
360+
361+/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
362+#define EF_MIPS_ABI 0x0000F000
363+
364+/* The original o32 abi. */
365+#define E_MIPS_ABI_O32 0x00001000
366+
367+/* O32 extended to work on 64 bit architectures */
368+#define E_MIPS_ABI_O64 0x00002000
369+
370+/* EABI in 32 bit mode */
371+#define E_MIPS_ABI_EABI32 0x00003000
372+
373+/* EABI in 64 bit mode */
374+#define E_MIPS_ABI_EABI64 0x00004000
375+
376+/* All the possible MIPS ABIs. */
377+enum mips_abi
378+ {
379+ MIPS_ABI_UNKNOWN = 0,
380+ MIPS_ABI_N32,
381+ MIPS_ABI_O32,
382+ MIPS_ABI_N64,
383+ MIPS_ABI_O64,
384+ MIPS_ABI_EABI32,
385+ MIPS_ABI_EABI64,
386+ MIPS_ABI_LAST
387+ };
388+
389+/* Find the mips ABI of the current file */
390+enum mips_abi find_mips_abi(Elf *elf)
391+{
392+ GElf_Ehdr ehdr_mem;
393+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
394+
395+ if (ehdr == NULL)
396+ return MIPS_ABI_LAST;
397+
398+ GElf_Word elf_flags = ehdr->e_flags;
399+
400+ /* Check elf_flags to see if it specifies the ABI being used. */
401+ switch ((elf_flags & EF_MIPS_ABI))
402+ {
403+ case E_MIPS_ABI_O32:
404+ return MIPS_ABI_O32;
405+ case E_MIPS_ABI_O64:
406+ return MIPS_ABI_O64;
407+ case E_MIPS_ABI_EABI32:
408+ return MIPS_ABI_EABI32;
409+ case E_MIPS_ABI_EABI64:
410+ return MIPS_ABI_EABI64;
411+ default:
412+ if ((elf_flags & EF_MIPS_ABI2))
413+ return MIPS_ABI_N32;
414+ }
415+
416+ /* GCC creates a pseudo-section whose name describes the ABI. */
417+ size_t shstrndx;
418+ if (elf_getshdrstrndx (elf, &shstrndx) < 0)
419+ return MIPS_ABI_LAST;
420+
421+ const char *name;
422+ Elf_Scn *scn = NULL;
423+ while ((scn = elf_nextscn (elf, scn)) != NULL)
424+ {
425+ GElf_Shdr shdr_mem;
426+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
427+ if (shdr == NULL)
428+ return MIPS_ABI_LAST;
429+
430+ name = elf_strptr (elf, shstrndx, shdr->sh_name) ?: "";
431+ if (strncmp (name, ".mdebug.", 8) != 0)
432+ continue;
433+
434+ if (strcmp (name, ".mdebug.abi32") == 0)
435+ return MIPS_ABI_O32;
436+ else if (strcmp (name, ".mdebug.abiN32") == 0)
437+ return MIPS_ABI_N32;
438+ else if (strcmp (name, ".mdebug.abi64") == 0)
439+ return MIPS_ABI_N64;
440+ else if (strcmp (name, ".mdebug.abiO64") == 0)
441+ return MIPS_ABI_O64;
442+ else if (strcmp (name, ".mdebug.eabi32") == 0)
443+ return MIPS_ABI_EABI32;
444+ else if (strcmp (name, ".mdebug.eabi64") == 0)
445+ return MIPS_ABI_EABI64;
446+ else
447+ return MIPS_ABI_UNKNOWN;
448+ }
449+
450+ return MIPS_ABI_UNKNOWN;
451+}
452+
453+unsigned int
454+mips_abi_regsize (enum mips_abi abi)
455+{
456+ switch (abi)
457+ {
458+ case MIPS_ABI_EABI32:
459+ case MIPS_ABI_O32:
460+ return 4;
461+ case MIPS_ABI_N32:
462+ case MIPS_ABI_N64:
463+ case MIPS_ABI_O64:
464+ case MIPS_ABI_EABI64:
465+ return 8;
466+ case MIPS_ABI_UNKNOWN:
467+ case MIPS_ABI_LAST:
468+ default:
469+ return 0;
470+ }
471+}
472+
473+
474+/* $v0 or pair $v0, $v1 */
475+static const Dwarf_Op loc_intreg_o32[] =
476+ {
477+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
478+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
479+ };
480+
481+static const Dwarf_Op loc_intreg[] =
482+ {
483+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 8 },
484+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 8 },
485+ };
486+#define nloc_intreg 1
487+#define nloc_intregpair 4
488+
489+/* $f0 (float), or pair $f0, $f1 (double).
490+ * f2/f3 are used for COMPLEX (= 2 doubles) returns in Fortran */
491+static const Dwarf_Op loc_fpreg_o32[] =
492+ {
493+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
494+ { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
495+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 },
496+ { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 },
497+ };
498+
499+/* $f0, or pair $f0, $f2. */
500+static const Dwarf_Op loc_fpreg[] =
501+ {
502+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 8 },
503+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 },
504+ };
505+#define nloc_fpreg 1
506+#define nloc_fpregpair 4
507+#define nloc_fpregquad 8
508+
509+/* The return value is a structure and is actually stored in stack space
510+ passed in a hidden argument by the caller. But, the compiler
511+ helpfully returns the address of that space in $v0. */
512+static const Dwarf_Op loc_aggregate[] =
513+ {
514+ { .atom = DW_OP_breg2, .number = 0 }
515+ };
516+#define nloc_aggregate 1
517+
518+int
519+mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
520+{
521+ /* First find the ABI used by the elf object */
522+ enum mips_abi abi = find_mips_abi(functypedie->cu->dbg->elf);
523+
524+ /* Something went seriously wrong while trying to figure out the ABI */
525+ if (abi == MIPS_ABI_LAST)
526+ return -1;
527+
528+ /* We couldn't identify the ABI, but the file seems valid */
529+ if (abi == MIPS_ABI_UNKNOWN)
530+ return -2;
531+
532+ /* Can't handle EABI variants */
533+ if ((abi == MIPS_ABI_EABI32) || (abi == MIPS_ABI_EABI64))
534+ return -2;
535+
536+ unsigned int regsize = mips_abi_regsize (abi);
537+ if (!regsize)
538+ return -2;
539+
540+ /* Start with the function's type, and get the DW_AT_type attribute,
541+ which is the type of the return value. */
542+
543+ Dwarf_Attribute attr_mem;
544+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
545+ if (attr == NULL)
546+ /* The function has no return value, like a `void' function in C. */
547+ return 0;
548+
549+ Dwarf_Die die_mem;
550+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
551+ int tag = dwarf_tag (typedie);
552+
553+ /* Follow typedefs and qualifiers to get to the actual type. */
554+ while (tag == DW_TAG_typedef
555+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
556+ || tag == DW_TAG_restrict_type)
557+ {
558+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
559+ typedie = dwarf_formref_die (attr, &die_mem);
560+ tag = dwarf_tag (typedie);
561+ }
562+
563+ switch (tag)
564+ {
565+ case -1:
566+ return -1;
567+
568+ case DW_TAG_subrange_type:
569+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
570+ {
571+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
572+ typedie = dwarf_formref_die (attr, &die_mem);
573+ tag = dwarf_tag (typedie);
574+ }
575+ /* Fall through. */
576+
577+ case DW_TAG_base_type:
578+ case DW_TAG_enumeration_type:
579+ case DW_TAG_pointer_type:
580+ case DW_TAG_ptr_to_member_type:
581+ {
582+ Dwarf_Word size;
583+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
584+ &attr_mem), &size) != 0)
585+ {
586+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
587+ size = regsize;
588+ else
589+ return -1;
590+ }
591+ if (tag == DW_TAG_base_type)
592+ {
593+ Dwarf_Word encoding;
594+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
595+ &attr_mem), &encoding) != 0)
596+ return -1;
597+
598+#define ABI_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc))
599+
600+ if (encoding == DW_ATE_float)
601+ {
602+ *locp = ABI_LOC(loc_fpreg, regsize);
603+ if (size <= regsize)
604+ return nloc_fpreg;
605+
606+ if (size <= 2*regsize)
607+ return nloc_fpregpair;
608+
609+ if (size <= 4*regsize && abi == MIPS_ABI_O32)
610+ return nloc_fpregquad;
611+
612+ goto aggregate;
613+ }
614+ }
615+ *locp = ABI_LOC(loc_intreg, regsize);
616+ if (size <= regsize)
617+ return nloc_intreg;
618+ if (size <= 2*regsize)
619+ return nloc_intregpair;
620+
621+ /* Else fall through. Shouldn't happen though (at least with gcc) */
622+ }
623+
624+ case DW_TAG_structure_type:
625+ case DW_TAG_class_type:
626+ case DW_TAG_union_type:
627+ case DW_TAG_array_type:
628+ aggregate:
629+ /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
630+ if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
631+ return -2;
632+
633+ *locp = loc_aggregate;
634+ return nloc_aggregate;
635+ }
636+
637+ /* XXX We don't have a good way to return specific errors from ebl calls.
638+ This value means we do not understand the type, but it is well-formed
639+ DWARF and might be valid. */
640+ return -2;
641+}
642diff --git a/backends/mips_symbol.c b/backends/mips_symbol.c
643new file mode 100644
644index 0000000..ba465fe
645--- /dev/null
646+++ b/backends/mips_symbol.c
647@@ -0,0 +1,52 @@
648+/* MIPS specific symbolic name handling.
649+ Copyright (C) 2002, 2003, 2005 Red Hat, Inc.
650+ This file is part of Red Hat elfutils.
651+ Written by Jakub Jelinek <jakub@redhat.com>, 2002.
652+
653+ Red Hat elfutils is free software; you can redistribute it and/or modify
654+ it under the terms of the GNU General Public License as published by the
655+ Free Software Foundation; version 2 of the License.
656+
657+ Red Hat elfutils is distributed in the hope that it will be useful, but
658+ WITHOUT ANY WARRANTY; without even the implied warranty of
659+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
660+ General Public License for more details.
661+
662+ You should have received a copy of the GNU General Public License along
663+ with Red Hat elfutils; if not, write to the Free Software Foundation,
664+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
665+
666+ Red Hat elfutils is an included package of the Open Invention Network.
667+ An included package of the Open Invention Network is a package for which
668+ Open Invention Network licensees cross-license their patents. No patent
669+ license is granted, either expressly or impliedly, by designation as an
670+ included package. Should you wish to participate in the Open Invention
671+ Network licensing program, please visit www.openinventionnetwork.com
672+ <http://www.openinventionnetwork.com>. */
673+
674+#ifdef HAVE_CONFIG_H
675+# include <config.h>
676+#endif
677+
678+#include <elf.h>
679+#include <stddef.h>
680+
681+#define BACKEND mips_
682+#include "libebl_CPU.h"
683+
684+/* Check for the simple reloc types. */
685+Elf_Type
686+mips_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
687+{
688+ switch (type)
689+ {
690+ case R_MIPS_16:
691+ return ELF_T_HALF;
692+ case R_MIPS_32:
693+ return ELF_T_WORD;
694+ case R_MIPS_64:
695+ return ELF_T_XWORD;
696+ default:
697+ return ELF_T_NUM;
698+ }
699+}
700diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
701index 1f81477..5371396 100644
702--- a/libebl/eblopenbackend.c
703+++ b/libebl/eblopenbackend.c
704@@ -72,6 +72,8 @@ static const struct
705 { "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
706 { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
707 { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
708+ { "mips", "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
709+ { "mips", "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 },
710
711 { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
712 { "m68k", "elf_m68k", "m68k", 4, EM_68K, ELFCLASS32, ELFDATA2MSB },
713--
7141.8.3.1
715
diff --git a/meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch b/meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch
new file mode 100644
index 0000000000..790930cf35
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/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 {