summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2020-06-26 09:18:20 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-28 08:36:00 +0100
commit22781f1a89de4681f5c2421156b095c024d67de7 (patch)
tree9ab04dee2cb2a3748480338d34a7b07b2ac7842f /meta/recipes-devtools/elfutils
parent658cde8788c2faf9532d332e37a6d98b14b070c5 (diff)
downloadpoky-22781f1a89de4681f5c2421156b095c024d67de7.tar.gz
elfutils: upgrade 0.179 -> 0.180
Drop all the debian patches: they are very invasive, the use case is unclear, and rebasing them is just too hard. Refresh 0002-musl-libs.patch Add a new musl fix: 0015-config-eu.am-do-not-use-Werror.patch Add a reproducibility fix: 0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch (From OE-Core rev: 79c290a0823ee996c69bb02a82dc6ded00fae629) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/elfutils')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils_0.180.bb (renamed from meta/recipes-devtools/elfutils/elfutils_0.179.bb)19
-rw-r--r--meta/recipes-devtools/elfutils/files/0001-musl-obstack-fts.patch11
-rw-r--r--meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch27
-rw-r--r--meta/recipes-devtools/elfutils/files/0002-musl-libs.patch17
-rw-r--r--meta/recipes-devtools/elfutils/files/0003-musl-utils.patch7
-rw-r--r--meta/recipes-devtools/elfutils/files/0004-Fix-error-on-musl.patch7
-rw-r--r--meta/recipes-devtools/elfutils/files/0015-config-eu.am-do-not-use-Werror.patch36
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch34
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/0001-fix-compile-failure-with-debian-patches.patch48
-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.diff624
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/disable_werror.patch20
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff828
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/hurd_path.patch17
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/ignore_strmerge.diff14
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/kfreebsd_path.patch20
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/mips_backend.diff724
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/mips_cfi.patch129
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch31
-rw-r--r--meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff52
21 files changed, 81 insertions, 2984 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.179.bb b/meta/recipes-devtools/elfutils/elfutils_0.180.bb
index 1da95ec1de..9f8bfc24f3 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.179.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.180.bb
@@ -15,33 +15,20 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
15 file://0006-Fix-build-on-aarch64-musl.patch \ 15 file://0006-Fix-build-on-aarch64-musl.patch \
16 file://0001-libasm-may-link-with-libbz2-if-found.patch \ 16 file://0001-libasm-may-link-with-libbz2-if-found.patch \
17 file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \ 17 file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \
18 file://debian/hppa_backend.diff \
19 file://debian/arm_backend.diff \
20 file://debian/mips_backend.diff \
21 file://debian/mips_readelf_w.patch \
22 file://debian/kfreebsd_path.patch \
23 file://debian/0001-Ignore-differences-between-mips-machine-identifiers.patch \
24 file://debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch \
25 file://debian/0003-Add-mips-n64-relocation-format-hack.patch \
26 file://debian/hurd_path.patch \
27 file://debian/ignore_strmerge.diff \
28 file://debian/disable_werror.patch \
29 file://debian/testsuite-ignore-elflint.diff \
30 file://debian/mips_cfi.patch \
31 file://debian/0001-fix-compile-failure-with-debian-patches.patch \
32 file://0001-skip-the-test-when-gcc-not-deployed.patch \ 18 file://0001-skip-the-test-when-gcc-not-deployed.patch \
33 file://0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch \ 19 file://0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch \
34 file://run-ptest \ 20 file://run-ptest \
35 file://ptest.patch \ 21 file://ptest.patch \
22 file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
36 " 23 "
37SRC_URI_append_libc-musl = " \ 24SRC_URI_append_libc-musl = " \
38 file://0001-musl-obstack-fts.patch \ 25 file://0001-musl-obstack-fts.patch \
39 file://0002-musl-libs.patch \ 26 file://0002-musl-libs.patch \
40 file://0003-musl-utils.patch \ 27 file://0003-musl-utils.patch \
41 file://0004-Fix-error-on-musl.patch \ 28 file://0004-Fix-error-on-musl.patch \
29 file://0015-config-eu.am-do-not-use-Werror.patch \
42 " 30 "
43SRC_URI[md5sum] = "8ee56b371b5a7ea081284c44e5164600" 31SRC_URI[sha256sum] = "b827b6e35c59d188ba97d7cf148fa8dc6f5c68eb6c5981888dfdbb758c0b569d"
44SRC_URI[sha256sum] = "25a545566cbacaa37ae6222e58f1c48ea4570f53ba991886e2f5ce96e22a23a2"
45 32
46inherit autotools gettext ptest pkgconfig 33inherit autotools gettext ptest pkgconfig
47 34
diff --git a/meta/recipes-devtools/elfutils/files/0001-musl-obstack-fts.patch b/meta/recipes-devtools/elfutils/files/0001-musl-obstack-fts.patch
index f751a2ecdb..2450b0d6b8 100644
--- a/meta/recipes-devtools/elfutils/files/0001-musl-obstack-fts.patch
+++ b/meta/recipes-devtools/elfutils/files/0001-musl-obstack-fts.patch
@@ -1,7 +1,7 @@
1From 8ccf3d92b8766b53f203df7e01b489604ef851f3 Mon Sep 17 00:00:00 2001 1From 1ec7b2208803e0fbdcbe6c07b849e7dc4d9fa8a2 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 23 Aug 2019 10:17:25 +0800 3Date: Fri, 23 Aug 2019 10:17:25 +0800
4Subject: [PATCH 1/4] musl-obstack-fts 4Subject: [PATCH] musl-obstack-fts
5 5
6Look for libfts and libobstack during configure, these 6Look for libfts and libobstack during configure, these
7libraries are external to libc when using musl, whereas 7libraries are external to libc when using musl, whereas
@@ -20,10 +20,10 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
20 3 files changed, 58 insertions(+), 4 deletions(-) 20 3 files changed, 58 insertions(+), 4 deletions(-)
21 21
22diff --git a/configure.ac b/configure.ac 22diff --git a/configure.ac b/configure.ac
23index cad7b2b..6d4229b 100644 23index e9649c2..03643c8 100644
24--- a/configure.ac 24--- a/configure.ac
25+++ b/configure.ac 25+++ b/configure.ac
26@@ -529,6 +529,60 @@ else 26@@ -538,6 +538,60 @@ else
27 fi 27 fi
28 AC_SUBST([argp_LDADD]) 28 AC_SUBST([argp_LDADD])
29 29
@@ -122,6 +122,3 @@ index 13d9bda..d5a4f7d 100644
122 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) 122 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
123 stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib) 123 stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
124 elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) 124 elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
125--
1262.17.1
127
diff --git a/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch b/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch
new file mode 100644
index 0000000000..481b912387
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch
@@ -0,0 +1,27 @@
1From 1ca86294ee5454592c9ad855e13080509d8a92d3 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 23 Jun 2020 07:49:35 +0000
4Subject: [PATCH] tests/Makefile.am: compile test_nlist with standard CFLAGS
5
6Otherwise, it will contain build paths in it and wont
7be reproducible.
8
9Upstream-Status: Inappropriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 tests/Makefile.am | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/tests/Makefile.am b/tests/Makefile.am
16index 8048b69..d2b28a4 100644
17--- a/tests/Makefile.am
18+++ b/tests/Makefile.am
19@@ -86,7 +86,7 @@ backtrace-child-biarch$(EXEEXT): backtrace-child.c
20 test-nlist$(EXEEXT): test-nlist.c
21 $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
22 $(AM_CPPFLAGS) $(CPPFLAGS) \
23- $(test_nlist_CFLAGS) $(test_nlist_LDADD) -o $@ $<
24+ $(CFLAGS) $(test_nlist_LDADD) -o $@ $<
25
26 TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
27 update1 update2 update3 update4 \
diff --git a/meta/recipes-devtools/elfutils/files/0002-musl-libs.patch b/meta/recipes-devtools/elfutils/files/0002-musl-libs.patch
index cf14683864..d5ec0ec9e5 100644
--- a/meta/recipes-devtools/elfutils/files/0002-musl-libs.patch
+++ b/meta/recipes-devtools/elfutils/files/0002-musl-libs.patch
@@ -1,7 +1,7 @@
1From ea908c7009de5a208383abf4bec4c6b3d9519ca3 Mon Sep 17 00:00:00 2001 1From 9a57efb0f826a70ae360aa55504ee2de656b92b6 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 23 Aug 2019 10:18:47 +0800 3Date: Fri, 23 Aug 2019 10:18:47 +0800
4Subject: [PATCH 2/4] musl-libs 4Subject: [PATCH] musl-libs
5 5
6Collection of fixes needed to compile libelf and other libraries 6Collection of fixes needed to compile libelf and other libraries
7provided by elfutils for musl targets 7provided by elfutils for musl targets
@@ -104,7 +104,7 @@ index 7bcf61c..11dcc8b 100644
104 return elf_errmsg (error & 0xffff); 104 return elf_errmsg (error & 0xffff);
105 case OTHER_ERROR (LIBDW): 105 case OTHER_ERROR (LIBDW):
106diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c 106diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
107index d46ab5a..1c3faee 100644 107index 0434f1e..5afaee8 100644
108--- a/libdwfl/linux-kernel-modules.c 108--- a/libdwfl/linux-kernel-modules.c
109+++ b/libdwfl/linux-kernel-modules.c 109+++ b/libdwfl/linux-kernel-modules.c
110@@ -50,6 +50,7 @@ 110@@ -50,6 +50,7 @@
@@ -116,7 +116,7 @@ index d46ab5a..1c3faee 100644
116 /* If fts.h is included before config.h, its indirect inclusions may not 116 /* If fts.h is included before config.h, its indirect inclusions may not
117 give us the right LFS aliases of these functions, so map them manually. */ 117 give us the right LFS aliases of these functions, so map them manually. */
118diff --git a/libelf/elf.h b/libelf/elf.h 118diff --git a/libelf/elf.h b/libelf/elf.h
119index bed273d..be228e6 100644 119index 197b557..8e5b94c 100644
120--- a/libelf/elf.h 120--- a/libelf/elf.h
121+++ b/libelf/elf.h 121+++ b/libelf/elf.h
122@@ -21,7 +21,9 @@ 122@@ -21,7 +21,9 @@
@@ -130,9 +130,9 @@ index bed273d..be228e6 100644
130 130
131 /* Standard ELF types. */ 131 /* Standard ELF types. */
132 132
133@@ -4029,6 +4031,7 @@ enum 133@@ -4103,6 +4105,7 @@ enum
134 #define R_NDS32_TLS_TPOFF 102 134 #define R_ARC_TLS_LE_S9 0x4a
135 #define R_NDS32_TLS_DESC 119 135 #define R_ARC_TLS_LE_32 0x4b
136 136
137-__END_DECLS 137-__END_DECLS
138- 138-
@@ -140,6 +140,3 @@ index bed273d..be228e6 100644
140+} 140+}
141+#endif 141+#endif
142 #endif /* elf.h */ 142 #endif /* elf.h */
143--
1442.17.1
145
diff --git a/meta/recipes-devtools/elfutils/files/0003-musl-utils.patch b/meta/recipes-devtools/elfutils/files/0003-musl-utils.patch
index 79c9d9ad57..4f28d9d027 100644
--- a/meta/recipes-devtools/elfutils/files/0003-musl-utils.patch
+++ b/meta/recipes-devtools/elfutils/files/0003-musl-utils.patch
@@ -1,7 +1,7 @@
1From 94028b16e56c8eef1aa02dcc4da268a0e471b4ea Mon Sep 17 00:00:00 2001 1From 6923400b777d4ba6f040c4006413bf997326460f Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 23 Aug 2019 10:19:48 +0800 3Date: Fri, 23 Aug 2019 10:19:48 +0800
4Subject: [PATCH 3/4] musl-utils 4Subject: [PATCH] musl-utils
5 5
6Provide missing defines which otherwise are available on glibc system headers 6Provide missing defines which otherwise are available on glibc system headers
7 7
@@ -161,6 +161,3 @@ index 9b8c09a..1fb5063 100644
161 /* Name and version of program. */ 161 /* Name and version of program. */
162 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; 162 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
163 163
164--
1652.17.1
166
diff --git a/meta/recipes-devtools/elfutils/files/0004-Fix-error-on-musl.patch b/meta/recipes-devtools/elfutils/files/0004-Fix-error-on-musl.patch
index 1b2f9ed98b..481e4b38eb 100644
--- a/meta/recipes-devtools/elfutils/files/0004-Fix-error-on-musl.patch
+++ b/meta/recipes-devtools/elfutils/files/0004-Fix-error-on-musl.patch
@@ -1,7 +1,7 @@
1From 7ff8cbecde7455b530fa7894a78d2326799f2556 Mon Sep 17 00:00:00 2001 1From 48b769ab692c8f02c1ae467229fe3404f662098a Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Wed, 1 May 2019 22:15:03 +0100 3Date: Wed, 1 May 2019 22:15:03 +0100
4Subject: [PATCH 4/4] Fix error on musl: 4Subject: [PATCH] Fix error on musl:
5 5
6| ../../elfutils-0.176/tests/elfstrmerge.c: In function 'main': 6| ../../elfutils-0.176/tests/elfstrmerge.c: In function 'main':
7| ../../elfutils-0.176/tests/elfstrmerge.c:370:60: error: 'ALLPERMS' undeclared (first use in this function); did you mean 'EPERM'? 7| ../../elfutils-0.176/tests/elfstrmerge.c:370:60: error: 'ALLPERMS' undeclared (first use in this function); did you mean 'EPERM'?
@@ -34,6 +34,3 @@ index ba0d68d..1d2447f 100644
34 /* The original ELF file. */ 34 /* The original ELF file. */
35 static int fd = -1; 35 static int fd = -1;
36 static Elf *elf = NULL; 36 static Elf *elf = NULL;
37--
382.17.1
39
diff --git a/meta/recipes-devtools/elfutils/files/0015-config-eu.am-do-not-use-Werror.patch b/meta/recipes-devtools/elfutils/files/0015-config-eu.am-do-not-use-Werror.patch
new file mode 100644
index 0000000000..c3ae357265
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0015-config-eu.am-do-not-use-Werror.patch
@@ -0,0 +1,36 @@
1From dce2187dd8f592316357b200ebbe8dbed9ee65cb Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 22 Jun 2020 21:35:16 +0000
4Subject: [PATCH] config/eu.am: do not use -Werror
5
6Due to re-definition of error() on musl, gcc starts throwing
7errors where none happen with glibc. Since upstream is not
8likely to be interested in musl builds, lets just disable
9Werror.
10
11Upstream-Status: Inappropriate [oe core specific]
12Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13---
14 config/eu.am | 2 --
15 1 file changed, 2 deletions(-)
16
17diff --git a/config/eu.am b/config/eu.am
18index 6c3c444..3bc0dc9 100644
19--- a/config/eu.am
20+++ b/config/eu.am
21@@ -73,7 +73,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
22 -Wold-style-definition -Wstrict-prototypes -Wtrampolines \
23 $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
24 $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
25- $(if $($(*F)_no_Werror),,-Werror) \
26 $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
27 $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
28 $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \
29@@ -83,7 +82,6 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \
30 -Wtrampolines \
31 $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
32 $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
33- $(if $($(*F)_no_Werror),,-Werror) \
34 $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
35 $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
36 $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \
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
deleted file mode 100644
index a2983c5770..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/0001-Ignore-differences-between-mips-machine-identifiers.patch
+++ /dev/null
@@ -1,34 +0,0 @@
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: Pending [from debian]
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 backends/mips_init.c | 6 +-----
16 1 file changed, 1 insertion(+), 5 deletions(-)
17
18Index: b/backends/mips_init.c
19===================================================================
20--- a/backends/mips_init.c
21+++ b/backends/mips_init.c
22@@ -45,11 +45,7 @@ mips_init (Elf *elf __attribute__ ((unus
23 return NULL;
24
25 /* We handle it. */
26- if (machine == EM_MIPS)
27- eh->name = "MIPS R3000 big-endian";
28- else if (machine == EM_MIPS_RS3_LE)
29- eh->name = "MIPS R3000 little-endian";
30-
31+ eh->name = "MIPS";
32 mips_init_reloc (eh);
33 HOOK (eh, reloc_simple_type);
34 HOOK (eh, return_value_location);
diff --git a/meta/recipes-devtools/elfutils/files/debian/0001-fix-compile-failure-with-debian-patches.patch b/meta/recipes-devtools/elfutils/files/debian/0001-fix-compile-failure-with-debian-patches.patch
deleted file mode 100644
index 19a2015062..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/0001-fix-compile-failure-with-debian-patches.patch
+++ /dev/null
@@ -1,48 +0,0 @@
1From 3f3e7b16934ec58ab47d2bdc9982f54a55b07534 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 16:25:33 +0800
4Subject: [PATCH] fix compile failure with debian patches
5
6While applying debian patches, there is a compile failure
7...
8elfutils-0.177/backends/mips_init.c:48:5: error: 'Ebl' {aka 'struct ebl'} has no member named 'name'
9...
10
11Since upstream applied commit [b323391 libdwelf: Add dwelf_elf_e_machine_string
12and use it in readelf], it remove 'name' from 'struct ebl'
13
14Upstream-Status: Pending
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 backends/mips_init.c | 1 -
19 backends/parisc_init.c | 1 -
20 2 files changed, 2 deletions(-)
21
22diff --git a/backends/mips_init.c b/backends/mips_init.c
23index bce5abe..e1c65c8 100644
24--- a/backends/mips_init.c
25+++ b/backends/mips_init.c
26@@ -45,7 +45,6 @@ mips_init (Elf *elf __attribute__ ((unused)),
27 return NULL;
28
29 /* We handle it. */
30- eh->name = "MIPS";
31 mips_init_reloc (eh);
32 HOOK (eh, reloc_simple_type);
33 HOOK (eh, return_value_location);
34diff --git a/backends/parisc_init.c b/backends/parisc_init.c
35index f1e401c..97b4a8c 100644
36--- a/backends/parisc_init.c
37+++ b/backends/parisc_init.c
38@@ -56,7 +56,6 @@ parisc_init (Elf *elf __attribute__ ((unused)),
39 pa64 = 1;
40 }
41 /* We handle it. */
42- eh->name = "PA-RISC";
43 parisc_init_reloc (eh);
44 HOOK (eh, reloc_simple_type);
45 HOOK (eh, machine_flag_check);
46--
472.7.4
48
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
deleted file mode 100644
index aee00cba14..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch
+++ /dev/null
@@ -1,171 +0,0 @@
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: Pending [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
deleted file mode 100644
index c949e96533..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/0003-Add-mips-n64-relocation-format-hack.patch
+++ /dev/null
@@ -1,229 +0,0 @@
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: Pending [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: elfutils-0.175/libelf/gelf_getrel.c
27===================================================================
28--- elfutils-0.175.orig/libelf/gelf_getrel.c
29+++ elfutils-0.175/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: elfutils-0.175/libelf/gelf_getrela.c
70===================================================================
71--- elfutils-0.175.orig/libelf/gelf_getrela.c
72+++ elfutils-0.175/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: elfutils-0.175/libelf/gelf_update_rel.c
113===================================================================
114--- elfutils-0.175.orig/libelf/gelf_update_rel.c
115+++ elfutils-0.175/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: elfutils-0.175/libelf/gelf_update_rela.c
158===================================================================
159--- elfutils-0.175.orig/libelf/gelf_update_rela.c
160+++ elfutils-0.175/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: elfutils-0.175/src/strip.c
203===================================================================
204--- elfutils-0.175.orig/src/strip.c
205+++ elfutils-0.175/src/strip.c
206@@ -1062,6 +1062,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 (phnum > 0)
229 {
diff --git a/meta/recipes-devtools/elfutils/files/debian/arm_backend.diff b/meta/recipes-devtools/elfutils/files/debian/arm_backend.diff
deleted file mode 100644
index ba0ce33bd4..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/arm_backend.diff
+++ /dev/null
@@ -1,624 +0,0 @@
1From 4e6fededb3d8c90694c44214c862ac216a69ecae Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 16:50:33 +0800
4Subject: [PATCH] arm_backend
5
6Upstream-Status: Pending [from debian]
7Rebase to 0.177
8Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
9---
10 backends/arm_init.c | 18 ++++-
11 backends/arm_regs.c | 132 ++++++++++++++++++++++++++++++++++++
12 backends/arm_retval.c | 43 +++++++++++-
13 backends/libebl_arm.h | 9 +++
14 libelf/elf.h | 11 +++
15 tests/run-addrcfi.sh | 93 ++++++++++++++++++++++++-
16 tests/run-allregs.sh | 95 +++++++++++++++++++++++++-
17 tests/run-readelf-mixed-corenote.sh | 11 ++-
18 8 files changed, 400 insertions(+), 12 deletions(-)
19 create mode 100644 backends/libebl_arm.h
20
21diff --git a/backends/arm_init.c b/backends/arm_init.c
22index af023f0..ea2bcb7 100644
23--- a/backends/arm_init.c
24+++ b/backends/arm_init.c
25@@ -35,20 +35,31 @@
26 #define RELOC_PREFIX R_ARM_
27 #include "libebl_CPU.h"
28
29+#include "libebl_arm.h"
30+
31 /* This defines the common reloc hooks based on arm_reloc.def. */
32 #include "common-reloc.c"
33
34
35 const char *
36-arm_init (Elf *elf __attribute__ ((unused)),
37+arm_init (Elf *elf,
38 GElf_Half machine __attribute__ ((unused)),
39 Ebl *eh,
40 size_t ehlen)
41 {
42+ int soft_float = 0;
43+
44 /* Check whether the Elf_BH object has a sufficent size. */
45 if (ehlen < sizeof (Ebl))
46 return NULL;
47
48+ if (elf) {
49+ GElf_Ehdr ehdr_mem;
50+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
51+ if (ehdr && (ehdr->e_flags & EF_ARM_SOFT_FLOAT))
52+ soft_float = 1;
53+ }
54+
55 /* We handle it. */
56 arm_init_reloc (eh);
57 HOOK (eh, segment_type_name);
58@@ -59,7 +70,10 @@ arm_init (Elf *elf __attribute__ ((unused)),
59 HOOK (eh, core_note);
60 HOOK (eh, auxv_info);
61 HOOK (eh, check_object_attribute);
62- HOOK (eh, return_value_location);
63+ if (soft_float)
64+ eh->return_value_location = arm_return_value_location_soft;
65+ else
66+ eh->return_value_location = arm_return_value_location_hard;
67 HOOK (eh, abi_cfi);
68 HOOK (eh, check_reloc_target_type);
69 HOOK (eh, symbol_type_name);
70diff --git a/backends/arm_regs.c b/backends/arm_regs.c
71index a46a4c9..418c931 100644
72--- a/backends/arm_regs.c
73+++ b/backends/arm_regs.c
74@@ -31,6 +31,7 @@
75 #endif
76
77 #include <string.h>
78+#include <stdio.h>
79 #include <dwarf.h>
80
81 #define BACKEND arm_
82@@ -76,6 +77,9 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
83 break;
84
85 case 16 + 0 ... 16 + 7:
86+ /* AADWARF says that there are no registers in that range,
87+ * but gcc maps FPA registers here
88+ */
89 regno += 96 - 16;
90 FALLTHROUGH;
91 case 96 + 0 ... 96 + 7:
92@@ -87,11 +91,139 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
93 namelen = 2;
94 break;
95
96+ case 64 + 0 ... 64 + 9:
97+ *setname = "VFP";
98+ *bits = 32;
99+ *type = DW_ATE_float;
100+ name[0] = 's';
101+ name[1] = regno - 64 + '0';
102+ namelen = 2;
103+ break;
104+
105+ case 64 + 10 ... 64 + 31:
106+ *setname = "VFP";
107+ *bits = 32;
108+ *type = DW_ATE_float;
109+ name[0] = 's';
110+ name[1] = (regno - 64) / 10 + '0';
111+ name[2] = (regno - 64) % 10 + '0';
112+ namelen = 3;
113+ break;
114+
115+ case 104 + 0 ... 104 + 7:
116+ /* XXX TODO:
117+ * This can be either intel wireless MMX general purpose/control
118+ * registers or xscale accumulator, which have different usage.
119+ * We only have the intel wireless MMX here now.
120+ * The name needs to be changed for the xscale accumulator too. */
121+ *setname = "MMX";
122+ *type = DW_ATE_unsigned;
123+ *bits = 32;
124+ memcpy(name, "wcgr", 4);
125+ name[4] = regno - 104 + '0';
126+ namelen = 5;
127+ break;
128+
129+ case 112 + 0 ... 112 + 9:
130+ *setname = "MMX";
131+ *type = DW_ATE_unsigned;
132+ *bits = 64;
133+ name[0] = 'w';
134+ name[1] = 'r';
135+ name[2] = regno - 112 + '0';
136+ namelen = 3;
137+ break;
138+
139+ case 112 + 10 ... 112 + 15:
140+ *setname = "MMX";
141+ *type = DW_ATE_unsigned;
142+ *bits = 64;
143+ name[0] = 'w';
144+ name[1] = 'r';
145+ name[2] = '1';
146+ name[3] = regno - 112 - 10 + '0';
147+ namelen = 4;
148+ break;
149+
150 case 128:
151+ *setname = "state";
152 *type = DW_ATE_unsigned;
153 return stpcpy (name, "spsr") + 1 - name;
154
155+ case 129:
156+ *setname = "state";
157+ *type = DW_ATE_unsigned;
158+ return stpcpy(name, "spsr_fiq") + 1 - name;
159+
160+ case 130:
161+ *setname = "state";
162+ *type = DW_ATE_unsigned;
163+ return stpcpy(name, "spsr_irq") + 1 - name;
164+
165+ case 131:
166+ *setname = "state";
167+ *type = DW_ATE_unsigned;
168+ return stpcpy(name, "spsr_abt") + 1 - name;
169+
170+ case 132:
171+ *setname = "state";
172+ *type = DW_ATE_unsigned;
173+ return stpcpy(name, "spsr_und") + 1 - name;
174+
175+ case 133:
176+ *setname = "state";
177+ *type = DW_ATE_unsigned;
178+ return stpcpy(name, "spsr_svc") + 1 - name;
179+
180+ case 144 ... 150:
181+ *setname = "integer";
182+ *type = DW_ATE_signed;
183+ *bits = 32;
184+ return sprintf(name, "r%d_usr", regno - 144 + 8) + 1;
185+
186+ case 151 ... 157:
187+ *setname = "integer";
188+ *type = DW_ATE_signed;
189+ *bits = 32;
190+ return sprintf(name, "r%d_fiq", regno - 151 + 8) + 1;
191+
192+ case 158 ... 159:
193+ *setname = "integer";
194+ *type = DW_ATE_signed;
195+ *bits = 32;
196+ return sprintf(name, "r%d_irq", regno - 158 + 13) + 1;
197+
198+ case 160 ... 161:
199+ *setname = "integer";
200+ *type = DW_ATE_signed;
201+ *bits = 32;
202+ return sprintf(name, "r%d_abt", regno - 160 + 13) + 1;
203+
204+ case 162 ... 163:
205+ *setname = "integer";
206+ *type = DW_ATE_signed;
207+ *bits = 32;
208+ return sprintf(name, "r%d_und", regno - 162 + 13) + 1;
209+
210+ case 164 ... 165:
211+ *setname = "integer";
212+ *type = DW_ATE_signed;
213+ *bits = 32;
214+ return sprintf(name, "r%d_svc", regno - 164 + 13) + 1;
215+
216+ case 192 ... 199:
217+ *setname = "MMX";
218+ *bits = 32;
219+ *type = DW_ATE_unsigned;
220+ name[0] = 'w';
221+ name[1] = 'c';
222+ name[2] = regno - 192 + '0';
223+ namelen = 3;
224+ break;
225+
226 case 256 + 0 ... 256 + 9:
227+ /* XXX TODO: Neon also uses those registers and can contain
228+ * both float and integers */
229 *setname = "VFP";
230 *type = DW_ATE_float;
231 *bits = 64;
232diff --git a/backends/arm_retval.c b/backends/arm_retval.c
233index 1c28f01..313e4eb 100644
234--- a/backends/arm_retval.c
235+++ b/backends/arm_retval.c
236@@ -48,6 +48,13 @@ static const Dwarf_Op loc_intreg[] =
237 #define nloc_intreg 1
238 #define nloc_intregs(n) (2 * (n))
239
240+/* f1 */ /* XXX TODO: f0 can also have number 96 if program was compiled with -mabi=aapcs */
241+static const Dwarf_Op loc_fpreg[] =
242+ {
243+ { .atom = DW_OP_reg16 },
244+ };
245+#define nloc_fpreg 1
246+
247 /* The return value is a structure and is actually stored in stack space
248 passed in a hidden argument by the caller. But, the compiler
249 helpfully returns the address of that space in r0. */
250@@ -58,8 +65,9 @@ static const Dwarf_Op loc_aggregate[] =
251 #define nloc_aggregate 1
252
253
254-int
255-arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
256+static int
257+arm_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp,
258+ int soft_float)
259 {
260 /* Start with the function's type, and get the DW_AT_type attribute,
261 which is the type of the return value. */
262@@ -98,6 +106,21 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
263 else
264 return -1;
265 }
266+ if (tag == DW_TAG_base_type)
267+ {
268+ Dwarf_Word encoding;
269+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
270+ &attr_mem), &encoding) != 0)
271+ return -1;
272+
273+ if ((encoding == DW_ATE_float) && !soft_float)
274+ {
275+ *locp = loc_fpreg;
276+ if (size <= 8)
277+ return nloc_fpreg;
278+ goto aggregate;
279+ }
280+ }
281 if (size <= 16)
282 {
283 intreg:
284@@ -106,6 +129,7 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
285 }
286
287 aggregate:
288+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
289 *locp = loc_aggregate;
290 return nloc_aggregate;
291 }
292@@ -125,3 +149,18 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
293 DWARF and might be valid. */
294 return -2;
295 }
296+
297+/* return location for -mabi=apcs-gnu -msoft-float */
298+int
299+arm_return_value_location_soft (Dwarf_Die *functypedie, const Dwarf_Op **locp)
300+{
301+ return arm_return_value_location_ (functypedie, locp, 1);
302+}
303+
304+/* return location for -mabi=apcs-gnu -mhard-float (current default) */
305+int
306+arm_return_value_location_hard (Dwarf_Die *functypedie, const Dwarf_Op **locp)
307+{
308+ return arm_return_value_location_ (functypedie, locp, 0);
309+}
310+
311diff --git a/backends/libebl_arm.h b/backends/libebl_arm.h
312new file mode 100644
313index 0000000..c00770c
314--- /dev/null
315+++ b/backends/libebl_arm.h
316@@ -0,0 +1,9 @@
317+#ifndef _LIBEBL_ARM_H
318+#define _LIBEBL_ARM_H 1
319+
320+#include <libdw.h>
321+
322+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
323+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
324+
325+#endif
326diff --git a/libelf/elf.h b/libelf/elf.h
327index 01648bd..05b7e7e 100644
328--- a/libelf/elf.h
329+++ b/libelf/elf.h
330@@ -2690,6 +2690,9 @@ enum
331 #define EF_ARM_EABI_VER4 0x04000000
332 #define EF_ARM_EABI_VER5 0x05000000
333
334+/* EI_OSABI values */
335+#define ELFOSABI_ARM_AEABI 64 /* Contains symbol versioning. */
336+
337 /* Additional symbol types for Thumb. */
338 #define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
339 #define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
340@@ -2707,12 +2710,19 @@ enum
341
342 /* Processor specific values for the Phdr p_type field. */
343 #define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
344+#define PT_ARM_UNWIND PT_ARM_EXIDX
345
346 /* Processor specific values for the Shdr sh_type field. */
347 #define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
348 #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
349 #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
350
351+/* Processor specific values for the Dyn d_tag field. */
352+#define DT_ARM_RESERVED1 (DT_LOPROC + 0)
353+#define DT_ARM_SYMTABSZ (DT_LOPROC + 1)
354+#define DT_ARM_PREEMTMAB (DT_LOPROC + 2)
355+#define DT_ARM_RESERVED2 (DT_LOPROC + 3)
356+#define DT_ARM_NUM 4
357
358 /* AArch64 relocs. */
359
360@@ -3005,6 +3015,7 @@ enum
361 TLS block (LDR, STR). */
362 #define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
363 to GOT origin (LDR). */
364+/* 112 - 127 private range */
365 #define R_ARM_ME_TOO 128 /* Obsolete. */
366 #define R_ARM_THM_TLS_DESCSEQ 129
367 #define R_ARM_THM_TLS_DESCSEQ16 129
368diff --git a/tests/run-addrcfi.sh b/tests/run-addrcfi.sh
369index 64fa24d..1c2aa4d 100755
370--- a/tests/run-addrcfi.sh
371+++ b/tests/run-addrcfi.sh
372@@ -3554,6 +3554,38 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
373 FPA reg21 (f5): undefined
374 FPA reg22 (f6): undefined
375 FPA reg23 (f7): undefined
376+ VFP reg64 (s0): undefined
377+ VFP reg65 (s1): undefined
378+ VFP reg66 (s2): undefined
379+ VFP reg67 (s3): undefined
380+ VFP reg68 (s4): undefined
381+ VFP reg69 (s5): undefined
382+ VFP reg70 (s6): undefined
383+ VFP reg71 (s7): undefined
384+ VFP reg72 (s8): undefined
385+ VFP reg73 (s9): undefined
386+ VFP reg74 (s10): undefined
387+ VFP reg75 (s11): undefined
388+ VFP reg76 (s12): undefined
389+ VFP reg77 (s13): undefined
390+ VFP reg78 (s14): undefined
391+ VFP reg79 (s15): undefined
392+ VFP reg80 (s16): undefined
393+ VFP reg81 (s17): undefined
394+ VFP reg82 (s18): undefined
395+ VFP reg83 (s19): undefined
396+ VFP reg84 (s20): undefined
397+ VFP reg85 (s21): undefined
398+ VFP reg86 (s22): undefined
399+ VFP reg87 (s23): undefined
400+ VFP reg88 (s24): undefined
401+ VFP reg89 (s25): undefined
402+ VFP reg90 (s26): undefined
403+ VFP reg91 (s27): undefined
404+ VFP reg92 (s28): undefined
405+ VFP reg93 (s29): undefined
406+ VFP reg94 (s30): undefined
407+ VFP reg95 (s31): undefined
408 FPA reg96 (f0): undefined
409 FPA reg97 (f1): undefined
410 FPA reg98 (f2): undefined
411@@ -3562,7 +3594,66 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
412 FPA reg101 (f5): undefined
413 FPA reg102 (f6): undefined
414 FPA reg103 (f7): undefined
415- integer reg128 (spsr): undefined
416+ MMX reg104 (wcgr0): undefined
417+ MMX reg105 (wcgr1): undefined
418+ MMX reg106 (wcgr2): undefined
419+ MMX reg107 (wcgr3): undefined
420+ MMX reg108 (wcgr4): undefined
421+ MMX reg109 (wcgr5): undefined
422+ MMX reg110 (wcgr6): undefined
423+ MMX reg111 (wcgr7): undefined
424+ MMX reg112 (wr0): undefined
425+ MMX reg113 (wr1): undefined
426+ MMX reg114 (wr2): undefined
427+ MMX reg115 (wr3): undefined
428+ MMX reg116 (wr4): undefined
429+ MMX reg117 (wr5): undefined
430+ MMX reg118 (wr6): undefined
431+ MMX reg119 (wr7): undefined
432+ MMX reg120 (wr8): undefined
433+ MMX reg121 (wr9): undefined
434+ MMX reg122 (wr10): undefined
435+ MMX reg123 (wr11): undefined
436+ MMX reg124 (wr12): undefined
437+ MMX reg125 (wr13): undefined
438+ MMX reg126 (wr14): undefined
439+ MMX reg127 (wr15): undefined
440+ state reg128 (spsr): undefined
441+ state reg129 (spsr_fiq): undefined
442+ state reg130 (spsr_irq): undefined
443+ state reg131 (spsr_abt): undefined
444+ state reg132 (spsr_und): undefined
445+ state reg133 (spsr_svc): undefined
446+ integer reg144 (r8_usr): undefined
447+ integer reg145 (r9_usr): undefined
448+ integer reg146 (r10_usr): undefined
449+ integer reg147 (r11_usr): undefined
450+ integer reg148 (r12_usr): undefined
451+ integer reg149 (r13_usr): undefined
452+ integer reg150 (r14_usr): undefined
453+ integer reg151 (r8_fiq): undefined
454+ integer reg152 (r9_fiq): undefined
455+ integer reg153 (r10_fiq): undefined
456+ integer reg154 (r11_fiq): undefined
457+ integer reg155 (r12_fiq): undefined
458+ integer reg156 (r13_fiq): undefined
459+ integer reg157 (r14_fiq): undefined
460+ integer reg158 (r13_irq): undefined
461+ integer reg159 (r14_irq): undefined
462+ integer reg160 (r13_abt): undefined
463+ integer reg161 (r14_abt): undefined
464+ integer reg162 (r13_und): undefined
465+ integer reg163 (r14_und): undefined
466+ integer reg164 (r13_svc): undefined
467+ integer reg165 (r14_svc): undefined
468+ MMX reg192 (wc0): undefined
469+ MMX reg193 (wc1): undefined
470+ MMX reg194 (wc2): undefined
471+ MMX reg195 (wc3): undefined
472+ MMX reg196 (wc4): undefined
473+ MMX reg197 (wc5): undefined
474+ MMX reg198 (wc6): undefined
475+ MMX reg199 (wc7): undefined
476 VFP reg256 (d0): undefined
477 VFP reg257 (d1): undefined
478 VFP reg258 (d2): undefined
479diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh
480index 1422bd6..dc0fc99 100755
481--- a/tests/run-allregs.sh
482+++ b/tests/run-allregs.sh
483@@ -2672,7 +2672,28 @@ integer registers:
484 13: sp (sp), address 32 bits
485 14: lr (lr), address 32 bits
486 15: pc (pc), address 32 bits
487- 128: spsr (spsr), unsigned 32 bits
488+ 144: r8_usr (r8_usr), signed 32 bits
489+ 145: r9_usr (r9_usr), signed 32 bits
490+ 146: r10_usr (r10_usr), signed 32 bits
491+ 147: r11_usr (r11_usr), signed 32 bits
492+ 148: r12_usr (r12_usr), signed 32 bits
493+ 149: r13_usr (r13_usr), signed 32 bits
494+ 150: r14_usr (r14_usr), signed 32 bits
495+ 151: r8_fiq (r8_fiq), signed 32 bits
496+ 152: r9_fiq (r9_fiq), signed 32 bits
497+ 153: r10_fiq (r10_fiq), signed 32 bits
498+ 154: r11_fiq (r11_fiq), signed 32 bits
499+ 155: r12_fiq (r12_fiq), signed 32 bits
500+ 156: r13_fiq (r13_fiq), signed 32 bits
501+ 157: r14_fiq (r14_fiq), signed 32 bits
502+ 158: r13_irq (r13_irq), signed 32 bits
503+ 159: r14_irq (r14_irq), signed 32 bits
504+ 160: r13_abt (r13_abt), signed 32 bits
505+ 161: r14_abt (r14_abt), signed 32 bits
506+ 162: r13_und (r13_und), signed 32 bits
507+ 163: r14_und (r14_und), signed 32 bits
508+ 164: r13_svc (r13_svc), signed 32 bits
509+ 165: r14_svc (r14_svc), signed 32 bits
510 FPA registers:
511 16: f0 (f0), float 96 bits
512 17: f1 (f1), float 96 bits
513@@ -2690,7 +2711,72 @@ FPA registers:
514 101: f5 (f5), float 96 bits
515 102: f6 (f6), float 96 bits
516 103: f7 (f7), float 96 bits
517+MMX registers:
518+ 104: wcgr0 (wcgr0), unsigned 32 bits
519+ 105: wcgr1 (wcgr1), unsigned 32 bits
520+ 106: wcgr2 (wcgr2), unsigned 32 bits
521+ 107: wcgr3 (wcgr3), unsigned 32 bits
522+ 108: wcgr4 (wcgr4), unsigned 32 bits
523+ 109: wcgr5 (wcgr5), unsigned 32 bits
524+ 110: wcgr6 (wcgr6), unsigned 32 bits
525+ 111: wcgr7 (wcgr7), unsigned 32 bits
526+ 112: wr0 (wr0), unsigned 64 bits
527+ 113: wr1 (wr1), unsigned 64 bits
528+ 114: wr2 (wr2), unsigned 64 bits
529+ 115: wr3 (wr3), unsigned 64 bits
530+ 116: wr4 (wr4), unsigned 64 bits
531+ 117: wr5 (wr5), unsigned 64 bits
532+ 118: wr6 (wr6), unsigned 64 bits
533+ 119: wr7 (wr7), unsigned 64 bits
534+ 120: wr8 (wr8), unsigned 64 bits
535+ 121: wr9 (wr9), unsigned 64 bits
536+ 122: wr10 (wr10), unsigned 64 bits
537+ 123: wr11 (wr11), unsigned 64 bits
538+ 124: wr12 (wr12), unsigned 64 bits
539+ 125: wr13 (wr13), unsigned 64 bits
540+ 126: wr14 (wr14), unsigned 64 bits
541+ 127: wr15 (wr15), unsigned 64 bits
542+ 192: wc0 (wc0), unsigned 32 bits
543+ 193: wc1 (wc1), unsigned 32 bits
544+ 194: wc2 (wc2), unsigned 32 bits
545+ 195: wc3 (wc3), unsigned 32 bits
546+ 196: wc4 (wc4), unsigned 32 bits
547+ 197: wc5 (wc5), unsigned 32 bits
548+ 198: wc6 (wc6), unsigned 32 bits
549+ 199: wc7 (wc7), unsigned 32 bits
550 VFP registers:
551+ 64: s0 (s0), float 32 bits
552+ 65: s1 (s1), float 32 bits
553+ 66: s2 (s2), float 32 bits
554+ 67: s3 (s3), float 32 bits
555+ 68: s4 (s4), float 32 bits
556+ 69: s5 (s5), float 32 bits
557+ 70: s6 (s6), float 32 bits
558+ 71: s7 (s7), float 32 bits
559+ 72: s8 (s8), float 32 bits
560+ 73: s9 (s9), float 32 bits
561+ 74: s10 (s10), float 32 bits
562+ 75: s11 (s11), float 32 bits
563+ 76: s12 (s12), float 32 bits
564+ 77: s13 (s13), float 32 bits
565+ 78: s14 (s14), float 32 bits
566+ 79: s15 (s15), float 32 bits
567+ 80: s16 (s16), float 32 bits
568+ 81: s17 (s17), float 32 bits
569+ 82: s18 (s18), float 32 bits
570+ 83: s19 (s19), float 32 bits
571+ 84: s20 (s20), float 32 bits
572+ 85: s21 (s21), float 32 bits
573+ 86: s22 (s22), float 32 bits
574+ 87: s23 (s23), float 32 bits
575+ 88: s24 (s24), float 32 bits
576+ 89: s25 (s25), float 32 bits
577+ 90: s26 (s26), float 32 bits
578+ 91: s27 (s27), float 32 bits
579+ 92: s28 (s28), float 32 bits
580+ 93: s29 (s29), float 32 bits
581+ 94: s30 (s30), float 32 bits
582+ 95: s31 (s31), float 32 bits
583 256: d0 (d0), float 64 bits
584 257: d1 (d1), float 64 bits
585 258: d2 (d2), float 64 bits
586@@ -2723,6 +2809,13 @@ VFP registers:
587 285: d29 (d29), float 64 bits
588 286: d30 (d30), float 64 bits
589 287: d31 (d31), float 64 bits
590+state registers:
591+ 128: spsr (spsr), unsigned 32 bits
592+ 129: spsr_fiq (spsr_fiq), unsigned 32 bits
593+ 130: spsr_irq (spsr_irq), unsigned 32 bits
594+ 131: spsr_abt (spsr_abt), unsigned 32 bits
595+ 132: spsr_und (spsr_und), unsigned 32 bits
596+ 133: spsr_svc (spsr_svc), unsigned 32 bits
597 EOF
598
599 # See run-readelf-mixed-corenote.sh for instructions to regenerate
600diff --git a/tests/run-readelf-mixed-corenote.sh b/tests/run-readelf-mixed-corenote.sh
601index c960f1d..e4bf074 100755
602--- a/tests/run-readelf-mixed-corenote.sh
603+++ b/tests/run-readelf-mixed-corenote.sh
604@@ -31,12 +31,11 @@ Note segment of 892 bytes at offset 0x274:
605 pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
606 utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
607 orig_r0: -1, fpvalid: 1
608- r0: 1 r1: -1091672508 r2: -1091672500
609- r3: 0 r4: 0 r5: 0
610- r6: 33728 r7: 0 r8: 0
611- r9: 0 r10: -1225703496 r11: -1091672844
612- r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48
613- pc: 0x00008500 spsr: 0x60000010
614+ r0: 1 r1: -1091672508 r2: -1091672500 r3: 0
615+ r4: 0 r5: 0 r6: 33728 r7: 0
616+ r8: 0 r9: 0 r10: -1225703496 r11: -1091672844
617+ r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48 pc: 0x00008500
618+ spsr: 0x60000010
619 CORE 124 PRPSINFO
620 state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400500
621 uid: 0, gid: 0, pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
622--
6232.7.4
624
diff --git a/meta/recipes-devtools/elfutils/files/debian/disable_werror.patch b/meta/recipes-devtools/elfutils/files/debian/disable_werror.patch
deleted file mode 100644
index bd98dae4b2..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/disable_werror.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1From: Helmut Grohne <helmut@subdivi.de>
2Subject: disable -Werror as it tends to break with new gcc versions
3Bug-Debian: https://bugs.debian.org/886004
4Last-Update: 2018-01-01
5
6Upstream-Status: Pending [from debian]
7Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
8
9Index: elfutils-0.176/config/eu.am
10===================================================================
11--- elfutils-0.176.orig/config/eu.am
12+++ elfutils-0.176/config/eu.am
13@@ -73,7 +73,6 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -W
14 -Wold-style-definition -Wstrict-prototypes -Wtrampolines \
15 $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
16 $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
17- $(if $($(*F)_no_Werror),,-Werror) \
18 $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
19 $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
20 $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \
diff --git a/meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff b/meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff
deleted file mode 100644
index 53fa2f435b..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/hppa_backend.diff
+++ /dev/null
@@ -1,828 +0,0 @@
1From ffb811e18d7046d5bbe54ede5b1b7e14eaac0146 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 15:44:18 +0800
4Subject: [PATCH] hppa backend
5
6Rebase to 0.177
7Upstream-Status: Pending [from debian]
8Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
9
10---
11 backends/Makefile.am | 7 +-
12 backends/libebl_parisc.h | 9 ++
13 backends/parisc_init.c | 73 +++++++++++++
14 backends/parisc_regs.c | 159 ++++++++++++++++++++++++++++
15 backends/parisc_reloc.def | 128 +++++++++++++++++++++++
16 backends/parisc_retval.c | 213 ++++++++++++++++++++++++++++++++++++++
17 backends/parisc_symbol.c | 113 ++++++++++++++++++++
18 libelf/elf.h | 11 ++
19 8 files changed, 711 insertions(+), 2 deletions(-)
20 create mode 100644 backends/libebl_parisc.h
21 create mode 100644 backends/parisc_init.c
22 create mode 100644 backends/parisc_regs.c
23 create mode 100644 backends/parisc_reloc.def
24 create mode 100644 backends/parisc_retval.c
25 create mode 100644 backends/parisc_symbol.c
26
27diff --git a/backends/Makefile.am b/backends/Makefile.am
28index f405212..4755f61 100644
29--- a/backends/Makefile.am
30+++ b/backends/Makefile.am
31@@ -37,7 +37,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
32 noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
33
34 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
35- tilegx m68k bpf riscv csky
36+ tilegx m68k bpf riscv csky parisc
37+
38+parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
39
40 i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \
41 i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \
42@@ -102,7 +104,8 @@ libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
43 $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
44 $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
45 $(ppc64_SRCS) $(s390_SRCS) $(tilegx_SRCS) \
46- $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS)
47+ $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
48+ $(parisc_SRCS)
49
50 libebl_backends_pic_a_SOURCES =
51 am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
52diff --git a/backends/libebl_parisc.h b/backends/libebl_parisc.h
53new file mode 100644
54index 0000000..f473b79
55--- /dev/null
56+++ b/backends/libebl_parisc.h
57@@ -0,0 +1,9 @@
58+#ifndef _LIBEBL_HPPA_H
59+#define _LIBEBL_HPPA_H 1
60+
61+#include <libdw.h>
62+
63+extern int parisc_return_value_location_32(Dwarf_Die *, const Dwarf_Op **locp);
64+extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp);
65+
66+#endif
67diff --git a/backends/parisc_init.c b/backends/parisc_init.c
68new file mode 100644
69index 0000000..f1e401c
70--- /dev/null
71+++ b/backends/parisc_init.c
72@@ -0,0 +1,73 @@
73+/* Initialization of PA-RISC specific backend library.
74+ Copyright (C) 2002, 2005, 2006 Red Hat, Inc.
75+ This file is part of Red Hat elfutils.
76+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
77+
78+ Red Hat elfutils is free software; you can redistribute it and/or modify
79+ it under the terms of the GNU General Public License as published by the
80+ Free Software Foundation; version 2 of the License.
81+
82+ Red Hat elfutils is distributed in the hope that it will be useful, but
83+ WITHOUT ANY WARRANTY; without even the implied warranty of
84+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85+ General Public License for more details.
86+
87+ You should have received a copy of the GNU General Public License along
88+ with Red Hat elfutils; if not, write to the Free Software Foundation,
89+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
90+
91+ Red Hat elfutils is an included package of the Open Invention Network.
92+ An included package of the Open Invention Network is a package for which
93+ Open Invention Network licensees cross-license their patents. No patent
94+ license is granted, either expressly or impliedly, by designation as an
95+ included package. Should you wish to participate in the Open Invention
96+ Network licensing program, please visit www.openinventionnetwork.com
97+ <http://www.openinventionnetwork.com>. */
98+
99+#ifdef HAVE_CONFIG_H
100+# include <config.h>
101+#endif
102+
103+#define BACKEND parisc_
104+#define RELOC_PREFIX R_PARISC_
105+#include "libebl_CPU.h"
106+#include "libebl_parisc.h"
107+
108+/* This defines the common reloc hooks based on parisc_reloc.def. */
109+#include "common-reloc.c"
110+
111+
112+const char *
113+parisc_init (Elf *elf __attribute__ ((unused)),
114+ GElf_Half machine __attribute__ ((unused)),
115+ Ebl *eh,
116+ size_t ehlen)
117+{
118+ int pa64 = 0;
119+
120+ /* Check whether the Elf_BH object has a sufficent size. */
121+ if (ehlen < sizeof (Ebl))
122+ return NULL;
123+
124+ if (elf) {
125+ GElf_Ehdr ehdr_mem;
126+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
127+ if (ehdr && (ehdr->e_flags & EF_PARISC_WIDE))
128+ pa64 = 1;
129+ }
130+ /* We handle it. */
131+ eh->name = "PA-RISC";
132+ parisc_init_reloc (eh);
133+ HOOK (eh, reloc_simple_type);
134+ HOOK (eh, machine_flag_check);
135+ HOOK (eh, symbol_type_name);
136+ HOOK (eh, segment_type_name);
137+ HOOK (eh, section_type_name);
138+ HOOK (eh, register_info);
139+ if (pa64)
140+ eh->return_value_location = parisc_return_value_location_64;
141+ else
142+ eh->return_value_location = parisc_return_value_location_32;
143+
144+ return MODVERSION;
145+}
146diff --git a/backends/parisc_regs.c b/backends/parisc_regs.c
147new file mode 100644
148index 0000000..3895f8e
149--- /dev/null
150+++ b/backends/parisc_regs.c
151@@ -0,0 +1,159 @@
152+/* Register names and numbers for PA-RISC DWARF.
153+ Copyright (C) 2005, 2006 Red Hat, Inc.
154+ This file is part of Red Hat elfutils.
155+
156+ Red Hat elfutils is free software; you can redistribute it and/or modify
157+ it under the terms of the GNU General Public License as published by the
158+ Free Software Foundation; version 2 of the License.
159+
160+ Red Hat elfutils is distributed in the hope that it will be useful, but
161+ WITHOUT ANY WARRANTY; without even the implied warranty of
162+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
163+ General Public License for more details.
164+
165+ You should have received a copy of the GNU General Public License along
166+ with Red Hat elfutils; if not, write to the Free Software Foundation,
167+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
168+
169+ Red Hat elfutils is an included package of the Open Invention Network.
170+ An included package of the Open Invention Network is a package for which
171+ Open Invention Network licensees cross-license their patents. No patent
172+ license is granted, either expressly or impliedly, by designation as an
173+ included package. Should you wish to participate in the Open Invention
174+ Network licensing program, please visit www.openinventionnetwork.com
175+ <http://www.openinventionnetwork.com>. */
176+
177+#ifdef HAVE_CONFIG_H
178+# include <config.h>
179+#endif
180+
181+#include <string.h>
182+#include <dwarf.h>
183+
184+#define BACKEND parisc_
185+#include "libebl_CPU.h"
186+
187+ssize_t
188+parisc_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
189+ const char **prefix, const char **setname,
190+ int *bits, int *type)
191+{
192+ int pa64 = 0;
193+
194+ if (ebl->elf) {
195+ GElf_Ehdr ehdr_mem;
196+ GElf_Ehdr *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem);
197+ if (ehdr->e_flags & EF_PARISC_WIDE)
198+ pa64 = 1;
199+ }
200+
201+ int nregs = pa64 ? 127 : 128;
202+
203+ if (name == NULL)
204+ return nregs;
205+
206+ if (regno < 0 || regno >= nregs || namelen < 6)
207+ return -1;
208+
209+ *prefix = "%";
210+
211+ if (regno < 32)
212+ {
213+ *setname = "integer";
214+ *type = DW_ATE_signed;
215+ if (pa64)
216+ {
217+ *bits = 64;
218+ }
219+ else
220+ {
221+ *bits = 32;
222+ }
223+ }
224+ else if (regno == 32)
225+ {
226+ *setname = "special";
227+ if (pa64)
228+ {
229+ *bits = 6;
230+ }
231+ else
232+ {
233+ *bits = 5;
234+ }
235+ *type = DW_ATE_unsigned;
236+ }
237+ else
238+ {
239+ *setname = "FPU";
240+ *type = DW_ATE_float;
241+ if (pa64)
242+ {
243+ *bits = 64;
244+ }
245+ else
246+ {
247+ *bits = 32;
248+ }
249+ }
250+
251+ if (regno < 33) {
252+ switch (regno)
253+ {
254+ case 0 ... 9:
255+ name[0] = 'r';
256+ name[1] = regno + '0';
257+ namelen = 2;
258+ break;
259+ case 10 ... 31:
260+ name[0] = 'r';
261+ name[1] = regno / 10 + '0';
262+ name[2] = regno % 10 + '0';
263+ namelen = 3;
264+ break;
265+ case 32:
266+ *prefix = NULL;
267+ name[0] = 'S';
268+ name[1] = 'A';
269+ name[2] = 'R';
270+ namelen = 3;
271+ break;
272+ }
273+ }
274+ else {
275+ if (pa64 && ((regno - 72) % 2)) {
276+ *setname = NULL;
277+ return 0;
278+ }
279+
280+ switch (regno)
281+ {
282+ case 72 + 0 ... 72 + 11:
283+ name[0] = 'f';
284+ name[1] = 'r';
285+ name[2] = (regno + 8 - 72) / 2 + '0';
286+ namelen = 3;
287+ if ((regno + 8 - 72) % 2) {
288+ name[3] = 'R';
289+ namelen++;
290+ }
291+ break;
292+ case 72 + 12 ... 72 + 55:
293+ name[0] = 'f';
294+ name[1] = 'r';
295+ name[2] = (regno + 8 - 72) / 2 / 10 + '0';
296+ name[3] = (regno + 8 - 72) / 2 % 10 + '0';
297+ namelen = 4;
298+ if ((regno + 8 - 72) % 2) {
299+ name[4] = 'R';
300+ namelen++;
301+ }
302+ break;
303+ default:
304+ *setname = NULL;
305+ return 0;
306+ }
307+ }
308+ name[namelen++] = '\0';
309+ return namelen;
310+}
311diff --git a/backends/parisc_reloc.def b/backends/parisc_reloc.def
312new file mode 100644
313index 0000000..1f875ba
314--- /dev/null
315+++ b/backends/parisc_reloc.def
316@@ -0,0 +1,128 @@
317+/* List the relocation types for PA-RISC. -*- C -*-
318+ Copyright (C) 2005 Red Hat, Inc.
319+ This file is part of Red Hat elfutils.
320+
321+ Red Hat elfutils is free software; you can redistribute it and/or modify
322+ it under the terms of the GNU General Public License as published by the
323+ Free Software Foundation; version 2 of the License.
324+
325+ Red Hat elfutils is distributed in the hope that it will be useful, but
326+ WITHOUT ANY WARRANTY; without even the implied warranty of
327+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
328+ General Public License for more details.
329+
330+ You should have received a copy of the GNU General Public License along
331+ with Red Hat elfutils; if not, write to the Free Software Foundation,
332+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
333+
334+ Red Hat elfutils is an included package of the Open Invention Network.
335+ An included package of the Open Invention Network is a package for which
336+ Open Invention Network licensees cross-license their patents. No patent
337+ license is granted, either expressly or impliedly, by designation as an
338+ included package. Should you wish to participate in the Open Invention
339+ Network licensing program, please visit www.openinventionnetwork.com
340+ <http://www.openinventionnetwork.com>. */
341+
342+/* NAME, REL|EXEC|DYN */
343+
344+RELOC_TYPE (NONE, EXEC|DYN)
345+RELOC_TYPE (DIR32, REL|EXEC|DYN)
346+RELOC_TYPE (DIR21L, REL|EXEC|DYN)
347+RELOC_TYPE (DIR17R, REL)
348+RELOC_TYPE (DIR17F, REL)
349+RELOC_TYPE (DIR14R, REL|DYN)
350+RELOC_TYPE (PCREL32, REL)
351+RELOC_TYPE (PCREL21L, REL)
352+RELOC_TYPE (PCREL17R, REL)
353+RELOC_TYPE (PCREL17F, REL)
354+RELOC_TYPE (PCREL14R, REL|EXEC)
355+RELOC_TYPE (DPREL21L, REL)
356+RELOC_TYPE (DPREL14WR, REL)
357+RELOC_TYPE (DPREL14DR, REL)
358+RELOC_TYPE (DPREL14R, REL)
359+RELOC_TYPE (GPREL21L, 0)
360+RELOC_TYPE (GPREL14R, 0)
361+RELOC_TYPE (LTOFF21L, REL)
362+RELOC_TYPE (LTOFF14R, REL)
363+RELOC_TYPE (DLTIND14F, 0)
364+RELOC_TYPE (SETBASE, 0)
365+RELOC_TYPE (SECREL32, REL)
366+RELOC_TYPE (BASEREL21L, 0)
367+RELOC_TYPE (BASEREL17R, 0)
368+RELOC_TYPE (BASEREL14R, 0)
369+RELOC_TYPE (SEGBASE, 0)
370+RELOC_TYPE (SEGREL32, REL)
371+RELOC_TYPE (PLTOFF21L, 0)
372+RELOC_TYPE (PLTOFF14R, 0)
373+RELOC_TYPE (PLTOFF14F, 0)
374+RELOC_TYPE (LTOFF_FPTR32, 0)
375+RELOC_TYPE (LTOFF_FPTR21L, 0)
376+RELOC_TYPE (LTOFF_FPTR14R, 0)
377+RELOC_TYPE (FPTR64, 0)
378+RELOC_TYPE (PLABEL32, REL|DYN)
379+RELOC_TYPE (PCREL64, 0)
380+RELOC_TYPE (PCREL22C, 0)
381+RELOC_TYPE (PCREL22F, 0)
382+RELOC_TYPE (PCREL14WR, 0)
383+RELOC_TYPE (PCREL14DR, 0)
384+RELOC_TYPE (PCREL16F, 0)
385+RELOC_TYPE (PCREL16WF, 0)
386+RELOC_TYPE (PCREL16DF, 0)
387+RELOC_TYPE (DIR64, REL|DYN)
388+RELOC_TYPE (DIR14WR, REL)
389+RELOC_TYPE (DIR14DR, REL)
390+RELOC_TYPE (DIR16F, REL)
391+RELOC_TYPE (DIR16WF, REL)
392+RELOC_TYPE (DIR16DF, REL)
393+RELOC_TYPE (GPREL64, 0)
394+RELOC_TYPE (GPREL14WR, 0)
395+RELOC_TYPE (GPREL14DR, 0)
396+RELOC_TYPE (GPREL16F, 0)
397+RELOC_TYPE (GPREL16WF, 0)
398+RELOC_TYPE (GPREL16DF, 0)
399+RELOC_TYPE (LTOFF64, 0)
400+RELOC_TYPE (LTOFF14WR, 0)
401+RELOC_TYPE (LTOFF14DR, 0)
402+RELOC_TYPE (LTOFF16F, 0)
403+RELOC_TYPE (LTOFF16WF, 0)
404+RELOC_TYPE (LTOFF16DF, 0)
405+RELOC_TYPE (SECREL64, 0)
406+RELOC_TYPE (BASEREL14WR, 0)
407+RELOC_TYPE (BASEREL14DR, 0)
408+RELOC_TYPE (SEGREL64, 0)
409+RELOC_TYPE (PLTOFF14WR, 0)
410+RELOC_TYPE (PLTOFF14DR, 0)
411+RELOC_TYPE (PLTOFF16F, 0)
412+RELOC_TYPE (PLTOFF16WF, 0)
413+RELOC_TYPE (PLTOFF16DF, 0)
414+RELOC_TYPE (LTOFF_FPTR64, 0)
415+RELOC_TYPE (LTOFF_FPTR14WR, 0)
416+RELOC_TYPE (LTOFF_FPTR14DR, 0)
417+RELOC_TYPE (LTOFF_FPTR16F, 0)
418+RELOC_TYPE (LTOFF_FPTR16WF, 0)
419+RELOC_TYPE (LTOFF_FPTR16DF, 0)
420+RELOC_TYPE (COPY, EXEC)
421+RELOC_TYPE (IPLT, EXEC|DYN)
422+RELOC_TYPE (EPLT, 0)
423+RELOC_TYPE (TPREL32, DYN)
424+RELOC_TYPE (TPREL21L, 0)
425+RELOC_TYPE (TPREL14R, 0)
426+RELOC_TYPE (LTOFF_TP21L, 0)
427+RELOC_TYPE (LTOFF_TP14R, 0)
428+RELOC_TYPE (LTOFF_TP14F, 0)
429+RELOC_TYPE (TPREL64, 0)
430+RELOC_TYPE (TPREL14WR, 0)
431+RELOC_TYPE (TPREL14DR, 0)
432+RELOC_TYPE (TPREL16F, 0)
433+RELOC_TYPE (TPREL16WF, 0)
434+RELOC_TYPE (TPREL16DF, 0)
435+RELOC_TYPE (LTOFF_TP64, 0)
436+RELOC_TYPE (LTOFF_TP14WR, 0)
437+RELOC_TYPE (LTOFF_TP14DR, 0)
438+RELOC_TYPE (LTOFF_TP16F, 0)
439+RELOC_TYPE (LTOFF_TP16WF, 0)
440+RELOC_TYPE (LTOFF_TP16DF, 0)
441+RELOC_TYPE (TLS_DTPMOD32, DYN)
442+RELOC_TYPE (TLS_DTPMOD64, DYN)
443+
444+#define NO_RELATIVE_RELOC 1
445diff --git a/backends/parisc_retval.c b/backends/parisc_retval.c
446new file mode 100644
447index 0000000..df7ec3a
448--- /dev/null
449+++ b/backends/parisc_retval.c
450@@ -0,0 +1,213 @@
451+/* Function return value location for Linux/PA-RISC ABI.
452+ Copyright (C) 2005 Red Hat, Inc.
453+ This file is part of Red Hat elfutils.
454+
455+ Red Hat elfutils is free software; you can redistribute it and/or modify
456+ it under the terms of the GNU General Public License as published by the
457+ Free Software Foundation; version 2 of the License.
458+
459+ Red Hat elfutils is distributed in the hope that it will be useful, but
460+ WITHOUT ANY WARRANTY; without even the implied warranty of
461+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
462+ General Public License for more details.
463+
464+ You should have received a copy of the GNU General Public License along
465+ with Red Hat elfutils; if not, write to the Free Software Foundation,
466+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
467+
468+ Red Hat elfutils is an included package of the Open Invention Network.
469+ An included package of the Open Invention Network is a package for which
470+ Open Invention Network licensees cross-license their patents. No patent
471+ license is granted, either expressly or impliedly, by designation as an
472+ included package. Should you wish to participate in the Open Invention
473+ Network licensing program, please visit www.openinventionnetwork.com
474+ <http://www.openinventionnetwork.com>. */
475+
476+#ifdef HAVE_CONFIG_H
477+# include <config.h>
478+#endif
479+
480+#include <assert.h>
481+#include <dwarf.h>
482+
483+#define BACKEND parisc_
484+#include "libebl_CPU.h"
485+#include "libebl_parisc.h"
486+
487+/* %r28, or pair %r28, %r29. */
488+static const Dwarf_Op loc_intreg32[] =
489+ {
490+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 4 },
491+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 4 },
492+ };
493+
494+static const Dwarf_Op loc_intreg[] =
495+ {
496+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 8 },
497+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 8 },
498+ };
499+#define nloc_intreg 1
500+#define nloc_intregpair 4
501+
502+/* %fr4L, or pair %fr4L, %fr4R on pa-32 */
503+static const Dwarf_Op loc_fpreg32[] =
504+ {
505+ { .atom = DW_OP_regx, .number = 72 }, { .atom = DW_OP_piece, .number = 4 },
506+ { .atom = DW_OP_regx, .number = 73 }, { .atom = DW_OP_piece, .number = 4 },
507+ };
508+#define nloc_fpreg32 2
509+#define nloc_fpregpair32 4
510+
511+/* $fr4 */
512+static const Dwarf_Op loc_fpreg[] =
513+ {
514+ { .atom = DW_OP_regx, .number = 72 },
515+ };
516+#define nloc_fpreg 1
517+
518+#if 0
519+/* The return value is a structure and is actually stored in stack space
520+ passed in a hidden argument by the caller. Address of the location is stored
521+ in %r28 before function call, but it may be changed by function. */
522+static const Dwarf_Op loc_aggregate[] =
523+ {
524+ { .atom = DW_OP_breg28 },
525+ };
526+#define nloc_aggregate 1
527+#endif
528+
529+static int
530+parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, int pa64)
531+{
532+ Dwarf_Word regsize = pa64 ? 8 : 4;
533+
534+ /* Start with the function's type, and get the DW_AT_type attribute,
535+ which is the type of the return value. */
536+
537+ Dwarf_Attribute attr_mem;
538+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
539+ if (attr == NULL)
540+ /* The function has no return value, like a `void' function in C. */
541+ return 0;
542+
543+ Dwarf_Die die_mem;
544+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
545+ int tag = dwarf_tag (typedie);
546+
547+ /* Follow typedefs and qualifiers to get to the actual type. */
548+ while (tag == DW_TAG_typedef
549+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
550+ || tag == DW_TAG_restrict_type)
551+ {
552+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
553+ typedie = dwarf_formref_die (attr, &die_mem);
554+ tag = dwarf_tag (typedie);
555+ }
556+
557+ switch (tag)
558+ {
559+ case -1:
560+ return -1;
561+
562+ case DW_TAG_subrange_type:
563+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
564+ {
565+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
566+ typedie = dwarf_formref_die (attr, &die_mem);
567+ tag = dwarf_tag (typedie);
568+ }
569+ /* Fall through. */
570+
571+ case DW_TAG_base_type:
572+ case DW_TAG_enumeration_type:
573+ case DW_TAG_pointer_type:
574+ case DW_TAG_ptr_to_member_type:
575+ {
576+ Dwarf_Word size;
577+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
578+ &attr_mem), &size) != 0)
579+ {
580+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
581+ size = 4;
582+ else
583+ return -1;
584+ }
585+ if (tag == DW_TAG_base_type)
586+ {
587+ Dwarf_Word encoding;
588+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
589+ &attr_mem), &encoding) != 0)
590+ return -1;
591+
592+ if (encoding == DW_ATE_float)
593+ {
594+ if (pa64) {
595+ *locp = loc_fpreg;
596+ if (size <= 8)
597+ return nloc_fpreg;
598+ }
599+ else {
600+ *locp = loc_fpreg32;
601+ if (size <= 4)
602+ return nloc_fpreg32;
603+ else if (size <= 8)
604+ return nloc_fpregpair32;
605+ }
606+ goto aggregate;
607+ }
608+ }
609+ if (pa64)
610+ *locp = loc_intreg;
611+ else
612+ *locp = loc_intreg32;
613+ if (size <= regsize)
614+ return nloc_intreg;
615+ if (size <= 2 * regsize)
616+ return nloc_intregpair;
617+
618+ /* Else fall through. */
619+ }
620+
621+ case DW_TAG_structure_type:
622+ case DW_TAG_class_type:
623+ case DW_TAG_union_type:
624+ case DW_TAG_array_type:
625+ aggregate: {
626+ Dwarf_Word size;
627+ if (dwarf_aggregate_size (typedie, &size) != 0)
628+ return -1;
629+ if (pa64)
630+ *locp = loc_intreg;
631+ else
632+ *locp = loc_intreg32;
633+ if (size <= regsize)
634+ return nloc_intreg;
635+ if (size <= 2 * regsize)
636+ return nloc_intregpair;
637+#if 0
638+ /* there should be some way to know this location... But I do not see it. */
639+ *locp = loc_aggregate;
640+ return nloc_aggregate;
641+#endif
642+ /* fall through. */
643+ }
644+ }
645+
646+ /* XXX We don't have a good way to return specific errors from ebl calls.
647+ This value means we do not understand the type, but it is well-formed
648+ DWARF and might be valid. */
649+ return -2;
650+}
651+
652+int
653+parisc_return_value_location_32 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
654+{
655+ return parisc_return_value_location_ (functypedie, locp, 0);
656+}
657+
658+int
659+parisc_return_value_location_64 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
660+{
661+ return parisc_return_value_location_ (functypedie, locp, 1);
662+}
663+
664diff --git a/backends/parisc_symbol.c b/backends/parisc_symbol.c
665new file mode 100644
666index 0000000..5754bd8
667--- /dev/null
668+++ b/backends/parisc_symbol.c
669@@ -0,0 +1,113 @@
670+/* PA-RISC specific symbolic name handling.
671+ Copyright (C) 2002, 2005 Red Hat, Inc.
672+ This file is part of Red Hat elfutils.
673+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
674+
675+ Red Hat elfutils is free software; you can redistribute it and/or modify
676+ it under the terms of the GNU General Public License as published by the
677+ Free Software Foundation; version 2 of the License.
678+
679+ Red Hat elfutils is distributed in the hope that it will be useful, but
680+ WITHOUT ANY WARRANTY; without even the implied warranty of
681+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
682+ General Public License for more details.
683+
684+ You should have received a copy of the GNU General Public License along
685+ with Red Hat elfutils; if not, write to the Free Software Foundation,
686+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
687+
688+ Red Hat elfutils is an included package of the Open Invention Network.
689+ An included package of the Open Invention Network is a package for which
690+ Open Invention Network licensees cross-license their patents. No patent
691+ license is granted, either expressly or impliedly, by designation as an
692+ included package. Should you wish to participate in the Open Invention
693+ Network licensing program, please visit www.openinventionnetwork.com
694+ <http://www.openinventionnetwork.com>. */
695+
696+#ifdef HAVE_CONFIG_H
697+# include <config.h>
698+#endif
699+
700+#include <elf.h>
701+#include <stddef.h>
702+
703+#define BACKEND parisc_
704+#include "libebl_CPU.h"
705+
706+const char *
707+parisc_segment_type_name (int segment, char *buf __attribute__ ((unused)),
708+ size_t len __attribute__ ((unused)))
709+{
710+ switch (segment)
711+ {
712+ case PT_PARISC_ARCHEXT:
713+ return "PARISC_ARCHEXT";
714+ case PT_PARISC_UNWIND:
715+ return "PARISC_UNWIND";
716+ default:
717+ break;
718+ }
719+ return NULL;
720+}
721+
722+/* Return symbolic representation of symbol type. */
723+const char *
724+parisc_symbol_type_name(int symbol, char *buf __attribute__ ((unused)),
725+ size_t len __attribute__ ((unused)))
726+{
727+ if (symbol == STT_PARISC_MILLICODE)
728+ return "PARISC_MILLI";
729+ return NULL;
730+}
731+
732+/* Return symbolic representation of section type. */
733+const char *
734+parisc_section_type_name (int type,
735+ char *buf __attribute__ ((unused)),
736+ size_t len __attribute__ ((unused)))
737+{
738+ switch (type)
739+ {
740+ case SHT_PARISC_EXT:
741+ return "PARISC_EXT";
742+ case SHT_PARISC_UNWIND:
743+ return "PARISC_UNWIND";
744+ case SHT_PARISC_DOC:
745+ return "PARISC_DOC";
746+ }
747+
748+ return NULL;
749+}
750+
751+/* Check whether machine flags are valid. */
752+bool
753+parisc_machine_flag_check (GElf_Word flags)
754+{
755+ if (flags &~ (EF_PARISC_TRAPNIL | EF_PARISC_EXT | EF_PARISC_LSB |
756+ EF_PARISC_WIDE | EF_PARISC_NO_KABP |
757+ EF_PARISC_LAZYSWAP | EF_PARISC_ARCH))
758+ return 0;
759+
760+ GElf_Word arch = flags & EF_PARISC_ARCH;
761+
762+ return ((arch == EFA_PARISC_1_0) || (arch == EFA_PARISC_1_1) ||
763+ (arch == EFA_PARISC_2_0));
764+}
765+
766+/* Check for the simple reloc types. */
767+Elf_Type
768+parisc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
769+ int *addsub __attribute__ ((unused)))
770+{
771+ switch (type)
772+ {
773+ case R_PARISC_DIR64:
774+ case R_PARISC_SECREL64:
775+ return ELF_T_XWORD;
776+ case R_PARISC_DIR32:
777+ case R_PARISC_SECREL32:
778+ return ELF_T_WORD;
779+ default:
780+ return ELF_T_NUM;
781+ }
782+}
783diff --git a/libelf/elf.h b/libelf/elf.h
784index 01648bd..218ceb2 100644
785--- a/libelf/elf.h
786+++ b/libelf/elf.h
787@@ -2162,16 +2162,24 @@ enum
788 #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
789 #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
790 #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
791+#define R_PARISC_DPREL14WR 19
792+#define R_PARISC_DPREL14DR 20
793 #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
794 #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
795 #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
796 #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
797 #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
798+#define R_PARISC_DLTIND14F 39
799+#define R_PARISC_SETBASE 40
800 #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
801+#define R_PARISC_BASEREL21L 42
802+#define R_PARISC_BASEREL17R 43
803+#define R_PARISC_BASEREL14R 46
804 #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
805 #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
806 #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
807 #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
808+#define R_PARISC_PLTOFF14F 55
809 #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
810 #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
811 #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
812@@ -2180,6 +2188,7 @@ enum
813 #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
814 #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
815 #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
816+#define R_PARISC_PCREL22C 73
817 #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
818 #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
819 #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
820@@ -2205,6 +2214,8 @@ enum
821 #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
822 #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
823 #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
824+#define R_PARISC_BASEREL14WR 107
825+#define R_PARISC_BASEREL14DR 108
826 #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
827 #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
828 #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
diff --git a/meta/recipes-devtools/elfutils/files/debian/hurd_path.patch b/meta/recipes-devtools/elfutils/files/debian/hurd_path.patch
deleted file mode 100644
index 62a960f3a8..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/hurd_path.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Upstream-Status: Pending [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: elfutils-0.165/tests/run-native-test.sh
5===================================================================
6--- elfutils-0.165.orig/tests/run-native-test.sh
7+++ elfutils-0.165/tests/run-native-test.sh
8@@ -83,6 +83,9 @@ native_test()
9 # "cannot attach to process: Function not implemented".
10 [ "$(uname)" = "GNU/kFreeBSD" ] && exit 77
11
12+# hurd's /proc/$PID/maps does not give paths yet.
13+[ "$(uname)" = "GNU" ] && exit 77
14+
15 native_test ${abs_builddir}/allregs
16 native_test ${abs_builddir}/funcretval
17
diff --git a/meta/recipes-devtools/elfutils/files/debian/ignore_strmerge.diff b/meta/recipes-devtools/elfutils/files/debian/ignore_strmerge.diff
deleted file mode 100644
index 55513eeddc..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/ignore_strmerge.diff
+++ /dev/null
@@ -1,14 +0,0 @@
1Upstream-Status: Pending [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4--- elfutils-0.165.orig/tests/run-strip-strmerge.sh
5+++ elfutils-0.165/tests/run-strip-strmerge.sh
6@@ -30,7 +30,7 @@ remerged=remerged.elf
7 tempfiles $merged $stripped $debugfile $remerged
8
9 echo elflint $input
10-testrun ${abs_top_builddir}/src/elflint --gnu $input
11+testrun_on_self_skip ${abs_top_builddir}/src/elflint --gnu $input
12 echo elfstrmerge
13 testrun ${abs_top_builddir}/tests/elfstrmerge -o $merged $input
14 echo elflint $merged
diff --git a/meta/recipes-devtools/elfutils/files/debian/kfreebsd_path.patch b/meta/recipes-devtools/elfutils/files/debian/kfreebsd_path.patch
deleted file mode 100644
index e85a2fed9d..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/kfreebsd_path.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1Upstream-Status: Pending [from debian]
2Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
3
4Index: b/tests/run-native-test.sh
5===================================================================
6--- a/tests/run-native-test.sh
7+++ b/tests/run-native-test.sh
8@@ -77,6 +77,12 @@ native_test()
9 test $native -eq 0 || testrun "$@" -p $native > /dev/null
10 }
11
12+# On the Debian buildds, GNU/kFreeBSD linprocfs /proc/$PID/maps does
13+# not give absolute paths due to sbuild's bind mounts (bug #570805)
14+# therefore the next two test programs are expected to fail with
15+# "cannot attach to process: Function not implemented".
16+[ "$(uname)" = "GNU/kFreeBSD" ] && exit 77
17+
18 native_test ${abs_builddir}/allregs
19 native_test ${abs_builddir}/funcretval
20
diff --git a/meta/recipes-devtools/elfutils/files/debian/mips_backend.diff b/meta/recipes-devtools/elfutils/files/debian/mips_backend.diff
deleted file mode 100644
index 749faa403f..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/mips_backend.diff
+++ /dev/null
@@ -1,724 +0,0 @@
1From 7e0b036d087dfff7f5e306f52fc78745f99454c3 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 15:49:52 +0800
4Subject: [PATCH] mips backend
5
6Rebase to 0.177
7Upstream-Status: Pending [from debian]
8
9Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
10
11---
12 backends/Makefile.am | 6 +-
13 backends/mips_init.c | 59 ++++++++
14 backends/mips_regs.c | 104 +++++++++++++
15 backends/mips_reloc.def | 79 ++++++++++
16 backends/mips_retval.c | 321 ++++++++++++++++++++++++++++++++++++++++
17 backends/mips_symbol.c | 53 +++++++
18 libebl/eblopenbackend.c | 3 +
19 7 files changed, 623 insertions(+), 2 deletions(-)
20 create mode 100644 backends/mips_init.c
21 create mode 100644 backends/mips_regs.c
22 create mode 100644 backends/mips_reloc.def
23 create mode 100644 backends/mips_retval.c
24 create mode 100644 backends/mips_symbol.c
25
26diff --git a/backends/Makefile.am b/backends/Makefile.am
27index 4755f61..07d45d7 100644
28--- a/backends/Makefile.am
29+++ b/backends/Makefile.am
30@@ -37,7 +37,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
31 noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
32
33 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
34- tilegx m68k bpf riscv csky parisc
35+ tilegx m68k bpf riscv csky parisc mips
36
37 parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
38
39@@ -100,12 +100,14 @@ riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
40 csky_SRCS = csky_attrs.c csky_init.c csky_symbol.c csky_cfi.c \
41 csky_regs.c csky_initreg.c csky_corenote.c
42
43+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
44+
45 libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
46 $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
47 $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
48 $(ppc64_SRCS) $(s390_SRCS) $(tilegx_SRCS) \
49 $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
50- $(parisc_SRCS)
51+ $(parisc_SRCS) $(mips_SRCS)
52
53 libebl_backends_pic_a_SOURCES =
54 am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
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..261b05d
645--- /dev/null
646+++ b/backends/mips_symbol.c
647@@ -0,0 +1,53 @@
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+ int *addsub __attribute__ ((unused)))
688+{
689+ switch (type)
690+ {
691+ case R_MIPS_16:
692+ return ELF_T_HALF;
693+ case R_MIPS_32:
694+ return ELF_T_WORD;
695+ case R_MIPS_64:
696+ return ELF_T_XWORD;
697+ default:
698+ return ELF_T_NUM;
699+ }
700+}
701diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
702index 210b47e..1feac13 100644
703--- a/libebl/eblopenbackend.c
704+++ b/libebl/eblopenbackend.c
705@@ -57,6 +57,7 @@ const char *m68k_init (Elf *, GElf_Half, Ebl *, size_t);
706 const char *bpf_init (Elf *, GElf_Half, Ebl *, size_t);
707 const char *riscv_init (Elf *, GElf_Half, Ebl *, size_t);
708 const char *csky_init (Elf *, GElf_Half, Ebl *, size_t);
709+const char *mips_init (Elf *, GElf_Half, Ebl *, size_t);
710
711 /* This table should contain the complete list of architectures as far
712 as the ELF specification is concerned. */
713@@ -87,6 +88,8 @@ static const struct
714 { sparc_init, "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
715 { sparc_init, "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
716 { s390_init, "ebl_s390", "s390", 4, EM_S390, 0, 0 },
717+ { mips_init, "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
718+ { mips_init, "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 },
719
720 { NULL, "elf_m32", "m32", 3, EM_M32, 0, 0 },
721 { m68k_init, "elf_m68k", "m68k", 4, EM_68K, ELFCLASS32, ELFDATA2MSB },
722--
7232.17.1
724
diff --git a/meta/recipes-devtools/elfutils/files/debian/mips_cfi.patch b/meta/recipes-devtools/elfutils/files/debian/mips_cfi.patch
deleted file mode 100644
index dd8f88a454..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/mips_cfi.patch
+++ /dev/null
@@ -1,129 +0,0 @@
1From 5bf6117a6eaf9007ce80adbb8b66a95ca98047a4 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 17:00:30 +0800
4Subject: [PATCH] mips_cfi
5
6Upstream-Status: Pending [from debian]
7
8Rebase to 0.177
9
10Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
11
12---
13 backends/Makefile.am | 2 +-
14 backends/mips_cfi.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
15 backends/mips_init.c | 1 +
16 3 files changed, 82 insertions(+), 1 deletion(-)
17 create mode 100644 backends/mips_cfi.c
18
19diff --git a/backends/Makefile.am b/backends/Makefile.am
20index 07d45d7..dec3080 100644
21--- a/backends/Makefile.am
22+++ b/backends/Makefile.am
23@@ -100,7 +100,7 @@ riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
24 csky_SRCS = csky_attrs.c csky_init.c csky_symbol.c csky_cfi.c \
25 csky_regs.c csky_initreg.c csky_corenote.c
26
27-mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
28+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c mips_cfi.c
29
30 libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
31 $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
32diff --git a/backends/mips_cfi.c b/backends/mips_cfi.c
33new file mode 100644
34index 0000000..9ffdab5
35--- /dev/null
36+++ b/backends/mips_cfi.c
37@@ -0,0 +1,80 @@
38+/* MIPS ABI-specified defaults for DWARF CFI.
39+ Copyright (C) 2018 Kurt Roeckx, Inc.
40+ This file is part of elfutils.
41+
42+ This file is free software; you can redistribute it and/or modify
43+ it under the terms of either
44+
45+ * the GNU Lesser General Public License as published by the Free
46+ Software Foundation; either version 3 of the License, or (at
47+ your option) any later version
48+
49+ or
50+
51+ * the GNU General Public License as published by the Free
52+ Software Foundation; either version 2 of the License, or (at
53+ your option) any later version
54+
55+ or both in parallel, as here.
56+
57+ elfutils is distributed in the hope that it will be useful, but
58+ WITHOUT ANY WARRANTY; without even the implied warranty of
59+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
60+ General Public License for more details.
61+
62+ You should have received copies of the GNU General Public License and
63+ the GNU Lesser General Public License along with this program. If
64+ not, see <http://www.gnu.org/licenses/>. */
65+
66+#ifdef HAVE_CONFIG_H
67+# include <config.h>
68+#endif
69+
70+#include <dwarf.h>
71+
72+#define BACKEND mips_
73+#include "libebl_CPU.h"
74+
75+int
76+mips_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
77+{
78+ static const uint8_t abi_cfi[] =
79+ {
80+ /* Call-saved regs. */
81+ DW_CFA_same_value, ULEB128_7 (16), /* $16 */
82+ DW_CFA_same_value, ULEB128_7 (17), /* $17 */
83+ DW_CFA_same_value, ULEB128_7 (18), /* $18 */
84+ DW_CFA_same_value, ULEB128_7 (19), /* $19 */
85+ DW_CFA_same_value, ULEB128_7 (20), /* $20 */
86+ DW_CFA_same_value, ULEB128_7 (21), /* $21 */
87+ DW_CFA_same_value, ULEB128_7 (22), /* $22 */
88+ DW_CFA_same_value, ULEB128_7 (23), /* $23 */
89+ DW_CFA_same_value, ULEB128_7 (28), /* $28 */
90+ DW_CFA_same_value, ULEB128_7 (29), /* $29 */
91+ DW_CFA_same_value, ULEB128_7 (30), /* $30 */
92+
93+ DW_CFA_same_value, ULEB128_7 (52), /* $f20 */
94+ DW_CFA_same_value, ULEB128_7 (53), /* $f21 */
95+ DW_CFA_same_value, ULEB128_7 (54), /* $f22 */
96+ DW_CFA_same_value, ULEB128_7 (55), /* $f23 */
97+ DW_CFA_same_value, ULEB128_7 (56), /* $f24 */
98+ DW_CFA_same_value, ULEB128_7 (57), /* $f25 */
99+ DW_CFA_same_value, ULEB128_7 (58), /* $f26 */
100+ DW_CFA_same_value, ULEB128_7 (59), /* $f27 */
101+ DW_CFA_same_value, ULEB128_7 (60), /* $f28 */
102+ DW_CFA_same_value, ULEB128_7 (61), /* $f29 */
103+ DW_CFA_same_value, ULEB128_7 (62), /* $f30 */
104+ DW_CFA_same_value, ULEB128_7 (63), /* $f31 */
105+
106+ /* The CFA is the SP. */
107+ DW_CFA_def_cfa, ULEB128_7 (29), ULEB128_7 (0),
108+ };
109+
110+ abi_info->initial_instructions = abi_cfi;
111+ abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
112+ abi_info->data_alignment_factor = 4;
113+
114+ abi_info->return_address_register = 31; /* $31 */
115+
116+ return 0;
117+}
118diff --git a/backends/mips_init.c b/backends/mips_init.c
119index 8482e7f..bce5abe 100644
120--- a/backends/mips_init.c
121+++ b/backends/mips_init.c
122@@ -50,6 +50,7 @@ mips_init (Elf *elf __attribute__ ((unused)),
123 HOOK (eh, reloc_simple_type);
124 HOOK (eh, return_value_location);
125 HOOK (eh, register_info);
126+ HOOK (eh, abi_cfi);
127
128 return MODVERSION;
129 }
diff --git a/meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch b/meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch
deleted file mode 100644
index c6d42e163a..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/mips_readelf_w.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 7bdc83296865cf2b2a5615dbdb7ac0d441fb1849 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 16:55:01 +0800
4Subject: [PATCH] mips_readelf_w
5
6Upstream-Status: Pending [from debian]
7
8Rebase to 0.177
9
10Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
11---
12 src/readelf.c | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/src/readelf.c b/src/readelf.c
16index 2084fb1..5c02a9b 100644
17--- a/src/readelf.c
18+++ b/src/readelf.c
19@@ -11256,7 +11256,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
20 GElf_Shdr shdr_mem;
21 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
22
23- if (shdr != NULL && shdr->sh_type == SHT_PROGBITS)
24+ if (shdr != NULL && (
25+ (shdr->sh_type == SHT_PROGBITS) || (shdr->sh_type == SHT_MIPS_DWARF)))
26 {
27 static const struct
28 {
29--
302.7.4
31
diff --git a/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff b/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff
deleted file mode 100644
index e6d7948c67..0000000000
--- a/meta/recipes-devtools/elfutils/files/debian/testsuite-ignore-elflint.diff
+++ /dev/null
@@ -1,52 +0,0 @@
1From 6393b0e57872b3ffedf0dbd6784cd29694010878 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 21 Aug 2019 16:59:01 +0800
4Subject: [PATCH 1/2] testsuite-ignore-elflint
5
6Upstream-Status: Pending [from debian]
7
8Rebase to 0.177
9
10Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
11---
12 tests/run-elflint-self.sh | 2 +-
13 tests/test-subr.sh | 15 +++++++++++++++
14 2 files changed, 16 insertions(+), 1 deletion(-)
15
16diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh
17index 58fa7d0..85d21a5 100755
18--- a/tests/run-elflint-self.sh
19+++ b/tests/run-elflint-self.sh
20@@ -18,5 +18,5 @@
21
22 . $srcdir/test-subr.sh
23
24-testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
25+testrun_on_self_skip ${abs_top_builddir}/src/elflint --quiet --gnu-ld
26 testrun_on_self_compressed ${abs_top_builddir}/src/elflint --quiet --gnu-ld
27diff --git a/tests/test-subr.sh b/tests/test-subr.sh
28index 09f428d..26f61f1 100644
29--- a/tests/test-subr.sh
30+++ b/tests/test-subr.sh
31@@ -201,3 +201,18 @@ testrun_on_self_quiet()
32 # Only exit if something failed
33 if test $exit_status != 0; then exit $exit_status; fi
34 }
35+
36+# Same as testrun_on_self(), but skip on failure.
37+testrun_on_self_skip()
38+{
39+ exit_status=0
40+
41+ for file in $self_test_files; do
42+ testrun $* $file \
43+ || { echo "*** failure in $* $file"; exit_status=77; }
44+ done
45+
46+ # Only exit if something failed
47+ if test $exit_status != 0; then exit $exit_status; fi
48+}
49+
50--
512.7.4
52