summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@xilinx.com>2021-12-02 04:32:53 -0800
committerMark Hatle <mark.hatle@xilinx.com>2022-01-14 11:21:53 -0800
commitb37226b7bc52e138adcbce1b0c36d8e500293ba3 (patch)
tree36b7d9b911183ef6f43223f1468ca8faf0a32f23 /meta-microblaze/recipes-devtools
parent1314f2e725a27c598f29a01f40834b47ff017a04 (diff)
downloadmeta-xilinx-b37226b7bc52e138adcbce1b0c36d8e500293ba3.tar.gz
gdb: Upgrade to the honister version
Move from pinned gdb version 9.2 to the honister version. Note: gdb/gdbserver for the target is known to not work yet. Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools')
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc21
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-common.inc62
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross.inc30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc56
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb.inc14
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch)162
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch65
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-Initial-port-of-core-reading-support.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch)209
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch49
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch911
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch261
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch47
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-Initial-support-for-native-gdb.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch)36
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch36
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Fixing-the-issues-related-to-GDB-7.12.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch)166
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch33
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch97
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-microblaze-Adding-64-bit-MB-support.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch)2421
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch47
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch27
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-fixing-the-MAX_OPCODES-to-correct-value.patch22
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-gdb-Fix-microblaze-target-compilation-3.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0053-gdb-Fix-microblaze-target-compilation.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch144
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch45
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch46
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch279
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch24
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch359
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch33
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch113
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch114
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixing-the-branch-related-issues.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch98
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch67
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch73
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch41
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0026-Added-support-to-new-arithmetic-single-register-inst.patch169
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch40
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch953
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0042-porting-GDB-for-linux.patch151
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0043-Binutils-security-check-is-causing-build-error-for-w.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch143
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch21
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch36
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch72
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch34
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch96
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch37
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0054-Patch-MicroBlaze.patch173
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb28
67 files changed, 2579 insertions, 6138 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc b/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc
deleted file mode 100644
index 017b61ef..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc
+++ /dev/null
@@ -1,21 +0,0 @@
1LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
8 file://0001-make-man-install-relative-to-DESTDIR.patch \
9 file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \
10 file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \
11 file://0004-Add-support-for-Renesas-SH-sh4-architecture.patch \
12 file://0005-Dont-disable-libreadline.a-when-using-disable-static.patch \
13 file://0006-use-asm-sgidefs.h.patch \
14 file://0007-Use-exorted-definitions-of-SIGRTMIN.patch \
15 file://0008-Change-order-of-CFLAGS.patch \
16 file://0009-resolve-restrict-keyword-conflict.patch \
17 file://0010-Fix-invalid-sigprocmask-call.patch \
18 file://0011-gdbserver-ctrl-c-handling.patch \
19 "
20SRC_URI[md5sum] = "db95524e554870209ab7d9f8fd8dc557"
21SRC_URI[sha256sum] = "360cd7ae79b776988e89d8f9a01c985d0b1fa21c767a4295e5f88cb49175c555"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
deleted file mode 100644
index 72ede01e..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
+++ /dev/null
@@ -1,62 +0,0 @@
1SUMMARY = "GNU debugger"
2HOMEPAGE = "http://www.gnu.org/software/gdb/"
3SECTION = "devel"
4DEPENDS = "expat zlib ncurses virtual/libiconv ${LTTNGUST} bison-native"
5
6LTTNGUST = "lttng-ust"
7LTTNGUST:arc = ""
8LTTNGUST:aarch64 = ""
9LTTNGUST:mipsarch = ""
10LTTNGUST:sh4 = ""
11
12inherit autotools texinfo
13
14UPSTREAM_CHECK_GITTAGREGEX = "gdb\-(?P<pver>.+)\-release"
15
16B = "${WORKDIR}/build-${TARGET_SYS}"
17
18EXTRA_OEMAKE = "'SUBDIRS=intl mmalloc libiberty opcodes bfd sim gdb etc utils'"
19
20EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}"
21
22EXTRA_OECONF = "--disable-gdbtk --disable-x --disable-werror \
23 --with-curses --disable-multilib --disable-sim \
24 --without-lzma --without-guile \
25 ${GDBPROPREFIX} ${EXPAT} \
26 ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \
27 --disable-rpath \
28 --disable-gas --disable-binutils \
29 --disable-ld --disable-gold \
30 --disable-gprof \
31"
32
33PACKAGECONFIG ??= "readline"
34# Use --without-system-readline to compile with readline 5.
35PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline"
36PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python3,python3 python3-codecs"
37PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace"
38# ncurses is already a hard DEPENDS, but would be added here if it weren't
39PACKAGECONFIG[tui] = "--enable-tui,--disable-tui"
40
41GDBPROPREFIX = "--program-prefix=''"
42
43do_configure () {
44 # override this function to avoid the autoconf/automake/aclocal/autoheader
45 # calls for now
46 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
47 oe_runconf
48}
49
50# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
51# right bits installed by binutils. Same for bfd.info -- also from binutils.
52do_install:append() {
53 rm -rf ${D}${libdir}
54 rm -rf ${D}${includedir}
55 rm -rf ${D}${datadir}/locale
56 rm -f ${D}${infodir}/bfd.info
57}
58
59RRECOMMENDS:gdb:append_linux = " glibc-thread-db "
60RRECOMMENDS:gdb:append:linux-gnueabi = " glibc-thread-db "
61RRECOMMENDS:gdbserver:append_linux = " glibc-thread-db "
62RRECOMMENDS:gdbserver:append:linux-gnueabi = " glibc-thread-db "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc
deleted file mode 100644
index 92bff6fc..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc
+++ /dev/null
@@ -1,42 +0,0 @@
1inherit cross-canadian
2inherit python3-dir
3
4SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)"
5PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
6BPN = "gdb"
7
8DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext \
9 virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-libc"
10
11GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
12
13# Overrides PACKAGECONFIG variables in gdb-common.inc
14PACKAGECONFIG ??= "python readline"
15PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,nativesdk-python3, \
16 nativesdk-python3-core \
17 nativesdk-python3-codecs nativesdk-python3-netclient \
18 "
19PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline"
20
21SSTATE_DUPWHITELIST += "${STAGING_DATADIR}/gdb"
22
23do_configure:prepend() {
24cat > ${WORKDIR}/python << EOF
25#! /bin/sh
26case "\$2" in
27 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;;
28 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;;
29 --exec-prefix) echo "${exec_prefix}" ;;
30 *) exit 1 ;;
31esac
32exit 0
33EOF
34 chmod +x ${WORKDIR}/python
35}
36
37# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
38# right bits installed by binutils.
39do_install:append() {
40 rm -rf ${D}${exec_prefix}/lib
41 cross_canadian_bindirlinks
42}
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb
deleted file mode 100644
index 30103594..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require gdb-common.inc
2require gdb-cross-canadian.inc
3require gdb-${PV}.inc
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc
deleted file mode 100644
index 56b8726f..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc
+++ /dev/null
@@ -1,30 +0,0 @@
1require gdb-common.inc
2
3DEPENDS = "expat-native ncurses-native flex-native bison-native"
4
5inherit python3native
6
7# Overrides PACKAGECONFIG variables in gdb-common.inc
8PACKAGECONFIG ??= "python readline"
9PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3-native"
10PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline-native"
11
12do_compile:prepend() {
13 export STAGING_LIBDIR="${STAGING_LIBDIR_NATIVE}"
14 export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}"
15}
16
17#EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'"
18
19GDBPROPREFIX = ""
20
21PN = "gdb-cross-${TARGET_ARCH}"
22BPN = "gdb"
23
24# Ignore how TARGET_ARCH is computed.
25TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
26
27inherit cross
28inherit gettext
29
30datadir .= "/gdb-${TARGET_SYS}${TARGET_VENDOR}-${TARGET_OS}"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb
deleted file mode 100644
index 50cf159f..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gdb-cross.inc
2require gdb-${PV}.inc
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
index b202b114..dddbaf82 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
@@ -5,50 +5,14 @@ LTTNGUST:microblaze = ""
5FILESEXTRAPATHS:append := ":${THISDIR}/gdb" 5FILESEXTRAPATHS:append := ":${THISDIR}/gdb"
6 6
7SRC_URI:append:microblaze = " \ 7SRC_URI:append:microblaze = " \
8 file://0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \ 8 file://0001-Add-initial-port-of-linux-gdbserver.patch \
9 file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \ 9 file://0002-Initial-port-of-core-reading-support.patch \
10 file://0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \ 10 file://0003-Fix-debug-message-when-register-is-unavailable.patch \
11 file://0005-upstream-change-to-garbage-collection-sweep-causes-m.patch \ 11 file://0004-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
12 file://0006-Fix-bug-in-TLSTPREL-Relocation.patch \ 12 file://0005-Initial-support-for-native-gdb.patch \
13 file://0007-Added-Address-extension-instructions.patch \ 13 file://0006-Fixing-the-issues-related-to-GDB-7.12.patch \
14 file://0008-fixing-the-MAX_OPCODES-to-correct-value.patch \ 14 file://0007-Patch-microblaze-Adding-64-bit-MB-support.patch \
15 file://0009-Add-new-bit-field-instructions.patch \ 15 file://0008-gdb-Fix-microblaze-target-compilation-3.patch \
16 file://0010-fixing-the-imm-bug.patch \ 16 file://0009-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \
17 file://0014-intial-commit-of-MB-64-bit.patch \ 17 file://0010-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch \
18 file://0015-MB-X-initial-commit.patch \
19 file://0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
20 file://0017-Added-relocations-for-MB-X.patch \
21 file://0018-Fixed-MB-x-relocation-issues.patch \
22 file://0019-Fixing-the-branch-related-issues.patch \
23 file://0020-Fixed-address-computation-issues-with-64bit-address.patch \
24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \
25 file://0022-fixing-the-.bss-relocation-issue.patch \
26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \
27 file://0025-fixing-the-long-long-long-mingw-toolchain-issue.patch \
28 file://0026-Added-support-to-new-arithmetic-single-register-inst.patch \
29 file://0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
30 file://0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
31 file://0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
32 file://0034-Initial-port-of-core-reading-support-Added-support-f.patch \
33 file://0035-Fix-debug-message-when-register-is-unavailable.patch \
34 file://0036-revert-master-rebase-changes-to-gdbserver.patch \
35 file://0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch \
36 file://0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
37 file://0039-Initial-support-for-native-gdb.patch \
38 file://0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch \
39 file://0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch \
40 file://0042-porting-GDB-for-linux.patch \
41 file://0043-Binutils-security-check-is-causing-build-error-for-w.patch \
42 file://0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch \
43 file://0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch \
44 file://0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch \
45 file://0047-bfd-elf64-microblaze.c-Fix-build-failures.patch \
46 file://0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch \
47 file://0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch \
48 file://0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch \
49 file://0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch \
50 file://0052-sim-Allow-microblaze-architecture.patch \
51 file://0053-gdb-Fix-microblaze-target-compilation.patch \
52 file://0054-Patch-MicroBlaze.patch \
53 file://0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \
54 " 18 "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb.inc b/meta-microblaze/recipes-devtools/gdb/gdb.inc
deleted file mode 100644
index 49870fbd..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb.inc
+++ /dev/null
@@ -1,14 +0,0 @@
1require gdb-common.inc
2
3inherit gettext
4
5#LDFLAGS:append = " -s"
6#export CFLAGS:append=" -L${STAGING_LIBDIR}"
7
8# cross-canadian must not see this
9PACKAGES =+ "gdbserver"
10FILES:gdbserver = "${bindir}/gdbserver"
11
12ALLOW_EMPTY:gdbserver:riscv64 = "1"
13ALLOW_EMPTY:gdbserver:riscv32 = "1"
14
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
index c82a9883..bc1c1a93 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
@@ -1,7 +1,7 @@
1From d495e03657b25b793f7c9bdd689fdc2d1633a47b Mon Sep 17 00:00:00 2001 1From 699248a2fc4b9334f5042e1657116ac6b67b7321 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 23 Jan 2017 19:07:44 +0530 3Date: Mon, 23 Jan 2017 19:07:44 +0530
4Subject: [PATCH 33/52] Add initial port of linux gdbserver add 4Subject: [PATCH 01/10] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux 5 gdb_proc_service_h to gdbserver microblaze-linux
6 6
7gdbserver needs to initialise the microblaze registers 7gdbserver needs to initialise the microblaze registers
@@ -19,21 +19,28 @@ architecture specific setup - may need to add in future
19 19
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22
23Conflicts:
24 gdbserver/Makefile.in
22--- 25---
23 gdb/configure.host | 3 + 26 gdb/configure.host | 3 +
27 gdb/features/microblaze-linux.xml | 12 ++
24 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++ 28 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++
25 gdb/microblaze-linux-tdep.c | 29 +++- 29 gdb/microblaze-linux-tdep.c | 29 +++-
26 gdb/microblaze-tdep.c | 35 ++++- 30 gdb/microblaze-tdep.c | 35 ++++-
27 gdb/microblaze-tdep.h | 4 +- 31 gdb/microblaze-tdep.h | 4 +-
28 gdb/regformats/reg-microblaze.dat | 41 ++++++ 32 gdb/regformats/reg-microblaze.dat | 41 ++++++
29 6 files changed, 298 insertions(+), 3 deletions(-) 33 gdbserver/Makefile.in | 6 +-
34 gdbserver/configure.srv | 8 ++
35 9 files changed, 323 insertions(+), 4 deletions(-)
36 create mode 100644 gdb/features/microblaze-linux.xml
30 create mode 100644 gdb/gdbserver/linux-microblaze-low.c 37 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
31 create mode 100644 gdb/regformats/reg-microblaze.dat 38 create mode 100644 gdb/regformats/reg-microblaze.dat
32 39
33Index: gdb-9.2/gdb/configure.host 40diff --git a/gdb/configure.host b/gdb/configure.host
34=================================================================== 41index ce528237291..cf1a08e8b28 100644
35--- gdb-9.2.orig/gdb/configure.host 42--- a/gdb/configure.host
36+++ gdb-9.2/gdb/configure.host 43+++ b/gdb/configure.host
37@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;; 44@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;;
38 i[34567]86*) gdb_host_cpu=i386 ;; 45 i[34567]86*) gdb_host_cpu=i386 ;;
39 m68*) gdb_host_cpu=m68k ;; 46 m68*) gdb_host_cpu=m68k ;;
@@ -51,10 +58,29 @@ Index: gdb-9.2/gdb/configure.host
51 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) 58 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
52 gdb_host=aix ;; 59 gdb_host=aix ;;
53 powerpc*-*-freebsd*) gdb_host=fbsd ;; 60 powerpc*-*-freebsd*) gdb_host=fbsd ;;
54Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c 61diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
55=================================================================== 62new file mode 100644
63index 00000000000..8983e66eb3d
64--- /dev/null
65+++ b/gdb/features/microblaze-linux.xml
66@@ -0,0 +1,12 @@
67+<?xml version="1.0"?>
68+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
69+
70+ Copying and distribution of this file, with or without modification,
71+ are permitted in any medium without royalty provided the copyright
72+ notice and this notice are preserved. -->
73+
74+<!DOCTYPE target SYSTEM "gdb-target.dtd">
75+<target>
76+ <osabi>GNU/Linux</osabi>
77+ <xi:include href="microblaze-core.xml"/>
78+</target>
79diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
80new file mode 100644
81index 00000000000..cba5d6fc585
56--- /dev/null 82--- /dev/null
57+++ gdb-9.2/gdb/gdbserver/linux-microblaze-low.c 83+++ b/gdb/gdbserver/linux-microblaze-low.c
58@@ -0,0 +1,189 @@ 84@@ -0,0 +1,189 @@
59+/* GNU/Linux/Microblaze specific low level interface, for the remote server for 85+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
60+ GDB. 86+ GDB.
@@ -245,10 +271,10 @@ Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
245+ microblaze_collect_ptrace_register, 271+ microblaze_collect_ptrace_register,
246+ microblaze_supply_ptrace_register, 272+ microblaze_supply_ptrace_register,
247+}; 273+};
248Index: gdb-9.2/gdb/microblaze-linux-tdep.c 274diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
249=================================================================== 275index 3fc5e768120..0322b4ea813 100644
250--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c 276--- a/gdb/microblaze-linux-tdep.c
251+++ gdb-9.2/gdb/microblaze-linux-tdep.c 277+++ b/gdb/microblaze-linux-tdep.c
252@@ -37,6 +37,22 @@ 278@@ -37,6 +37,22 @@
253 #include "tramp-frame.h" 279 #include "tramp-frame.h"
254 #include "linux-tdep.h" 280 #include "linux-tdep.h"
@@ -272,17 +298,14 @@ Index: gdb-9.2/gdb/microblaze-linux-tdep.c
272 static int 298 static int
273 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 299 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
274 struct bp_target_info *bp_tgt) 300 struct bp_target_info *bp_tgt)
275@@ -46,18 +62,25 @@ microblaze_linux_memory_remove_breakpoin 301@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
276 int val;
277 int bplen;
278 gdb_byte old_contents[BREAKPOINT_MAX];
279+ struct cleanup *cleanup;
280
281 /* Determine appropriate breakpoint contents and size for this address. */ 302 /* Determine appropriate breakpoint contents and size for this address. */
282 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 303 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
283 304
284+ /* Make sure we see the memory breakpoints. */ 305+ /* Make sure we see the memory breakpoints. */
285+ cleanup = make_show_memory_breakpoints_cleanup (1); 306+ scoped_restore restore_memory
307+ = make_scoped_restore_show_memory_breakpoints (1);
308+
286 val = target_read_memory (addr, old_contents, bplen); 309 val = target_read_memory (addr, old_contents, bplen);
287 310
288 /* If our breakpoint is no longer at the address, this means that the 311 /* If our breakpoint is no longer at the address, this means that the
@@ -295,11 +318,9 @@ Index: gdb-9.2/gdb/microblaze-linux-tdep.c
295+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 318+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
296+ } 319+ }
297 320
298+ do_cleanups (cleanup);
299 return val; 321 return val;
300 } 322 }
301 323@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
302@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarc
303 /* Trampolines. */ 324 /* Trampolines. */
304 tramp_frame_prepend_unwinder (gdbarch, 325 tramp_frame_prepend_unwinder (gdbarch,
305 &microblaze_linux_sighandler_tramp_frame); 326 &microblaze_linux_sighandler_tramp_frame);
@@ -309,15 +330,16 @@ Index: gdb-9.2/gdb/microblaze-linux-tdep.c
309+ svr4_fetch_objfile_link_map); 330+ svr4_fetch_objfile_link_map);
310 } 331 }
311 332
312 void 333 void _initialize_microblaze_linux_tdep ();
313Index: gdb-9.2/gdb/microblaze-tdep.c 334diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
314=================================================================== 335index c263228856f..28c2ed9a74c 100644
315--- gdb-9.2.orig/gdb/microblaze-tdep.c 336--- a/gdb/microblaze-tdep.c
316+++ gdb-9.2/gdb/microblaze-tdep.c 337+++ b/gdb/microblaze-tdep.c
317@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR 338@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
318 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; 339 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
319 340
320 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; 341 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
342-
321+static int 343+static int
322+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 344+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
323+ struct bp_target_info *bp_tgt) 345+ struct bp_target_info *bp_tgt)
@@ -327,7 +349,6 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
327+ int val; 349+ int val;
328+ int bplen; 350+ int bplen;
329+ gdb_byte old_contents[BREAKPOINT_MAX]; 351+ gdb_byte old_contents[BREAKPOINT_MAX];
330+ struct cleanup *cleanup;
331+ 352+
332+ /* Determine appropriate breakpoint contents and size for this address. */ 353+ /* Determine appropriate breakpoint contents and size for this address. */
333+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 354+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
@@ -335,7 +356,9 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
335+ error (_("Software breakpoints not implemented for this target.")); 356+ error (_("Software breakpoints not implemented for this target."));
336+ 357+
337+ /* Make sure we see the memory breakpoints. */ 358+ /* Make sure we see the memory breakpoints. */
338+ cleanup = make_show_memory_breakpoints_cleanup (1); 359+ scoped_restore restore_memory
360+ = make_scoped_restore_show_memory_breakpoints (1);
361+
339+ val = target_read_memory (addr, old_contents, bplen); 362+ val = target_read_memory (addr, old_contents, bplen);
340+ 363+
341+ /* If our breakpoint is no longer at the address, this means that the 364+ /* If our breakpoint is no longer at the address, this means that the
@@ -346,14 +369,13 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
346+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); 369+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
347+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 370+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
348+ } 371+ }
349 372+
350+ do_cleanups (cleanup);
351+ return val; 373+ return val;
352+} 374+}
353 375
354 /* Allocate and initialize a frame cache. */ 376 /* Allocate and initialize a frame cache. */
355 377
356@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_ 378@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
357 microblaze_breakpoint::kind_from_pc); 379 microblaze_breakpoint::kind_from_pc);
358 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 380 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
359 microblaze_breakpoint::bp_from_kind); 381 microblaze_breakpoint::bp_from_kind);
@@ -361,16 +383,16 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
361 383
362 set_gdbarch_frame_args_skip (gdbarch, 8); 384 set_gdbarch_frame_args_skip (gdbarch, 8);
363 385
364@@ -770,4 +802,5 @@ When non-zero, microblaze specific debug 386@@ -771,4 +803,5 @@ When non-zero, microblaze specific debugging is enabled."),
365 NULL, 387 NULL,
366 &setdebuglist, &showdebuglist); 388 &setdebuglist, &showdebuglist);
367 389
368+ 390+
369 } 391 }
370Index: gdb-9.2/gdb/microblaze-tdep.h 392diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
371=================================================================== 393index 08af0d191c5..8a429cbf001 100644
372--- gdb-9.2.orig/gdb/microblaze-tdep.h 394--- a/gdb/microblaze-tdep.h
373+++ gdb-9.2/gdb/microblaze-tdep.h 395+++ b/gdb/microblaze-tdep.h
374@@ -117,6 +117,8 @@ struct microblaze_frame_cache 396@@ -117,6 +117,8 @@ struct microblaze_frame_cache
375 397
376 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 398 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
@@ -381,10 +403,11 @@ Index: gdb-9.2/gdb/microblaze-tdep.h
381+ 403+
382 404
383 #endif /* microblaze-tdep.h */ 405 #endif /* microblaze-tdep.h */
384Index: gdb-9.2/gdb/regformats/reg-microblaze.dat 406diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
385=================================================================== 407new file mode 100644
408index 00000000000..bd8a4384424
386--- /dev/null 409--- /dev/null
387+++ gdb-9.2/gdb/regformats/reg-microblaze.dat 410+++ b/gdb/regformats/reg-microblaze.dat
388@@ -0,0 +1,41 @@ 411@@ -0,0 +1,41 @@
389+name:microblaze 412+name:microblaze
390+expedite:r1,pc 413+expedite:r1,pc
@@ -427,3 +450,56 @@ Index: gdb-9.2/gdb/regformats/reg-microblaze.dat
427+32:fsr 450+32:fsr
428+32:slr 451+32:slr
429+32:shr 452+32:shr
453diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
454index 2bd3a578932..7bee1f1894e 100644
455--- a/gdbserver/Makefile.in
456+++ b/gdbserver/Makefile.in
457@@ -184,7 +184,8 @@ SFILES = \
458 $(srcdir)/linux-ia64-low.cc \
459 $(srcdir)/linux-low.cc \
460 $(srcdir)/linux-m68k-low.cc \
461- $(srcdir)/linux-mips-low.cc \
462+ $(srcdir)/linux-microblaze-low.c \
463+ $(srcdir)/linux-mips-low.cc \
464 $(srcdir)/linux-nios2-low.cc \
465 $(srcdir)/linux-ppc-low.cc \
466 $(srcdir)/linux-riscv-low.cc \
467@@ -221,6 +222,7 @@ SFILES = \
468 $(srcdir)/../gdb/nat/linux-namespaces.c \
469 $(srcdir)/../gdb/nat/linux-osdata.c \
470 $(srcdir)/../gdb/nat/linux-personality.c \
471+ $(srcdir)/../gdb/nat/microblaze-linux.c \
472 $(srcdir)/../gdb/nat/mips-linux-watch.c \
473 $(srcdir)/../gdb/nat/ppc-linux.c \
474 $(srcdir)/../gdb/nat/riscv-linux-tdesc.c \
475@@ -562,6 +564,8 @@ target/%.o: ../gdb/target/%.c
476
477 %-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
478 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
479+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
480+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
481
482 #
483 # Dependency tracking.
484diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
485index 0cb5072c8ab..9d68c24a92d 100644
486--- a/gdbserver/configure.srv
487+++ b/gdbserver/configure.srv
488@@ -166,6 +166,14 @@ case "${gdbserver_host}" in
489 srv_linux_usrregs=yes
490 srv_linux_thread_db=yes
491 ;;
492+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
493+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
494+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
495+ srv_xmlfiles="microblaze-linux.xml"
496+ srv_linux_regsets=yes
497+ srv_linux_usrregs=yes
498+ srv_linux_thread_db=yes
499+ ;;
500 powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
501 srv_regobj="${srv_regobj} powerpc-altivec32l.o"
502 srv_regobj="${srv_regobj} powerpc-vsx32l.o"
503--
5042.17.1
505
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
deleted file mode 100644
index bf8757ae..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ /dev/null
@@ -1,65 +0,0 @@
1From fd3110f46b2de34bddfe855aa8830c957e89d815 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 01/52] Add wdc.ext.clear and wdc.ext.flush insns
5
6Added two new instructions, wdc.ext.clear and wdc.ext.flush,
7to enable MicroBlaze to flush an external cache, which is
8used with the new coherency support for multiprocessing.
9
10Signed-off-by:nagaraju <nmekala@xilix.com>
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12---
13 opcodes/microblaze-opc.h | 5 ++++-
14 opcodes/microblaze-opcm.h | 4 ++--
15 2 files changed, 6 insertions(+), 3 deletions(-)
16
17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
18index 62ee3c9a4d..865151f95b 100644
19--- a/opcodes/microblaze-opc.h
20+++ b/opcodes/microblaze-opc.h
21@@ -91,6 +91,7 @@
22 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
23 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
24 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
25+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
26 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
27
28 /* New Mask for msrset, msrclr insns. */
29@@ -101,7 +102,7 @@
30 #define DELAY_SLOT 1
31 #define NO_DELAY_SLOT 0
32
33-#define MAX_OPCODES 289
34+#define MAX_OPCODES 291
35
36 struct op_code_struct
37 {
38@@ -174,7 +175,9 @@ struct op_code_struct
39 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
40 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
41 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
42+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
43 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
44+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
45 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
46 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
47 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
48diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
49index 5a2d3b0c8b..42f3dd3be5 100644
50--- a/opcodes/microblaze-opcm.h
51+++ b/opcodes/microblaze-opcm.h
52@@ -33,8 +33,8 @@ enum microblaze_instr
53 /* 'or/and/xor' are C++ keywords. */
54 microblaze_or, microblaze_and, microblaze_xor,
55 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
56- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
57- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
58+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br,
59+ brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
60 bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
61 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
62 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
63--
642.17.1
65
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
deleted file mode 100644
index 82287ea1..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 036f8e1d387f65e52cb021dbb1bd28e8b75cf017 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 02:27:55 +0000
4Subject: [PATCH] make man install relative to DESTDIR
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 sim/common/Makefile.in | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in
14index c6de14122c..c4b1214946 100644
15--- a/sim/common/Makefile.in
16+++ b/sim/common/Makefile.in
17@@ -35,7 +35,7 @@ tooldir = $(libdir)/$(target_alias)
18 datarootdir = @datarootdir@
19 datadir = @datadir@
20 mandir = @mandir@
21-man1dir = $(mandir)/man1
22+man1dir = $(DESTDIR)$(mandir)/man1
23 infodir = @infodir@
24 includedir = @includedir@
25
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Initial-port-of-core-reading-support.patch
index d32b501c..d49a7fe6 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Initial-port-of-core-reading-support.patch
@@ -1,25 +1,25 @@
1From e6929fae6b3850eb925ef147bf0d0b09ca80cdf8 Mon Sep 17 00:00:00 2001 1From eae6f2fc7324729056f4bd3bfa66c0c5887d7b94 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 24 Jan 2017 14:55:56 +0530 3Date: Tue, 24 Jan 2017 14:55:56 +0530
4Subject: [PATCH 34/52] Initial port of core reading support Added support for 4Subject: [PATCH 02/10] Initial port of core reading support Added support for
5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO 5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 information for rebuilding ".reg" sections of core dumps at run time. 6 information for rebuilding ".reg" sections of core dumps at run time.
7 7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10--- 10---
11 bfd/elf32-microblaze.c | 84 ++++++++++++++++++++++++++++++++++ 11 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
12 gdb/configure.tgt | 2 +- 12 gdb/configure.tgt | 2 +-
13 gdb/microblaze-linux-tdep.c | 57 +++++++++++++++++++++++ 13 gdb/microblaze-linux-tdep.c | 17 +++++++-
14 gdb/microblaze-tdep.c | 90 +++++++++++++++++++++++++++++++++++++ 14 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++
15 gdb/microblaze-tdep.h | 27 +++++++++++ 15 gdb/microblaze-tdep.h | 27 ++++++++++++
16 5 files changed, 259 insertions(+), 1 deletion(-) 16 5 files changed, 176 insertions(+), 2 deletions(-)
17 17
18Index: gdb-9.2/bfd/elf32-microblaze.c 18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
19=================================================================== 19index 1b5c2efcd6e..cfd70ae9178 100644
20--- gdb-9.2.orig/bfd/elf32-microblaze.c 20--- a/bfd/elf32-microblaze.c
21+++ gdb-9.2/bfd/elf32-microblaze.c 21+++ b/bfd/elf32-microblaze.c
22@@ -767,6 +767,87 @@ microblaze_elf_is_local_label_name (bfd 22@@ -715,6 +715,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
23 return _bfd_elf_is_local_label_name (abfd, name); 23 return _bfd_elf_is_local_label_name (abfd, name);
24 } 24 }
25 25
@@ -107,7 +107,7 @@ Index: gdb-9.2/bfd/elf32-microblaze.c
107 /* ELF linker hash entry. */ 107 /* ELF linker hash entry. */
108 108
109 struct elf32_mb_link_hash_entry 109 struct elf32_mb_link_hash_entry
110@@ -3675,4 +3756,7 @@ microblaze_elf_add_symbol_hook (bfd *abf 110@@ -3450,4 +3531,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
111 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 111 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
112 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 112 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
113 113
@@ -115,10 +115,10 @@ Index: gdb-9.2/bfd/elf32-microblaze.c
115+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo 115+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
116+ 116+
117 #include "elf32-target.h" 117 #include "elf32-target.h"
118Index: gdb-9.2/gdb/configure.tgt 118diff --git a/gdb/configure.tgt b/gdb/configure.tgt
119=================================================================== 119index a3e11c4b9b8..b8378440b23 100644
120--- gdb-9.2.orig/gdb/configure.tgt 120--- a/gdb/configure.tgt
121+++ gdb-9.2/gdb/configure.tgt 121+++ b/gdb/configure.tgt
122@@ -400,7 +400,7 @@ mep-*-*) 122@@ -400,7 +400,7 @@ mep-*-*)
123 123
124 microblaze*-linux-*|microblaze*-*-linux*) 124 microblaze*-linux-*|microblaze*-*-linux*)
@@ -128,66 +128,35 @@ Index: gdb-9.2/gdb/configure.tgt
128 symfile-mem.o linux-tdep.o" 128 symfile-mem.o linux-tdep.o"
129 gdb_sim=../sim/microblaze/libsim.a 129 gdb_sim=../sim/microblaze/libsim.a
130 ;; 130 ;;
131Index: gdb-9.2/gdb/microblaze-linux-tdep.c 131diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
132=================================================================== 132index 0322b4ea813..b8277dfd735 100644
133--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c 133--- a/gdb/microblaze-linux-tdep.c
134+++ gdb-9.2/gdb/microblaze-linux-tdep.c 134+++ b/gdb/microblaze-linux-tdep.c
135@@ -135,11 +135,54 @@ static struct tramp_frame microblaze_lin 135@@ -36,6 +36,7 @@
136 #include "frame-unwind.h"
137 #include "tramp-frame.h"
138 #include "linux-tdep.h"
139+#include "glibc-tdep.h"
140
141 static int microblaze_debug_flag = 0;
142
143@@ -135,11 +136,14 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
136 microblaze_linux_sighandler_cache_init 144 microblaze_linux_sighandler_cache_init
137 }; 145 };
138 146
139+const struct microblaze_gregset microblaze_linux_core_gregset; 147-
140+
141+static void
142+microblaze_linux_supply_core_gregset (const struct regset *regset,
143+ struct regcache *regcache,
144+ int regnum, const void *gregs, size_t len)
145+{
146+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
147+ regnum, gregs);
148+}
149+
150+static void
151+microblaze_linux_collect_core_gregset (const struct regset *regset,
152+ const struct regcache *regcache,
153+ int regnum, void *gregs, size_t len)
154+{
155+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
156+ regnum, gregs);
157+}
158+
159+static void
160+microblaze_linux_supply_core_fpregset (const struct regset *regset,
161+ struct regcache *regcache,
162+ int regnum, const void *fpregs, size_t len)
163+{
164+ /* FIXME. */
165+ microblaze_supply_fpregset (regcache, regnum, fpregs);
166+}
167+
168+static void
169+microblaze_linux_collect_core_fpregset (const struct regset *regset,
170+ const struct regcache *regcache,
171+ int regnum, void *fpregs, size_t len)
172+{
173+ /* FIXME. */
174+ microblaze_collect_fpregset (regcache, regnum, fpregs);
175+}
176
177 static void 148 static void
178 microblaze_linux_init_abi (struct gdbarch_info info, 149 microblaze_linux_init_abi (struct gdbarch_info info,
179 struct gdbarch *gdbarch) 150 struct gdbarch *gdbarch)
180 { 151 {
181+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 152+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
182+ 153+
183+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
184+ microblaze_linux_collect_core_gregset);
185+ tdep->sizeof_gregset = 200; 154+ tdep->sizeof_gregset = 200;
186+ 155+
187 linux_init_abi (info, gdbarch); 156 linux_init_abi (info, gdbarch);
188 157
189 set_gdbarch_memory_remove_breakpoint (gdbarch, 158 set_gdbarch_memory_remove_breakpoint (gdbarch,
190@@ -153,6 +196,20 @@ microblaze_linux_init_abi (struct gdbarc 159@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
191 tramp_frame_prepend_unwinder (gdbarch, 160 tramp_frame_prepend_unwinder (gdbarch,
192 &microblaze_linux_sighandler_tramp_frame); 161 &microblaze_linux_sighandler_tramp_frame);
193 162
@@ -202,109 +171,50 @@ Index: gdb-9.2/gdb/microblaze-linux-tdep.c
202+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 171+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
203+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); 172+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
204+ 173+
205+ set_gdbarch_regset_from_core_section (gdbarch,
206+ microblaze_regset_from_core_section);
207+
208 /* Enable TLS support. */ 174 /* Enable TLS support. */
209 set_gdbarch_fetch_tls_load_module_address (gdbarch, 175 set_gdbarch_fetch_tls_load_module_address (gdbarch,
210 svr4_fetch_objfile_link_map); 176 svr4_fetch_objfile_link_map);
211Index: gdb-9.2/gdb/microblaze-tdep.c 177diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
212=================================================================== 178index 28c2ed9a74c..399fa0e3dca 100644
213--- gdb-9.2.orig/gdb/microblaze-tdep.c 179--- a/gdb/microblaze-tdep.c
214+++ gdb-9.2/gdb/microblaze-tdep.c 180+++ b/gdb/microblaze-tdep.c
215@@ -137,6 +137,14 @@ microblaze_fetch_instruction (CORE_ADDR 181@@ -677,6 +677,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
216 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
217
218 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
219+static CORE_ADDR
220+microblaze_store_arguments (struct regcache *regcache, int nargs,
221+ struct value **args, CORE_ADDR sp,
222+ int struct_return, CORE_ADDR struct_addr)
223+{
224+ error (_("store_arguments not implemented"));
225+ return sp;
226+}
227 static int
228 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
229 struct bp_target_info *bp_tgt)
230@@ -541,6 +549,12 @@ microblaze_frame_base_address (struct fr
231 return cache->base;
232 }
233
234+static const struct frame_unwind *
235+microblaze_frame_sniffer (struct frame_info *next_frame)
236+{
237+ return &microblaze_frame_unwind;
238+}
239+
240 static const struct frame_base microblaze_frame_base =
241 {
242 &microblaze_frame_unwind,
243@@ -677,6 +691,71 @@ microblaze_register_g_packet_guesses (st
244 tdesc_microblaze_with_stack_protect); 182 tdesc_microblaze_with_stack_protect);
245 } 183 }
246 184
247+void 185+void
248+microblaze_supply_gregset (const struct microblaze_gregset *gregset, 186+microblaze_supply_gregset (const struct regset *regset,
249+ struct regcache *regcache, 187+ struct regcache *regcache,
250+ int regnum, const void *gregs) 188+ int regnum, const void *gregs)
251+{ 189+{
252+ unsigned int *regs = gregs; 190+ const unsigned int *regs = (const unsigned int *)gregs;
253+ if (regnum >= 0) 191+ if (regnum >= 0)
254+ regcache_raw_supply (regcache, regnum, regs + regnum); 192+ regcache->raw_supply (regnum, regs + regnum);
255+ 193+
256+ if (regnum == -1) { 194+ if (regnum == -1) {
257+ int i; 195+ int i;
258+ 196+
259+ for (i = 0; i < 50; i++) { 197+ for (i = 0; i < 50; i++) {
260+ regcache_raw_supply (regcache, i, regs + i); 198+ regcache->raw_supply (i, regs + i);
261+ } 199+ }
262+ } 200+ }
263+} 201+}
264+ 202+
265+ 203+
266+void
267+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
268+ const struct regcache *regcache,
269+ int regnum, void *gregs)
270+{
271+ /* FIXME. */
272+}
273+
274+void
275+microblaze_supply_fpregset (struct regcache *regcache,
276+ int regnum, const void *fpregs)
277+{
278+ /* FIXME. */
279+}
280+
281+void
282+microblaze_collect_fpregset (const struct regcache *regcache,
283+ int regnum, void *fpregs)
284+{
285+ /* FIXME. */
286+}
287+
288+
289+/* Return the appropriate register set for the core section identified 204+/* Return the appropriate register set for the core section identified
290+ by SECT_NAME and SECT_SIZE. */ 205+ by SECT_NAME and SECT_SIZE. */
291+ 206+
292+const struct regset * 207+static void
293+microblaze_regset_from_core_section (struct gdbarch *gdbarch, 208+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
294+ const char *sect_name, size_t sect_size) 209+ iterate_over_regset_sections_cb *cb,
210+ void *cb_data,
211+ const struct regcache *regcache)
295+{ 212+{
296+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 213+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
297+ 214+
298+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name); 215+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
299+ 216+
300+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset) 217+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
301+ return tdep->gregset;
302+
303+ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
304+ return tdep->fpregset;
305+
306+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n");
307+ return NULL;
308+} 218+}
309+ 219+
310+ 220+
@@ -312,7 +222,7 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
312 static struct gdbarch * 222 static struct gdbarch *
313 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 223 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
314 { 224 {
315@@ -733,6 +812,10 @@ microblaze_gdbarch_init (struct gdbarch_ 225@@ -733,6 +770,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
316 tdep = XCNEW (struct gdbarch_tdep); 226 tdep = XCNEW (struct gdbarch_tdep);
317 gdbarch = gdbarch_alloc (&info, tdep); 227 gdbarch = gdbarch_alloc (&info, tdep);
318 228
@@ -323,7 +233,7 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
323 set_gdbarch_long_double_bit (gdbarch, 128); 233 set_gdbarch_long_double_bit (gdbarch, 128);
324 234
325 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 235 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
326@@ -781,6 +864,13 @@ microblaze_gdbarch_init (struct gdbarch_ 236@@ -781,6 +822,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
327 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 237 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
328 if (tdesc_data != NULL) 238 if (tdesc_data != NULL)
329 tdesc_use_registers (gdbarch, tdesc, tdesc_data); 239 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
@@ -331,16 +241,16 @@ Index: gdb-9.2/gdb/microblaze-tdep.c
331+ 241+
332+ /* If we have register sets, enable the generic core file support. */ 242+ /* If we have register sets, enable the generic core file support. */
333+ if (tdep->gregset) { 243+ if (tdep->gregset) {
334+ set_gdbarch_regset_from_core_section (gdbarch, 244+ set_gdbarch_iterate_over_regset_sections (gdbarch,
335+ microblaze_regset_from_core_section); 245+ microblaze_iterate_over_regset_sections);
336+ } 246+ }
337 247
338 return gdbarch; 248 return gdbarch;
339 } 249 }
340Index: gdb-9.2/gdb/microblaze-tdep.h 250diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
341=================================================================== 251index 8a429cbf001..e91991b8dba 100644
342--- gdb-9.2.orig/gdb/microblaze-tdep.h 252--- a/gdb/microblaze-tdep.h
343+++ gdb-9.2/gdb/microblaze-tdep.h 253+++ b/gdb/microblaze-tdep.h
344@@ -22,8 +22,22 @@ 254@@ -22,8 +22,22 @@
345 255
346 256
@@ -368,10 +278,10 @@ Index: gdb-9.2/gdb/microblaze-tdep.h
368 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} 278 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
369 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} 279 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
370 280
371+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, 281+extern void microblaze_supply_gregset (const struct regset *regset,
372+ struct regcache *regcache, 282+ struct regcache *regcache,
373+ int regnum, const void *gregs); 283+ int regnum, const void *gregs);
374+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset, 284+extern void microblaze_collect_gregset (const struct regset *regset,
375+ const struct regcache *regcache, 285+ const struct regcache *regcache,
376+ int regnum, void *gregs); 286+ int regnum, void *gregs);
377+extern void microblaze_supply_fpregset (struct regcache *regcache, 287+extern void microblaze_supply_fpregset (struct regcache *regcache,
@@ -383,3 +293,6 @@ Index: gdb-9.2/gdb/microblaze-tdep.h
383+ const char *sect_name, size_t sect_size); 293+ const char *sect_name, size_t sect_size);
384 294
385 #endif /* microblaze-tdep.h */ 295 #endif /* microblaze-tdep.h */
296--
2972.17.1
298
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
deleted file mode 100644
index 6067caf6..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 6bff2862f9597f324a9385eb2f828e838e51a8a1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 23 Mar 2016 06:30:09 +0000
4Subject: [PATCH] mips-linux-nat: Define _ABIO32 if not defined
5
6This helps building gdb on mips64 on musl, since
7musl does not provide sgidefs.h this define is
8only defined when GCC is using o32 ABI, in that
9case gcc emits it as built-in define and hence
10it works ok for mips32
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 gdb/mips-linux-nat.c | 4 ++++
16 1 file changed, 4 insertions(+)
17
18diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
19index 104c972f24..7f575b3363 100644
20--- a/gdb/mips-linux-nat.c
21+++ b/gdb/mips-linux-nat.c
22@@ -41,6 +41,10 @@
23 #ifndef PTRACE_GET_THREAD_AREA
24 #define PTRACE_GET_THREAD_AREA 25
25 #endif
26+/* musl does not define and relies on compiler built-in macros for it */
27+#ifndef _ABIO32
28+#define _ABIO32 1
29+#endif
30
31 class mips_linux_nat_target final : public linux_nat_trad_target
32 {
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
deleted file mode 100644
index 28d6057a..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 1e223d69ba8c3587c18e57e22dc3b6d2c6ce5cc9 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 03/52] Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7---
8 bfd/elf-eh-frame.c | 3 +++
9 1 file changed, 3 insertions(+)
10
11Index: gdb-9.2/bfd/elf-eh-frame.c
12===================================================================
13--- gdb-9.2.orig/bfd/elf-eh-frame.c
14+++ gdb-9.2/bfd/elf-eh-frame.c
15@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
16 goto success;
17
18 free_no_table:
19+/* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
20+if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
21 _bfd_error_handler
22 /* xgettext:c-format */
23 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
24 abfd, sec);
25+}
26 hdr_info->u.dwarf.table = FALSE;
27 if (sec_info)
28 free (sec_info);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
index 9983f17f..68d90f27 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
@@ -1,18 +1,18 @@
1From c6da374fbce33b35b060a07ee446aaf1803b1e1d Mon Sep 17 00:00:00 2001 1From 80c56ef8463c23f51759f5c64ce0165e259a4071 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com> 2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000 3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 35/52] Fix debug message when register is unavailable 4Subject: [PATCH 03/10] Fix debug message when register is unavailable
5 5
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7--- 7---
8 gdb/frame.c | 13 ++++++++++--- 8 gdb/frame.c | 13 ++++++++++---
9 1 file changed, 10 insertions(+), 3 deletions(-) 9 1 file changed, 10 insertions(+), 3 deletions(-)
10 10
11Index: gdb-9.2/gdb/frame.c 11diff --git a/gdb/frame.c b/gdb/frame.c
12=================================================================== 12index c1eba5848af..fe4a0dc0dd0 100644
13--- gdb-9.2.orig/gdb/frame.c 13--- a/gdb/frame.c
14+++ gdb-9.2/gdb/frame.c 14+++ b/gdb/frame.c
15@@ -1255,12 +1255,19 @@ frame_unwind_register_value (frame_info 15@@ -1305,12 +1305,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
16 else 16 else
17 { 17 {
18 int i; 18 int i;
@@ -35,3 +35,6 @@ Index: gdb-9.2/gdb/frame.c
35 fprintf_unfiltered (gdb_stdlog, "]"); 35 fprintf_unfiltered (gdb_stdlog, "]");
36 } 36 }
37 } 37 }
38--
392.17.1
40
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
deleted file mode 100644
index c4bab7bb..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From d5817bcf2f7313699bfa85b41220d862db327664 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 18:32:14 -0700
4Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gdb/gdbserver/linux-ppc-low.c | 6 ++++++
11 gdb/nat/ppc-linux.h | 6 ++++++
12 2 files changed, 12 insertions(+)
13
14diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
15index 5d8d67bec2..ffcf65ab58 100644
16--- a/gdb/gdbserver/linux-ppc-low.c
17+++ b/gdb/gdbserver/linux-ppc-low.c
18@@ -23,7 +23,13 @@
19 #include "elf/common.h"
20 #include <sys/uio.h>
21 #include <elf.h>
22+#if !defined(__GLIBC__)
23+# define pt_regs uapi_pt_regs
24+#endif
25 #include <asm/ptrace.h>
26+#if !defined(__GLIBC__)
27+# undef pt_regs
28+#endif
29
30 #include "arch/ppc-linux-common.h"
31 #include "arch/ppc-linux-tdesc.h"
32diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
33index d937a65b69..1fd54b4a0e 100644
34--- a/gdb/nat/ppc-linux.h
35+++ b/gdb/nat/ppc-linux.h
36@@ -18,7 +18,13 @@
37 #ifndef NAT_PPC_LINUX_H
38 #define NAT_PPC_LINUX_H
39
40+#if !defined(__GLIBC__)
41+# define pt_regs uapi_pt_regs
42+#endif
43 #include <asm/ptrace.h>
44+#if !defined(__GLIBC__)
45+# undef pt_regs
46+#endif
47 #include <asm/cputable.h>
48
49 /* This sometimes isn't defined. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch
deleted file mode 100644
index fd165d4b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch
+++ /dev/null
@@ -1,911 +0,0 @@
1From 505f10a0ea1a8bba0584859d9a348bb779593ec2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 02:31:12 +0000
4Subject: [PATCH] Add support for Renesas SH (sh4) architecture.
5
6gdb (7.4-1~cvs20111117.2) experimental; urgency=low
7 .
8 * Add Renesas SH (sh4) support (Closes: #576242)
9 - Thanks Nobuhiro Iwamatsu, Takashi Yoshii.
10Author: Hector Oron <zumbi@debian.org>
11Bug-Debian: http://bugs.debian.org/576242
12
13Upstream-Status: Pending
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 gdb/Makefile.in | 2 +
17 gdb/configure.host | 1 +
18 gdb/sh-linux-tdep.c | 519 +++++++++++++++++++++++++++
19 gdb/sh-tdep.c | 53 ++-
20 gdb/sh-tdep.h | 49 +++
21 gdb/testsuite/gdb.asm/asm-source.exp | 5 +
22 gdb/testsuite/gdb.asm/sh.inc | 3 +-
23 gdb/testsuite/gdb.base/annota1.c | 3 +
24 gdb/testsuite/gdb.base/annota3.c | 4 +
25 gdb/testsuite/gdb.base/sigall.c | 3 +
26 gdb/testsuite/gdb.base/signals.c | 4 +
27 11 files changed, 617 insertions(+), 29 deletions(-)
28
29diff --git a/gdb/Makefile.in b/gdb/Makefile.in
30index c3e074b21f..42dd7af59c 100644
31--- a/gdb/Makefile.in
32+++ b/gdb/Makefile.in
33@@ -2317,6 +2317,8 @@ ALLDEPFILES = \
34 sh-nbsd-nat.c \
35 sh-nbsd-tdep.c \
36 sh-tdep.c \
37+ sh-linux-tdep.c \
38+ sh-linux-nat.c \
39 sol2-tdep.c \
40 solib-aix.c \
41 solib-svr4.c \
42diff --git a/gdb/configure.host b/gdb/configure.host
43index ce52823729..5b5173a71a 100644
44--- a/gdb/configure.host
45+++ b/gdb/configure.host
46@@ -148,6 +148,7 @@ riscv*-*-linux*) gdb_host=linux ;;
47
48 s390*-*-linux*) gdb_host=linux ;;
49
50+sh*-*-linux*) gdb_host=linux ;;
51 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
52 gdb_host=nbsd ;;
53 sh*-*-openbsd*) gdb_host=nbsd ;;
54diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
55index 13c10eeeda..1d0d583a64 100644
56--- a/gdb/sh-linux-tdep.c
57+++ b/gdb/sh-linux-tdep.c
58@@ -18,14 +18,37 @@
59 along with this program. If not, see <http://www.gnu.org/licenses/>. */
60
61 #include "defs.h"
62+#include "gdbcore.h"
63+#include "frame.h"
64+#include "frame-base.h"
65+#include "frame-unwind.h"
66+#include "dwarf2-frame.h"
67+#include "value.h"
68+#include "regcache.h"
69+#include "inferior.h"
70 #include "osabi.h"
71
72+#include "reggroups.h"
73+#include "arch-utils.h"
74+#include "floatformat.h"
75 #include "solib-svr4.h"
76 #include "symtab.h"
77+#include "gdb_string.h"
78+#include "command.h"
79+#include "gdb_assert.h"
80
81 #include "trad-frame.h"
82 #include "tramp-frame.h"
83
84+#include <sys/ptrace.h>
85+#include <sys/types.h>
86+#include <sys/param.h>
87+#include <sys/user.h>
88+#include <sys/syscall.h>
89+
90+#include <asm/ptrace.h>
91+
92+#include "regset.h"
93 #include "glibc-tdep.h"
94 #include "sh-tdep.h"
95 #include "linux-tdep.h"
96@@ -181,9 +204,505 @@ static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = {
97 sh_linux_rt_sigreturn_init
98 };
99
100+/* Recognizing signal handler frames. */
101+
102+/* GNU/Linux has two flavors of signals. Normal signal handlers, and
103+ "realtime" (RT) signals. The RT signals can provide additional
104+ information to the signal handler if the SA_SIGINFO flag is set
105+ when establishing a signal handler using `sigaction'. It is not
106+ unlikely that future versions of GNU/Linux will support SA_SIGINFO
107+ for normal signals too. */
108+
109+/* When the SH Linux kernel calls a signal handler and the
110+ SA_RESTORER flag isn't set, the return address points to a bit of
111+ code on the stack. This function returns whether the PC appears to
112+ be within this bit of code.
113+
114+ The instruction sequence for normal signals is
115+ mov.w 1f,r3
116+ trapa #16
117+ or r0, r0
118+ or r0, r0
119+ or r0, r0
120+ or r0, r0
121+ or r0, r0
122+ 1: .word __NR_sigreturn
123+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077.
124+
125+ Checking for the code sequence should be somewhat reliable, because
126+ the effect is to call the system call sigreturn. This is unlikely
127+ to occur anywhere other than a signal trampoline.
128+
129+ It kind of sucks that we have to read memory from the process in
130+ order to identify a signal trampoline, but there doesn't seem to be
131+ any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
132+ only call us if no function name could be identified, which should
133+ be the case since the code is on the stack.
134+
135+ Detection of signal trampolines for handlers that set the
136+ SA_RESTORER flag is in general not possible. Unfortunately this is
137+ what the GNU C Library has been doing for quite some time now.
138+ However, as of version 2.1.2, the GNU C Library uses signal
139+ trampolines (named __restore and __restore_rt) that are identical
140+ to the ones used by the kernel. Therefore, these trampolines are
141+ supported too. */
142+
143+#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
144+#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */
145+#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
146+
147+#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
148+#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
149+#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
150+
151+static const unsigned short linux_sigtramp_code[] =
152+{
153+ LINUX_SIGTRAMP_INSN0,
154+ LINUX_SIGTRAMP_INSN1,
155+ LINUX_SIGTRAMP_INSN2,
156+ LINUX_SIGTRAMP_INSN2,
157+ LINUX_SIGTRAMP_INSN2,
158+ LINUX_SIGTRAMP_INSN2,
159+ LINUX_SIGTRAMP_INSN2,
160+ __NR_sigreturn
161+};
162+
163+#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
164+
165+/* If PC is in a sigtramp routine, return the address of the start of
166+ the routine. Otherwise, return 0. */
167+
168+static CORE_ADDR
169+sh_linux_sigtramp_start (struct frame_info *next_frame)
170+{
171+ CORE_ADDR pc = get_frame_pc (next_frame);
172+ gdb_byte buf[LINUX_SIGTRAMP_LEN];
173+
174+ /* We only recognize a signal trampoline if PC is at the start of
175+ one of the three instructions. We optimize for finding the PC at
176+ the start, as will be the case when the trampoline is not the
177+ first frame on the stack. We assume that in the case where the
178+ PC is not at the start of the instruction sequence, there will be
179+ a few trailing readable bytes on the stack. */
180+
181+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
182+ return 0;
183+
184+ if (buf[0] != LINUX_SIGTRAMP_INSN0)
185+ {
186+ if (buf[0] != LINUX_SIGTRAMP_INSN1)
187+ return 0;
188+
189+ pc -= 2;
190+
191+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
192+ return 0;
193+ }
194+
195+ if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
196+ return 0;
197+
198+ return pc;
199+}
200+
201+/* This function does the same for RT signals. Here the instruction
202+ sequence is
203+ mov.w 1f,r3
204+ trapa #16
205+ or r0, r0
206+ or r0, r0
207+ or r0, r0
208+ or r0, r0
209+ or r0, r0
210+ 1: .word __NR_rt_sigreturn
211+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad.
212+
213+ The effect is to call the system call rt_sigreturn. */
214+
215+#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
216+#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
217+#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
218+
219+static const unsigned short linux_rt_sigtramp_code[] =
220+{
221+ LINUX_RT_SIGTRAMP_INSN0,
222+ LINUX_RT_SIGTRAMP_INSN1,
223+ LINUX_RT_SIGTRAMP_INSN2,
224+ LINUX_RT_SIGTRAMP_INSN2,
225+ LINUX_RT_SIGTRAMP_INSN2,
226+ LINUX_RT_SIGTRAMP_INSN2,
227+ LINUX_RT_SIGTRAMP_INSN2,
228+ __NR_rt_sigreturn
229+};
230+
231+#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
232+
233+/* If PC is in a RT sigtramp routine, return the address of the start
234+ of the routine. Otherwise, return 0. */
235+
236+static CORE_ADDR
237+sh_linux_rt_sigtramp_start (struct frame_info *next_frame)
238+{
239+ CORE_ADDR pc = get_frame_pc (next_frame);
240+ gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
241+
242+ /* We only recognize a signal trampoline if PC is at the start of
243+ one of the two instructions. We optimize for finding the PC at
244+ the start, as will be the case when the trampoline is not the
245+ first frame on the stack. We assume that in the case where the
246+ PC is not at the start of the instruction sequence, there will be
247+ a few trailing readable bytes on the stack. */
248+
249+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
250+ return 0;
251+
252+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
253+ {
254+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
255+ return 0;
256+
257+ pc -= 2;
258+
259+ if (!safe_frame_unwind_memory (next_frame, pc, buf,
260+ LINUX_RT_SIGTRAMP_LEN))
261+ return 0;
262+ }
263+
264+ if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
265+ return 0;
266+
267+ return pc;
268+}
269+
270+/* Return whether PC is in a GNU/Linux sigtramp routine. */
271+
272+static int
273+sh_linux_sigtramp_p (struct frame_info *this_frame)
274+{
275+ CORE_ADDR pc = get_frame_pc (this_frame);
276+ char *name;
277+
278+ find_pc_partial_function (pc, &name, NULL, NULL);
279+
280+ /* If we have NAME, we can optimize the search. The trampolines are
281+ named __restore and __restore_rt. However, they aren't dynamically
282+ exported from the shared C library, so the trampoline may appear to
283+ be part of the preceding function. This should always be sigaction,
284+ __sigaction, or __libc_sigaction (all aliases to the same function). */
285+ if (name == NULL || strstr (name, "sigaction") != NULL)
286+ return (sh_linux_sigtramp_start (this_frame) != 0
287+ || sh_linux_rt_sigtramp_start (this_frame) != 0);
288+
289+ return (strcmp ("__restore", name) == 0
290+ || strcmp ("__restore_rt", name) == 0);
291+}
292+
293+/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
294+#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12
295+
296+
297+/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
298+ routine, return the address of the associated sigcontext structure. */
299+
300+static CORE_ADDR
301+sh_linux_sigcontext_addr (struct frame_info *this_frame)
302+{
303+ CORE_ADDR pc;
304+ CORE_ADDR sp;
305+
306+ sp = get_frame_register_unsigned (this_frame, SP_REGNUM);
307+
308+ pc = sh_linux_sigtramp_start (this_frame);
309+ if (pc)
310+ {
311+ return sp;
312+ }
313+
314+ pc = sh_linux_rt_sigtramp_start (this_frame);
315+ if (pc)
316+ {
317+ CORE_ADDR ucontext_addr;
318+
319+ /* The sigcontext structure is part of the user context. A
320+ pointer to the user context is passed as the third argument
321+ to the signal handler. */
322+ ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2);
323+ return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
324+ }
325+
326+ error ("Couldn't recognize signal trampoline.");
327+ return 0;
328+}
329+
330+/* Signal trampolines. */
331+extern struct sh_frame_cache *sh_alloc_frame_cache (void);
332+
333+static struct sh_frame_cache *
334+sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
335+{
336+ struct sh_frame_cache *cache;
337+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ());
338+ CORE_ADDR sigcontext_addr;
339+
340+ if (*this_cache)
341+ return *this_cache;
342+
343+ cache = sh_alloc_frame_cache ();
344+
345+ cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM);
346+ sigcontext_addr = tdep->sigcontext_addr (this_frame);
347+ if (tdep->sc_reg_offset)
348+ {
349+ int i;
350+
351+ gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS);
352+
353+ for (i = 0; i < tdep->sc_num_regs; i++)
354+ if (tdep->sc_reg_offset[i] != -1)
355+ cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i];
356+ }
357+
358+ *this_cache = cache;
359+ return cache;
360+}
361+
362+static void
363+sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
364+ struct frame_id *this_id)
365+{
366+ struct sh_frame_cache *cache =
367+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
368+
369+ (*this_id) = frame_id_build (cache->base + 64, cache->pc);
370+}
371+
372+extern struct value * sh_frame_prev_register ();
373+static struct value *
374+sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
375+ void **this_cache, int regnum)
376+{
377+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
378+
379+ return sh_frame_prev_register (this_frame, this_cache, regnum);
380+}
381+
382+static int
383+sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
384+ struct frame_info *this_frame,
385+ void **this_prologue_cache)
386+{
387+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
388+
389+ /* We shouldn't even bother if we don't have a sigcontext_addr
390+ handler. */
391+ if (tdep->sigcontext_addr == NULL)
392+ return 0;
393+
394+ if (tdep->sigtramp_p != NULL)
395+ {
396+ if (tdep->sigtramp_p (this_frame))
397+ return 1;
398+ }
399+
400+ return 0;
401+}
402+
403+static const struct frame_unwind sh_linux_sigtramp_frame_unwind =
404+{
405+ SIGTRAMP_FRAME,
406+ sh_linux_sigtramp_frame_this_id,
407+ sh_linux_sigtramp_frame_prev_register,
408+ NULL,
409+ sh_linux_sigtramp_frame_sniffer
410+};
411+
412+/* Supply register REGNUM from the buffer specified by GREGS and LEN
413+ in the general-purpose register set REGSET to register cache
414+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
415+
416+void
417+sh_supply_gregset (const struct regset *regset, struct regcache *regcache,
418+ int regnum, const void *gregs, size_t len)
419+{
420+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
421+ const char *regs = gregs;
422+ int i;
423+
424+ gdb_assert (len == tdep->sizeof_gregset);
425+
426+ for (i = 0; i < tdep->gregset_num_regs; i++)
427+ {
428+ if ((regnum == i || regnum == -1)
429+ && tdep->gregset_reg_offset[i] != -1)
430+ regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]);
431+ }
432+}
433+
434+/* Collect register REGNUM from the register cache REGCACHE and store
435+ it in the buffer specified by GREGS and LEN as described by the
436+ general-purpose register set REGSET. If REGNUM is -1, do this for
437+ all registers in REGSET. */
438+
439+void
440+sh_collect_gregset (const struct regset *regset,
441+ const struct regcache *regcache,
442+ int regnum, void *gregs, size_t len)
443+{
444+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
445+ char *regs = gregs;
446+ int i;
447+
448+ gdb_assert (len == tdep->sizeof_gregset);
449+
450+ for (i = 0; i < tdep->gregset_num_regs; i++)
451+ {
452+ if ((regnum == i || regnum == -1)
453+ && tdep->gregset_reg_offset[i] != -1)
454+ regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]);
455+ }
456+}
457+
458+/* Supply register REGNUM from the buffer specified by FPREGS and LEN
459+ in the floating-point register set REGSET to register cache
460+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
461+
462+static void
463+sh_supply_fpregset (const struct regset *regset, struct regcache *regcache,
464+ int regnum, const void *fpregs, size_t len)
465+{
466+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
467+ const char *regs = fpregs;
468+ int i;
469+
470+ gdb_assert (len == tdep->sizeof_fpregset);
471+ for (i = 0; i < 16; i++)
472+ {
473+ if (regnum == i+25 || regnum == -1)
474+ regcache_raw_supply (regcache, i+25, regs + i*4);
475+ }
476+ if (regnum == FPSCR_REGNUM || regnum == -1)
477+ regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4);
478+ if (regnum == FPUL_REGNUM || regnum == -1)
479+ regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4);
480+}
481+
482+/* Collect register REGNUM from the register cache REGCACHE and store
483+ it in the buffer specified by FPREGS and LEN as described by the
484+ floating-point register set REGSET. If REGNUM is -1, do this for
485+ all registers in REGSET. */
486+
487+static void
488+sh_collect_fpregset (const struct regset *regset,
489+ const struct regcache *regcache,
490+ int regnum, void *fpregs, size_t len)
491+{
492+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
493+ char *regs = fpregs;
494+ int i;
495+
496+ gdb_assert (len == tdep->sizeof_fpregset);
497+ for (i = 0; i < 16; i++)
498+ {
499+ if (regnum == i+25 || regnum == -1)
500+ regcache_raw_collect (regcache, i+25, regs + i*4);
501+ }
502+ if (regnum == FPSCR_REGNUM || regnum == -1)
503+ regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4);
504+ if (regnum == FPUL_REGNUM || regnum == -1)
505+ regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4);
506+}
507+
508+/* Return the appropriate register set for the core section identified
509+ by SECT_NAME and SECT_SIZE. */
510+
511+const struct regset *
512+sh_linux_regset_from_core_section (struct gdbarch *gdbarch,
513+ const char *sect_name, size_t sect_size)
514+{
515+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
516+
517+ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
518+ {
519+ if (tdep->gregset == NULL)
520+ tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset,
521+ sh_collect_gregset);
522+ return tdep->gregset;
523+ }
524+
525+ if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset))
526+ {
527+ if (tdep->fpregset == NULL)
528+ tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset,
529+ sh_collect_fpregset);
530+ return tdep->fpregset;
531+ }
532+
533+ return NULL;
534+}
535+
536+/* The register sets used in GNU/Linux ELF core-dumps are identical to
537+ the register sets in `struct user' that are used for a.out
538+ core-dumps. These are also used by ptrace(2). The corresponding
539+ types are `elf_gregset_t' for the general-purpose registers (with
540+ `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
541+ for the floating-point registers.
542+
543+ Those types used to be available under the names `gregset_t' and
544+ `fpregset_t' too, and GDB used those names in the past. But those
545+ names are now used for the register sets used in the `mcontext_t'
546+ type, which have a different size and layout. */
547+
548+/* Mapping between the general-purpose registers in `struct user'
549+ format and GDB's register cache layout. */
550+
551+/* From <sys/reg.h>. */
552+static int sh_linux_gregset_reg_offset[] =
553+{
554+ 0, 4, 8, 12, 16, 20, 24, 28,
555+ 32, 36, 40, 44, 48, 52, 56, 60,
556+
557+ REG_PC*4, REG_PR*4, REG_GBR*4, -1,
558+ REG_MACH*4, REG_MACL*4, REG_SR*4,
559+};
560+
561+/* Mapping between the general-purpose registers in `struct
562+ sigcontext' format and GDB's register cache layout. */
563+
564+/* From <asm/sigcontext.h>. */
565+static int sh_linux_sc_reg_offset[] =
566+{
567+ 4, 8, 12, 16, 20, 24, 28, 32,
568+ 36, 40, 44, 48, 52, 56, 60, 64,
569+ 68, 72, 80, -1,
570+ 84, 88, 76
571+};
572+
573 static void
574 sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
575 {
576+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
577+ bfd abfd;
578+
579+ tdep->gregset_reg_offset = sh_linux_gregset_reg_offset;
580+ tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset);
581+ tdep->sizeof_gregset = 23 * 4;
582+
583+ tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */
584+
585+ tdep->sigtramp_p = sh_linux_sigtramp_p;
586+ tdep->sigcontext_addr = sh_linux_sigcontext_addr;
587+ tdep->sc_reg_offset = sh_linux_sc_reg_offset;
588+ tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset);
589+
590+ frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind);
591+
592+ /* If we have a register mapping, enable the generic core file
593+ support, unless it has already been enabled. */
594+ if (tdep->gregset_reg_offset
595+ && !gdbarch_regset_from_core_section_p (gdbarch))
596+ set_gdbarch_regset_from_core_section (gdbarch,
597+ sh_linux_regset_from_core_section);
598+
599 linux_init_abi (info, gdbarch);
600
601 /* GNU/Linux uses SVR4-style shared libraries. */
602diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
603index e3aee0ac28..5958cf3688 100644
604--- a/gdb/sh-tdep.c
605+++ b/gdb/sh-tdep.c
606@@ -21,6 +21,9 @@
607 sac@cygnus.com. */
608
609 #include "defs.h"
610+#include "arch-utils.h"
611+#include "command.h"
612+#include "dummy-frame.h"
613 #include "frame.h"
614 #include "frame-base.h"
615 #include "frame-unwind.h"
616@@ -66,23 +69,6 @@ static const char *const sh_cc_enum[] = {
617
618 static const char *sh_active_calling_convention = sh_cc_gcc;
619
620-#define SH_NUM_REGS 67
621-
622-struct sh_frame_cache
623-{
624- /* Base address. */
625- CORE_ADDR base;
626- LONGEST sp_offset;
627- CORE_ADDR pc;
628-
629- /* Flag showing that a frame has been created in the prologue code. */
630- int uses_fp;
631-
632- /* Saved registers. */
633- CORE_ADDR saved_regs[SH_NUM_REGS];
634- CORE_ADDR saved_sp;
635-};
636-
637 static int
638 sh_is_renesas_calling_convention (struct type *func_type)
639 {
640@@ -1050,7 +1036,7 @@ sh_treat_as_flt_p (struct type *type)
641 return 0;
642 /* Otherwise if the type of that member is float, the whole type is
643 treated as float. */
644- if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT)
645+ if (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) == TYPE_CODE_FLT)
646 return 1;
647 /* Otherwise it's not treated as float. */
648 return 0;
649@@ -1100,7 +1086,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
650 in four registers available. Loop thru args from first to last. */
651 for (argnum = 0; argnum < nargs; argnum++)
652 {
653- type = value_type (args[argnum]);
654+ type = check_typedef (value_type (args[argnum]));
655 len = TYPE_LENGTH (type);
656 val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
657
658@@ -1835,7 +1821,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
659 reg->how = DWARF2_FRAME_REG_UNDEFINED;
660 }
661
662-static struct sh_frame_cache *
663+struct sh_frame_cache *
664 sh_alloc_frame_cache (void)
665 {
666 struct sh_frame_cache *cache;
667@@ -1862,7 +1848,7 @@ sh_alloc_frame_cache (void)
668 return cache;
669 }
670
671-static struct sh_frame_cache *
672+struct sh_frame_cache *
673 sh_frame_cache (struct frame_info *this_frame, void **this_cache)
674 {
675 struct gdbarch *gdbarch = get_frame_arch (this_frame);
676@@ -1929,9 +1915,9 @@ sh_frame_cache (struct frame_info *this_frame, void **this_cache)
677 return cache;
678 }
679
680-static struct value *
681-sh_frame_prev_register (struct frame_info *this_frame,
682- void **this_cache, int regnum)
683+struct value *
684+sh_frame_prev_register (struct frame_info *this_frame, void **this_cache,
685+ int regnum)
686 {
687 struct gdbarch *gdbarch = get_frame_arch (this_frame);
688 struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
689@@ -1945,7 +1931,7 @@ sh_frame_prev_register (struct frame_info *this_frame,
690 the current frame. Frob regnum so that we pull the value from
691 the correct place. */
692 if (regnum == gdbarch_pc_regnum (gdbarch))
693- regnum = PR_REGNUM;
694+ regnum = PR_REGNUM; /* XXX: really? */
695
696 if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
697 return frame_unwind_got_memory (this_frame, regnum,
698@@ -2234,8 +2220,8 @@ sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
699 static struct gdbarch *
700 sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
701 {
702- struct gdbarch *gdbarch;
703 struct gdbarch_tdep *tdep;
704+ struct gdbarch *gdbarch;
705
706 /* If there is already a candidate, use it. */
707 arches = gdbarch_list_lookup_by_info (arches, &info);
708@@ -2247,6 +2233,18 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
709 tdep = XCNEW (struct gdbarch_tdep);
710 gdbarch = gdbarch_alloc (&info, tdep);
711
712+ /* General-purpose registers. */
713+ tdep->gregset = NULL;
714+ tdep->gregset_reg_offset = NULL;
715+ tdep->gregset_num_regs = 23;
716+ tdep->sizeof_gregset = 0;
717+
718+ /* Floating-point registers. */
719+ tdep->fpregset = NULL;
720+ tdep->sizeof_fpregset = 34*4;
721+
722+ tdep->jb_pc_offset = -1;
723+
724 set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
725 set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
726 set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
727@@ -2398,10 +2396,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
728 break;
729 }
730
731+ dwarf2_append_unwinders (gdbarch);
732+
733 /* Hook in ABI-specific overrides, if they have been registered. */
734 gdbarch_init_osabi (info, gdbarch);
735
736- dwarf2_append_unwinders (gdbarch);
737 frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
738 frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
739
740diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
741index 76e2e76e39..2710f63010 100644
742--- a/gdb/sh-tdep.h
743+++ b/gdb/sh-tdep.h
744@@ -21,6 +21,12 @@
745
746 /* Contributed by Steve Chamberlain sac@cygnus.com. */
747
748+struct frame_info;
749+struct gdbarch;
750+struct reggroup;
751+struct regset;
752+struct regcache;
753+
754 /* Registers for all SH variants. Used also by sh3-rom.c. */
755 enum
756 {
757@@ -29,6 +35,7 @@ enum
758 ARG0_REGNUM = 4,
759 ARGLAST_REGNUM = 7,
760 FP_REGNUM = 14,
761+ SP_REGNUM = 15,
762 PC_REGNUM = 16,
763 PR_REGNUM = 17,
764 GBR_REGNUM = 18,
765@@ -81,6 +88,24 @@ enum
766 FV0_REGNUM = 76,
767 FV_LAST_REGNUM = 79
768 };
769+#define SH_NUM_REGS 67
770+
771+struct sh_frame_cache
772+{
773+ /* Base address. */
774+ CORE_ADDR base;
775+ LONGEST sp_offset;
776+ CORE_ADDR pc;
777+
778+ /* Flag showing that a frame has been created in the prologue code. */
779+ int uses_fp;
780+
781+ /* Saved registers. */
782+ CORE_ADDR saved_regs[SH_NUM_REGS];
783+ CORE_ADDR saved_sp;
784+};
785+
786+extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache);
787
788 /* This structure describes a register in a core-file. */
789 struct sh_corefile_regmap
790@@ -89,8 +114,32 @@ struct sh_corefile_regmap
791 unsigned int offset;
792 };
793
794+/* sh architecture specific information. */
795 struct gdbarch_tdep
796 {
797+ /* General-purpose registers. */
798+ struct regset *gregset;
799+ int *gregset_reg_offset;
800+ int gregset_num_regs;
801+ size_t sizeof_gregset;
802+
803+ /* Floating-point registers. */
804+ struct regset *fpregset;
805+ size_t sizeof_fpregset;
806+
807+ /* Offset of saved PC in jmp_buf. */
808+ int jb_pc_offset;
809+
810+ /* Detect sigtramp. */
811+ int (*sigtramp_p) (struct frame_info *);
812+
813+ /* Get address of sigcontext for sigtramp. */
814+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
815+
816+ /* Offset of registers in `struct sigcontext'. */
817+ int *sc_reg_offset;
818+ int sc_num_regs;
819+
820 /* Non-NULL when debugging from a core file. Provides the offset
821 where each general-purpose register is stored inside the associated
822 core file section. */
823diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
824index 4914498f98..6e25cbed18 100644
825--- a/gdb/testsuite/gdb.asm/asm-source.exp
826+++ b/gdb/testsuite/gdb.asm/asm-source.exp
827@@ -116,6 +116,11 @@ switch -glob -- [istarget] {
828 append link-flags " -m elf32ppc"
829 }
830 }
831+ "sh*-linux*" {
832+ set asm-arch sh-linux
833+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
834+ set debug-flags "-gdwarf-2"
835+ }
836 "sh*-*-*" {
837 set asm-arch sh
838 set debug-flags "-gdwarf-2"
839diff --git a/gdb/testsuite/gdb.asm/sh.inc b/gdb/testsuite/gdb.asm/sh.inc
840index a4a5fc545e..89efed7795 100644
841--- a/gdb/testsuite/gdb.asm/sh.inc
842+++ b/gdb/testsuite/gdb.asm/sh.inc
843@@ -40,9 +40,8 @@
844 mov.l .Lconst\@,r1
845 bra .Lafterconst\@
846 nop
847- nop
848-.Lconst\@:
849 .align 2
850+.Lconst\@:
851 .long \subr
852 .align 1
853 .Lafterconst\@:
854diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c
855index 424e1b8327..0de2e7b633 100644
856--- a/gdb/testsuite/gdb.base/annota1.c
857+++ b/gdb/testsuite/gdb.base/annota1.c
858@@ -1,6 +1,9 @@
859 #include <stdio.h>
860 #include <signal.h>
861
862+#ifdef __sh__
863+#define signal(a,b) /* Signals not supported on this target - make them go away */
864+#endif
865
866 void
867 handle_USR1 (int sig)
868diff --git a/gdb/testsuite/gdb.base/annota3.c b/gdb/testsuite/gdb.base/annota3.c
869index 424e1b8327..952aaf218a 100644
870--- a/gdb/testsuite/gdb.base/annota3.c
871+++ b/gdb/testsuite/gdb.base/annota3.c
872@@ -1,6 +1,10 @@
873 #include <stdio.h>
874 #include <signal.h>
875
876+#ifdef __sh__
877+#define signal(a,b) /* Signals not supported on this target - make them go away */
878+#endif
879+
880
881 void
882 handle_USR1 (int sig)
883diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c
884index 81f3b08d6b..1574b2d6cb 100644
885--- a/gdb/testsuite/gdb.base/sigall.c
886+++ b/gdb/testsuite/gdb.base/sigall.c
887@@ -1,6 +1,9 @@
888 #include <signal.h>
889 #include <unistd.h>
890
891+#ifdef __sh__
892+#define signal(a,b) /* Signals not supported on this target - make them go away */
893+#endif
894
895 /* Signal handlers, we set breakpoints in them to make sure that the
896 signals really get delivered. */
897diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c
898index 756606880f..1205a9bc9c 100644
899--- a/gdb/testsuite/gdb.base/signals.c
900+++ b/gdb/testsuite/gdb.base/signals.c
901@@ -3,6 +3,10 @@
902 #include <signal.h>
903 #include <unistd.h>
904
905+#ifdef __sh__
906+#define signal(a,b) /* Signals not supported on this target - make them go away */
907+#define alarm(a) /* Ditto for alarm() */
908+#endif
909
910 static int count = 0;
911
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index d5862d87..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
+++ /dev/null
@@ -1,261 +0,0 @@
1From e98a2f325e1a90dfd6911d124889f0760d663b5c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 8 Nov 2016 11:54:08 +0530
4Subject: [PATCH 04/52] [LOCAL]: Fix relaxation of assembler resolved
5 references,Fixup debug_loc sections after linker relaxation Adds a new
6 reloctype R_MICROBLAZE_32_NONE, used for passing reloc info from the
7 assembler to the linker when the linker manages to fully resolve a local
8 symbol reference.
9
10This is a workaround for design flaws in the assembler to
11linker interface with regards to linker relaxation.
12
13Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15
16Conflicts:
17 bfd/elf32-microblaze.c
18 binutils/readelf.c
19 include/elf/microblaze.h
20---
21 bfd/bfd-in2.h | 5 ++
22 bfd/elf32-microblaze.c | 126 ++++++++++++++++++++++++++++---------
23 bfd/libbfd.h | 1 +
24 bfd/reloc.c | 6 ++
25 binutils/readelf.c | 4 ++
26 gas/config/tc-microblaze.c | 4 ++
27 include/elf/microblaze.h | 2 +
28 7 files changed, 119 insertions(+), 29 deletions(-)
29
30Index: gdb-9.2/bfd/bfd-in2.h
31===================================================================
32--- gdb-9.2.orig/bfd/bfd-in2.h
33+++ gdb-9.2/bfd/bfd-in2.h
34@@ -5363,6 +5363,11 @@ value relative to the read-write small d
35 expressions of the form "Symbol Op Symbol" */
36 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
37
38+/* This is a 32 bit reloc that stores the 32 bit pc relative
39+value in two words (with an imm instruction).No relocation is
40+done here - only used for relaxing */
41+ BFD_RELOC_MICROBLAZE_32_NONE,
42+
43 /* This is a 64 bit reloc that stores the 32 bit pc relative
44 value in two words (with an imm instruction). No relocation is
45 done here - only used for relaxing */
46Index: gdb-9.2/bfd/elf32-microblaze.c
47===================================================================
48--- gdb-9.2.orig/bfd/elf32-microblaze.c
49+++ gdb-9.2/bfd/elf32-microblaze.c
50@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_h
51 FALSE), /* PC relative offset? */
52
53 /* This reloc does nothing. Used for relaxation. */
54+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
55+ 0, /* Rightshift. */
56+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
57+ 32, /* Bitsize. */
58+ TRUE, /* PC_relative. */
59+ 0, /* Bitpos. */
60+ complain_overflow_bitfield, /* Complain on overflow. */
61+ NULL, /* Special Function. */
62+ "R_MICROBLAZE_32_NONE",/* Name. */
63+ FALSE, /* Partial Inplace. */
64+ 0, /* Source Mask. */
65+ 0, /* Dest Mask. */
66+ FALSE), /* PC relative offset? */
67+
68 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
69 0, /* Rightshift. */
70 3, /* Size (0 = byte, 1 = short, 2 = long). */
71@@ -562,7 +576,10 @@ microblaze_elf_reloc_type_lookup (bfd *
72 case BFD_RELOC_NONE:
73 microblaze_reloc = R_MICROBLAZE_NONE;
74 break;
75- case BFD_RELOC_MICROBLAZE_64_NONE:
76+ case BFD_RELOC_MICROBLAZE_32_NONE:
77+ microblaze_reloc = R_MICROBLAZE_32_NONE;
78+ break;
79+ case BFD_RELOC_MICROBLAZE_64_NONE:
80 microblaze_reloc = R_MICROBLAZE_64_NONE;
81 break;
82 case BFD_RELOC_32:
83@@ -1918,18 +1935,26 @@ microblaze_elf_relax_section (bfd *abfd,
84 }
85 break;
86 case R_MICROBLAZE_NONE:
87+ case R_MICROBLAZE_32_NONE:
88 {
89 /* This was a PC-relative instruction that was
90 completely resolved. */
91 int sfix, efix;
92+ unsigned int val;
93 bfd_vma target_address;
94 target_address = irel->r_addend + irel->r_offset;
95 sfix = calc_fixup (irel->r_offset, 0, sec);
96 efix = calc_fixup (target_address, 0, sec);
97- irel->r_addend -= (efix - sfix);
98- /* Should use HOWTO. */
99- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
100- irel->r_addend);
101+
102+ /* Validate the in-band val. */
103+ val = bfd_get_32 (abfd, contents + irel->r_offset);
104+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
105+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
106+ }
107+ irel->r_addend -= (efix - sfix);
108+ /* Should use HOWTO. */
109+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
110+ irel->r_addend);
111 }
112 break;
113 case R_MICROBLAZE_64_NONE:
114@@ -1973,30 +1998,73 @@ microblaze_elf_relax_section (bfd *abfd,
115 irelscanend = irelocs + o->reloc_count;
116 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
117 {
118- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
119- {
120- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
121+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
122+ {
123+ unsigned int val;
124+
125+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
126+
127+ /* hax: We only do the following fixup for debug location lists. */
128+ if (strcmp(".debug_loc", o->name))
129+ continue;
130+
131+ /* This was a PC-relative instruction that was completely resolved. */
132+ if (ocontents == NULL)
133+ {
134+ if (elf_section_data (o)->this_hdr.contents != NULL)
135+ ocontents = elf_section_data (o)->this_hdr.contents;
136+ else
137+ {
138+ /* We always cache the section contents.
139+ Perhaps, if info->keep_memory is FALSE, we
140+ should free them, if we are permitted to. */
141+
142+ if (o->rawsize == 0)
143+ o->rawsize = o->size;
144+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
145+ if (ocontents == NULL)
146+ goto error_return;
147+ if (!bfd_get_section_contents (abfd, o, ocontents,
148+ (file_ptr) 0,
149+ o->rawsize))
150+ goto error_return;
151+ elf_section_data (o)->this_hdr.contents = ocontents;
152+ }
153+ }
154
155- /* Look at the reloc only if the value has been resolved. */
156- if (isym->st_shndx == shndx
157- && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
158- {
159- if (ocontents == NULL)
160- {
161- if (elf_section_data (o)->this_hdr.contents != NULL)
162- ocontents = elf_section_data (o)->this_hdr.contents;
163- else
164- {
165- /* We always cache the section contents.
166- Perhaps, if info->keep_memory is FALSE, we
167- should free them, if we are permitted to. */
168- if (o->rawsize == 0)
169- o->rawsize = o->size;
170- ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
171- if (ocontents == NULL)
172- goto error_return;
173- if (!bfd_get_section_contents (abfd, o, ocontents,
174- (file_ptr) 0,
175+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
176+ if (val != irelscan->r_addend) {
177+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
178+ }
179+
180+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
181+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
182+ irelscan->r_addend);
183+ }
184+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
185+ {
186+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
187+
188+ /* Look at the reloc only if the value has been resolved. */
189+ if (isym->st_shndx == shndx
190+ && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
191+ {
192+ if (ocontents == NULL)
193+ {
194+ if (elf_section_data (o)->this_hdr.contents != NULL)
195+ ocontents = elf_section_data (o)->this_hdr.contents;
196+ else
197+ {
198+ /* We always cache the section contents.
199+ Perhaps, if info->keep_memory is FALSE, we
200+ should free them, if we are permitted to. */
201+ if (o->rawsize == 0)
202+ o->rawsize = o->size;
203+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
204+ if (ocontents == NULL)
205+ goto error_return;
206+ if (!bfd_get_section_contents (abfd, o, ocontents,
207+ (file_ptr) 0,
208 o->rawsize))
209 goto error_return;
210 elf_section_data (o)->this_hdr.contents = ocontents;
211@@ -2032,7 +2100,7 @@ microblaze_elf_relax_section (bfd *abfd,
212 elf_section_data (o)->this_hdr.contents = ocontents;
213 }
214 }
215- irelscan->r_addend -= calc_fixup (irel->r_addend
216+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
217 + isym->st_value,
218 0,
219 sec);
220Index: gdb-9.2/bfd/libbfd.h
221===================================================================
222--- gdb-9.2.orig/bfd/libbfd.h
223+++ gdb-9.2/bfd/libbfd.h
224@@ -2903,6 +2903,7 @@ static const char *const bfd_reloc_code_
225 "BFD_RELOC_MICROBLAZE_32_ROSDA",
226 "BFD_RELOC_MICROBLAZE_32_RWSDA",
227 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
228+ "BFD_RELOC_MICROBLAZE_32_NONE",
229 "BFD_RELOC_MICROBLAZE_64_NONE",
230 "BFD_RELOC_MICROBLAZE_64_GOTPC",
231 "BFD_RELOC_MICROBLAZE_64_GOT",
232Index: gdb-9.2/bfd/reloc.c
233===================================================================
234--- gdb-9.2.orig/bfd/reloc.c
235+++ gdb-9.2/bfd/reloc.c
236@@ -6807,6 +6807,12 @@ ENUMDOC
237 This is a 32 bit reloc for the microblaze to handle
238 expressions of the form "Symbol Op Symbol"
239 ENUM
240+ BFD_RELOC_MICROBLAZE_32_NONE
241+ENUMDOC
242+ This is a 32 bit reloc that stores the 32 bit pc relative
243+ value in two words (with an imm instruction). No relocation is
244+ done here - only used for relaxing
245+ENUM
246 BFD_RELOC_MICROBLAZE_64_NONE
247 ENUMDOC
248 This is a 64 bit reloc that stores the 32 bit pc relative
249Index: gdb-9.2/include/elf/microblaze.h
250===================================================================
251--- gdb-9.2.orig/include/elf/microblaze.h
252+++ gdb-9.2/include/elf/microblaze.h
253@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_relo
254 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
255 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
256 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
257+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
258+
259 END_RELOC_NUMBERS (R_MICROBLAZE_max)
260
261 /* Global base address names. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index 37a9646f..e63a696d 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 6474cf4147887529ccb506b80f945aa67178f5bd Mon Sep 17 00:00:00 2001 1From 7d970a0c616063a5095ce3725efed0feb40ceb30 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 16 Dec 2013 16:37:32 +1000 3Date: Mon, 16 Dec 2013 16:37:32 +1000
4Subject: [PATCH 38/52] microblaze: Add build_gdbserver=yes to top level 4Subject: [PATCH 04/10] microblaze: Add build_gdbserver=yes to top level
5 configure.tgt 5 configure.tgt
6 6
7For Microblaze linux toolchains, set the build_gdbserver=yes 7For Microblaze linux toolchains, set the build_gdbserver=yes
@@ -15,10 +15,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15 gdb/configure.tgt | 1 + 15 gdb/configure.tgt | 1 +
16 1 file changed, 1 insertion(+) 16 1 file changed, 1 insertion(+)
17 17
18Index: gdb-9.2/gdb/configure.tgt 18diff --git a/gdb/configure.tgt b/gdb/configure.tgt
19=================================================================== 19index b8378440b23..8ca2042c7cb 100644
20--- gdb-9.2.orig/gdb/configure.tgt 20--- a/gdb/configure.tgt
21+++ gdb-9.2/gdb/configure.tgt 21+++ b/gdb/configure.tgt
22@@ -408,6 +408,7 @@ microblaze*-*-*) 22@@ -408,6 +408,7 @@ microblaze*-*-*)
23 # Target: Xilinx MicroBlaze running standalone 23 # Target: Xilinx MicroBlaze running standalone
24 gdb_target_obs="microblaze-tdep.o" 24 gdb_target_obs="microblaze-tdep.o"
@@ -27,3 +27,6 @@ Index: gdb-9.2/gdb/configure.tgt
27 ;; 27 ;;
28 28
29 mips*-*-linux*) 29 mips*-*-linux*)
30--
312.17.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch
deleted file mode 100644
index d0360da4..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From d132f21d89157e980574da7d0c949f6dd17df8c3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 15:25:03 -0700
4Subject: [PATCH] Dont disable libreadline.a when using --disable-static
5
6If gdb is configured with --disable-static then this is dutifully passed to
7readline which then disables libreadline.a, which causes a problem when gdb
8tries to link against that.
9
10To ensure that readline always builds static libraries, pass --enable-static to
11the sub-configure.
12
13Upstream-Status: Pending
14Signed-off-by: Ross Burton <ross.burton@intel.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 Makefile.def | 3 ++-
18 Makefile.in | 2 +-
19 2 files changed, 3 insertions(+), 2 deletions(-)
20
21diff --git a/Makefile.def b/Makefile.def
22index 311feb9de3..24c0685d48 100644
23--- a/Makefile.def
24+++ b/Makefile.def
25@@ -105,7 +105,8 @@ host_modules= { module= libiconv;
26 missing= install-html;
27 missing= install-info; };
28 host_modules= { module= m4; };
29-host_modules= { module= readline; };
30+host_modules= { module= readline;
31+ extra_configure_flags='--enable-static';};
32 host_modules= { module= sid; };
33 host_modules= { module= sim; };
34 host_modules= { module= texinfo; no_install= true; };
35diff --git a/Makefile.in b/Makefile.in
36index 1aabf6ede4..d957efde81 100644
37--- a/Makefile.in
38+++ b/Makefile.in
39@@ -25510,7 +25510,7 @@ configure-readline:
40 $$s/$$module_srcdir/configure \
41 --srcdir=$${topdir}/$$module_srcdir \
42 $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
43- --target=${target_alias} \
44+ --target=${target_alias} --enable-static \
45 || exit 1
46 @endif readline
47
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Initial-support-for-native-gdb.patch
index 669b5927..3482bcd8 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Initial-support-for-native-gdb.patch
@@ -1,15 +1,12 @@
1From db3c0a8a59b292eea6ed1f532f4097c40cafd7df Mon Sep 17 00:00:00 2001 1From bac086097dfa813fcc0b978dc32eb9ae469bf4a8 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com> 2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 20 Jul 2012 15:18:35 +1000 3Date: Fri, 20 Jul 2012 15:18:35 +1000
4Subject: [PATCH 39/52] Initial support for native gdb 4Subject: [PATCH 05/10] Initial support for native gdb
5 5
6microblaze: Follow PPC method of getting setting registers 6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE 7using PTRACE PEEK/POKE
8 8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10
11Conflicts:
12 gdb/Makefile.in
13--- 10---
14 gdb/Makefile.in | 2 + 11 gdb/Makefile.in | 2 +
15 gdb/config/microblaze/linux.mh | 9 + 12 gdb/config/microblaze/linux.mh | 9 +
@@ -18,11 +15,11 @@ Conflicts:
18 create mode 100644 gdb/config/microblaze/linux.mh 15 create mode 100644 gdb/config/microblaze/linux.mh
19 create mode 100644 gdb/microblaze-linux-nat.c 16 create mode 100644 gdb/microblaze-linux-nat.c
20 17
21Index: gdb-9.2/gdb/Makefile.in 18diff --git a/gdb/Makefile.in b/gdb/Makefile.in
22=================================================================== 19index ec371fc7e52..2e8d4cfe82e 100644
23--- gdb-9.2.orig/gdb/Makefile.in 20--- a/gdb/Makefile.in
24+++ gdb-9.2/gdb/Makefile.in 21+++ b/gdb/Makefile.in
25@@ -1337,6 +1337,7 @@ HFILES_NO_SRCDIR = \ 22@@ -1336,6 +1336,7 @@ HFILES_NO_SRCDIR = \
26 memory-map.h \ 23 memory-map.h \
27 memrange.h \ 24 memrange.h \
28 microblaze-tdep.h \ 25 microblaze-tdep.h \
@@ -30,7 +27,7 @@ Index: gdb-9.2/gdb/Makefile.in
30 mips-linux-tdep.h \ 27 mips-linux-tdep.h \
31 mips-nbsd-tdep.h \ 28 mips-nbsd-tdep.h \
32 mips-tdep.h \ 29 mips-tdep.h \
33@@ -2261,6 +2262,7 @@ ALLDEPFILES = \ 30@@ -2216,6 +2217,7 @@ ALLDEPFILES = \
34 m68k-tdep.c \ 31 m68k-tdep.c \
35 microblaze-linux-tdep.c \ 32 microblaze-linux-tdep.c \
36 microblaze-tdep.c \ 33 microblaze-tdep.c \
@@ -38,10 +35,11 @@ Index: gdb-9.2/gdb/Makefile.in
38 mingw-hdep.c \ 35 mingw-hdep.c \
39 mips-fbsd-nat.c \ 36 mips-fbsd-nat.c \
40 mips-fbsd-tdep.c \ 37 mips-fbsd-tdep.c \
41Index: gdb-9.2/gdb/config/microblaze/linux.mh 38diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
42=================================================================== 39new file mode 100644
40index 00000000000..a4eaf540e1d
43--- /dev/null 41--- /dev/null
44+++ gdb-9.2/gdb/config/microblaze/linux.mh 42+++ b/gdb/config/microblaze/linux.mh
45@@ -0,0 +1,9 @@ 43@@ -0,0 +1,9 @@
46+# Host: Microblaze, running Linux 44+# Host: Microblaze, running Linux
47+ 45+
@@ -52,10 +50,11 @@ Index: gdb-9.2/gdb/config/microblaze/linux.mh
52+NAT_CDEPS = $(srcdir)/proc-service.list 50+NAT_CDEPS = $(srcdir)/proc-service.list
53+ 51+
54+LOADLIBES = -ldl $(RDYNAMIC) 52+LOADLIBES = -ldl $(RDYNAMIC)
55Index: gdb-9.2/gdb/microblaze-linux-nat.c 53diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
56=================================================================== 54new file mode 100644
55index 00000000000..e9b8c9c5221
57--- /dev/null 56--- /dev/null
58+++ gdb-9.2/gdb/microblaze-linux-nat.c 57+++ b/gdb/microblaze-linux-nat.c
59@@ -0,0 +1,431 @@ 58@@ -0,0 +1,431 @@
60+/* Microblaze GNU/Linux native support. 59+/* Microblaze GNU/Linux native support.
61+ 60+
@@ -488,3 +487,6 @@ Index: gdb-9.2/gdb/microblaze-linux-nat.c
488+ /* Register the target. */ 487+ /* Register the target. */
489+ linux_nat_add_target (t); 488+ linux_nat_add_target (t);
490+} 489+}
490--
4912.17.1
492
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
deleted file mode 100644
index d5195308..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From c78337f4e6459e18e1d2af95d8e313b9dcb3f097 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 05/52] upstream change to garbage collection sweep causes mb
5 regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21---
22 bfd/elflink.c | 1 -
23 1 file changed, 1 deletion(-)
24
25Index: gdb-9.2/bfd/elflink.c
26===================================================================
27--- gdb-9.2.orig/bfd/elflink.c
28+++ gdb-9.2/bfd/elflink.c
29@@ -6274,7 +6274,6 @@ elf_gc_sweep_symbol (struct elf_link_has
30
31 inf = (struct elf_gc_sweep_symbol_info *) data;
32 (*inf->hide_symbol) (inf->info, h, TRUE);
33- h->def_regular = 0;
34 h->ref_regular = 0;
35 h->ref_regular_nonweak = 0;
36 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch
deleted file mode 100644
index 2843bc2d..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 17ac5acd91e0ef6b103d18018f93fd0fc29a2048 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 15 Jun 2015 16:50:30 +0530
4Subject: [PATCH 06/52] Fix bug in TLSTPREL Relocation
5
6Fixed the problem related to the fixup/relocations TLSTPREL.
7When the fixup is applied the addend is not added at the correct offset
8of the instruction. The offset is hard coded considering its big endian
9and it fails for Little endian. This patch allows support for both
10big & little-endian compilers
11---
12 bfd/elf32-microblaze.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15Index: gdb-9.2/bfd/elf32-microblaze.c
16===================================================================
17--- gdb-9.2.orig/bfd/elf32-microblaze.c
18+++ gdb-9.2/bfd/elf32-microblaze.c
19@@ -1451,9 +1451,9 @@ microblaze_elf_relocate_section (bfd *ou
20 relocation += addend;
21 relocation -= dtprel_base(info);
22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
23- contents + offset + 2);
24+ contents + offset + endian);
25 bfd_put_16 (input_bfd, relocation & 0xffff,
26- contents + offset + 2 + INST_WORD_SIZE);
27+ contents + offset + endian + INST_WORD_SIZE);
28 break;
29 case (int) R_MICROBLAZE_TEXTREL_64:
30 case (int) R_MICROBLAZE_TEXTREL_32_LO:
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fixing-the-issues-related-to-GDB-7.12.patch
index 85f8174a..eb1efa71 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fixing-the-issues-related-to-GDB-7.12.patch
@@ -1,22 +1,21 @@
1From bf3c50c95c4dcca6c5c07a3c082bdd9d687f1496 Mon Sep 17 00:00:00 2001 1From 41b0d54fa00ce765e9a2ce09136938b72b2b96d7 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 17 Feb 2017 14:09:40 +0530 3Date: Fri, 17 Feb 2017 14:09:40 +0530
4Subject: [PATCH 40/52] Fixing the issues related to GDB-7.12 added all the 4Subject: [PATCH 06/10] Fixing the issues related to GDB-7.12
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
7 5
6added all the required function which are new in 7.12 and removed
7few deprecated functions from 7.6
8--- 8---
9 gdb/config/microblaze/linux.mh | 4 +- 9 gdb/config/microblaze/linux.mh | 4 +-
10 gdb/gdbserver/configure.srv | 3 +-
11 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++---- 10 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
12 gdb/microblaze-linux-tdep.c | 68 +++++++++++++++++--
13 gdb/microblaze-tdep.h | 1 + 11 gdb/microblaze-tdep.h | 1 +
14 5 files changed, 153 insertions(+), 20 deletions(-) 12 gdbserver/configure.srv | 3 +-
13 4 files changed, 89 insertions(+), 16 deletions(-)
15 14
16Index: gdb-9.2/gdb/config/microblaze/linux.mh 15diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
17=================================================================== 16index a4eaf540e1d..74a53b854a4 100644
18--- gdb-9.2.orig/gdb/config/microblaze/linux.mh 17--- a/gdb/config/microblaze/linux.mh
19+++ gdb-9.2/gdb/config/microblaze/linux.mh 18+++ b/gdb/config/microblaze/linux.mh
20@@ -1,9 +1,11 @@ 19@@ -1,9 +1,11 @@
21 # Host: Microblaze, running Linux 20 # Host: Microblaze, running Linux
22 21
@@ -30,24 +29,10 @@ Index: gdb-9.2/gdb/config/microblaze/linux.mh
30 NAT_CDEPS = $(srcdir)/proc-service.list 29 NAT_CDEPS = $(srcdir)/proc-service.list
31 30
32 LOADLIBES = -ldl $(RDYNAMIC) 31 LOADLIBES = -ldl $(RDYNAMIC)
33Index: gdb-9.2/gdb/gdbserver/configure.srv 32diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
34=================================================================== 33index cba5d6fc585..a2733f3c21c 100644
35--- gdb-9.2.orig/gdb/gdbserver/configure.srv 34--- a/gdb/gdbserver/linux-microblaze-low.c
36+++ gdb-9.2/gdb/gdbserver/configure.srv 35+++ b/gdb/gdbserver/linux-microblaze-low.c
37@@ -185,8 +185,7 @@ case "${target}" in
38 srv_linux_thread_db=yes
39 ;;
40 microblaze*-*-linux*) srv_regobj=microblaze-linux.o
41- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
42- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
43+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
44 srv_linux_regsets=yes
45 srv_linux_usrregs=yes
46 srv_linux_thread_db=yes
47Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
48===================================================================
49--- gdb-9.2.orig/gdb/gdbserver/linux-microblaze-low.c
50+++ gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
51@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 36@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
52 PT_FSR 37 PT_FSR
53 }; 38 };
@@ -61,7 +46,7 @@ Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
61 46
62 static int 47 static int
63 microblaze_cannot_store_register (int regno) 48 microblaze_cannot_store_register (int regno)
64@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regc 49@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
65 static const unsigned long microblaze_breakpoint = 0xba0c0018; 50 static const unsigned long microblaze_breakpoint = 0xba0c0018;
66 #define microblaze_breakpoint_len 4 51 #define microblaze_breakpoint_len 4
67 52
@@ -77,7 +62,7 @@ Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
77 static int 62 static int
78 microblaze_breakpoint_at (CORE_ADDR where) 63 microblaze_breakpoint_at (CORE_ADDR where)
79 { 64 {
80@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcach 65@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcache *regcache)
81 static void 66 static void
82 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) 67 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
83 { 68 {
@@ -95,7 +80,7 @@ Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
95 80
96 if (regno == 0) { 81 if (regno == 0) {
97 unsigned long regbuf_0 = 0; 82 unsigned long regbuf_0 = 0;
98@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcach 83@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcache *regcache, const void *buf)
99 84
100 #endif /* HAVE_PTRACE_GETREGS */ 85 #endif /* HAVE_PTRACE_GETREGS */
101 86
@@ -200,102 +185,10 @@ Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
200+{ 185+{
201+ init_registers_microblaze (); 186+ init_registers_microblaze ();
202+} 187+}
203Index: gdb-9.2/gdb/microblaze-linux-tdep.c 188diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
204=================================================================== 189index e91991b8dba..872a3931f20 100644
205--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c 190--- a/gdb/microblaze-tdep.h
206+++ gdb-9.2/gdb/microblaze-linux-tdep.c 191+++ b/gdb/microblaze-tdep.h
207@@ -29,13 +29,76 @@
208 #include "regcache.h"
209 #include "value.h"
210 #include "osabi.h"
211-#include "regset.h"
212 #include "solib-svr4.h"
213 #include "microblaze-tdep.h"
214 #include "trad-frame.h"
215 #include "frame-unwind.h"
216 #include "tramp-frame.h"
217 #include "linux-tdep.h"
218+#include "glibc-tdep.h"
219+
220+#include "gdb_assert.h"
221+
222+#ifndef REGSET_H
223+#define REGSET_H 1
224+
225+struct gdbarch;
226+struct regcache;
227+
228+/* Data structure for the supported register notes in a core file. */
229+struct core_regset_section
230+{
231+ const char *sect_name;
232+ int size;
233+ const char *human_name;
234+};
235+
236+/* Data structure describing a register set. */
237+
238+typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
239+ int, const void *, size_t);
240+typedef void (collect_regset_ftype) (const struct regset *,
241+ const struct regcache *,
242+ int, void *, size_t);
243+
244+struct regset
245+{
246+ /* Data pointer for private use by the methods below, presumably
247+ providing some sort of description of the register set. */
248+ const void *descr;
249+
250+ /* Function supplying values in a register set to a register cache. */
251+ supply_regset_ftype *supply_regset;
252+
253+ /* Function collecting values in a register set from a register cache. */
254+ collect_regset_ftype *collect_regset;
255+
256+ /* Architecture associated with the register set. */
257+ struct gdbarch *arch;
258+};
259+
260+#endif
261+
262+/* Allocate a fresh 'struct regset' whose supply_regset function is
263+ SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
264+ If the regset has no collect_regset function, pass NULL for
265+ COLLECT_REGSET.
266+
267+ The object returned is allocated on ARCH's obstack. */
268+
269+struct regset *
270+regset_alloc (struct gdbarch *arch,
271+ supply_regset_ftype *supply_regset,
272+ collect_regset_ftype *collect_regset)
273+{
274+ struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
275+
276+ regset->arch = arch;
277+ regset->supply_regset = supply_regset;
278+ regset->collect_regset = collect_regset;
279+
280+ return regset;
281+}
282
283 static int microblaze_debug_flag = 0;
284
285@@ -207,9 +270,6 @@ microblaze_linux_init_abi (struct gdbarc
286 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
287 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
288
289- set_gdbarch_regset_from_core_section (gdbarch,
290- microblaze_regset_from_core_section);
291-
292 /* Enable TLS support. */
293 set_gdbarch_fetch_tls_load_module_address (gdbarch,
294 svr4_fetch_objfile_link_map);
295Index: gdb-9.2/gdb/microblaze-tdep.h
296===================================================================
297--- gdb-9.2.orig/gdb/microblaze-tdep.h
298+++ gdb-9.2/gdb/microblaze-tdep.h
299@@ -24,6 +24,7 @@ 192@@ -24,6 +24,7 @@
300 /* Microblaze architecture-specific information. */ 193 /* Microblaze architecture-specific information. */
301 struct microblaze_gregset 194 struct microblaze_gregset
@@ -304,3 +197,20 @@ Index: gdb-9.2/gdb/microblaze-tdep.h
304 unsigned int gregs[32]; 197 unsigned int gregs[32];
305 unsigned int fpregs[32]; 198 unsigned int fpregs[32];
306 unsigned int pregs[16]; 199 unsigned int pregs[16];
200diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
201index 9d68c24a92d..af10cb05683 100644
202--- a/gdbserver/configure.srv
203+++ b/gdbserver/configure.srv
204@@ -167,8 +167,7 @@ case "${gdbserver_host}" in
205 srv_linux_thread_db=yes
206 ;;
207 microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
208- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
209- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
210+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
211 srv_xmlfiles="microblaze-linux.xml"
212 srv_linux_regsets=yes
213 srv_linux_usrregs=yes
214--
2152.17.1
216
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch
deleted file mode 100644
index d222d010..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 329e5bf29e934ba99622372a9660865864bb0298 Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <amccurdy@gmail.com>
3Date: Sat, 30 Apr 2016 15:29:06 -0700
4Subject: [PATCH] use <asm/sgidefs.h>
5
6Build fix for MIPS with musl libc
7
8The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
9but not by musl. Regardless of the libc, the kernel headers provide
10<asm/sgidefs.h> which provides the same definitions, so use that
11instead.
12
13Upstream-Status: Pending
14
15Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 gdb/mips-linux-nat.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
22index 7f575b3363..dc93a64a93 100644
23--- a/gdb/mips-linux-nat.c
24+++ b/gdb/mips-linux-nat.c
25@@ -31,7 +31,7 @@
26 #include "gdb_proc_service.h"
27 #include "gregset.h"
28
29-#include <sgidefs.h>
30+#include <asm/sgidefs.h>
31 #include "nat/gdb_ptrace.h"
32 #include <asm/ptrace.h>
33 #include "inf-ptrace.h"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch
deleted file mode 100644
index a2584ed4..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From 40107e7f6430aebfeba7e8f4eb6d67863520ebd4 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jan 2016 12:28:21 +0530
4Subject: [PATCH 07/52] Added Address extension instructions
5
6This patch adds the support of new instructions which are required
7for supporting Address extension feature.
8
9Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
10
11ChangeLog:
12 2016-01-18 Nagaraju Mekala <nmekala@xilix.com>
13
14 *microblaze-opc.h (op_code_struct): Update
15 Added new instructions
16 *microblaze-opcm.h (microblaze_instr): Update
17 Added new instructions
18---
19 opcodes/microblaze-opc.h | 11 +++++++++++
20 opcodes/microblaze-opcm.h | 12 ++++++------
21 2 files changed, 17 insertions(+), 6 deletions(-)
22
23Index: gdb-9.2/opcodes/microblaze-opc.h
24===================================================================
25--- gdb-9.2.orig/opcodes/microblaze-opc.h
26+++ gdb-9.2/opcodes/microblaze-opc.h
27@@ -178,8 +178,11 @@ struct op_code_struct
28 {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
29 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
30 {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
31+ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst },
32 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
33+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst },
34 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
35+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst },
36 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
37 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
38 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
39@@ -229,18 +232,24 @@ struct op_code_struct
40 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
41 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
42 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
43+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst },
44 {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
45 {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst },
46+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst },
47 {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
48 {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst },
49 {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
50+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst },
51 {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
52 {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst },
53+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst },
54 {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
55 {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst },
56+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst },
57 {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
58 {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst },
59 {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
60+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst },
61 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
62 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
63 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
64@@ -405,6 +414,8 @@ struct op_code_struct
65 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
66 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
67 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
68+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */
69+ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
70 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
71 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
72 {"", 0, 0, 0, 0, 0, 0, 0, 0},
73Index: gdb-9.2/opcodes/microblaze-opcm.h
74===================================================================
75--- gdb-9.2.orig/opcodes/microblaze-opcm.h
76+++ gdb-9.2/opcodes/microblaze-opcm.h
77@@ -33,14 +33,14 @@ enum microblaze_instr
78 /* 'or/and/xor' are C++ keywords. */
79 microblaze_or, microblaze_and, microblaze_xor,
80 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
81- wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br,
82- brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
83- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
84+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse,
85+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd,
86+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
87 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
88 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
89- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
90- shr, sw, swr, swx, lbui, lhui, lwi,
91- sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv,
92+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
93+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
94+ sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
95 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
96 fint, fsqrt,
97 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-microblaze-Adding-64-bit-MB-support.patch
index a2a80d53..6536c22d 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-microblaze-Adding-64-bit-MB-support.patch
@@ -1,45 +1,70 @@
1From b6f02b2535c4051db5fdadbf03dbb88438b5d116 Mon Sep 17 00:00:00 2001 1From f9e5f9f884470d0a216126b347b4699d6051fcdd Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 16:28:28 +0530 3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 14/52] intial commit of MB 64-bit 4Subject: [PATCH 07/10] [Patch, microblaze]: Adding 64 bit MB support Added new
5 architecture to Microblaze 64-bit support to GDB Signed-off-by :Nagaraju
6 Mekala <nmekala@xilix.com>
7
8Conflicts:
9 gdb/Makefile.in
5 10
6Conflicts: 11Conflicts:
7 bfd/configure
8 bfd/configure.ac
9 bfd/cpu-microblaze.c 12 bfd/cpu-microblaze.c
10 ld/Makefile.am 13 gdb/microblaze-tdep.c
11 ld/Makefile.in
12 opcodes/microblaze-dis.c 14 opcodes/microblaze-dis.c
15
16Conflicts:
17 bfd/configure
18 opcodes/microblaze-opcm.h
13--- 19---
14 bfd/Makefile.am | 2 + 20 bfd/Makefile.am | 2 +
15 bfd/Makefile.in | 3 + 21 bfd/Makefile.in | 3 +
16 bfd/config.bfd | 4 + 22 bfd/archures.c | 2 +
17 bfd/configure | 2 + 23 bfd/bfd-in2.h | 31 +-
18 bfd/configure.ac | 2 + 24 bfd/config.bfd | 4 +
19 bfd/cpu-microblaze.c | 53 +- 25 bfd/configure | 2 +
20 bfd/elf64-microblaze.c | 3610 ++++++++++++++++++++++++++++ 26 bfd/cpu-microblaze.c | 55 +-
21 bfd/targets.c | 6 + 27 bfd/elf32-microblaze.c | 243 +-
22 gas/config/tc-microblaze.c | 274 ++- 28 bfd/elf64-microblaze.c | 3711 +++++++++++++++++
23 gas/config/tc-microblaze.h | 4 +- 29 bfd/libbfd.h | 3 +
24 include/elf/common.h | 1 + 30 bfd/reloc.c | 20 +
25 ld/Makefile.am | 4 + 31 bfd/targets.c | 6 +
26 ld/Makefile.in | 6 + 32 gdb/features/Makefile | 3 +
27 ld/configure.tgt | 3 + 33 gdb/features/microblaze-core.xml | 6 +-
28 ld/emulparams/elf64microblaze.sh | 23 + 34 gdb/features/microblaze-stack-protect.xml | 4 +-
29 ld/emulparams/elf64microblazeel.sh | 23 + 35 gdb/features/microblaze-with-stack-protect.c | 8 +-
30 opcodes/microblaze-dis.c | 35 +- 36 gdb/features/microblaze.c | 6 +-
31 opcodes/microblaze-opc.h | 162 +- 37 gdb/features/microblaze64-core.xml | 69 +
32 opcodes/microblaze-opcm.h | 20 +- 38 gdb/features/microblaze64-stack-protect.xml | 12 +
33 19 files changed, 4197 insertions(+), 40 deletions(-) 39 .../microblaze64-with-stack-protect.c | 79 +
34 create mode 100644 bfd/elf64-microblaze.c 40 .../microblaze64-with-stack-protect.xml | 12 +
35 create mode 100644 ld/emulparams/elf64microblaze.sh 41 gdb/features/microblaze64.c | 77 +
36 create mode 100644 ld/emulparams/elf64microblazeel.sh 42 gdb/features/microblaze64.xml | 11 +
43 gdb/microblaze-linux-tdep.c | 36 +-
44 gdb/microblaze-tdep.c | 210 +-
45 gdb/microblaze-tdep.h | 8 +-
46 .../microblaze-with-stack-protect.dat | 4 +-
47 .../linux-microblaze-low.c | 0
48 include/elf/common.h | 1 +
49 include/elf/microblaze.h | 4 +
50 opcodes/microblaze-dis.c | 51 +-
51 opcodes/microblaze-opc.h | 180 +-
52 opcodes/microblaze-opcm.h | 36 +-
53 41 files changed, 5454 insertions(+), 248 deletions(-)
54 create mode 100755 bfd/elf64-microblaze.c
55 create mode 100644 gdb/features/microblaze64-core.xml
56 create mode 100644 gdb/features/microblaze64-stack-protect.xml
57 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
58 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
59 create mode 100644 gdb/features/microblaze64.c
60 create mode 100644 gdb/features/microblaze64.xml
61 rename {gdb/gdbserver => gdbserver}/linux-microblaze-low.c (100%)
37 62
38Index: gdb-9.2/bfd/Makefile.am 63diff --git a/bfd/Makefile.am b/bfd/Makefile.am
39=================================================================== 64index d07c9605b6f..11bbf9a4e0d 100644
40--- gdb-9.2.orig/bfd/Makefile.am 65--- a/bfd/Makefile.am
41+++ gdb-9.2/bfd/Makefile.am 66+++ b/bfd/Makefile.am
42@@ -568,6 +568,7 @@ BFD64_BACKENDS = \ 67@@ -558,6 +558,7 @@ BFD64_BACKENDS = \
43 elf64-riscv.lo \ 68 elf64-riscv.lo \
44 elfxx-riscv.lo \ 69 elfxx-riscv.lo \
45 elf64-s390.lo \ 70 elf64-s390.lo \
@@ -47,7 +72,7 @@ Index: gdb-9.2/bfd/Makefile.am
47 elf64-sparc.lo \ 72 elf64-sparc.lo \
48 elf64-tilegx.lo \ 73 elf64-tilegx.lo \
49 elf64-x86-64.lo \ 74 elf64-x86-64.lo \
50@@ -602,6 +603,7 @@ BFD64_BACKENDS_CFILES = \ 75@@ -592,6 +593,7 @@ BFD64_BACKENDS_CFILES = \
51 elf64-nfp.c \ 76 elf64-nfp.c \
52 elf64-ppc.c \ 77 elf64-ppc.c \
53 elf64-s390.c \ 78 elf64-s390.c \
@@ -55,11 +80,11 @@ Index: gdb-9.2/bfd/Makefile.am
55 elf64-sparc.c \ 80 elf64-sparc.c \
56 elf64-tilegx.c \ 81 elf64-tilegx.c \
57 elf64-x86-64.c \ 82 elf64-x86-64.c \
58Index: gdb-9.2/bfd/Makefile.in 83diff --git a/bfd/Makefile.in b/bfd/Makefile.in
59=================================================================== 84index 9cad4da6f8f..72745bb62b1 100644
60--- gdb-9.2.orig/bfd/Makefile.in 85--- a/bfd/Makefile.in
61+++ gdb-9.2/bfd/Makefile.in 86+++ b/bfd/Makefile.in
62@@ -994,6 +994,7 @@ BFD64_BACKENDS = \ 87@@ -985,6 +985,7 @@ BFD64_BACKENDS = \
63 elf64-riscv.lo \ 88 elf64-riscv.lo \
64 elfxx-riscv.lo \ 89 elfxx-riscv.lo \
65 elf64-s390.lo \ 90 elf64-s390.lo \
@@ -67,7 +92,7 @@ Index: gdb-9.2/bfd/Makefile.in
67 elf64-sparc.lo \ 92 elf64-sparc.lo \
68 elf64-tilegx.lo \ 93 elf64-tilegx.lo \
69 elf64-x86-64.lo \ 94 elf64-x86-64.lo \
70@@ -1028,6 +1029,7 @@ BFD64_BACKENDS_CFILES = \ 95@@ -1019,6 +1020,7 @@ BFD64_BACKENDS_CFILES = \
71 elf64-nfp.c \ 96 elf64-nfp.c \
72 elf64-ppc.c \ 97 elf64-ppc.c \
73 elf64-s390.c \ 98 elf64-s390.c \
@@ -75,7 +100,7 @@ Index: gdb-9.2/bfd/Makefile.in
75 elf64-sparc.c \ 100 elf64-sparc.c \
76 elf64-tilegx.c \ 101 elf64-tilegx.c \
77 elf64-x86-64.c \ 102 elf64-x86-64.c \
78@@ -1510,6 +1512,7 @@ distclean-compile: 103@@ -1498,6 +1500,7 @@ distclean-compile:
79 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@ 104 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
80 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@ 105 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
81 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@ 106 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
@@ -83,11 +108,81 @@ Index: gdb-9.2/bfd/Makefile.in
83 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@ 108 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@ 109 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@ 110 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
86Index: gdb-9.2/bfd/config.bfd 111diff --git a/bfd/archures.c b/bfd/archures.c
87=================================================================== 112index 50698648d6a..7ebae017347 100644
88--- gdb-9.2.orig/bfd/config.bfd 113--- a/bfd/archures.c
89+++ gdb-9.2/bfd/config.bfd 114+++ b/bfd/archures.c
90@@ -842,11 +842,15 @@ case "${targ}" in 115@@ -523,6 +523,8 @@ DESCRIPTION
116 . bfd_arch_lm32, {* Lattice Mico32. *}
117 .#define bfd_mach_lm32 1
118 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
119+.#define bfd_mach_microblaze 1
120+.#define bfd_mach_microblaze64 2
121 . bfd_arch_tilepro, {* Tilera TILEPro. *}
122 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
123 .#define bfd_mach_tilepro 1
124diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
125index 935ba535b54..b9f98fb5f40 100644
126--- a/bfd/bfd-in2.h
127+++ b/bfd/bfd-in2.h
128@@ -1923,6 +1923,8 @@ enum bfd_architecture
129 bfd_arch_lm32, /* Lattice Mico32. */
130 #define bfd_mach_lm32 1
131 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
132+#define bfd_mach_microblaze 1
133+#define bfd_mach_microblaze64 2
134 bfd_arch_tilepro, /* Tilera TILEPro. */
135 bfd_arch_tilegx, /* Tilera TILE-Gx. */
136 #define bfd_mach_tilepro 1
137@@ -5433,16 +5435,41 @@ value relative to the read-write small data area anchor */
138 expressions of the form "Symbol Op Symbol" */
139 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
140
141-/* This is a 64 bit reloc that stores the 32 bit pc relative
142+/* This is a 32 bit reloc that stores the 32 bit pc relative
143 value in two words (with an imm instruction). No relocation is
144 done here - only used for relaxing */
145- BFD_RELOC_MICROBLAZE_64_NONE,
146+ BFD_RELOC_MICROBLAZE_32_NONE,
147+
148+/* This is a 64 bit reloc that stores the 32 bit pc relative
149+ * +value in two words (with an imml instruction). No relocation is
150+ * +done here - only used for relaxing */
151+ BFD_RELOC_MICROBLAZE_64_PCREL,
152+
153+/* This is a 64 bit reloc that stores the 32 bit relative
154+ * +value in two words (with an imml instruction). No relocation is
155+ * +done here - only used for relaxing */
156+ BFD_RELOC_MICROBLAZE_64,
157+
158+/* This is a 64 bit reloc that stores the 32 bit relative
159+ * +value in two words (with an imml instruction). No relocation is
160+ * +done here - only used for relaxing */
161+ BFD_RELOC_MICROBLAZE_EA64,
162+
163+/* This is a 64 bit reloc that stores the 32 bit pc relative
164+ * +value in two words (with an imm instruction). No relocation is
165+ * +done here - only used for relaxing */
166+ BFD_RELOC_MICROBLAZE_64_NONE,
167
168 /* This is a 64 bit reloc that stores the 32 bit pc relative
169 value in two words (with an imm instruction). The relocation is
170 PC-relative GOT offset */
171 BFD_RELOC_MICROBLAZE_64_GOTPC,
172
173+/* This is a 64 bit reloc that stores the 32 bit pc relative
174+value in two words (with an imml instruction). The relocation is
175+PC-relative GOT offset */
176+ BFD_RELOC_MICROBLAZE_64_GPC,
177+
178 /* This is a 64 bit reloc that stores the 32 bit pc relative
179 value in two words (with an imm instruction). The relocation is
180 GOT offset */
181diff --git a/bfd/config.bfd b/bfd/config.bfd
182index 6c2919e47eb..0f752de267b 100644
183--- a/bfd/config.bfd
184+++ b/bfd/config.bfd
185@@ -827,11 +827,15 @@ case "${targ}" in
91 microblazeel*-*) 186 microblazeel*-*)
92 targ_defvec=microblaze_elf32_le_vec 187 targ_defvec=microblaze_elf32_le_vec
93 targ_selvecs=microblaze_elf32_vec 188 targ_selvecs=microblaze_elf32_vec
@@ -103,37 +198,24 @@ Index: gdb-9.2/bfd/config.bfd
103 ;; 198 ;;
104 199
105 #ifdef BFD64 200 #ifdef BFD64
106Index: gdb-9.2/bfd/configure 201diff --git a/bfd/configure b/bfd/configure
107=================================================================== 202index a9c4fd93669..ea697865179 100755
108--- gdb-9.2.orig/bfd/configure 203--- a/bfd/configure
109+++ gdb-9.2/bfd/configure 204+++ b/bfd/configure
110@@ -14879,6 +14879,8 @@ do 205@@ -14928,6 +14928,8 @@ do
206 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
207 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
111 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 208 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
112 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
113 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
114+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 209+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
115+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 210+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
211 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
212 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
116 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; 213 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
117 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;; 214diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
118 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;; 215index 05a3f767e22..749d4352c5b 100644
119Index: gdb-9.2/bfd/configure.ac 216--- a/bfd/cpu-microblaze.c
120=================================================================== 217+++ b/bfd/cpu-microblaze.c
121--- gdb-9.2.orig/bfd/configure.ac 218@@ -23,13 +23,30 @@
122+++ gdb-9.2/bfd/configure.ac
123@@ -615,6 +615,8 @@ do
124 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
125 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
126 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
127+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
128+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
129 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
130 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
131 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
132Index: gdb-9.2/bfd/cpu-microblaze.c
133===================================================================
134--- gdb-9.2.orig/bfd/cpu-microblaze.c
135+++ gdb-9.2/bfd/cpu-microblaze.c
136@@ -23,7 +23,24 @@
137 #include "bfd.h" 219 #include "bfd.h"
138 #include "libbfd.h" 220 #include "libbfd.h"
139 221
@@ -145,8 +227,8 @@ Index: gdb-9.2/bfd/cpu-microblaze.c
145+ 64, /* 32 bits in a word. */ 227+ 64, /* 32 bits in a word. */
146+ 64, /* 32 bits in an address. */ 228+ 64, /* 32 bits in an address. */
147+ 8, /* 8 bits in a byte. */ 229+ 8, /* 8 bits in a byte. */
148+ bfd_arch_microblaze, /* Architecture. */ 230+ bfd_arch_microblaze, /* Architecture. */
149+ 0, /* Machine number - 0 for now. */ 231+ bfd_mach_microblaze64, /* 64 bit Machine */
150+ "microblaze", /* Architecture name. */ 232+ "microblaze", /* Architecture name. */
151+ "MicroBlaze", /* Printable name. */ 233+ "MicroBlaze", /* Printable name. */
152+ 3, /* Section align power. */ 234+ 3, /* Section align power. */
@@ -159,7 +241,14 @@ Index: gdb-9.2/bfd/cpu-microblaze.c
159 { 241 {
160 32, /* Bits in a word. */ 242 32, /* Bits in a word. */
161 32, /* Bits in an address. */ 243 32, /* Bits in an address. */
162@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_ 244 8, /* Bits in a byte. */
245 bfd_arch_microblaze, /* Architecture number. */
246- 0, /* Machine number - 0 for now. */
247+ bfd_mach_microblaze, /* Machine number - 0 for now. */
248 "microblaze", /* Architecture name. */
249 "MicroBlaze", /* Printable name. */
250 3, /* Section align power. */
251@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
163 bfd_arch_default_fill, /* Default fill. */ 252 bfd_arch_default_fill, /* Default fill. */
164 NULL, /* Next in list. */ 253 NULL, /* Next in list. */
165 0 /* Maximum offset of a reloc from the start of an insn. */ 254 0 /* Maximum offset of a reloc from the start of an insn. */
@@ -170,7 +259,7 @@ Index: gdb-9.2/bfd/cpu-microblaze.c
170+ 32, /* 32 bits in an address. */ 259+ 32, /* 32 bits in an address. */
171+ 8, /* 8 bits in a byte. */ 260+ 8, /* 8 bits in a byte. */
172+ bfd_arch_microblaze, /* Architecture. */ 261+ bfd_arch_microblaze, /* Architecture. */
173+ 0, /* Machine number - 0 for now. */ 262+ bfd_mach_microblaze, /* 32 bit Machine */
174+ "microblaze", /* Architecture name. */ 263+ "microblaze", /* Architecture name. */
175+ "MicroBlaze", /* Printable name. */ 264+ "MicroBlaze", /* Printable name. */
176+ 3, /* Section align power. */ 265+ 3, /* Section align power. */
@@ -184,8 +273,8 @@ Index: gdb-9.2/bfd/cpu-microblaze.c
184+ 64, /* 32 bits in a word. */ 273+ 64, /* 32 bits in a word. */
185+ 64, /* 32 bits in an address. */ 274+ 64, /* 32 bits in an address. */
186+ 8, /* 8 bits in a byte. */ 275+ 8, /* 8 bits in a byte. */
187+ bfd_arch_microblaze, /* Architecture. */ 276+ bfd_arch_microblaze, /* Architecture. */
188+ 0, /* Machine number - 0 for now. */ 277+ bfd_mach_microblaze64, /* 64 bit Machine */
189+ "microblaze", /* Architecture name. */ 278+ "microblaze", /* Architecture name. */
190+ "MicroBlaze", /* Printable name. */ 279+ "MicroBlaze", /* Printable name. */
191+ 3, /* Section align power. */ 280+ 3, /* Section align power. */
@@ -194,15 +283,384 @@ Index: gdb-9.2/bfd/cpu-microblaze.c
194+ bfd_default_scan, /* String to architecture conversion. */ 283+ bfd_default_scan, /* String to architecture conversion. */
195+ bfd_arch_default_fill, /* Default fill. */ 284+ bfd_arch_default_fill, /* Default fill. */
196+ NULL, /* Next in list. */ 285+ NULL, /* Next in list. */
197+ 0 /* Maximum offset of a reloc from the start of an insn. */ 286+ 0
198+} 287+}
199+#endif 288+#endif
200 }; 289 };
201Index: gdb-9.2/bfd/elf64-microblaze.c 290diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
202=================================================================== 291index cfd70ae9178..9f9e13467d2 100644
292--- a/bfd/elf32-microblaze.c
293+++ b/bfd/elf32-microblaze.c
294@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
295 0x0000ffff, /* Dest Mask. */
296 TRUE), /* PC relative offset? */
297
298+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
299+ 0, /* Rightshift. */
300+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
301+ 16, /* Bitsize. */
302+ TRUE, /* PC_relative. */
303+ 0, /* Bitpos. */
304+ complain_overflow_dont, /* Complain on overflow. */
305+ bfd_elf_generic_reloc,/* Special Function. */
306+ "R_MICROBLAZE_IMML_64", /* Name. */
307+ FALSE, /* Partial Inplace. */
308+ 0, /* Source Mask. */
309+ 0x0000ffff, /* Dest Mask. */
310+ FALSE), /* PC relative offset? */
311+
312 /* A 64 bit relocation. Table entry not really used. */
313 HOWTO (R_MICROBLAZE_64, /* Type. */
314 0, /* Rightshift. */
315@@ -176,7 +190,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
316 0x0000ffff, /* Dest Mask. */
317 FALSE), /* PC relative offset? */
318
319- /* This reloc does nothing. Used for relaxation. */
320+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
321+ 0, /* Rightshift. */
322+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
323+ 32, /* Bitsize. */
324+ TRUE, /* PC_relative. */
325+ 0, /* Bitpos. */
326+ complain_overflow_bitfield, /* Complain on overflow. */
327+ NULL, /* Special Function. */
328+ "R_MICROBLAZE_32_NONE",/* Name. */
329+ FALSE, /* Partial Inplace. */
330+ 0, /* Source Mask. */
331+ 0, /* Dest Mask. */
332+ FALSE), /* PC relative offset? */
333+
334+ /* This reloc does nothing. Used for relaxation. */
335 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
336 0, /* Rightshift. */
337 3, /* Size (0 = byte, 1 = short, 2 = long). */
338@@ -266,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
339 0x0000ffff, /* Dest Mask. */
340 TRUE), /* PC relative offset? */
341
342+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
343+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
344+ 0, /* Rightshift. */
345+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
346+ 16, /* Bitsize. */
347+ TRUE, /* PC_relative. */
348+ 0, /* Bitpos. */
349+ complain_overflow_dont, /* Complain on overflow. */
350+ bfd_elf_generic_reloc, /* Special Function. */
351+ "R_MICROBLAZE_GPC_64", /* Name. */
352+ FALSE, /* Partial Inplace. */
353+ 0, /* Source Mask. */
354+ 0x0000ffff, /* Dest Mask. */
355+ TRUE), /* PC relative offset? */
356+
357 /* A 64 bit GOT relocation. Table-entry not really used. */
358 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
359 0, /* Rightshift. */
360@@ -562,6 +605,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
361 case BFD_RELOC_NONE:
362 microblaze_reloc = R_MICROBLAZE_NONE;
363 break;
364+ case BFD_RELOC_MICROBLAZE_32_NONE:
365+ microblaze_reloc = R_MICROBLAZE_32_NONE;
366+ break;
367 case BFD_RELOC_MICROBLAZE_64_NONE:
368 microblaze_reloc = R_MICROBLAZE_64_NONE;
369 break;
370@@ -602,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
371 case BFD_RELOC_VTABLE_ENTRY:
372 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
373 break;
374+ case BFD_RELOC_MICROBLAZE_64:
375+ microblaze_reloc = R_MICROBLAZE_IMML_64;
376+ break;
377 case BFD_RELOC_MICROBLAZE_64_GOTPC:
378 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
379 break;
380+ case BFD_RELOC_MICROBLAZE_64_GPC:
381+ microblaze_reloc = R_MICROBLAZE_GPC_64;
382+ break;
383 case BFD_RELOC_MICROBLAZE_64_GOT:
384 microblaze_reloc = R_MICROBLAZE_GOT_64;
385 break;
386@@ -715,87 +767,6 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
387 return _bfd_elf_is_local_label_name (abfd, name);
388 }
389
390-/* Support for core dump NOTE sections. */
391-static bfd_boolean
392-microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
393-{
394- int offset;
395- unsigned int size;
396-
397- switch (note->descsz)
398- {
399- default:
400- return FALSE;
401-
402- case 228: /* Linux/MicroBlaze */
403- /* pr_cursig */
404- elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
405-
406- /* pr_pid */
407- elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
408-
409- /* pr_reg */
410- offset = 72;
411- size = 50 * 4;
412-
413- break;
414- }
415-
416- /* Make a ".reg/999" section. */
417- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
418- size, note->descpos + offset);
419-}
420-
421-static bfd_boolean
422-microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
423-{
424- switch (note->descsz)
425- {
426- default:
427- return FALSE;
428-
429- case 128: /* Linux/MicroBlaze elf_prpsinfo */
430- elf_tdata (abfd)->core->program
431- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
432- elf_tdata (abfd)->core->command
433- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
434- }
435-
436- /* Note that for some reason, a spurious space is tacked
437- onto the end of the args in some (at least one anyway)
438- implementations, so strip it off if it exists. */
439-
440- {
441- char *command = elf_tdata (abfd)->core->command;
442- int n = strlen (command);
443-
444- if (0 < n && command[n - 1] == ' ')
445- command[n - 1] = '\0';
446- }
447-
448- return TRUE;
449-}
450-
451-/* The microblaze linker (like many others) needs to keep track of
452- the number of relocs that it decides to copy as dynamic relocs in
453- check_relocs for each symbol. This is so that it can later discard
454- them if they are found to be unnecessary. We store the information
455- in a field extending the regular ELF linker hash table. */
456-
457-struct elf32_mb_dyn_relocs
458-{
459- struct elf32_mb_dyn_relocs *next;
460-
461- /* The input section of the reloc. */
462- asection *sec;
463-
464- /* Total number of relocs copied for the input section. */
465- bfd_size_type count;
466-
467- /* Number of pc-relative relocs copied for the input section. */
468- bfd_size_type pc_count;
469-};
470-
471 /* ELF linker hash entry. */
472
473 struct elf32_mb_link_hash_entry
474@@ -1509,9 +1480,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
475 relocation += addend;
476 relocation -= dtprel_base(info);
477 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
478- contents + offset + 2);
479+ contents + offset + endian);
480 bfd_put_16 (input_bfd, relocation & 0xffff,
481- contents + offset + 2 + INST_WORD_SIZE);
482+ contents + offset + endian + INST_WORD_SIZE);
483 break;
484 case (int) R_MICROBLAZE_TEXTREL_64:
485 case (int) R_MICROBLAZE_TEXTREL_32_LO:
486@@ -1525,7 +1496,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
487 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
488 {
489 relocation += addend;
490- if (r_type == R_MICROBLAZE_32)
491+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
492 bfd_put_32 (input_bfd, relocation, contents + offset);
493 else
494 {
495@@ -1927,8 +1898,7 @@ microblaze_elf_relax_section (bfd *abfd,
496 else
497 symval += irel->r_addend;
498
499- if ((symval & 0xffff8000) == 0
500- || (symval & 0xffff8000) == 0xffff8000)
501+ if ((symval & 0xffff8000) == 0)
502 {
503 /* We can delete this instruction. */
504 sec->relax[sec->relax_count].addr = irel->r_offset;
505@@ -1992,21 +1962,51 @@ microblaze_elf_relax_section (bfd *abfd,
506 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
507 }
508 break;
509+ case R_MICROBLAZE_IMML_64:
510+ {
511+ /* This was a PC-relative instruction that was
512+ completely resolved. */
513+ int sfix, efix;
514+ unsigned int val;
515+ bfd_vma target_address;
516+ target_address = irel->r_addend + irel->r_offset;
517+ sfix = calc_fixup (irel->r_offset, 0, sec);
518+ efix = calc_fixup (target_address, 0, sec);
519+
520+ /* Validate the in-band val. */
521+ val = bfd_get_32 (abfd, contents + irel->r_offset);
522+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
523+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
524+ }
525+ irel->r_addend -= (efix - sfix);
526+ /* Should use HOWTO. */
527+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
528+ irel->r_addend);
529+ }
530+ break;
531 case R_MICROBLAZE_NONE:
532+ case R_MICROBLAZE_32_NONE:
533 {
534 /* This was a PC-relative instruction that was
535 completely resolved. */
536 int sfix, efix;
537+ unsigned int val;
538 bfd_vma target_address;
539 target_address = irel->r_addend + irel->r_offset;
540 sfix = calc_fixup (irel->r_offset, 0, sec);
541 efix = calc_fixup (target_address, 0, sec);
542+
543+ /* Validate the in-band val. */
544+ val = bfd_get_32 (abfd, contents + irel->r_offset);
545+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
546+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
547+ }
548 irel->r_addend -= (efix - sfix);
549 /* Should use HOWTO. */
550 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
551 irel->r_addend);
552- }
553- break;
554+ }
555+ break;
556 case R_MICROBLAZE_64_NONE:
557 {
558 /* This was a PC-relative 64-bit instruction that was
559@@ -2017,8 +2017,8 @@ microblaze_elf_relax_section (bfd *abfd,
560 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
561 efix = calc_fixup (target_address, 0, sec);
562 irel->r_addend -= (efix - sfix);
563- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
564- + INST_WORD_SIZE, irel->r_addend);
565+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
566+ irel->r_addend);
567 }
568 break;
569 }
570@@ -2048,9 +2048,50 @@ microblaze_elf_relax_section (bfd *abfd,
571 irelscanend = irelocs + o->reloc_count;
572 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
573 {
574- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
575- {
576- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
577+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
578+ {
579+ unsigned int val;
580+
581+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
582+
583+ /* hax: We only do the following fixup for debug location lists. */
584+ if (strcmp(".debug_loc", o->name))
585+ continue;
586+
587+ /* This was a PC-relative instruction that was completely resolved. */
588+ if (ocontents == NULL)
589+ {
590+ if (elf_section_data (o)->this_hdr.contents != NULL)
591+ ocontents = elf_section_data (o)->this_hdr.contents;
592+ else
593+ {
594+ /* We always cache the section contents.
595+ Perhaps, if info->keep_memory is FALSE, we
596+ should free them, if we are permitted to. */
597+
598+ if (o->rawsize == 0)
599+ o->rawsize = o->size;
600+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
601+ if (ocontents == NULL)
602+ goto error_return;
603+ if (!bfd_get_section_contents (abfd, o, ocontents,
604+ (file_ptr) 0,
605+ o->rawsize))
606+ goto error_return;
607+ elf_section_data (o)->this_hdr.contents = ocontents;
608+ }
609+ }
610+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
611+ if (val != irelscan->r_addend) {
612+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
613+ }
614+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
615+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
616+ irelscan->r_addend);
617+ }
618+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
619+ {
620+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
621
622 /* Look at the reloc only if the value has been resolved. */
623 if (isym->st_shndx == shndx
624@@ -2107,7 +2148,7 @@ microblaze_elf_relax_section (bfd *abfd,
625 elf_section_data (o)->this_hdr.contents = ocontents;
626 }
627 }
628- irelscan->r_addend -= calc_fixup (irel->r_addend
629+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
630 + isym->st_value,
631 0,
632 sec);
633@@ -3461,6 +3502,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
634 return TRUE;
635 }
636
637+
638+static bfd_boolean
639+elf_microblaze_object_p (bfd *abfd)
640+{
641+ /* Set the right machine number for an s390 elf32 file. */
642+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
643+}
644+
645 /* Hook called by the linker routine which adds symbols from an object
646 file. We use it to put .comm items in .sbss, and not .bss. */
647
648@@ -3530,8 +3579,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
649 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
650 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
651 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
652-
653-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
654-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
655+#define elf_backend_object_p elf_microblaze_object_p
656
657 #include "elf32-target.h"
658diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
659new file mode 100755
660index 00000000000..bf58b4b0a67
203--- /dev/null 661--- /dev/null
204+++ gdb-9.2/bfd/elf64-microblaze.c 662+++ b/bfd/elf64-microblaze.c
205@@ -0,0 +1,3610 @@ 663@@ -0,0 +1,3711 @@
206+/* Xilinx MicroBlaze-specific support for 32-bit ELF 664+/* Xilinx MicroBlaze-specific support for 32-bit ELF
207+ 665+
208+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 666+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -322,6 +780,21 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
322+ TRUE), /* PC relative offset? */ 780+ TRUE), /* PC relative offset? */
323+ 781+
324+ /* A 64 bit relocation. Table entry not really used. */ 782+ /* A 64 bit relocation. Table entry not really used. */
783+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
784+ 0, /* Rightshift. */
785+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
786+ 64, /* Bitsize. */
787+ FALSE, /* PC_relative. */
788+ 0, /* Bitpos. */
789+ complain_overflow_dont, /* Complain on overflow. */
790+ bfd_elf_generic_reloc,/* Special Function. */
791+ "R_MICROBLAZE_IMML_64", /* Name. */
792+ FALSE, /* Partial Inplace. */
793+ 0, /* Source Mask. */
794+ 0xffffffffffffff, /* Dest Mask. */
795+ FALSE), /* PC relative offset? */
796+
797+ /* A 64 bit relocation. Table entry not really used. */
325+ HOWTO (R_MICROBLAZE_64, /* Type. */ 798+ HOWTO (R_MICROBLAZE_64, /* Type. */
326+ 0, /* Rightshift. */ 799+ 0, /* Rightshift. */
327+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 800+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
@@ -470,6 +943,21 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
470+ 0x0000ffff, /* Dest Mask. */ 943+ 0x0000ffff, /* Dest Mask. */
471+ TRUE), /* PC relative offset? */ 944+ TRUE), /* PC relative offset? */
472+ 945+
946+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
947+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
948+ 0, /* Rightshift. */
949+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
950+ 16, /* Bitsize. */
951+ TRUE, /* PC_relative. */
952+ 0, /* Bitpos. */
953+ complain_overflow_dont, /* Complain on overflow. */
954+ bfd_elf_generic_reloc, /* Special Function. */
955+ "R_MICROBLAZE_GPC_64", /* Name. */
956+ FALSE, /* Partial Inplace. */
957+ 0, /* Source Mask. */
958+ 0x0000ffff, /* Dest Mask. */
959+ TRUE), /* PC relative offset? */
960+
473+ /* A 64 bit GOT relocation. Table-entry not really used. */ 961+ /* A 64 bit GOT relocation. Table-entry not really used. */
474+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ 962+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
475+ 0, /* Rightshift. */ 963+ 0, /* Rightshift. */
@@ -760,9 +1248,9 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
760+ case BFD_RELOC_32: 1248+ case BFD_RELOC_32:
761+ microblaze_reloc = R_MICROBLAZE_32; 1249+ microblaze_reloc = R_MICROBLAZE_32;
762+ break; 1250+ break;
763+ /* RVA is treated the same as 32 */ 1251+ /* RVA is treated the same as 64 */
764+ case BFD_RELOC_RVA: 1252+ case BFD_RELOC_RVA:
765+ microblaze_reloc = R_MICROBLAZE_32; 1253+ microblaze_reloc = R_MICROBLAZE_IMML_64;
766+ break; 1254+ break;
767+ case BFD_RELOC_32_PCREL: 1255+ case BFD_RELOC_32_PCREL:
768+ microblaze_reloc = R_MICROBLAZE_32_PCREL; 1256+ microblaze_reloc = R_MICROBLAZE_32_PCREL;
@@ -794,9 +1282,15 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
794+ case BFD_RELOC_VTABLE_ENTRY: 1282+ case BFD_RELOC_VTABLE_ENTRY:
795+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 1283+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
796+ break; 1284+ break;
1285+ case BFD_RELOC_MICROBLAZE_EA64:
1286+ microblaze_reloc = R_MICROBLAZE_IMML_64;
1287+ break;
797+ case BFD_RELOC_MICROBLAZE_64_GOTPC: 1288+ case BFD_RELOC_MICROBLAZE_64_GOTPC:
798+ microblaze_reloc = R_MICROBLAZE_GOTPC_64; 1289+ microblaze_reloc = R_MICROBLAZE_GOTPC_64;
799+ break; 1290+ break;
1291+ case BFD_RELOC_MICROBLAZE_64_GPC:
1292+ microblaze_reloc = R_MICROBLAZE_GPC_64;
1293+ break;
800+ case BFD_RELOC_MICROBLAZE_64_GOT: 1294+ case BFD_RELOC_MICROBLAZE_64_GOT:
801+ microblaze_reloc = R_MICROBLAZE_GOT_64; 1295+ microblaze_reloc = R_MICROBLAZE_GOT_64;
802+ break; 1296+ break;
@@ -860,8 +1354,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
860+ 1354+
861+/* Set the howto pointer for a RCE ELF reloc. */ 1355+/* Set the howto pointer for a RCE ELF reloc. */
862+ 1356+
863+static bfd_boolean 1357+static void
864+microblaze_elf_info_to_howto (bfd * abfd, 1358+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
865+ arelent * cache_ptr, 1359+ arelent * cache_ptr,
866+ Elf_Internal_Rela * dst) 1360+ Elf_Internal_Rela * dst)
867+{ 1361+{
@@ -874,15 +1368,13 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
874+ r_type = ELF64_R_TYPE (dst->r_info); 1368+ r_type = ELF64_R_TYPE (dst->r_info);
875+ if (r_type >= R_MICROBLAZE_max) 1369+ if (r_type >= R_MICROBLAZE_max)
876+ { 1370+ {
877+ /* xgettext:c-format */ 1371+ (*_bfd_error_handler) (_("%B: unrecognised MicroBlaze reloc number: %d"),
878+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), 1372+ abfd, r_type);
879+ abfd, r_type);
880+ bfd_set_error (bfd_error_bad_value); 1373+ bfd_set_error (bfd_error_bad_value);
881+ return FALSE; 1374+ r_type = R_MICROBLAZE_NONE;
882+ } 1375+ }
883+ 1376+
884+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 1377+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
885+ return TRUE;
886+} 1378+}
887+ 1379+
888+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 1380+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
@@ -1005,6 +1497,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1005+ struct elf64_mb_link_hash_entry *eh; 1497+ struct elf64_mb_link_hash_entry *eh;
1006+ 1498+
1007+ eh = (struct elf64_mb_link_hash_entry *) entry; 1499+ eh = (struct elf64_mb_link_hash_entry *) entry;
1500+ eh->dyn_relocs = NULL;
1008+ eh->tls_mask = 0; 1501+ eh->tls_mask = 0;
1009+ } 1502+ }
1010+ 1503+
@@ -1017,7 +1510,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1017+microblaze_elf_link_hash_table_create (bfd *abfd) 1510+microblaze_elf_link_hash_table_create (bfd *abfd)
1018+{ 1511+{
1019+ struct elf64_mb_link_hash_table *ret; 1512+ struct elf64_mb_link_hash_table *ret;
1020+ size_t amt = sizeof (struct elf64_mb_link_hash_table); 1513+ bfd_size_type amt = sizeof (struct elf64_mb_link_hash_table);
1021+ 1514+
1022+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt); 1515+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt);
1023+ if (ret == NULL) 1516+ if (ret == NULL)
@@ -1232,7 +1725,6 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1232+ else 1725+ else
1233+ { 1726+ {
1234+ bfd_vma relocation; 1727+ bfd_vma relocation;
1235+ bfd_boolean resolved_to_zero;
1236+ 1728+
1237+ /* This is a final link. */ 1729+ /* This is a final link. */
1238+ sym = NULL; 1730+ sym = NULL;
@@ -1272,9 +1764,6 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1272+ goto check_reloc; 1764+ goto check_reloc;
1273+ } 1765+ }
1274+ 1766+
1275+ resolved_to_zero = (h != NULL
1276+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
1277+
1278+ switch ((int) r_type) 1767+ switch ((int) r_type)
1279+ { 1768+ {
1280+ case (int) R_MICROBLAZE_SRO32 : 1769+ case (int) R_MICROBLAZE_SRO32 :
@@ -1309,14 +1798,11 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1309+ } 1798+ }
1310+ else 1799+ else
1311+ { 1800+ {
1312+ _bfd_error_handler 1801+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"),
1313+ /* xgettext:c-format */ 1802+ bfd_get_filename (input_bfd),
1314+ (_("%pB: the target (%s) of an %s relocation" 1803+ sym_name,
1315+ " is in the wrong section (%pA)"), 1804+ microblaze_elf_howto_table[(int) r_type]->name,
1316+ input_bfd, 1805+ bfd_section_name (sec));
1317+ sym_name,
1318+ microblaze_elf_howto_table[(int) r_type]->name,
1319+ sec);
1320+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1806+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1321+ ret = FALSE; 1807+ ret = FALSE;
1322+ continue; 1808+ continue;
@@ -1357,14 +1843,11 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1357+ } 1843+ }
1358+ else 1844+ else
1359+ { 1845+ {
1360+ _bfd_error_handler 1846+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"),
1361+ /* xgettext:c-format */ 1847+ bfd_get_filename (input_bfd),
1362+ (_("%pB: the target (%s) of an %s relocation" 1848+ sym_name,
1363+ " is in the wrong section (%pA)"), 1849+ microblaze_elf_howto_table[(int) r_type]->name,
1364+ input_bfd, 1850+ bfd_section_name (sec));
1365+ sym_name,
1366+ microblaze_elf_howto_table[(int) r_type]->name,
1367+ sec);
1368+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1851+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1369+ ret = FALSE; 1852+ ret = FALSE;
1370+ continue; 1853+ continue;
@@ -1377,6 +1860,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1377+ break; /* Do nothing. */ 1860+ break; /* Do nothing. */
1378+ 1861+
1379+ case (int) R_MICROBLAZE_GOTPC_64: 1862+ case (int) R_MICROBLAZE_GOTPC_64:
1863+ case (int) R_MICROBLAZE_GPC_64:
1380+ relocation = htab->sgotplt->output_section->vma 1864+ relocation = htab->sgotplt->output_section->vma
1381+ + htab->sgotplt->output_offset; 1865+ + htab->sgotplt->output_offset;
1382+ relocation -= (input_section->output_section->vma 1866+ relocation -= (input_section->output_section->vma
@@ -1489,8 +1973,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1489+ /* Need to generate relocs ? */ 1973+ /* Need to generate relocs ? */
1490+ if ((bfd_link_pic (info) || indx != 0) 1974+ if ((bfd_link_pic (info) || indx != 0)
1491+ && (h == NULL 1975+ && (h == NULL
1492+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1976+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1493+ && !resolved_to_zero)
1494+ || h->root.type != bfd_link_hash_undefweak)) 1977+ || h->root.type != bfd_link_hash_undefweak))
1495+ need_relocs = TRUE; 1978+ need_relocs = TRUE;
1496+ 1979+
@@ -1552,47 +2035,47 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1552+ } 2035+ }
1553+ else if (IS_TLS_GD(tls_type)) 2036+ else if (IS_TLS_GD(tls_type))
1554+ { 2037+ {
1555+ *offp |= 1; 2038+ *offp |= 1;
1556+ static_value -= dtprel_base(info); 2039+ static_value -= dtprel_base(info);
1557+ if (need_relocs) 2040+ if (need_relocs)
1558+ microblaze_elf_output_dynamic_relocation 2041+ {
1559+ (output_bfd, 2042+ microblaze_elf_output_dynamic_relocation (output_bfd,
1560+ htab->elf.srelgot, 2043+ htab->srelgot, htab->srelgot->reloc_count++,
1561+ htab->elf.srelgot->reloc_count++, 2044+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
1562+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32, 2045+ got_offset, indx ? 0 : static_value);
1563+ got_offset, indx ? 0 : static_value); 2046+ }
1564+ else 2047+ else
1565+ bfd_put_32 (output_bfd, static_value, 2048+ {
1566+ htab->elf.sgot->contents + off2); 2049+ bfd_put_32 (output_bfd, static_value,
2050+ htab->sgot->contents + off2);
2051+ }
1567+ } 2052+ }
1568+ else 2053+ else
1569+ { 2054+ {
1570+ bfd_put_32 (output_bfd, static_value, 2055+ bfd_put_32 (output_bfd, static_value,
1571+ htab->elf.sgot->contents + off2); 2056+ htab->sgot->contents + off2);
1572+ 2057+
1573+ /* Relocs for dyn symbols generated by 2058+ /* Relocs for dyn symbols generated by
1574+ finish_dynamic_symbols */ 2059+ finish_dynamic_symbols */
1575+ if (bfd_link_pic (info) && h == NULL) 2060+ if (bfd_link_pic (info) && h == NULL)
1576+ { 2061+ {
1577+ *offp |= 1; 2062+ *offp |= 1;
1578+ microblaze_elf_output_dynamic_relocation 2063+ microblaze_elf_output_dynamic_relocation (output_bfd,
1579+ (output_bfd, 2064+ htab->srelgot, htab->srelgot->reloc_count++,
1580+ htab->elf.srelgot, 2065+ /* symindex= */ indx, R_MICROBLAZE_REL,
1581+ htab->elf.srelgot->reloc_count++, 2066+ got_offset, static_value);
1582+ /* symindex= */ indx, R_MICROBLAZE_REL, 2067+ }
1583+ got_offset, static_value);
1584+ }
1585+ } 2068+ }
1586+ } 2069+ }
1587+ 2070+
1588+ /* 4. Fixup Relocation with GOT offset value 2071+ /* 4. Fixup Relocation with GOT offset value
1589+ Compute relative address of GOT entry for applying 2072+ Compute relative address of GOT entry for applying
1590+ the current relocation */ 2073+ the current relocation */
1591+ relocation = htab->elf.sgot->output_section->vma 2074+ relocation = htab->sgot->output_section->vma
1592+ + htab->elf.sgot->output_offset 2075+ + htab->sgot->output_offset
1593+ + off 2076+ + off
1594+ - htab->elf.sgotplt->output_section->vma 2077+ - htab->sgotplt->output_section->vma
1595+ - htab->elf.sgotplt->output_offset; 2078+ - htab->sgotplt->output_offset;
1596+ 2079+
1597+ /* Apply Current Relocation */ 2080+ /* Apply Current Relocation */
1598+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 2081+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
@@ -1609,8 +2092,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1609+ bfd_vma immediate; 2092+ bfd_vma immediate;
1610+ unsigned short lo, high; 2093+ unsigned short lo, high;
1611+ relocation += addend; 2094+ relocation += addend;
1612+ relocation -= (htab->elf.sgotplt->output_section->vma 2095+ relocation -= htab->sgotplt->output_section->vma
1613+ + htab->elf.sgotplt->output_offset); 2096+ + htab->sgotplt->output_offset;
1614+ /* Write this value into correct location. */ 2097+ /* Write this value into correct location. */
1615+ immediate = relocation; 2098+ immediate = relocation;
1616+ lo = immediate & 0x0000ffff; 2099+ lo = immediate & 0x0000ffff;
@@ -1623,8 +2106,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1623+ case (int) R_MICROBLAZE_GOTOFF_32: 2106+ case (int) R_MICROBLAZE_GOTOFF_32:
1624+ { 2107+ {
1625+ relocation += addend; 2108+ relocation += addend;
1626+ relocation -= (htab->elf.sgotplt->output_section->vma 2109+ relocation -= htab->sgotplt->output_section->vma
1627+ + htab->elf.sgotplt->output_offset); 2110+ + htab->sgotplt->output_offset;
1628+ /* Write this value into correct location. */ 2111+ /* Write this value into correct location. */
1629+ bfd_put_32 (input_bfd, relocation, contents + offset); 2112+ bfd_put_32 (input_bfd, relocation, contents + offset);
1630+ break; 2113+ break;
@@ -1641,6 +2124,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1641+ case (int) R_MICROBLAZE_64_PCREL : 2124+ case (int) R_MICROBLAZE_64_PCREL :
1642+ case (int) R_MICROBLAZE_64: 2125+ case (int) R_MICROBLAZE_64:
1643+ case (int) R_MICROBLAZE_32: 2126+ case (int) R_MICROBLAZE_32:
2127+ case (int) R_MICROBLAZE_IMML_64:
1644+ { 2128+ {
1645+ /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols 2129+ /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
1646+ from removed linkonce sections, or sections discarded by 2130+ from removed linkonce sections, or sections discarded by
@@ -1648,16 +2132,27 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1648+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0) 2132+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
1649+ { 2133+ {
1650+ relocation += addend; 2134+ relocation += addend;
1651+ if (r_type == R_MICROBLAZE_32) 2135+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
1652+ bfd_put_32 (input_bfd, relocation, contents + offset); 2136+ bfd_put_32 (input_bfd, relocation, contents + offset);
2137+ else if (r_type == R_MICROBLAZE_IMML_64)
2138+ bfd_put_64 (input_bfd, relocation, contents + offset);
1653+ else 2139+ else
1654+ { 2140+ {
1655+ if (r_type == R_MICROBLAZE_64_PCREL) 2141+ if (r_type == R_MICROBLAZE_64_PCREL)
1656+ relocation -= (input_section->output_section->vma 2142+ relocation -= (input_section->output_section->vma
1657+ + input_section->output_offset 2143+ + input_section->output_offset
1658+ + offset + INST_WORD_SIZE); 2144+ + offset + INST_WORD_SIZE);
1659+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 2145+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
2146+ if ((insn & 0xff000000) == 0xb2000000)
2147+ {
2148+ insn &= ~0x00ffffff;
2149+ insn |= (relocation >> 16) & 0xffffff;
2150+ bfd_put_32 (input_bfd, insn,
1660+ contents + offset + endian); 2151+ contents + offset + endian);
2152+ }
2153+ else
2154+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
2155+ contents + offset + endian);
1661+ bfd_put_16 (input_bfd, relocation & 0xffff, 2156+ bfd_put_16 (input_bfd, relocation & 0xffff,
1662+ contents + offset + endian + INST_WORD_SIZE); 2157+ contents + offset + endian + INST_WORD_SIZE);
1663+ } 2158+ }
@@ -1666,8 +2161,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1666+ 2161+
1667+ if ((bfd_link_pic (info) 2162+ if ((bfd_link_pic (info)
1668+ && (h == NULL 2163+ && (h == NULL
1669+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 2164+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1670+ && !resolved_to_zero)
1671+ || h->root.type != bfd_link_hash_undefweak) 2165+ || h->root.type != bfd_link_hash_undefweak)
1672+ && (!howto->pc_relative 2166+ && (!howto->pc_relative
1673+ || (h != NULL 2167+ || (h != NULL
@@ -1719,7 +2213,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1719+ } 2213+ }
1720+ else 2214+ else
1721+ { 2215+ {
1722+ if (r_type == R_MICROBLAZE_32) 2216+ if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64)
1723+ { 2217+ {
1724+ outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); 2218+ outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
1725+ outrel.r_addend = relocation + addend; 2219+ outrel.r_addend = relocation + addend;
@@ -1745,14 +2239,33 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1745+ relocation += addend; 2239+ relocation += addend;
1746+ if (r_type == R_MICROBLAZE_32) 2240+ if (r_type == R_MICROBLAZE_32)
1747+ bfd_put_32 (input_bfd, relocation, contents + offset); 2241+ bfd_put_32 (input_bfd, relocation, contents + offset);
2242+ else if (r_type == R_MICROBLAZE_IMML_64)
2243+ bfd_put_64 (input_bfd, relocation, contents + offset + endian);
1748+ else 2244+ else
1749+ { 2245+ {
1750+ if (r_type == R_MICROBLAZE_64_PCREL) 2246+ if (r_type == R_MICROBLAZE_64_PCREL)
1751+ relocation -= (input_section->output_section->vma 2247+ {
1752+ + input_section->output_offset 2248+ if (!input_section->output_section->vma &&
1753+ + offset + INST_WORD_SIZE); 2249+ !input_section->output_offset && !offset)
1754+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 2250+ relocation -= (input_section->output_section->vma
2251+ + input_section->output_offset
2252+ + offset);
2253+ else
2254+ relocation -= (input_section->output_section->vma
2255+ + input_section->output_offset
2256+ + offset + INST_WORD_SIZE);
2257+ }
2258+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
2259+ if ((insn & 0xff000000) == 0xb2000000)
2260+ {
2261+ insn &= ~0x00ffffff;
2262+ insn |= (relocation >> 16) & 0xffffff;
2263+ bfd_put_32 (input_bfd, insn,
1755+ contents + offset + endian); 2264+ contents + offset + endian);
2265+ }
2266+ else
2267+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
2268+ contents + offset + endian);
1756+ bfd_put_16 (input_bfd, relocation & 0xffff, 2269+ bfd_put_16 (input_bfd, relocation & 0xffff,
1757+ contents + offset + endian + INST_WORD_SIZE); 2270+ contents + offset + endian + INST_WORD_SIZE);
1758+ } 2271+ }
@@ -1871,9 +2384,19 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1871+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 2384+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
1872+{ 2385+{
1873+ unsigned long instr = bfd_get_32 (abfd, bfd_addr); 2386+ unsigned long instr = bfd_get_32 (abfd, bfd_addr);
1874+ instr &= ~0x0000ffff; 2387+
1875+ instr |= (val & 0x0000ffff); 2388+ if ((instr & 0xff000000) == 0xb2000000)
1876+ bfd_put_32 (abfd, instr, bfd_addr); 2389+ {
2390+ instr &= ~0x00ffffff;
2391+ instr |= (val & 0xffffff);
2392+ bfd_put_32 (abfd, instr, bfd_addr);
2393+ }
2394+ else
2395+ {
2396+ instr &= ~0x0000ffff;
2397+ instr |= (val & 0x0000ffff);
2398+ bfd_put_32 (abfd, instr, bfd_addr);
2399+ }
1877+} 2400+}
1878+ 2401+
1879+/* Read-modify-write into the bfd, an immediate value into appropriate fields of 2402+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
@@ -1885,10 +2408,18 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
1885+ unsigned long instr_lo; 2408+ unsigned long instr_lo;
1886+ 2409+
1887+ instr_hi = bfd_get_32 (abfd, bfd_addr); 2410+ instr_hi = bfd_get_32 (abfd, bfd_addr);
1888+ instr_hi &= ~0x0000ffff; 2411+ if ((instr_hi & 0xff000000) == 0xb2000000)
1889+ instr_hi |= ((val >> 16) & 0x0000ffff); 2412+ {
1890+ bfd_put_32 (abfd, instr_hi, bfd_addr); 2413+ instr_hi &= ~0x00ffffff;
1891+ 2414+ instr_hi |= (val >> 16) & 0xffffff;
2415+ bfd_put_32 (abfd, instr_hi,bfd_addr);
2416+ }
2417+ else
2418+ {
2419+ instr_hi &= ~0x0000ffff;
2420+ instr_hi |= ((val >> 16) & 0x0000ffff);
2421+ bfd_put_32 (abfd, instr_hi, bfd_addr);
2422+ }
1892+ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE); 2423+ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
1893+ instr_lo &= ~0x0000ffff; 2424+ instr_lo &= ~0x0000ffff;
1894+ instr_lo |= (val & 0x0000ffff); 2425+ instr_lo |= (val & 0x0000ffff);
@@ -2094,6 +2625,28 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2094+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 2625+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
2095+ } 2626+ }
2096+ break; 2627+ break;
2628+ case R_MICROBLAZE_IMML_64:
2629+ {
2630+ /* This was a PC-relative instruction that was
2631+ completely resolved. */
2632+ int sfix, efix;
2633+ unsigned int val;
2634+ bfd_vma target_address;
2635+ target_address = irel->r_addend + irel->r_offset;
2636+ sfix = calc_fixup (irel->r_offset, 0, sec);
2637+ efix = calc_fixup (target_address, 0, sec);
2638+
2639+ /* Validate the in-band val. */
2640+ val = bfd_get_64 (abfd, contents + irel->r_offset);
2641+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2642+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2643+ }
2644+ irel->r_addend -= (efix - sfix);
2645+ /* Should use HOWTO. */
2646+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2647+ irel->r_addend);
2648+ }
2649+ break;
2097+ case R_MICROBLAZE_NONE: 2650+ case R_MICROBLAZE_NONE:
2098+ case R_MICROBLAZE_32_NONE: 2651+ case R_MICROBLAZE_32_NONE:
2099+ { 2652+ {
@@ -2127,8 +2680,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2127+ sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); 2680+ sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
2128+ efix = calc_fixup (target_address, 0, sec); 2681+ efix = calc_fixup (target_address, 0, sec);
2129+ irel->r_addend -= (efix - sfix); 2682+ irel->r_addend -= (efix - sfix);
2130+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset 2683+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2131+ + INST_WORD_SIZE, irel->r_addend); 2684+ irel->r_addend);
2132+ } 2685+ }
2133+ break; 2686+ break;
2134+ } 2687+ }
@@ -2200,7 +2753,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2200+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 2753+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
2201+ irelscan->r_addend); 2754+ irelscan->r_addend);
2202+ } 2755+ }
2203+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 2756+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
2757+ || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
2204+ { 2758+ {
2205+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 2759+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2206+ 2760+
@@ -2347,7 +2901,10 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2347+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents 2901+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
2348+ + irelscan->r_offset 2902+ + irelscan->r_offset
2349+ + INST_WORD_SIZE); 2903+ + INST_WORD_SIZE);
2350+ immediate = (instr_hi & 0x0000ffff) << 16; 2904+ if ((instr_hi & 0xff000000) == 0xb2000000)
2905+ immediate = (instr_hi & 0x00ffffff) << 24;
2906+ else
2907+ immediate = (instr_hi & 0x0000ffff) << 16;
2351+ immediate |= (instr_lo & 0x0000ffff); 2908+ immediate |= (instr_lo & 0x0000ffff);
2352+ offset = calc_fixup (irelscan->r_addend, 0, sec); 2909+ offset = calc_fixup (irelscan->r_addend, 0, sec);
2353+ immediate -= offset; 2910+ immediate -= offset;
@@ -2391,7 +2948,10 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2391+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents 2948+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
2392+ + irelscan->r_offset 2949+ + irelscan->r_offset
2393+ + INST_WORD_SIZE); 2950+ + INST_WORD_SIZE);
2394+ immediate = (instr_hi & 0x0000ffff) << 16; 2951+ if ((instr_hi & 0xff000000) == 0xb2000000)
2952+ immediate = (instr_hi & 0x00ffffff) << 24;
2953+ else
2954+ immediate = (instr_hi & 0x0000ffff) << 16;
2395+ immediate |= (instr_lo & 0x0000ffff); 2955+ immediate |= (instr_lo & 0x0000ffff);
2396+ target_address = immediate; 2956+ target_address = immediate;
2397+ offset = calc_fixup (target_address, 0, sec); 2957+ offset = calc_fixup (target_address, 0, sec);
@@ -2644,9 +3204,10 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2644+ else 3204+ else
2645+ { 3205+ {
2646+ h = sym_hashes [r_symndx - symtab_hdr->sh_info]; 3206+ h = sym_hashes [r_symndx - symtab_hdr->sh_info];
2647+ while (h->root.type == bfd_link_hash_indirect 3207+
2648+ || h->root.type == bfd_link_hash_warning) 3208+ /* PR15323, ref flags aren't set for references in the same
2649+ h = (struct elf_link_hash_entry *) h->root.u.i.link; 3209+ object. */
3210+ h->root.non_ir_ref_regular = 1;
2650+ } 3211+ }
2651+ 3212+
2652+ switch (r_type) 3213+ switch (r_type)
@@ -2705,6 +3266,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2705+ case R_MICROBLAZE_64: 3266+ case R_MICROBLAZE_64:
2706+ case R_MICROBLAZE_64_PCREL: 3267+ case R_MICROBLAZE_64_PCREL:
2707+ case R_MICROBLAZE_32: 3268+ case R_MICROBLAZE_32:
3269+ case R_MICROBLAZE_IMML_64:
2708+ { 3270+ {
2709+ if (h != NULL && !bfd_link_pic (info)) 3271+ if (h != NULL && !bfd_link_pic (info))
2710+ { 3272+ {
@@ -2777,7 +3339,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2777+ /* If this is a global symbol, we count the number of 3339+ /* If this is a global symbol, we count the number of
2778+ relocations we need for this symbol. */ 3340+ relocations we need for this symbol. */
2779+ if (h != NULL) 3341+ if (h != NULL)
2780+ head = &h->dyn_relocs; 3342+ head = &((struct elf64_mb_link_hash_entry *) h)->dyn_relocs;
2781+ else 3343+ else
2782+ { 3344+ {
2783+ /* Track dynamic relocs needed for local syms too. 3345+ /* Track dynamic relocs needed for local syms too.
@@ -2804,7 +3366,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2804+ p = *head; 3366+ p = *head;
2805+ if (p == NULL || p->sec != sec) 3367+ if (p == NULL || p->sec != sec)
2806+ { 3368+ {
2807+ size_t amt = sizeof *p; 3369+ bfd_size_type amt = sizeof *p;
2808+ p = ((struct elf64_mb_dyn_relocs *) 3370+ p = ((struct elf64_mb_dyn_relocs *)
2809+ bfd_alloc (htab->elf.dynobj, amt)); 3371+ bfd_alloc (htab->elf.dynobj, amt));
2810+ if (p == NULL) 3372+ if (p == NULL)
@@ -2914,8 +3476,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2914+ struct elf64_mb_link_hash_table *htab; 3476+ struct elf64_mb_link_hash_table *htab;
2915+ struct elf64_mb_link_hash_entry * eh; 3477+ struct elf64_mb_link_hash_entry * eh;
2916+ struct elf64_mb_dyn_relocs *p; 3478+ struct elf64_mb_dyn_relocs *p;
2917+ asection *sdynbss; 3479+ asection *sdynbss, *s;
2918+ asection *s, *srel;
2919+ unsigned int power_of_two; 3480+ unsigned int power_of_two;
2920+ bfd *dynobj; 3481+ bfd *dynobj;
2921+ 3482+
@@ -2963,7 +3524,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2963+ h->root.u.def.section = def->root.u.def.section; 3524+ h->root.u.def.section = def->root.u.def.section;
2964+ h->root.u.def.value = def->root.u.def.value; 3525+ h->root.u.def.value = def->root.u.def.value;
2965+ return TRUE; 3526+ return TRUE;
2966+ } 3527+ }
2967+ 3528+
2968+ /* This is a reference to a symbol defined by a dynamic object which 3529+ /* This is a reference to a symbol defined by a dynamic object which
2969+ is not a function. */ 3530+ is not a function. */
@@ -2997,7 +3558,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
2997+ 3558+
2998+ /* If we didn't find any dynamic relocs in read-only sections, then 3559+ /* If we didn't find any dynamic relocs in read-only sections, then
2999+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ 3560+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
3000+ if (!_bfd_elf_readonly_dynrelocs (h)) 3561+ if (p == NULL)
3001+ { 3562+ {
3002+ h->non_got_ref = 0; 3563+ h->non_got_ref = 0;
3003+ return TRUE; 3564+ return TRUE;
@@ -3016,19 +3577,11 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3016+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker 3577+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
3017+ to copy the initial value out of the dynamic object and into the 3578+ to copy the initial value out of the dynamic object and into the
3018+ runtime process image. */ 3579+ runtime process image. */
3019+ if ((h->root.u.def.section->flags & SEC_READONLY) != 0) 3580+ dynobj = elf_hash_table (info)->dynobj;
3020+ { 3581+ BFD_ASSERT (dynobj != NULL);
3021+ s = htab->elf.sdynrelro;
3022+ srel = htab->elf.sreldynrelro;
3023+ }
3024+ else
3025+ {
3026+ s = htab->elf.sdynbss;
3027+ srel = htab->elf.srelbss;
3028+ }
3029+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) 3582+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
3030+ { 3583+ {
3031+ srel->size += sizeof (Elf64_External_Rela); 3584+ htab->srelbss->size += sizeof (Elf64_External_Rela);
3032+ h->needs_copy = 1; 3585+ h->needs_copy = 1;
3033+ } 3586+ }
3034+ 3587+
@@ -3038,20 +3591,21 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3038+ if (power_of_two > 3) 3591+ if (power_of_two > 3)
3039+ power_of_two = 3; 3592+ power_of_two = 3;
3040+ 3593+
3594+ sdynbss = htab->sdynbss;
3041+ /* Apply the required alignment. */ 3595+ /* Apply the required alignment. */
3042+ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); 3596+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
3043+ if (power_of_two > s->alignment_power) 3597+ if (power_of_two > bfd_section_alignment (sdynbss))
3044+ { 3598+ {
3045+ if (!bfd_set_section_alignment (s, power_of_two)) 3599+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
3046+ return FALSE; 3600+ return FALSE;
3047+ } 3601+ }
3048+ 3602+
3049+ /* Define the symbol as being at this point in the section. */ 3603+ /* Define the symbol as being at this point in the section. */
3050+ h->root.u.def.section = s; 3604+ h->root.u.def.section = sdynbss;
3051+ h->root.u.def.value = s->size; 3605+ h->root.u.def.value = sdynbss->size;
3052+ 3606+
3053+ /* Increment the section size to make room for the symbol. */ 3607+ /* Increment the section size to make room for the symbol. */
3054+ s->size += h->size; 3608+ sdynbss->size += h->size;
3055+ return TRUE; 3609+ return TRUE;
3056+} 3610+}
3057+ 3611+
@@ -3111,13 +3665,13 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3111+ /* Make room for this entry. */ 3665+ /* Make room for this entry. */
3112+ s->size += PLT_ENTRY_SIZE; 3666+ s->size += PLT_ENTRY_SIZE;
3113+ 3667+
3114+ /* We also need to make an entry in the .got.plt section, which 3668+ /* We also need to make an entry in the .got.plt section, which
3115+ will be placed in the .got section by the linker script. */ 3669+ will be placed in the .got section by the linker script. */
3116+ htab->elf.sgotplt->size += 4; 3670+ htab->sgotplt->size += 4;
3117+ 3671+
3118+ /* We also need to make an entry in the .rel.plt section. */ 3672+ /* We also need to make an entry in the .rel.plt section. */
3119+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela); 3673+ htab->srelplt->size += sizeof (Elf64_External_Rela);
3120+ } 3674+ }
3121+ else 3675+ else
3122+ { 3676+ {
3123+ h->plt.offset = (bfd_vma) -1; 3677+ h->plt.offset = (bfd_vma) -1;
@@ -3172,17 +3726,17 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3172+ h->got.offset = (bfd_vma) -1; 3726+ h->got.offset = (bfd_vma) -1;
3173+ } 3727+ }
3174+ else 3728+ else
3175+ { 3729+ {
3176+ s = htab->elf.sgot; 3730+ s = htab->sgot;
3177+ h->got.offset = s->size; 3731+ h->got.offset = s->size;
3178+ s->size += need; 3732+ s->size += need;
3179+ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4); 3733+ htab->srelgot->size += need * (sizeof (Elf64_External_Rela) / 4);
3180+ } 3734+ }
3181+ } 3735+ }
3182+ else 3736+ else
3183+ h->got.offset = (bfd_vma) -1; 3737+ h->got.offset = (bfd_vma) -1;
3184+ 3738+
3185+ if (h->dyn_relocs == NULL) 3739+ if (eh->dyn_relocs == NULL)
3186+ return TRUE; 3740+ return TRUE;
3187+ 3741+
3188+ /* In the shared -Bsymbolic case, discard space allocated for 3742+ /* In the shared -Bsymbolic case, discard space allocated for
@@ -3199,7 +3753,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3199+ { 3753+ {
3200+ struct elf64_mb_dyn_relocs **pp; 3754+ struct elf64_mb_dyn_relocs **pp;
3201+ 3755+
3202+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) 3756+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
3203+ { 3757+ {
3204+ p->count -= p->pc_count; 3758+ p->count -= p->pc_count;
3205+ p->pc_count = 0; 3759+ p->pc_count = 0;
@@ -3209,8 +3763,6 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3209+ pp = &p->next; 3763+ pp = &p->next;
3210+ } 3764+ }
3211+ } 3765+ }
3212+ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
3213+ h->dyn_relocs = NULL;
3214+ } 3766+ }
3215+ else 3767+ else
3216+ { 3768+ {
@@ -3240,13 +3792,13 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3240+ goto keep; 3792+ goto keep;
3241+ } 3793+ }
3242+ 3794+
3243+ h->dyn_relocs = NULL; 3795+ eh->dyn_relocs = NULL;
3244+ 3796+
3245+ keep: ; 3797+ keep: ;
3246+ } 3798+ }
3247+ 3799+
3248+ /* Finally, allocate space. */ 3800+ /* Finally, allocate space. */
3249+ for (p = h->dyn_relocs; p != NULL; p = p->next) 3801+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
3250+ { 3802+ {
3251+ asection *sreloc = elf_section_data (p->sec)->sreloc; 3803+ asection *sreloc = elf_section_data (p->sec)->sreloc;
3252+ sreloc->size += p->count * sizeof (Elf64_External_Rela); 3804+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
@@ -3322,8 +3874,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3322+ locsymcount = symtab_hdr->sh_info; 3874+ locsymcount = symtab_hdr->sh_info;
3323+ end_local_got = local_got + locsymcount; 3875+ end_local_got = local_got + locsymcount;
3324+ lgot_masks = (unsigned char *) end_local_got; 3876+ lgot_masks = (unsigned char *) end_local_got;
3325+ s = htab->elf.sgot; 3877+ s = htab->sgot;
3326+ srel = htab->elf.srelgot; 3878+ srel = htab->srelgot;
3327+ 3879+
3328+ for (; local_got < end_local_got; ++local_got, ++lgot_masks) 3880+ for (; local_got < end_local_got; ++local_got, ++lgot_masks)
3329+ { 3881+ {
@@ -3363,10 +3915,10 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3363+ 3915+
3364+ if (htab->tlsld_got.refcount > 0) 3916+ if (htab->tlsld_got.refcount > 0)
3365+ { 3917+ {
3366+ htab->tlsld_got.offset = htab->elf.sgot->size; 3918+ htab->tlsld_got.offset = htab->sgot->size;
3367+ htab->elf.sgot->size += 8; 3919+ htab->sgot->size += 8;
3368+ if (bfd_link_pic (info)) 3920+ if (bfd_link_pic (info))
3369+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela); 3921+ htab->srelgot->size += sizeof (Elf64_External_Rela);
3370+ } 3922+ }
3371+ else 3923+ else
3372+ htab->tlsld_got.offset = (bfd_vma) -1; 3924+ htab->tlsld_got.offset = (bfd_vma) -1;
@@ -3374,8 +3926,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3374+ if (elf_hash_table (info)->dynamic_sections_created) 3926+ if (elf_hash_table (info)->dynamic_sections_created)
3375+ { 3927+ {
3376+ /* Make space for the trailing nop in .plt. */ 3928+ /* Make space for the trailing nop in .plt. */
3377+ if (htab->elf.splt->size > 0) 3929+ if (htab->splt->size > 0)
3378+ htab->elf.splt->size += 4; 3930+ htab->splt->size += 4;
3379+ } 3931+ }
3380+ 3932+
3381+ /* The check_relocs and adjust_dynamic_symbol entry points have 3933+ /* The check_relocs and adjust_dynamic_symbol entry points have
@@ -3390,40 +3942,36 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3390+ continue; 3942+ continue;
3391+ 3943+
3392+ /* It's OK to base decisions on the section name, because none 3944+ /* It's OK to base decisions on the section name, because none
3393+ of the dynobj section names depend upon the input files. */ 3945+ of the dynobj section names depend upon the input files. */
3394+ name = bfd_section_name (s); 3946+ name = bfd_section_name (s);
3395+ 3947+
3396+ if (strncmp (name, ".rela", 5) == 0) 3948+ if (strncmp (name, ".rela", 5) == 0)
3397+ { 3949+ {
3398+ if (s->size == 0) 3950+ if (s->size == 0)
3399+ { 3951+ {
3400+ /* If we don't need this section, strip it from the 3952+ /* If we don't need this section, strip it from the
3401+ output file. This is to handle .rela.bss and 3953+ output file. This is to handle .rela.bss and
3402+ .rela.plt. We must create it in 3954+ .rela.plt. We must create it in
3403+ create_dynamic_sections, because it must be created 3955+ create_dynamic_sections, because it must be created
3404+ before the linker maps input sections to output 3956+ before the linker maps input sections to output
3405+ sections. The linker does that before 3957+ sections. The linker does that before
3406+ adjust_dynamic_symbol is called, and it is that 3958+ adjust_dynamic_symbol is called, and it is that
3407+ function which decides whether anything needs to go 3959+ function which decides whether anything needs to go
3408+ into these sections. */ 3960+ into these sections. */
3409+ strip = TRUE; 3961+ strip = TRUE;
3410+ } 3962+ }
3411+ else 3963+ else
3412+ { 3964+ {
3413+ /* We use the reloc_count field as a counter if we need 3965+ /* We use the reloc_count field as a counter if we need
3414+ to copy relocs into the output file. */ 3966+ to copy relocs into the output file. */
3415+ s->reloc_count = 0; 3967+ s->reloc_count = 0;
3416+ } 3968+ }
3417+ } 3969+ }
3418+ else if (s != htab->elf.splt 3970+ else if (s != htab->splt && s != htab->sgot && s != htab->sgotplt)
3419+ && s != htab->elf.sgot 3971+ {
3420+ && s != htab->elf.sgotplt 3972+ /* It's not one of our sections, so don't allocate space. */
3421+ && s != htab->elf.sdynbss 3973+ continue;
3422+ && s != htab->elf.sdynrelro) 3974+ }
3423+ {
3424+ /* It's not one of our sections, so don't allocate space. */
3425+ continue;
3426+ }
3427+ 3975+
3428+ if (strip) 3976+ if (strip)
3429+ { 3977+ {
@@ -3525,7 +4073,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3525+ 4073+
3526+ /* For non-PIC objects we need absolute address of the GOT entry. */ 4074+ /* For non-PIC objects we need absolute address of the GOT entry. */
3527+ if (!bfd_link_pic (info)) 4075+ if (!bfd_link_pic (info))
3528+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset; 4076+ got_addr += htab->sgotplt->output_section->vma + sgotplt->output_offset;
3529+ 4077+
3530+ /* Fill in the entry in the procedure linkage table. */ 4078+ /* Fill in the entry in the procedure linkage table. */
3531+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), 4079+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
@@ -3577,8 +4125,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3577+ /* This symbol has an entry in the global offset table. Set it 4125+ /* This symbol has an entry in the global offset table. Set it
3578+ up. */ 4126+ up. */
3579+ 4127+
3580+ sgot = htab->elf.sgot; 4128+ sgot = htab->sgot;
3581+ srela = htab->elf.srelgot; 4129+ srela = htab->srelgot;
3582+ BFD_ASSERT (sgot != NULL && srela != NULL); 4130+ BFD_ASSERT (sgot != NULL && srela != NULL);
3583+ 4131+
3584+ offset = (sgot->output_section->vma + sgot->output_offset 4132+ offset = (sgot->output_section->vma + sgot->output_offset
@@ -3725,7 +4273,7 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3725+ 4273+
3726+ /* Set the first entry in the global offset table to the address of 4274+ /* Set the first entry in the global offset table to the address of
3727+ the dynamic section. */ 4275+ the dynamic section. */
3728+ sgot = htab->elf.sgotplt; 4276+ sgot = bfd_get_linker_section (dynobj, ".got.plt");
3729+ if (sgot && sgot->size > 0) 4277+ if (sgot && sgot->size > 0)
3730+ { 4278+ {
3731+ if (sdyn == NULL) 4279+ if (sdyn == NULL)
@@ -3737,11 +4285,21 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3737+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; 4285+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
3738+ } 4286+ }
3739+ 4287+
3740+ if (htab->elf.sgot && htab->elf.sgot->size > 0) 4288+ if (htab->sgot && htab->sgot->size > 0)
3741+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4; 4289+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
4290+
4291+ return TRUE;
4292+}
3742+ 4293+
4294+static bfd_boolean
4295+microblaze_elf_object_p (bfd *abfd)
4296+{
4297+ bfd_default_set_arch_mach (abfd, bfd_arch_microblaze,
4298+ bfd_mach_microblaze64);
3743+ return TRUE; 4299+ return TRUE;
3744+} 4300+}
4301+
4302+
3745+ 4303+
3746+/* Hook called by the linker routine which adds symbols from an object 4304+/* Hook called by the linker routine which adds symbols from an object
3747+ file. We use it to put .comm items in .sbss, and not .bss. */ 4305+ file. We use it to put .comm items in .sbss, and not .bss. */
@@ -3763,8 +4321,8 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3763+ put into .sbss. */ 4321+ put into .sbss. */
3764+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 4322+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3765+ if (*secp == NULL 4323+ if (*secp == NULL
3766+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON)) 4324+ || ! bfd_set_section_flags (*secp, SEC_IS_COMMON))
3767+ return FALSE; 4325+ return FALSE;
3768+ 4326+
3769+ *valp = sym->st_size; 4327+ *valp = sym->st_size;
3770+ } 4328+ }
@@ -3811,13 +4369,73 @@ Index: gdb-9.2/bfd/elf64-microblaze.c
3811+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol 4369+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
3812+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 4370+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
3813+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 4371+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
4372+#define elf_backend_object_p microblaze_elf_object_p
3814+ 4373+
3815+#include "elf64-target.h" 4374+#include "elf64-target.h"
3816Index: gdb-9.2/bfd/targets.c 4375diff --git a/bfd/libbfd.h b/bfd/libbfd.h
3817=================================================================== 4376index 74d7e4111d3..311fec7f2e8 100644
3818--- gdb-9.2.orig/bfd/targets.c 4377--- a/bfd/libbfd.h
3819+++ gdb-9.2/bfd/targets.c 4378+++ b/bfd/libbfd.h
3820@@ -779,6 +779,8 @@ extern const bfd_target mep_elf32_le_vec 4379@@ -2971,6 +2971,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
4380 "BFD_RELOC_MICROBLAZE_32_ROSDA",
4381 "BFD_RELOC_MICROBLAZE_32_RWSDA",
4382 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
4383+ "BFD_RELOC_MICROBLAZE_32_NONE",
4384 "BFD_RELOC_MICROBLAZE_64_NONE",
4385 "BFD_RELOC_MICROBLAZE_64_GOTPC",
4386 "BFD_RELOC_MICROBLAZE_64_GOT",
4387@@ -2978,6 +2979,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
4388 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
4389 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
4390 "BFD_RELOC_MICROBLAZE_COPY",
4391+ "BFD_RELOC_MICROBLAZE_64",
4392+ "BFD_RELOC_MICROBLAZE_64_PCREL",
4393 "BFD_RELOC_MICROBLAZE_64_TLS",
4394 "BFD_RELOC_MICROBLAZE_64_TLSGD",
4395 "BFD_RELOC_MICROBLAZE_64_TLSLD",
4396diff --git a/bfd/reloc.c b/bfd/reloc.c
4397index dc923fe39c2..d2204ded537 100644
4398--- a/bfd/reloc.c
4399+++ b/bfd/reloc.c
4400@@ -6867,6 +6867,12 @@ ENUM
4401 ENUMDOC
4402 This is a 32 bit reloc for the microblaze to handle
4403 expressions of the form "Symbol Op Symbol"
4404+ENUM
4405+ BFD_RELOC_MICROBLAZE_32_NONE
4406+ENUMDOC
4407+ This is a 32 bit reloc that stores the 32 bit pc relative
4408+ value in two words (with an imm instruction). No relocation is
4409+ done here - only used for relaxing
4410 ENUM
4411 BFD_RELOC_MICROBLAZE_64_NONE
4412 ENUMDOC
4413@@ -6960,6 +6966,20 @@ ENUMDOC
4414 value in two words (with an imm instruction). The relocation is
4415 relative offset from start of TEXT.
4416
4417+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
4418+ to two words (uses imml instruction).
4419+ENUM
4420+BFD_RELOC_MICROBLAZE_64,
4421+ENUMDOC
4422+ This is a 64 bit reloc that stores the 64 bit pc relative
4423+ value in two words (with an imml instruction). No relocation is
4424+ done here - only used for relaxing
4425+ENUM
4426+BFD_RELOC_MICROBLAZE_64_PCREL,
4427+ENUMDOC
4428+ This is a 32 bit reloc that stores the 32 bit pc relative
4429+ value in two words (with an imml instruction). No relocation is
4430+ done here - only used for relaxing
4431 ENUM
4432 BFD_RELOC_AARCH64_RELOC_START
4433 ENUMDOC
4434diff --git a/bfd/targets.c b/bfd/targets.c
4435index 35492b92bbe..99fbfdf6cd8 100644
4436--- a/bfd/targets.c
4437+++ b/bfd/targets.c
4438@@ -782,6 +782,8 @@ extern const bfd_target mep_elf32_le_vec;
3821 extern const bfd_target metag_elf32_vec; 4439 extern const bfd_target metag_elf32_vec;
3822 extern const bfd_target microblaze_elf32_vec; 4440 extern const bfd_target microblaze_elf32_vec;
3823 extern const bfd_target microblaze_elf32_le_vec; 4441 extern const bfd_target microblaze_elf32_le_vec;
@@ -3826,7 +4444,7 @@ Index: gdb-9.2/bfd/targets.c
3826 extern const bfd_target mips_ecoff_be_vec; 4444 extern const bfd_target mips_ecoff_be_vec;
3827 extern const bfd_target mips_ecoff_le_vec; 4445 extern const bfd_target mips_ecoff_le_vec;
3828 extern const bfd_target mips_ecoff_bele_vec; 4446 extern const bfd_target mips_ecoff_bele_vec;
3829@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_tar 4447@@ -1146,6 +1148,10 @@ static const bfd_target * const _bfd_target_vector[] =
3830 4448
3831 &metag_elf32_vec, 4449 &metag_elf32_vec,
3832 4450
@@ -3837,11 +4455,951 @@ Index: gdb-9.2/bfd/targets.c
3837 &microblaze_elf32_vec, 4455 &microblaze_elf32_vec,
3838 4456
3839 &mips_ecoff_be_vec, 4457 &mips_ecoff_be_vec,
3840Index: gdb-9.2/include/elf/common.h 4458diff --git a/gdb/features/Makefile b/gdb/features/Makefile
3841=================================================================== 4459index 67c3ae17a77..131fc14adbf 100644
3842--- gdb-9.2.orig/include/elf/common.h 4460--- a/gdb/features/Makefile
3843+++ gdb-9.2/include/elf/common.h 4461+++ b/gdb/features/Makefile
3844@@ -339,6 +339,7 @@ 4462@@ -46,6 +46,7 @@
4463 # List of .dat files to create in ../regformats/
4464 WHICH = mips-linux mips-dsp-linux \
4465 microblaze-with-stack-protect \
4466+ microblaze64-with-stack-protect \
4467 mips64-linux mips64-dsp-linux \
4468 nios2-linux \
4469 rs6000/powerpc-32 \
4470@@ -107,7 +108,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
4471 # to make on the command line.
4472 XMLTOC = \
4473 microblaze-with-stack-protect.xml \
4474+ microblaze64-with-stack-protect.xml \
4475 microblaze.xml \
4476+ microblaze64.xml \
4477 mips-dsp-linux.xml \
4478 mips-linux.xml \
4479 mips64-dsp-linux.xml \
4480diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
4481index 47fb4fb4b51..b2ee4f11bc2 100644
4482--- a/gdb/features/microblaze-core.xml
4483+++ b/gdb/features/microblaze-core.xml
4484@@ -8,7 +8,7 @@
4485 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4486 <feature name="org.gnu.gdb.microblaze.core">
4487 <reg name="r0" bitsize="32" regnum="0"/>
4488- <reg name="r1" bitsize="32" type="data_ptr"/>
4489+ <reg name="r1" bitsize="32"/>
4490 <reg name="r2" bitsize="32"/>
4491 <reg name="r3" bitsize="32"/>
4492 <reg name="r4" bitsize="32"/>
4493@@ -39,7 +39,7 @@
4494 <reg name="r29" bitsize="32"/>
4495 <reg name="r30" bitsize="32"/>
4496 <reg name="r31" bitsize="32"/>
4497- <reg name="rpc" bitsize="32" type="code_ptr"/>
4498+ <reg name="rpc" bitsize="32"/>
4499 <reg name="rmsr" bitsize="32"/>
4500 <reg name="rear" bitsize="32"/>
4501 <reg name="resr" bitsize="32"/>
4502@@ -64,4 +64,6 @@
4503 <reg name="rtlbsx" bitsize="32"/>
4504 <reg name="rtlblo" bitsize="32"/>
4505 <reg name="rtlbhi" bitsize="32"/>
4506+ <reg name="slr" bitsize="32"/>
4507+ <reg name="shr" bitsize="32"/>
4508 </feature>
4509diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
4510index 2b95c2f2bcf..9efe6114128 100644
4511--- a/gdb/features/microblaze-stack-protect.xml
4512+++ b/gdb/features/microblaze-stack-protect.xml
4513@@ -7,6 +7,6 @@
4514
4515 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4516 <feature name="org.gnu.gdb.microblaze.stack-protect">
4517- <reg name="rslr" bitsize="32"/>
4518- <reg name="rshr" bitsize="32"/>
4519+ <reg name="slr" bitsize="32"/>
4520+ <reg name="shr" bitsize="32"/>
4521 </feature>
4522diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
4523index b39aa198874..609934e2b41 100644
4524--- a/gdb/features/microblaze-with-stack-protect.c
4525+++ b/gdb/features/microblaze-with-stack-protect.c
4526@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4527
4528 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
4529 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4530- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4531+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4532 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4533 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4534 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4535@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4536 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4537 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4538 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4539- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4540+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4541 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4542 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4543 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4544@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4545 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4546
4547 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
4548- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
4549- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
4550+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
4551+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
4552
4553 tdesc_microblaze_with_stack_protect = result;
4554 }
4555diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
4556index 6c86fc07700..ceb98ca8b82 100644
4557--- a/gdb/features/microblaze.c
4558+++ b/gdb/features/microblaze.c
4559@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
4560
4561 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
4562 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4563- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4564+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4565 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4566 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4567 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4568@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
4569 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4570 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4571 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4572- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4573+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4574 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4575 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4576 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4577@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
4578 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4579 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4580 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4581+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4582+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4583
4584 tdesc_microblaze = result;
4585 }
4586diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
4587new file mode 100644
4588index 00000000000..96e99e2fb24
4589--- /dev/null
4590+++ b/gdb/features/microblaze64-core.xml
4591@@ -0,0 +1,69 @@
4592+<?xml version="1.0"?>
4593+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4594+
4595+ Copying and distribution of this file, with or without modification,
4596+ are permitted in any medium without royalty provided the copyright
4597+ notice and this notice are preserved. -->
4598+
4599+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4600+<feature name="org.gnu.gdb.microblaze64.core">
4601+ <reg name="r0" bitsize="64" regnum="0"/>
4602+ <reg name="r1" bitsize="64"/>
4603+ <reg name="r2" bitsize="64"/>
4604+ <reg name="r3" bitsize="64"/>
4605+ <reg name="r4" bitsize="64"/>
4606+ <reg name="r5" bitsize="64"/>
4607+ <reg name="r6" bitsize="64"/>
4608+ <reg name="r7" bitsize="64"/>
4609+ <reg name="r8" bitsize="64"/>
4610+ <reg name="r9" bitsize="64"/>
4611+ <reg name="r10" bitsize="64"/>
4612+ <reg name="r11" bitsize="64"/>
4613+ <reg name="r12" bitsize="64"/>
4614+ <reg name="r13" bitsize="64"/>
4615+ <reg name="r14" bitsize="64"/>
4616+ <reg name="r15" bitsize="64"/>
4617+ <reg name="r16" bitsize="64"/>
4618+ <reg name="r17" bitsize="64"/>
4619+ <reg name="r18" bitsize="64"/>
4620+ <reg name="r19" bitsize="64"/>
4621+ <reg name="r20" bitsize="64"/>
4622+ <reg name="r21" bitsize="64"/>
4623+ <reg name="r22" bitsize="64"/>
4624+ <reg name="r23" bitsize="64"/>
4625+ <reg name="r24" bitsize="64"/>
4626+ <reg name="r25" bitsize="64"/>
4627+ <reg name="r26" bitsize="64"/>
4628+ <reg name="r27" bitsize="64"/>
4629+ <reg name="r28" bitsize="64"/>
4630+ <reg name="r29" bitsize="64"/>
4631+ <reg name="r30" bitsize="64"/>
4632+ <reg name="r31" bitsize="64"/>
4633+ <reg name="rpc" bitsize="64"/>
4634+ <reg name="rmsr" bitsize="32"/>
4635+ <reg name="rear" bitsize="64"/>
4636+ <reg name="resr" bitsize="32"/>
4637+ <reg name="rfsr" bitsize="32"/>
4638+ <reg name="rbtr" bitsize="64"/>
4639+ <reg name="rpvr0" bitsize="32"/>
4640+ <reg name="rpvr1" bitsize="32"/>
4641+ <reg name="rpvr2" bitsize="32"/>
4642+ <reg name="rpvr3" bitsize="32"/>
4643+ <reg name="rpvr4" bitsize="32"/>
4644+ <reg name="rpvr5" bitsize="32"/>
4645+ <reg name="rpvr6" bitsize="32"/>
4646+ <reg name="rpvr7" bitsize="32"/>
4647+ <reg name="rpvr8" bitsize="64"/>
4648+ <reg name="rpvr9" bitsize="64"/>
4649+ <reg name="rpvr10" bitsize="32"/>
4650+ <reg name="rpvr11" bitsize="32"/>
4651+ <reg name="redr" bitsize="32"/>
4652+ <reg name="rpid" bitsize="32"/>
4653+ <reg name="rzpr" bitsize="32"/>
4654+ <reg name="rtlbx" bitsize="32"/>
4655+ <reg name="rtlbsx" bitsize="32"/>
4656+ <reg name="rtlblo" bitsize="32"/>
4657+ <reg name="rtlbhi" bitsize="32"/>
4658+ <reg name="slr" bitsize="64"/>
4659+ <reg name="shr" bitsize="64"/>
4660+</feature>
4661diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
4662new file mode 100644
4663index 00000000000..1bbf5fc3cea
4664--- /dev/null
4665+++ b/gdb/features/microblaze64-stack-protect.xml
4666@@ -0,0 +1,12 @@
4667+<?xml version="1.0"?>
4668+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4669+
4670+ Copying and distribution of this file, with or without modification,
4671+ are permitted in any medium without royalty provided the copyright
4672+ notice and this notice are preserved. -->
4673+
4674+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4675+<feature name="org.gnu.gdb.microblaze64.stack-protect">
4676+ <reg name="slr" bitsize="64"/>
4677+ <reg name="shr" bitsize="64"/>
4678+</feature>
4679diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
4680new file mode 100644
4681index 00000000000..f448c9a749c
4682--- /dev/null
4683+++ b/gdb/features/microblaze64-with-stack-protect.c
4684@@ -0,0 +1,79 @@
4685+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4686+ Original: microblaze-with-stack-protect.xml */
4687+
4688+#include "defs.h"
4689+#include "osabi.h"
4690+#include "target-descriptions.h"
4691+
4692+struct target_desc *tdesc_microblaze64_with_stack_protect;
4693+static void
4694+initialize_tdesc_microblaze64_with_stack_protect (void)
4695+{
4696+ struct target_desc *result = allocate_target_description ();
4697+ struct tdesc_feature *feature;
4698+
4699+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
4700+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
4701+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
4702+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
4703+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4704+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4705+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4706+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4707+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4708+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4709+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4710+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4711+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4712+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4713+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4714+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4715+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4716+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4717+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4718+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4719+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4720+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4721+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4722+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4723+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4724+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4725+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4726+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4727+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4728+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4729+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4730+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4731+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4732+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4733+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4734+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
4735+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4736+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4737+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4738+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4739+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4740+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4741+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4742+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4743+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4744+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4745+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4746+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4747+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4748+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4749+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4750+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4751+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4752+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4753+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4754+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4755+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4756+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4757+
4758+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
4759+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4760+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4761+
4762+ tdesc_microblaze64_with_stack_protect = result;
4763+}
4764diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
4765new file mode 100644
4766index 00000000000..0e9f01611f3
4767--- /dev/null
4768+++ b/gdb/features/microblaze64-with-stack-protect.xml
4769@@ -0,0 +1,12 @@
4770+<?xml version="1.0"?>
4771+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4772+
4773+ Copying and distribution of this file, with or without modification,
4774+ are permitted in any medium without royalty provided the copyright
4775+ notice and this notice are preserved. -->
4776+
4777+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4778+<target>
4779+ <xi:include href="microblaze64-core.xml"/>
4780+ <xi:include href="microblaze64-stack-protect.xml"/>
4781+</target>
4782diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
4783new file mode 100644
4784index 00000000000..1aa37c45129
4785--- /dev/null
4786+++ b/gdb/features/microblaze64.c
4787@@ -0,0 +1,77 @@
4788+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4789+ Original: microblaze.xml */
4790+
4791+#include "defs.h"
4792+#include "osabi.h"
4793+#include "target-descriptions.h"
4794+
4795+struct target_desc *tdesc_microblaze64;
4796+static void
4797+initialize_tdesc_microblaze64 (void)
4798+{
4799+ struct target_desc *result = allocate_target_description ();
4800+ struct tdesc_feature *feature;
4801+
4802+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
4803+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
4804+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
4805+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
4806+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4807+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4808+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4809+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4810+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4811+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4812+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4813+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4814+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4815+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4816+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4817+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4818+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4819+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4820+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4821+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4822+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4823+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4824+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4825+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4826+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4827+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4828+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4829+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4830+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4831+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4832+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4833+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4834+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4835+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4836+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4837+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
4838+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4839+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4840+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4841+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4842+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4843+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4844+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4845+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4846+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4847+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4848+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4849+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4850+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4851+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4852+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4853+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4854+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4855+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4856+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4857+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4858+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4859+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4860+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4861+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4862+
4863+ tdesc_microblaze64 = result;
4864+}
4865diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
4866new file mode 100644
4867index 00000000000..515d18e65cf
4868--- /dev/null
4869+++ b/gdb/features/microblaze64.xml
4870@@ -0,0 +1,11 @@
4871+<?xml version="1.0"?>
4872+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4873+
4874+ Copying and distribution of this file, with or without modification,
4875+ are permitted in any medium without royalty provided the copyright
4876+ notice and this notice are preserved. -->
4877+
4878+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4879+<target>
4880+ <xi:include href="microblaze64-core.xml"/>
4881+</target>
4882diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
4883index b8277dfd735..0c9ec82cee5 100644
4884--- a/gdb/microblaze-linux-tdep.c
4885+++ b/gdb/microblaze-linux-tdep.c
4886@@ -39,6 +39,7 @@
4887 #include "glibc-tdep.h"
4888
4889 static int microblaze_debug_flag = 0;
4890+int MICROBLAZE_REGISTER_SIZE=4;
4891
4892 static void
4893 microblaze_debug (const char *fmt, ...)
4894@@ -54,6 +55,7 @@ microblaze_debug (const char *fmt, ...)
4895 }
4896 }
4897
4898+#if 0
4899 static int
4900 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4901 struct bp_target_info *bp_tgt)
4902@@ -85,6 +87,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4903 return val;
4904 }
4905
4906+#endif
4907+
4908 static void
4909 microblaze_linux_sigtramp_cache (struct frame_info *next_frame,
4910 struct trad_frame_cache *this_cache,
4911@@ -146,8 +150,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
4912
4913 linux_init_abi (info, gdbarch);
4914
4915- set_gdbarch_memory_remove_breakpoint (gdbarch,
4916- microblaze_linux_memory_remove_breakpoint);
4917+ // set_gdbarch_memory_remove_breakpoint (gdbarch,
4918+ // microblaze_linux_memory_remove_breakpoint);
4919
4920 /* Shared library handling. */
4921 set_solib_svr4_fetch_link_map_offsets (gdbarch,
4922@@ -159,10 +163,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
4923
4924 /* BFD target for core files. */
4925 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
4926- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
4927+ {
4928+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
4929+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
4930+ MICROBLAZE_REGISTER_SIZE=8;
4931+ }
4932+ else
4933+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
4934+ }
4935 else
4936- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
4937+ {
4938+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
4939+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
4940+ MICROBLAZE_REGISTER_SIZE=8;
4941+ }
4942+ else
4943+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
4944+ }
4945
4946+ switch (info.bfd_arch_info->mach)
4947+ {
4948+ case bfd_mach_microblaze64:
4949+ set_gdbarch_ptr_bit (gdbarch, 64);
4950+ break;
4951+ }
4952
4953 /* Shared library handling. */
4954 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
4955@@ -177,6 +201,8 @@ void _initialize_microblaze_linux_tdep ();
4956 void
4957 _initialize_microblaze_linux_tdep ()
4958 {
4959- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
4960+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
4961+ microblaze_linux_init_abi);
4962+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
4963 microblaze_linux_init_abi);
4964 }
4965diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
4966index 399fa0e3dca..e51c022c1ba 100644
4967--- a/gdb/microblaze-tdep.c
4968+++ b/gdb/microblaze-tdep.c
4969@@ -40,7 +40,9 @@
4970 #include "remote.h"
4971
4972 #include "features/microblaze-with-stack-protect.c"
4973+#include "features/microblaze64-with-stack-protect.c"
4974 #include "features/microblaze.c"
4975+#include "features/microblaze64.c"
4976
4977 /* Instruction macros used for analyzing the prologue. */
4978 /* This set of instruction macros need to be changed whenever the
4979@@ -75,12 +77,13 @@ static const char *microblaze_register_names[] =
4980 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
4981 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
4982 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
4983- "rslr", "rshr"
4984+ "slr", "shr"
4985 };
4986
4987 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
4988
4989 static unsigned int microblaze_debug_flag = 0;
4990+int reg_size = 4;
4991
4992 static void ATTRIBUTE_PRINTF (1, 2)
4993 microblaze_debug (const char *fmt, ...)
4994@@ -137,6 +140,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
4995 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
4996
4997 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
4998+static CORE_ADDR
4999+microblaze_store_arguments (struct regcache *regcache, int nargs,
5000+ struct value **args, CORE_ADDR sp,
5001+ int struct_return, CORE_ADDR struct_addr)
5002+{
5003+ error (_("store_arguments not implemented"));
5004+ return sp;
5005+}
5006+#if 0
5007 static int
5008 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5009 struct bp_target_info *bp_tgt)
5010@@ -155,7 +167,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5011 /* Make sure we see the memory breakpoints. */
5012 scoped_restore restore_memory
5013 = make_scoped_restore_show_memory_breakpoints (1);
5014-
5015 val = target_read_memory (addr, old_contents, bplen);
5016
5017 /* If our breakpoint is no longer at the address, this means that the
5018@@ -170,6 +181,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5019 return val;
5020 }
5021
5022+#endif
5023 /* Allocate and initialize a frame cache. */
5024
5025 static struct microblaze_frame_cache *
5026@@ -556,17 +568,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
5027 gdb_byte *valbuf)
5028 {
5029 gdb_byte buf[8];
5030-
5031 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
5032 switch (TYPE_LENGTH (type))
5033 {
5034 case 1: /* return last byte in the register. */
5035 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5036- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
5037+ memcpy(valbuf, buf + reg_size - 1, 1);
5038 return;
5039 case 2: /* return last 2 bytes in register. */
5040 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5041- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
5042+ memcpy(valbuf, buf + reg_size - 2, 2);
5043 return;
5044 case 4: /* for sizes 4 or 8, copy the required length. */
5045 case 8:
5046@@ -633,7 +644,119 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
5047 return (TYPE_LENGTH (type) == 16);
5048 }
5049
5050-
5051+#if 0
5052+static std::vector<CORE_ADDR>
5053+microblaze_software_single_step (struct regcache *regcache)
5054+{
5055+// struct gdbarch *arch = get_frame_arch(frame);
5056+ struct gdbarch *arch = get_regcache_arch (regcache);
5057+ struct address_space *aspace = get_regcache_aspace (regcache);
5058+// struct address_space *aspace = get_frame_address_space (frame);
5059+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
5060+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
5061+ static char be_breakp[] = MICROBLAZE_BREAKPOINT;
5062+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
5063+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
5064+ std::vector<CORE_ADDR> ret = 0;
5065+
5066+ /* Save the address and the values of the next_pc and the target */
5067+ static struct sstep_breaks
5068+ {
5069+ CORE_ADDR address;
5070+ bfd_boolean valid;
5071+ /* Shadow contents. */
5072+ char data[INST_WORD_SIZE];
5073+ } stepbreaks[2];
5074+ int ii;
5075+
5076+ if (1)
5077+ {
5078+ CORE_ADDR pc;
5079+ std::vector<CORE_ADDR> *next_pcs = NULL;
5080+ long insn;
5081+ enum microblaze_instr minstr;
5082+ bfd_boolean isunsignednum;
5083+ enum microblaze_instr_type insn_type;
5084+ short delay_slots;
5085+ int imm;
5086+ bfd_boolean immfound = FALSE;
5087+
5088+ /* Set a breakpoint at the next instruction */
5089+ /* If the current instruction is an imm, set it at the inst after */
5090+ /* If the instruction has a delay slot, skip the delay slot */
5091+ pc = regcache_read_pc (regcache);
5092+ insn = microblaze_fetch_instruction (pc);
5093+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
5094+ if (insn_type == immediate_inst)
5095+ {
5096+ int rd, ra, rb;
5097+ immfound = TRUE;
5098+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
5099+ pc = pc + INST_WORD_SIZE;
5100+ insn = microblaze_fetch_instruction (pc);
5101+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
5102+ }
5103+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE;
5104+ if (insn_type != return_inst) {
5105+ stepbreaks[0].valid = TRUE;
5106+ } else {
5107+ stepbreaks[0].valid = FALSE;
5108+ }
5109+
5110+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn);
5111+ /* Now check for branch or return instructions */
5112+ if (insn_type == branch_inst || insn_type == return_inst) {
5113+ int limm;
5114+ int lrd, lra, lrb;
5115+ int ra, rb;
5116+ bfd_boolean targetvalid;
5117+ bfd_boolean unconditionalbranch;
5118+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm);
5119+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS)
5120+ ra = regcache_raw_get_unsigned(regcache, lra);
5121+ else
5122+ ra = 0;
5123+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
5124+ rb = regcache_raw_get_unsigned(regcache, lrb);
5125+ else
5126+ rb = 0;
5127+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
5128+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
5129+ if (unconditionalbranch)
5130+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
5131+ if (targetvalid && (stepbreaks[0].valid == FALSE ||
5132+ (stepbreaks[0].address != stepbreaks[1].address))
5133+ && (stepbreaks[1].address != pc)) {
5134+ stepbreaks[1].valid = TRUE;
5135+ } else {
5136+ stepbreaks[1].valid = FALSE;
5137+ }
5138+ } else {
5139+ stepbreaks[1].valid = FALSE;
5140+ }
5141+
5142+ /* Insert the breakpoints */
5143+ for (ii = 0; ii < 2; ++ii)
5144+ {
5145+
5146+ /* ignore invalid breakpoint. */
5147+ if (stepbreaks[ii].valid) {
5148+ VEC_safe_push (CORE_ADDR, next_pcs, stepbreaks[ii].address);;
5149+// insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address);
5150+ ret = next_pcs;
5151+ }
5152+ }
5153+ }
5154+ return ret;
5155+}
5156+#endif
5157+
5158+static void
5159+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
5160+{
5161+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
5162+}
5163+
5164 static int dwarf2_to_reg_map[78] =
5165 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
5166 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
5167@@ -668,13 +791,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
5168 static void
5169 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
5170 {
5171+
5172 register_remote_g_packet_guess (gdbarch,
5173- 4 * MICROBLAZE_NUM_CORE_REGS,
5174- tdesc_microblaze);
5175+ 4 * MICROBLAZE_NUM_REGS,
5176+ tdesc_microblaze64);
5177
5178 register_remote_g_packet_guess (gdbarch,
5179 4 * MICROBLAZE_NUM_REGS,
5180- tdesc_microblaze_with_stack_protect);
5181+ tdesc_microblaze64_with_stack_protect);
5182 }
5183
5184 void
5185@@ -682,7 +806,7 @@ microblaze_supply_gregset (const struct regset *regset,
5186 struct regcache *regcache,
5187 int regnum, const void *gregs)
5188 {
5189- const unsigned int *regs = (const unsigned int *)gregs;
5190+ const gdb_byte *regs = (const gdb_byte *) gregs;
5191 if (regnum >= 0)
5192 regcache->raw_supply (regnum, regs + regnum);
5193
5194@@ -690,7 +814,7 @@ microblaze_supply_gregset (const struct regset *regset,
5195 int i;
5196
5197 for (i = 0; i < 50; i++) {
5198- regcache->raw_supply (i, regs + i);
5199+ regcache->raw_supply (regnum, regs + i);
5200 }
5201 }
5202 }
5203@@ -713,6 +837,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
5204 }
5205
5206
5207+static void
5208+make_regs (struct gdbarch *arch)
5209+{
5210+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
5211+ int mach = gdbarch_bfd_arch_info (arch)->mach;
5212+
5213+ if (mach == bfd_mach_microblaze64)
5214+ {
5215+ set_gdbarch_ptr_bit (arch, 64);
5216+ }
5217+}
5218
5219 static struct gdbarch *
5220 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5221@@ -727,8 +862,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5222 if (arches != NULL)
5223 return arches->gdbarch;
5224 if (tdesc == NULL)
5225- tdesc = tdesc_microblaze;
5226-
5227+ {
5228+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5229+ {
5230+ tdesc = tdesc_microblaze64;
5231+ reg_size = 8;
5232+ }
5233+ else
5234+ tdesc = tdesc_microblaze;
5235+ }
5236 /* Check any target description for validity. */
5237 if (tdesc_has_registers (tdesc))
5238 {
5239@@ -736,27 +878,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5240 int valid_p;
5241 int i;
5242
5243- feature = tdesc_find_feature (tdesc,
5244+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5245+ feature = tdesc_find_feature (tdesc,
5246+ "org.gnu.gdb.microblaze64.core");
5247+ else
5248+ feature = tdesc_find_feature (tdesc,
5249 "org.gnu.gdb.microblaze.core");
5250 if (feature == NULL)
5251 return NULL;
5252 tdesc_data = tdesc_data_alloc ();
5253
5254 valid_p = 1;
5255- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
5256+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
5257 valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
5258 microblaze_register_names[i]);
5259- feature = tdesc_find_feature (tdesc,
5260+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5261+ feature = tdesc_find_feature (tdesc,
5262+ "org.gnu.gdb.microblaze64.stack-protect");
5263+ else
5264+ feature = tdesc_find_feature (tdesc,
5265 "org.gnu.gdb.microblaze.stack-protect");
5266 if (feature != NULL)
5267 {
5268 valid_p = 1;
5269 valid_p &= tdesc_numbered_register (feature, tdesc_data,
5270 MICROBLAZE_SLR_REGNUM,
5271- "rslr");
5272+ "slr");
5273 valid_p &= tdesc_numbered_register (feature, tdesc_data,
5274 MICROBLAZE_SHR_REGNUM,
5275- "rshr");
5276+ "shr");
5277 }
5278
5279 if (!valid_p)
5280@@ -764,6 +914,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5281 tdesc_data_cleanup (tdesc_data);
5282 return NULL;
5283 }
5284+
5285 }
5286
5287 /* Allocate space for the new architecture. */
5288@@ -783,7 +934,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5289 /* Register numbers of various important registers. */
5290 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
5291 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
5292+
5293+ /* Register set.
5294+ make_regs (gdbarch); */
5295+ switch (info.bfd_arch_info->mach)
5296+ {
5297+ case bfd_mach_microblaze64:
5298+ set_gdbarch_ptr_bit (gdbarch, 64);
5299+ break;
5300+ }
5301
5302+
5303 /* Map Dwarf2 registers to GDB registers. */
5304 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
5305
5306@@ -803,13 +964,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5307 microblaze_breakpoint::kind_from_pc);
5308 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
5309 microblaze_breakpoint::bp_from_kind);
5310- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
5311+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
5312+
5313+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
5314
5315 set_gdbarch_frame_args_skip (gdbarch, 8);
5316
5317 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
5318
5319- microblaze_register_g_packet_guesses (gdbarch);
5320+ //microblaze_register_g_packet_guesses (gdbarch);
5321
5322 frame_base_set_default (gdbarch, &microblaze_frame_base);
5323
5324@@ -824,12 +987,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5325 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
5326 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
5327
5328- /* If we have register sets, enable the generic core file support. */
5329+ /* If we have register sets, enable the generic core file support.
5330 if (tdep->gregset) {
5331 set_gdbarch_iterate_over_regset_sections (gdbarch,
5332 microblaze_iterate_over_regset_sections);
5333- }
5334-
5335+ }*/
5336 return gdbarch;
5337 }
5338
5339@@ -841,6 +1003,8 @@ _initialize_microblaze_tdep ()
5340
5341 initialize_tdesc_microblaze_with_stack_protect ();
5342 initialize_tdesc_microblaze ();
5343+ initialize_tdesc_microblaze64_with_stack_protect ();
5344+ initialize_tdesc_microblaze64 ();
5345 /* Debug this files internals. */
5346 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
5347 &microblaze_debug_flag, _("\
5348diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
5349index 872a3931f20..dc1d4686914 100644
5350--- a/gdb/microblaze-tdep.h
5351+++ b/gdb/microblaze-tdep.h
5352@@ -27,7 +27,7 @@ struct microblaze_gregset
5353 microblaze_gregset() {}
5354 unsigned int gregs[32];
5355 unsigned int fpregs[32];
5356- unsigned int pregs[16];
5357+ unsigned int pregs[18];
5358 };
5359
5360 struct gdbarch_tdep
5361@@ -101,9 +101,9 @@ enum microblaze_regnum
5362 MICROBLAZE_RTLBSX_REGNUM,
5363 MICROBLAZE_RTLBLO_REGNUM,
5364 MICROBLAZE_RTLBHI_REGNUM,
5365- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
5366+ MICROBLAZE_SLR_REGNUM,
5367 MICROBLAZE_SHR_REGNUM,
5368- MICROBLAZE_NUM_REGS
5369+ MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS
5370 };
5371
5372 struct microblaze_frame_cache
5373@@ -128,7 +128,7 @@ struct microblaze_frame_cache
5374 struct trad_frame_saved_reg *saved_regs;
5375 };
5376 /* All registers are 32 bits. */
5377-#define MICROBLAZE_REGISTER_SIZE 4
5378+//#define MICROBLAZE_REGISTER_SIZE 8
5379
5380 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
5381 Only used for native debugging. */
5382diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat
5383index 8040a7b3fd0..450e321d49e 100644
5384--- a/gdb/regformats/microblaze-with-stack-protect.dat
5385+++ b/gdb/regformats/microblaze-with-stack-protect.dat
5386@@ -60,5 +60,5 @@ expedite:r1,rpc
5387 32:rtlbsx
5388 32:rtlblo
5389 32:rtlbhi
5390-32:rslr
5391-32:rshr
5392+32:slr
5393+32:shr
5394diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdbserver/linux-microblaze-low.c
5395similarity index 100%
5396rename from gdb/gdbserver/linux-microblaze-low.c
5397rename to gdbserver/linux-microblaze-low.c
5398diff --git a/include/elf/common.h b/include/elf/common.h
5399index 571e21af29a..fa10064712a 100644
5400--- a/include/elf/common.h
5401+++ b/include/elf/common.h
5402@@ -340,6 +340,7 @@
3845 #define EM_RISCV 243 /* RISC-V */ 5403 #define EM_RISCV 243 /* RISC-V */
3846 #define EM_LANAI 244 /* Lanai 32-bit processor. */ 5404 #define EM_LANAI 244 /* Lanai 32-bit processor. */
3847 #define EM_BPF 247 /* Linux BPF – in-kernel virtual machine. */ 5405 #define EM_BPF 247 /* Linux BPF – in-kernel virtual machine. */
@@ -3849,66 +5407,25 @@ Index: gdb-9.2/include/elf/common.h
3849 #define EM_NFP 250 /* Netronome Flow Processor. */ 5407 #define EM_NFP 250 /* Netronome Flow Processor. */
3850 #define EM_CSKY 252 /* C-SKY processor family. */ 5408 #define EM_CSKY 252 /* C-SKY processor family. */
3851 5409
3852Index: gdb-9.2/ld/emulparams/elf64microblaze.sh 5410diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
3853=================================================================== 5411index 2fec296967b..938841b2408 100644
3854--- /dev/null 5412--- a/include/elf/microblaze.h
3855+++ gdb-9.2/ld/emulparams/elf64microblaze.sh 5413+++ b/include/elf/microblaze.h
3856@@ -0,0 +1,23 @@ 5414@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
3857+SCRIPT_NAME=elfmicroblaze 5415 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
3858+OUTPUT_FORMAT="elf64-microblazeel" 5416 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
3859+#BIG_OUTPUT_FORMAT="elf64-microblaze" 5417 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
3860+LITTLE_OUTPUT_FORMAT="elf64-microblazeel" 5418+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
3861+#TEXT_START_ADDR=0 5419+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
3862+NONPAGED_TEXT_START_ADDR=0x28 5420+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
3863+ALIGNMENT=4 5421+
3864+MAXPAGESIZE=4 5422 END_RELOC_NUMBERS (R_MICROBLAZE_max)
3865+ARCH=microblaze 5423
3866+EMBEDDED=yes 5424 /* Global base address names. */
3867+ 5425diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
3868+NOP=0x80000000 5426index be1534c257c..564c810a6c7 100644
3869+ 5427--- a/opcodes/microblaze-dis.c
3870+# Hmmm, there's got to be a better way. This sets the stack to the 5428+++ b/opcodes/microblaze-dis.c
3871+# top of the simulator memory (2^19 bytes).
3872+#PAGE_SIZE=0x1000
3873+#DATA_ADDR=0x10000
3874+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
3875+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
3876+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
3877+
3878+TEMPLATE_NAME=elf32
3879+#GENERATE_SHLIB_SCRIPT=yes
3880Index: gdb-9.2/ld/emulparams/elf64microblazeel.sh
3881===================================================================
3882--- /dev/null
3883+++ gdb-9.2/ld/emulparams/elf64microblazeel.sh
3884@@ -0,0 +1,23 @@
3885+SCRIPT_NAME=elfmicroblaze
3886+OUTPUT_FORMAT="elf64-microblazeel"
3887+#BIG_OUTPUT_FORMAT="elf64-microblaze"
3888+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
3889+#TEXT_START_ADDR=0
3890+NONPAGED_TEXT_START_ADDR=0x28
3891+ALIGNMENT=4
3892+MAXPAGESIZE=4
3893+ARCH=microblaze
3894+EMBEDDED=yes
3895+
3896+NOP=0x80000000
3897+
3898+# Hmmm, there's got to be a better way. This sets the stack to the
3899+# top of the simulator memory (2^19 bytes).
3900+#PAGE_SIZE=0x1000
3901+#DATA_ADDR=0x10000
3902+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
3903+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
3904+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
3905+
3906+TEMPLATE_NAME=elf32
3907+#GENERATE_SHLIB_SCRIPT=yes
3908Index: gdb-9.2/opcodes/microblaze-dis.c
3909===================================================================
3910--- gdb-9.2.orig/opcodes/microblaze-dis.c
3911+++ gdb-9.2/opcodes/microblaze-dis.c
3912@@ -33,6 +33,7 @@ 5429@@ -33,6 +33,7 @@
3913 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW) 5430 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
3914 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW) 5431 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
@@ -3917,55 +5434,58 @@ Index: gdb-9.2/opcodes/microblaze-dis.c
3917 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) 5434 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
3918 5435
3919 #define NUM_STRBUFS 3 5436 #define NUM_STRBUFS 3
3920@@ -73,11 +74,19 @@ get_field_imm (struct string_buf *buf, l 5437@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
3921 } 5438 }
3922 5439
3923 static char * 5440 static char *
3924-get_field_imm5 (struct string_buf *buf, long instr) 5441-get_field_imm5 (struct string_buf *buf, long instr)
3925+get_field_imml (struct string_buf *buf, long instr) 5442+get_field_imml (struct string_buf *buf, long instr)
3926+{ 5443 {
3927+ char *p = strbuf (buf); 5444 char *p = strbuf (buf);
3928+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 5445
5446- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
5447+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
3929+ return p; 5448+ return p;
3930+} 5449+}
3931+ 5450+
3932+static char * 5451+static char *
3933+get_field_imms (struct string_buf *buf, long instr) 5452+get_field_imms (struct string_buf *buf, long instr)
3934 { 5453+{
3935 char *p = strbuf (buf); 5454+ char *p = strbuf (buf);
3936 5455+
3937- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
3938+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW)); 5456+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
3939 return p; 5457 return p;
3940 } 5458 }
3941 5459
3942@@ -91,14 +100,14 @@ get_field_imm5_mbar (struct string_buf * 5460@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
5461 return p;
3943 } 5462 }
3944 5463
3945 static char * 5464+static char *
3946-get_field_imm5width (struct string_buf *buf, long instr)
3947+get_field_immw (struct string_buf *buf, long instr) 5465+get_field_immw (struct string_buf *buf, long instr)
3948 { 5466+{
3949 char *p = strbuf (buf); 5467+ char *p = strbuf (buf);
3950 5468+
3951 if (instr & 0x00004000) 5469+ if (instr & 0x00004000)
3952- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
3953+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 5470+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
3954 else 5471+ else
3955- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
3956+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */ 5472+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
3957 return p; 5473+ return p;
3958 } 5474+}
3959 5475+
3960@@ -306,9 +315,13 @@ print_insn_microblaze (bfd_vma memaddr, 5476 static char *
5477 get_field_rfsl (struct string_buf *buf, long instr)
5478 {
5479@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
3961 } 5480 }
3962 } 5481 }
3963 break; 5482 break;
3964- case INST_TYPE_RD_R1_IMM5: 5483- case INST_TYPE_RD_R1_IMM5:
3965+ case INST_TYPE_RD_R1_IMML: 5484+ case INST_TYPE_RD_R1_IMML:
3966+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 5485+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3967+ get_field_r1 (&buf, inst), get_field_imm (&buf, inst)); 5486+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
3968+ /* TODO: Also print symbol */ 5487+ /* TODO: Also print symbol */
5488+ break;
3969+ case INST_TYPE_RD_R1_IMMS: 5489+ case INST_TYPE_RD_R1_IMMS:
3970 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 5490 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3971- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst)); 5491- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
@@ -3973,32 +5493,40 @@ Index: gdb-9.2/opcodes/microblaze-dis.c
3973 break; 5493 break;
3974 case INST_TYPE_RD_RFSL: 5494 case INST_TYPE_RD_RFSL:
3975 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 5495 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3976@@ -415,6 +428,10 @@ print_insn_microblaze (bfd_vma memaddr, 5496@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
3977 case INST_TYPE_RD_R2: 5497 }
3978 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 5498 }
3979 get_field_r2 (&buf, inst)); 5499 break;
3980+ break; 5500- case INST_TYPE_RD_R2:
5501- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
5502- get_field_r2 (&buf, inst));
3981+ case INST_TYPE_IMML: 5503+ case INST_TYPE_IMML:
3982+ print_func (stream, "\t%s", get_field_imml (&buf, inst)); 5504+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
3983+ /* TODO: Also print symbol */ 5505+ /* TODO: Also print symbol */
5506+ break;
5507+ case INST_TYPE_RD_R2:
5508+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
3984 break; 5509 break;
3985 case INST_TYPE_R2: 5510 case INST_TYPE_R2:
3986 print_func (stream, "\t%s", get_field_r2 (&buf, inst)); 5511 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
3987@@ -438,8 +455,8 @@ print_insn_microblaze (bfd_vma memaddr, 5512@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5513 /* For mbar 16 or sleep insn. */
3988 case INST_TYPE_NONE: 5514 case INST_TYPE_NONE:
3989 break; 5515 break;
3990 /* For bit field insns. */ 5516- /* For tuqula instruction */
3991- case INST_TYPE_RD_R1_IMM5_IMM5: 5517+ /* For bit field insns. */
3992- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
3993+ case INST_TYPE_RD_R1_IMMW_IMMS: 5518+ case INST_TYPE_RD_R1_IMMW_IMMS:
3994+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst)); 5519+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
3995 break; 5520+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
3996 /* For tuqula instruction */ 5521+ break;
5522+ /* For tuqula instruction */
3997 case INST_TYPE_RD: 5523 case INST_TYPE_RD:
3998Index: gdb-9.2/opcodes/microblaze-opc.h 5524 print_func (stream, "\t%s", get_field_rd (&buf, inst));
3999=================================================================== 5525 break;
4000--- gdb-9.2.orig/opcodes/microblaze-opc.h 5526diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
4001+++ gdb-9.2/opcodes/microblaze-opc.h 5527index 27d8684df04..f9709412097 100644
5528--- a/opcodes/microblaze-opc.h
5529+++ b/opcodes/microblaze-opc.h
4002@@ -40,7 +40,7 @@ 5530@@ -40,7 +40,7 @@
4003 #define INST_TYPE_RD_SPECIAL 11 5531 #define INST_TYPE_RD_SPECIAL 11
4004 #define INST_TYPE_R1 12 5532 #define INST_TYPE_R1 12
@@ -4008,11 +5536,11 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4008 #define INST_TYPE_RD_RFSL 14 5536 #define INST_TYPE_RD_RFSL 14
4009 #define INST_TYPE_R1_RFSL 15 5537 #define INST_TYPE_R1_RFSL 15
4010 5538
4011@@ -60,7 +60,13 @@ 5539@@ -59,6 +59,15 @@
5540 /* For mbar. */
4012 #define INST_TYPE_IMM5 20 5541 #define INST_TYPE_IMM5 20
4013 5542
4014 /* For bsefi and bsifi */ 5543+/* For bsefi and bsifi */
4015-#define INST_TYPE_RD_R1_IMM5_IMM5 21
4016+#define INST_TYPE_RD_R1_IMMW_IMMS 21 5544+#define INST_TYPE_RD_R1_IMMW_IMMS 21
4017+ 5545+
4018+/* For 64-bit instructions */ 5546+/* For 64-bit instructions */
@@ -4020,37 +5548,36 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4020+#define INST_TYPE_RD_R1_IMML 23 5548+#define INST_TYPE_RD_R1_IMML 23
4021+#define INST_TYPE_R1_IMML 24 5549+#define INST_TYPE_R1_IMML 24
4022+#define INST_TYPE_RD_R1_IMMW_IMMS 21 5550+#define INST_TYPE_RD_R1_IMMW_IMMS 21
4023 5551+
4024 #define INST_TYPE_NONE 25 5552 #define INST_TYPE_NONE 25
4025 5553
4026@@ -91,13 +97,14 @@ 5554
5555@@ -88,10 +97,14 @@
4027 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */ 5556 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
4028 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */ 5557 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
4029 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */ 5558 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
4030-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */ 5559-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
4031-#define OPCODE_MASK_H3B 0xFC00C600 /* High 6 bits and bits 16, 17, 21, 22. */
4032+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */ 5560+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
4033+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */ 5561+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
4034 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */ 5562 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
4035-#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */
4036+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */ 5563+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
4037 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */ 5564 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
4038 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */ 5565+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
4039 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */ 5566 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
4040+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */ 5567+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
4041 5568
4042 /* New Mask for msrset, msrclr insns. */ 5569 /* New Mask for msrset, msrclr insns. */
4043 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ 5570 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
4044@@ -107,7 +114,7 @@ 5571@@ -101,7 +114,7 @@
4045 #define DELAY_SLOT 1 5572 #define DELAY_SLOT 1
4046 #define NO_DELAY_SLOT 0 5573 #define NO_DELAY_SLOT 0
4047 5574
4048-#define MAX_OPCODES 301 5575-#define MAX_OPCODES 289
4049+#define MAX_OPCODES 412 5576+#define MAX_OPCODES 412
4050 5577
4051 struct op_code_struct 5578 struct op_code_struct
4052 { 5579 {
4053@@ -125,6 +132,7 @@ struct op_code_struct 5580@@ -119,6 +132,7 @@ struct op_code_struct
4054 /* More info about output format here. */ 5581 /* More info about output format here. */
4055 } opcodes[MAX_OPCODES] = 5582 } opcodes[MAX_OPCODES] =
4056 { 5583 {
@@ -4058,15 +5585,13 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4058 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst }, 5585 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
4059 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst }, 5586 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
4060 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst }, 5587 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
4061@@ -161,11 +169,11 @@ struct op_code_struct 5588@@ -155,9 +169,11 @@ struct op_code_struct
4062 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst }, 5589 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
4063 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst }, 5590 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
4064 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst }, 5591 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
4065- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, 5592- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
4066- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, 5593- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
4067- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, 5594- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
4068- {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
4069- {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
4070+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst }, 5595+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
4071+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst }, 5596+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
4072+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst }, 5597+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
@@ -4075,8 +5600,62 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4075 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, 5600 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
4076 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst }, 5601 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
4077 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst }, 5602 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
4078@@ -425,6 +433,129 @@ struct op_code_struct 5603@@ -174,9 +190,14 @@ struct op_code_struct
4079 {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */ 5604 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
5605 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
5606 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
5607+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
5608 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
5609+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
5610+ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst },
5611 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
5612+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst },
5613 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
5614+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst },
5615 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
5616 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
5617 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
5618@@ -226,18 +247,24 @@ struct op_code_struct
5619 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
5620 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
5621 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
5622+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst },
5623 {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
5624 {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst },
5625+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst },
5626 {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
5627 {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst },
5628 {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
5629+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst },
5630 {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
5631 {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst },
5632+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst },
5633 {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
5634 {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst },
5635+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst },
5636 {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
5637 {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst },
5638 {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
5639+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst },
5640 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
5641 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
5642 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
5643@@ -248,9 +275,7 @@ struct op_code_struct
5644 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
5645 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
5646 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
5647- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5648 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
5649- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
5650 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
5651 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
5652 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
5653@@ -402,8 +427,135 @@ struct op_code_struct
5654 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
5655 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
5656 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
5657+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */
5658+ {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
4080 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst }, 5659 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
4081 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst }, 5660 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
4082+ 5661+
@@ -4184,8 +5763,8 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4184+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst }, 5763+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
4185+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst }, 5764+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
4186+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst }, 5765+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
4187+ {"lli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */ 5766+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
4188+ {"sli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */ 5767+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
4189+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */ 5768+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
4190+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 5769+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
4191+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst }, 5770+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
@@ -4201,20 +5780,22 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4201+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst }, 5780+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
4202+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst }, 5781+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
4203+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst }, 5782+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
5783+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5784+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
4204+ 5785+
4205 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 5786 {"", 0, 0, 0, 0, 0, 0, 0, 0},
4206 }; 5787 };
4207 5788
4208@@ -445,8 +576,17 @@ char pvr_register_prefix[] = "rpvr"; 5789@@ -424,5 +576,17 @@ char pvr_register_prefix[] = "rpvr";
4209 #define MIN_IMM5 ((int) 0x00000000) 5790 #define MIN_IMM5 ((int) 0x00000000)
4210 #define MAX_IMM5 ((int) 0x0000001f) 5791 #define MAX_IMM5 ((int) 0x0000001f)
4211 5792
4212+#define MIN_IMM6 ((int) 0x00000000) 5793+#define MIN_IMM6 ((int) 0x00000000)
4213+#define MAX_IMM6 ((int) 0x0000003f) 5794+#define MAX_IMM6 ((int) 0x0000003f)
4214+ 5795+
4215 #define MIN_IMM_WIDTH ((int) 0x00000001) 5796+#define MIN_IMM_WIDTH ((int) 0x00000001)
4216 #define MAX_IMM_WIDTH ((int) 0x00000020) 5797+#define MAX_IMM_WIDTH ((int) 0x00000020)
4217 5798+
4218+#define MIN_IMM6_WIDTH ((int) 0x00000001) 5799+#define MIN_IMM6_WIDTH ((int) 0x00000001)
4219+#define MAX_IMM6_WIDTH ((int) 0x00000040) 5800+#define MAX_IMM6_WIDTH ((int) 0x00000040)
4220+ 5801+
@@ -4223,11 +5804,11 @@ Index: gdb-9.2/opcodes/microblaze-opc.h
4223+ 5804+
4224 #endif /* MICROBLAZE_OPC */ 5805 #endif /* MICROBLAZE_OPC */
4225 5806
4226Index: gdb-9.2/opcodes/microblaze-opcm.h 5807diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
4227=================================================================== 5808index aa53dfe6bb5..ad8b8ce345b 100644
4228--- gdb-9.2.orig/opcodes/microblaze-opcm.h 5809--- a/opcodes/microblaze-opcm.h
4229+++ gdb-9.2/opcodes/microblaze-opcm.h 5810+++ b/opcodes/microblaze-opcm.h
4230@@ -25,6 +25,7 @@ 5811@@ -25,22 +25,23 @@
4231 5812
4232 enum microblaze_instr 5813 enum microblaze_instr
4233 { 5814 {
@@ -4235,6 +5816,29 @@ Index: gdb-9.2/opcodes/microblaze-opcm.h
4235 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu, 5816 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
4236 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 5817 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
4237 mulh, mulhu, mulhsu,swapb,swaph, 5818 mulh, mulhu, mulhsu,swapb,swaph,
5819 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
5820- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
5821+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
5822 /* 'or/and/xor' are C++ keywords. */
5823 microblaze_or, microblaze_and, microblaze_xor,
5824 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
5825- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
5826- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
5827- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5828+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse,
5829+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd,
5830+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5831 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
5832 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
5833- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
5834- shr, sw, swr, swx, lbui, lhui, lwi,
5835- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5836+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
5837+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
5838+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5839 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
5840 fint, fsqrt,
5841 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
4238@@ -58,6 +59,18 @@ enum microblaze_instr 5842@@ -58,6 +59,18 @@ enum microblaze_instr
4239 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd, 5843 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
4240 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd, 5844 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
@@ -4254,7 +5858,13 @@ Index: gdb-9.2/opcodes/microblaze-opcm.h
4254 invalid_inst 5858 invalid_inst
4255 }; 5859 };
4256 5860
4257@@ -135,15 +148,18 @@ enum microblaze_instr_type 5861@@ -129,18 +142,25 @@ enum microblaze_instr_type
5862 #define RB_LOW 11 /* Low bit for RB. */
5863 #define IMM_LOW 0 /* Low bit for immediate. */
5864 #define IMM_MBAR 21 /* low bit for mbar instruction. */
5865+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
5866
5867 #define RD_MASK 0x03E00000
4258 #define RA_MASK 0x001F0000 5868 #define RA_MASK 0x001F0000
4259 #define RB_MASK 0x0000F800 5869 #define RB_MASK 0x0000F800
4260 #define IMM_MASK 0x0000FFFF 5870 #define IMM_MASK 0x0000FFFF
@@ -4268,10 +5878,13 @@ Index: gdb-9.2/opcodes/microblaze-opcm.h
4268 /* Imm mask for mbar. */ 5878 /* Imm mask for mbar. */
4269 #define IMM5_MBAR_MASK 0x03E00000 5879 #define IMM5_MBAR_MASK 0x03E00000
4270 5880
4271-/* Imm mask for extract/insert width. */
4272+/* Imm masks for extract/insert width. */ 5881+/* Imm masks for extract/insert width. */
4273 #define IMM5_WIDTH_MASK 0x000007C0 5882+#define IMM5_WIDTH_MASK 0x000007C0
4274+#define IMM6_WIDTH_MASK 0x00000FC0 5883+#define IMM6_WIDTH_MASK 0x00000FC0
4275 5884+
4276 /* FSL imm mask for get, put instructions. */ 5885 /* FSL imm mask for get, put instructions. */
4277 #define RFSL_MASK 0x000000F 5886 #define RFSL_MASK 0x000000F
5887
5888--
58892.17.1
5890
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch
deleted file mode 100644
index 09896611..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 782bb2ab9b104dad4bbaed1d9ac769ce7e5b9f4d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 15:31:40 -0700
4Subject: [PATCH] Use exorted definitions of SIGRTMIN
5
6Define W_STOPCODE if not defined already
7
8__SIGRTMIN is internal to glibc and other libcs e.g. musl
9may not provide them
10
11Fixes
12https://sourceware.org/bugzilla/show_bug.cgi?id=13012
13
14Upstream-Status: Submitted
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 gdb/linux-nat.c | 4 ++--
19 gdb/nat/linux-nat.h | 4 ++++
20 2 files changed, 6 insertions(+), 2 deletions(-)
21
22diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
23index 4484fa5c87..3bb0ee7a49 100644
24--- a/gdb/linux-nat.c
25+++ b/gdb/linux-nat.c
26@@ -4588,6 +4588,6 @@ lin_thread_get_thread_signals (sigset_t *set)
27 /* NPTL reserves the first two RT signals, but does not provide any
28 way for the debugger to query the signal numbers - fortunately
29 they don't change. */
30- sigaddset (set, __SIGRTMIN);
31- sigaddset (set, __SIGRTMIN + 1);
32+ sigaddset (set, SIGRTMIN);
33+ sigaddset (set, SIGRTMIN + 1);
34 }
35diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
36index 44dcbb7758..975d7276f6 100644
37--- a/gdb/nat/linux-nat.h
38+++ b/gdb/nat/linux-nat.h
39@@ -91,4 +91,8 @@ extern void linux_stop_lwp (struct lwp_info *lwp);
40
41 extern int lwp_is_stepping (struct lwp_info *lwp);
42
43+#ifndef W_STOPCODE
44+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
45+#endif
46+
47 #endif /* NAT_LINUX_NAT_H */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch
deleted file mode 100644
index 18168c6b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 40c9c174590ce6fdc873b453285249fe957f376d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 15:35:39 -0700
4Subject: [PATCH] Change order of CFLAGS
5
6Lets us override Werror if need be
7
8Upstream-Status: Inappropriate
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 gdb/gdbserver/Makefile.in | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
16index 16a9f2fd38..b9c8cd9c41 100644
17--- a/gdb/gdbserver/Makefile.in
18+++ b/gdb/gdbserver/Makefile.in
19@@ -146,7 +146,7 @@ PTHREAD_LIBS = @PTHREAD_LIBS@
20 INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
21 ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
22 INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
23-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
24+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${COMPILER_CFLAGS} -DGDBSERVER
25
26 # LDFLAGS is specifically reserved for setting from the command line
27 # when running make.
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-fixing-the-MAX_OPCODES-to-correct-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-fixing-the-MAX_OPCODES-to-correct-value.patch
deleted file mode 100644
index ce2447a5..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-fixing-the-MAX_OPCODES-to-correct-value.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1From e8cd7c56c206c7a4582008d9059fe7a9ad35a44c Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 28 Jan 2016 14:07:34 +0530
4Subject: [PATCH 08/52] fixing the MAX_OPCODES to correct value
5
6---
7 opcodes/microblaze-opc.h | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10Index: gdb-9.2/opcodes/microblaze-opc.h
11===================================================================
12--- gdb-9.2.orig/opcodes/microblaze-opc.h
13+++ gdb-9.2/opcodes/microblaze-opc.h
14@@ -102,7 +102,7 @@
15 #define DELAY_SLOT 1
16 #define NO_DELAY_SLOT 0
17
18-#define MAX_OPCODES 291
19+#define MAX_OPCODES 299
20
21 struct op_code_struct
22 {
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0053-gdb-Fix-microblaze-target-compilation.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-gdb-Fix-microblaze-target-compilation-3.patch
index 01e48a02..6a570b6a 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0053-gdb-Fix-microblaze-target-compilation.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-gdb-Fix-microblaze-target-compilation-3.patch
@@ -1,7 +1,7 @@
1From e770e163e918c6065fc437687839bfbbd0137cff Mon Sep 17 00:00:00 2001 1From 306ca46b3f330ee39601b9aede6b53c9cdbe9f86 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org> 2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Mon, 7 Dec 2020 12:03:25 -0600 3Date: Wed, 9 Dec 2020 23:35:35 -0600
4Subject: [PATCH] gdb: Fix microblaze target compilation 4Subject: [PATCH 08/10] gdb: Fix microblaze target compilation (#3)
5 5
6Add microblaze-linux-nat.c to configure.nat 6Add microblaze-linux-nat.c to configure.nat
7 7
@@ -15,7 +15,7 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
15 3 files changed, 43 insertions(+), 61 deletions(-) 15 3 files changed, 43 insertions(+), 61 deletions(-)
16 16
17diff --git a/gdb/configure.nat b/gdb/configure.nat 17diff --git a/gdb/configure.nat b/gdb/configure.nat
18index fb4522f579..2b6873f9d6 100644 18index bb70e303384..d8548a6b666 100644
19--- a/gdb/configure.nat 19--- a/gdb/configure.nat
20+++ b/gdb/configure.nat 20+++ b/gdb/configure.nat
21@@ -261,6 +261,11 @@ case ${gdb_host} in 21@@ -261,6 +261,11 @@ case ${gdb_host} in
@@ -31,7 +31,7 @@ index fb4522f579..2b6873f9d6 100644
31 # Host: Linux/MIPS 31 # Host: Linux/MIPS
32 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \ 32 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
33diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 33diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
34index e9b8c9c522..bac4697e1e 100644 34index e9b8c9c5221..bac4697e1e6 100644
35--- a/gdb/microblaze-linux-nat.c 35--- a/gdb/microblaze-linux-nat.c
36+++ b/gdb/microblaze-linux-nat.c 36+++ b/gdb/microblaze-linux-nat.c
37@@ -36,13 +36,14 @@ 37@@ -36,13 +36,14 @@
@@ -270,7 +270,7 @@ index e9b8c9c522..bac4697e1e 100644
270+ add_inf_child_target (&the_microblaze_linux_nat_target); 270+ add_inf_child_target (&the_microblaze_linux_nat_target);
271 } 271 }
272diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 272diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
273index c0fc900733..c777d93a95 100644 273index dc1d4686914..a5c12c10e0b 100644
274--- a/gdb/microblaze-tdep.h 274--- a/gdb/microblaze-tdep.h
275+++ b/gdb/microblaze-tdep.h 275+++ b/gdb/microblaze-tdep.h
276@@ -106,6 +106,9 @@ enum microblaze_regnum 276@@ -106,6 +106,9 @@ enum microblaze_regnum
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch
deleted file mode 100644
index 155ef3b5..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch
+++ /dev/null
@@ -1,144 +0,0 @@
1From 01453aca6478379bef05095f64ed79509da3a5ca Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 09/52] Add new bit-field instructions
5
6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a
8register and place it right-adjusted in the destination register.
9The other bits in the destination register shall be set to zero
10BSIFI- The instruction shall insert a right-adjusted bit field
11from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged
13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
18---
19 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
20 opcodes/microblaze-dis.c | 20 +++++++++--
21 opcodes/microblaze-opc.h | 12 ++++++-
22 opcodes/microblaze-opcm.h | 6 +++-
23 4 files changed, 104 insertions(+), 5 deletions(-)
24
25Index: gdb-9.2/opcodes/microblaze-dis.c
26===================================================================
27--- gdb-9.2.orig/opcodes/microblaze-dis.c
28+++ gdb-9.2/opcodes/microblaze-dis.c
29@@ -91,7 +91,19 @@ get_field_imm5_mbar (struct string_buf *
30 }
31
32 static char *
33-get_field_rfsl (struct string_buf *buf, long instr)
34+get_field_imm5width (struct string_buf *buf, long instr)
35+{
36+ char *p = strbuf (buf);
37+
38+ if (instr & 0x00004000)
39+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
40+ else
41+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
42+ return p;
43+}
44+
45+static char *
46+get_field_rfsl (struct string_buf *buf,long instr)
47 {
48 char *p = strbuf (buf);
49
50@@ -425,7 +437,11 @@ print_insn_microblaze (bfd_vma memaddr,
51 /* For mbar 16 or sleep insn. */
52 case INST_TYPE_NONE:
53 break;
54- /* For tuqula instruction */
55+ /* For bit field insns. */
56+ case INST_TYPE_RD_R1_IMM5_IMM5:
57+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
58+ break;
59+ /* For tuqula instruction */
60 case INST_TYPE_RD:
61 print_func (stream, "\t%s", get_field_rd (&buf, inst));
62 break;
63Index: gdb-9.2/opcodes/microblaze-opc.h
64===================================================================
65--- gdb-9.2.orig/opcodes/microblaze-opc.h
66+++ gdb-9.2/opcodes/microblaze-opc.h
67@@ -59,6 +59,9 @@
68 /* For mbar. */
69 #define INST_TYPE_IMM5 20
70
71+/* For bsefi and bsifi */
72+#define INST_TYPE_RD_R1_IMM5_IMM5 21
73+
74 #define INST_TYPE_NONE 25
75
76
77@@ -89,7 +92,9 @@
78 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
79 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
80 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
81+#define OPCODE_MASK_H3B 0xFC00C600 /* High 6 bits and bits 16, 17, 21, 22. */
82 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
83+#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */
84 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
85 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
86 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
87@@ -102,7 +107,7 @@
88 #define DELAY_SLOT 1
89 #define NO_DELAY_SLOT 0
90
91-#define MAX_OPCODES 299
92+#define MAX_OPCODES 301
93
94 struct op_code_struct
95 {
96@@ -159,6 +164,8 @@ struct op_code_struct
97 {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
98 {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
99 {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
100+ {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
101+ {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
102 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
103 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
104 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
105@@ -438,5 +445,8 @@ char pvr_register_prefix[] = "rpvr";
106 #define MIN_IMM5 ((int) 0x00000000)
107 #define MAX_IMM5 ((int) 0x0000001f)
108
109+#define MIN_IMM_WIDTH ((int) 0x00000001)
110+#define MAX_IMM_WIDTH ((int) 0x00000020)
111+
112 #endif /* MICROBLAZE_OPC */
113
114Index: gdb-9.2/opcodes/microblaze-opcm.h
115===================================================================
116--- gdb-9.2.orig/opcodes/microblaze-opcm.h
117+++ gdb-9.2/opcodes/microblaze-opcm.h
118@@ -29,7 +29,7 @@ enum microblaze_instr
119 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
120 mulh, mulhu, mulhsu,swapb,swaph,
121 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
122- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
123+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
124 /* 'or/and/xor' are C++ keywords. */
125 microblaze_or, microblaze_and, microblaze_xor,
126 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
127@@ -129,6 +129,7 @@ enum microblaze_instr_type
128 #define RB_LOW 11 /* Low bit for RB. */
129 #define IMM_LOW 0 /* Low bit for immediate. */
130 #define IMM_MBAR 21 /* low bit for mbar instruction. */
131+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
132
133 #define RD_MASK 0x03E00000
134 #define RA_MASK 0x001F0000
135@@ -141,6 +142,9 @@ enum microblaze_instr_type
136 /* Imm mask for mbar. */
137 #define IMM5_MBAR_MASK 0x03E00000
138
139+/* Imm mask for extract/insert width. */
140+#define IMM5_WIDTH_MASK 0x000007C0
141+
142 /* FSL imm mask for get, put instructions. */
143 #define RFSL_MASK 0x000000F
144
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
index 320d6ecb..fca85fa2 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
@@ -1,7 +1,7 @@
1From 6b29e1a8ff62e01299ee07840b4443cbda5b8c61 Mon Sep 17 00:00:00 2001 1From 9ab0a0a551902e5196d46178b57fa1b33b587092 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 19 Apr 2021 14:33:27 +0530 3Date: Mon, 19 Apr 2021 14:33:27 +0530
4Subject: [PATCH 55] [Patch,MicroBlaze] : these changes will make 64 bit 4Subject: [PATCH 09/10] [Patch,MicroBlaze] : these changes will make 64 bit
5 vectors as default target types when we built gdb with microblaze 64 bit type 5 vectors as default target types when we built gdb with microblaze 64 bit type
6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64 6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7 7
@@ -9,11 +9,11 @@ Subject: [PATCH 55] [Patch,MicroBlaze] : these changes will make 64 bit
9 bfd/config.bfd | 8 ++++++++ 9 bfd/config.bfd | 8 ++++++++
10 1 file changed, 8 insertions(+) 10 1 file changed, 8 insertions(+)
11 11
12Index: gdb-9.2/bfd/config.bfd 12diff --git a/bfd/config.bfd b/bfd/config.bfd
13=================================================================== 13index 0f752de267b..4945e7fa3b5 100644
14--- gdb-9.2.orig/bfd/config.bfd 14--- a/bfd/config.bfd
15+++ gdb-9.2/bfd/config.bfd 15+++ b/bfd/config.bfd
16@@ -838,7 +838,15 @@ case "${targ}" in 16@@ -823,7 +823,15 @@ case "${targ}" in
17 targ_defvec=metag_elf32_vec 17 targ_defvec=metag_elf32_vec
18 targ_underscore=yes 18 targ_underscore=yes
19 ;; 19 ;;
@@ -29,3 +29,6 @@ Index: gdb-9.2/bfd/config.bfd
29 microblazeel*-*) 29 microblazeel*-*)
30 targ_defvec=microblaze_elf32_le_vec 30 targ_defvec=microblaze_elf32_le_vec
31 targ_selvecs=microblaze_elf32_vec 31 targ_selvecs=microblaze_elf32_vec
32--
332.17.1
34
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch
deleted file mode 100644
index 8f15c49d..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 5b69a98f6bb7363a1f79f29bac2b25b7df6d2fdd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 10 May 2016 08:47:05 -0700
4Subject: [PATCH] resolve restrict keyword conflict
5
6GCC detects that we call 'restrict' as param name in function
7signatures and complains since both params are called 'restrict'
8therefore we use __restrict to denote the C99 keywork
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 gnulib/import/sys_time.in.h | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h
18index d535a6a48b..7c34d5a1aa 100644
19--- a/gnulib/import/sys_time.in.h
20+++ b/gnulib/import/sys_time.in.h
21@@ -93,20 +93,20 @@ struct timeval
22 # define gettimeofday rpl_gettimeofday
23 # endif
24 _GL_FUNCDECL_RPL (gettimeofday, int,
25- (struct timeval *restrict, void *restrict)
26+ (struct timeval *__restrict, void *__restrict)
27 _GL_ARG_NONNULL ((1)));
28 _GL_CXXALIAS_RPL (gettimeofday, int,
29- (struct timeval *restrict, void *restrict));
30+ (struct timeval *__restrict, void *__restrict));
31 # else
32 # if !@HAVE_GETTIMEOFDAY@
33 _GL_FUNCDECL_SYS (gettimeofday, int,
34- (struct timeval *restrict, void *restrict)
35+ (struct timeval *__restrict, void *__restrict)
36 _GL_ARG_NONNULL ((1)));
37 # endif
38 /* Need to cast, because on glibc systems, by default, the second argument is
39 struct timezone *. */
40 _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
41- (struct timeval *restrict, void *restrict));
42+ (struct timeval *__restrict, void *__restrict));
43 # endif
44 _GL_CXXALIASWARN (gettimeofday);
45 # if defined __cplusplus && defined GNULIB_NAMESPACE
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch
deleted file mode 100644
index 5209c002..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From bc1f01ff5e524f7777083024bce348a9b0017a7a Mon Sep 17 00:00:00 2001
2From: Yousong Zhou <yszhou4tech@gmail.com>
3Date: Fri, 24 Mar 2017 10:36:03 +0800
4Subject: [PATCH] Fix invalid sigprocmask call
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The POSIX document says
10
11 The pthread_sigmask() and sigprocmask() functions shall fail if:
12
13 [EINVAL]
14 The value of the how argument is not equal to one of the defined values.
15
16and this is how musl-libc is currently doing. Fix the call to be safe
17and correct
18
19 [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
20
21gdb/ChangeLog:
222017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
23
24 * common/signals-state-save-restore.c (save_original_signals_state):
25 Fix invalid sigprocmask call.
26
27Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek]
28Signed-off-by: André Draszik <adraszik@tycoint.com>
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30---
31 gdb/gdbsupport/signals-state-save-restore.c | 2 +-
32 1 file changed, 1 insertion(+), 1 deletion(-)
33
34diff --git a/gdb/gdbsupport/signals-state-save-restore.c b/gdb/gdbsupport/signals-state-save-restore.c
35index c292d498da..af9dcaeb08 100644
36--- a/gdb/gdbsupport/signals-state-save-restore.c
37+++ b/gdb/gdbsupport/signals-state-save-restore.c
38@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
39 int i;
40 int res;
41
42- res = gdb_sigmask (0, NULL, &original_signal_mask);
43+ res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask);
44 if (res == -1)
45 perror_with_name (("sigprocmask"));
46
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
new file mode 100644
index 00000000..78ef9202
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
@@ -0,0 +1,279 @@
1From 67fd78c3fa5894e0038c09a858cb518c20340abf Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 10/10] [Patch,MicroBlaze] : Added m64 abi for 64 bit target
5 descriptions. set m64 abi for 64 bit elf.
6
7---
8 gdb/features/microblaze64.xml | 1 +
9 gdb/microblaze-tdep.c | 150 ++++++++++++++++++++++++++++++++--
10 gdb/microblaze-tdep.h | 11 +++
11 3 files changed, 155 insertions(+), 7 deletions(-)
12
13diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
14index 515d18e65cf..9c1b7d22003 100644
15--- a/gdb/features/microblaze64.xml
16+++ b/gdb/features/microblaze64.xml
17@@ -7,5 +7,6 @@
18
19 <!DOCTYPE target SYSTEM "gdb-target.dtd">
20 <target>
21+ <architecture>microblaze64</architecture>
22 <xi:include href="microblaze64-core.xml"/>
23 </target>
24diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
25index e51c022c1ba..3bffbbe4b3d 100644
26--- a/gdb/microblaze-tdep.c
27+++ b/gdb/microblaze-tdep.c
28@@ -65,8 +65,94 @@
29 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
30 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
31
32+static const char *microblaze_abi_string;
33+
34+static const char *const microblaze_abi_strings[] = {
35+ "auto",
36+ "m64",
37+};
38+
39+enum microblaze_abi
40+microblaze_abi (struct gdbarch *gdbarch)
41+{
42+ return gdbarch_tdep (gdbarch)->microblaze_abi;
43+}
44 /* The registers of the Xilinx microblaze processor. */
45
46+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
47+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
48+
49+static void
50+microblaze_abi_update (const char *ignore_args,
51+ int from_tty, struct cmd_list_element *c)
52+{
53+ struct gdbarch_info info;
54+
55+ /* Force the architecture to update, and (if it's a microblaze architecture)
56+ * microblaze_gdbarch_init will take care of the rest. */
57+ gdbarch_info_init (&info);
58+ gdbarch_update_p (info);
59+}
60+
61+
62+static enum microblaze_abi
63+global_microblaze_abi (void)
64+{
65+ int i;
66+
67+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
68+ if (microblaze_abi_strings[i] == microblaze_abi_string)
69+ return (enum microblaze_abi) i;
70+
71+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
72+}
73+
74+static void
75+show_microblaze_abi (struct ui_file *file,
76+ int from_tty,
77+ struct cmd_list_element *ignored_cmd,
78+ const char *ignored_value)
79+{
80+ enum microblaze_abi global_abi = global_microblaze_abi ();
81+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
82+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
83+
84+#if 1
85+ if (global_abi == MICROBLAZE_ABI_AUTO)
86+ fprintf_filtered
87+ (file,
88+ "The microblaze ABI is set automatically (currently \"%s\").\n",
89+ actual_abi_str);
90+ else if (global_abi == actual_abi)
91+ fprintf_filtered
92+ (file,
93+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
94+ actual_abi_str);
95+ else
96+ {
97+#endif
98+ /* Probably shouldn't happen... */
99+ fprintf_filtered (file,
100+ "The (auto detected) microblaze ABI \"%s\" is in use "
101+ "even though the user setting was \"%s\".\n",
102+ actual_abi_str, microblaze_abi_strings[global_abi]);
103+ }
104+}
105+
106+static void
107+show_microblaze_command (const char *args, int from_tty)
108+{
109+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
110+}
111+
112+static void
113+set_microblaze_command (const char *args, int from_tty)
114+{
115+ printf_unfiltered
116+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
117+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
118+}
119+
120 static const char *microblaze_register_names[] =
121 {
122 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
123@@ -85,6 +171,18 @@ static const char *microblaze_register_names[] =
124 static unsigned int microblaze_debug_flag = 0;
125 int reg_size = 4;
126
127+unsigned int
128+microblaze_abi_regsize (struct gdbarch *gdbarch)
129+{
130+ switch (microblaze_abi (gdbarch))
131+ {
132+ case MICROBLAZE_ABI_M64:
133+ return 8;
134+ default:
135+ return 4;
136+ }
137+}
138+
139 static void ATTRIBUTE_PRINTF (1, 2)
140 microblaze_debug (const char *fmt, ...)
141 {
142@@ -855,15 +953,30 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
143 struct gdbarch_tdep *tdep;
144 struct gdbarch *gdbarch;
145 struct tdesc_arch_data *tdesc_data = NULL;
146+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
147 const struct target_desc *tdesc = info.target_desc;
148
149+ /* What has the user specified from the command line? */
150+ wanted_abi = global_microblaze_abi ();
151+ if (gdbarch_debug)
152+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
153+ wanted_abi);
154+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
155+ microblaze_abi = wanted_abi;
156+
157 /* If there is already a candidate, use it. */
158 arches = gdbarch_list_lookup_by_info (arches, &info);
159- if (arches != NULL)
160+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
161 return arches->gdbarch;
162+
163+ if (microblaze_abi == MICROBLAZE_ABI_M64)
164+ {
165+ tdesc = tdesc_microblaze64;
166+ reg_size = 8;
167+ }
168 if (tdesc == NULL)
169 {
170- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
171+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
172 {
173 tdesc = tdesc_microblaze64;
174 reg_size = 8;
175@@ -878,7 +991,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
176 int valid_p;
177 int i;
178
179- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
180+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
181 feature = tdesc_find_feature (tdesc,
182 "org.gnu.gdb.microblaze64.core");
183 else
184@@ -892,7 +1005,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
185 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
186 valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
187 microblaze_register_names[i]);
188- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
189+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
190 feature = tdesc_find_feature (tdesc,
191 "org.gnu.gdb.microblaze64.stack-protect");
192 else
193@@ -943,7 +1056,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
194 set_gdbarch_ptr_bit (gdbarch, 64);
195 break;
196 }
197-
198+ if(microblaze_abi == MICROBLAZE_ABI_M64)
199+ set_gdbarch_ptr_bit (gdbarch, 64);
200
201 /* Map Dwarf2 registers to GDB registers. */
202 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
203@@ -1000,7 +1114,30 @@ void
204 _initialize_microblaze_tdep ()
205 {
206 register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
207-
208+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
209+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
210+
211+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
212+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
213+ _("Various microblaze specific commands."),
214+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
215+
216+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
217+ _("Various microblaze specific commands."),
218+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
219+
220+ /* Allow the user to override the ABI. */
221+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
222+ &microblaze_abi_string, _("\
223+Set the microblaze ABI used by this program."), _("\
224+Show the microblaze ABI used by this program."), _("\
225+This option can be set to one of:\n\
226+ auto - the default ABI associated with the current binary\n\
227+ m64"),
228+ microblaze_abi_update,
229+ show_microblaze_abi,
230+ &setmicroblazecmdlist, &showmicroblazecmdlist);
231+
232 initialize_tdesc_microblaze_with_stack_protect ();
233 initialize_tdesc_microblaze ();
234 initialize_tdesc_microblaze64_with_stack_protect ();
235@@ -1015,5 +1152,4 @@ When non-zero, microblaze specific debugging is enabled."),
236 NULL,
237 &setdebuglist, &showdebuglist);
238
239-
240 }
241diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
242index a5c12c10e0b..29da6d29dcb 100644
243--- a/gdb/microblaze-tdep.h
244+++ b/gdb/microblaze-tdep.h
245@@ -19,8 +19,16 @@
246
247 #ifndef MICROBLAZE_TDEP_H
248 #define MICROBLAZE_TDEP_H 1
249+#include "objfiles.h"
250
251+struct gdbarch;
252+enum microblaze_abi
253+ {
254+ MICROBLAZE_ABI_AUTO = 0,
255+ MICROBLAZE_ABI_M64,
256+ };
257
258+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
259 /* Microblaze architecture-specific information. */
260 struct microblaze_gregset
261 {
262@@ -34,11 +42,14 @@ struct gdbarch_tdep
263 {
264 int dummy; // declare something.
265
266+ enum microblaze_abi microblaze_abi;
267+ enum microblaze_abi found_abi;
268 /* Register sets. */
269 struct regset *gregset;
270 size_t sizeof_gregset;
271 struct regset *fpregset;
272 size_t sizeof_fpregset;
273+ int register_size;
274 };
275
276 /* Register numbers. */
277--
2782.17.1
279
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch
deleted file mode 100644
index 201dfeb1..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From b2dc3bfabd4d80be7d90502e3d2dc26b508679cb Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 10 Jul 2017 16:07:28 +0530
4Subject: [PATCH 10/52] fixing the imm bug. with relax option imm -1 is also
5 getting removed this is corrected now.
6
7---
8 bfd/elf32-microblaze.c | 3 +--
9 1 file changed, 1 insertion(+), 2 deletions(-)
10
11Index: gdb-9.2/bfd/elf32-microblaze.c
12===================================================================
13--- gdb-9.2.orig/bfd/elf32-microblaze.c
14+++ gdb-9.2/bfd/elf32-microblaze.c
15@@ -1869,8 +1869,7 @@ microblaze_elf_relax_section (bfd *abfd,
16 else
17 symval += irel->r_addend;
18
19- if ((symval & 0xffff8000) == 0
20- || (symval & 0xffff8000) == 0xffff8000)
21+ if ((symval & 0xffff8000) == 0)
22 {
23 /* We can delete this instruction. */
24 sec->relax[sec->relax_count].addr = irel->r_offset;
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch
deleted file mode 100644
index eedd94c4..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 3d6700d38153a0ec8e0800de703a5089a8cd3d2d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 29 Nov 2018 18:00:23 -0800
4Subject: [PATCH] gdbserver ctrl-c handling
5
6This problem was created by the upstream commit 78708b7c8c
7After applying the commit, it will send SIGINT to the process
8group(-signal_pid).
9But if we use gdbserver send SIGINT, and the attached process is not a
10process
11group leader, then the "kill (-signal_pid, SIGINT)" returns error and
12fails to
13interrupt the attached process.
14
15Upstream-Status: Submitted
16[https://sourceware.org/bugzilla/show_bug.cgi?id=18945]
17
18Author: Josh Gao
19Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21---
22 gdb/gdbserver/linux-low.c | 4 +---
23 1 file changed, 1 insertion(+), 3 deletions(-)
24
25diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
26index 4255795ea6..762f8bafb6 100644
27--- a/gdb/gdbserver/linux-low.c
28+++ b/gdb/gdbserver/linux-low.c
29@@ -5904,9 +5904,7 @@ linux_look_up_symbols (void)
30 static void
31 linux_request_interrupt (void)
32 {
33- /* Send a SIGINT to the process group. This acts just like the user
34- typed a ^C on the controlling terminal. */
35- kill (-signal_pid, SIGINT);
36+ kill (signal_pid, SIGINT);
37 }
38
39 /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch
deleted file mode 100644
index 6f5e0b6c..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch
+++ /dev/null
@@ -1,359 +0,0 @@
1From 070b7b1f35dedc41b1ba9a228d701485b2239ac0 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 16:31:26 +0530
4Subject: [PATCH 15/52] MB-X initial commit code cleanup is needed.
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-opcm.h
10---
11 bfd/bfd-in2.h | 10 +++
12 bfd/elf32-microblaze.c | 59 +++++++++++++-
13 bfd/elf64-microblaze.c | 61 ++++++++++++++-
14 bfd/libbfd.h | 2 +
15 bfd/reloc.c | 12 +++
16 gas/config/tc-microblaze.c | 154 ++++++++++++++++++++++++++++++-------
17 include/elf/microblaze.h | 2 +
18 opcodes/microblaze-opc.h | 10 +--
19 opcodes/microblaze-opcm.h | 4 +-
20 9 files changed, 278 insertions(+), 36 deletions(-)
21
22Index: gdb-9.2/bfd/bfd-in2.h
23===================================================================
24--- gdb-9.2.orig/bfd/bfd-in2.h
25+++ gdb-9.2/bfd/bfd-in2.h
26@@ -5374,11 +5374,21 @@ done here - only used for relaxing */
27 BFD_RELOC_MICROBLAZE_64_NONE,
28
29 /* This is a 64 bit reloc that stores the 32 bit pc relative
30+ * +value in two words (with an imml instruction). No relocation is
31+ * +done here - only used for relaxing */
32+ BFD_RELOC_MICROBLAZE_64,
33+
34+/* This is a 64 bit reloc that stores the 32 bit pc relative
35 value in two words (with an imm instruction). The relocation is
36 PC-relative GOT offset */
37 BFD_RELOC_MICROBLAZE_64_GOTPC,
38
39 /* This is a 64 bit reloc that stores the 32 bit pc relative
40+value in two words (with an imml instruction). The relocation is
41+PC-relative GOT offset */
42+ BFD_RELOC_MICROBLAZE_64_GPC,
43+
44+/* This is a 64 bit reloc that stores the 32 bit pc relative
45 value in two words (with an imm instruction). The relocation is
46 GOT offset */
47 BFD_RELOC_MICROBLAZE_64_GOT,
48Index: gdb-9.2/bfd/elf32-microblaze.c
49===================================================================
50--- gdb-9.2.orig/bfd/elf32-microblaze.c
51+++ gdb-9.2/bfd/elf32-microblaze.c
52@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_h
53 0x0000ffff, /* Dest Mask. */
54 TRUE), /* PC relative offset? */
55
56+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
57+ 0, /* Rightshift. */
58+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
59+ 16, /* Bitsize. */
60+ TRUE, /* PC_relative. */
61+ 0, /* Bitpos. */
62+ complain_overflow_dont, /* Complain on overflow. */
63+ bfd_elf_generic_reloc,/* Special Function. */
64+ "R_MICROBLAZE_IMML_64", /* Name. */
65+ FALSE, /* Partial Inplace. */
66+ 0, /* Source Mask. */
67+ 0x0000ffff, /* Dest Mask. */
68+ FALSE), /* PC relative offset? */
69+
70 /* A 64 bit relocation. Table entry not really used. */
71 HOWTO (R_MICROBLAZE_64, /* Type. */
72 0, /* Rightshift. */
73@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_h
74 0x0000ffff, /* Dest Mask. */
75 TRUE), /* PC relative offset? */
76
77+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
78+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
79+ 0, /* Rightshift. */
80+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
81+ 16, /* Bitsize. */
82+ TRUE, /* PC_relative. */
83+ 0, /* Bitpos. */
84+ complain_overflow_dont, /* Complain on overflow. */
85+ bfd_elf_generic_reloc, /* Special Function. */
86+ "R_MICROBLAZE_GPC_64", /* Name. */
87+ FALSE, /* Partial Inplace. */
88+ 0, /* Source Mask. */
89+ 0x0000ffff, /* Dest Mask. */
90+ TRUE), /* PC relative offset? */
91+
92 /* A 64 bit GOT relocation. Table-entry not really used. */
93 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
94 0, /* Rightshift. */
95@@ -619,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd *
96 case BFD_RELOC_VTABLE_ENTRY:
97 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
98 break;
99+ case BFD_RELOC_MICROBLAZE_64:
100+ microblaze_reloc = R_MICROBLAZE_IMML_64;
101+ break;
102 case BFD_RELOC_MICROBLAZE_64_GOTPC:
103 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
104 break;
105+ case BFD_RELOC_MICROBLAZE_64_GPC:
106+ microblaze_reloc = R_MICROBLAZE_GPC_64;
107+ break;
108 case BFD_RELOC_MICROBLAZE_64_GOT:
109 microblaze_reloc = R_MICROBLAZE_GOT_64;
110 break;
111@@ -1467,7 +1502,7 @@ microblaze_elf_relocate_section (bfd *ou
112 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
113 {
114 relocation += addend;
115- if (r_type == R_MICROBLAZE_32)
116+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
117 bfd_put_32 (input_bfd, relocation, contents + offset);
118 else
119 {
120@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd,
121 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
122 }
123 break;
124+ case R_MICROBLAZE_IMML_64:
125+ {
126+ /* This was a PC-relative instruction that was
127+ completely resolved. */
128+ int sfix, efix;
129+ unsigned int val;
130+ bfd_vma target_address;
131+ target_address = irel->r_addend + irel->r_offset;
132+ sfix = calc_fixup (irel->r_offset, 0, sec);
133+ efix = calc_fixup (target_address, 0, sec);
134+
135+ /* Validate the in-band val. */
136+ val = bfd_get_32 (abfd, contents + irel->r_offset);
137+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
138+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
139+ }
140+ irel->r_addend -= (efix - sfix);
141+ /* Should use HOWTO. */
142+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
143+ irel->r_addend);
144+ }
145+ break;
146 case R_MICROBLAZE_NONE:
147 case R_MICROBLAZE_32_NONE:
148 {
149Index: gdb-9.2/bfd/elf64-microblaze.c
150===================================================================
151--- gdb-9.2.orig/bfd/elf64-microblaze.c
152+++ gdb-9.2/bfd/elf64-microblaze.c
153@@ -117,6 +117,21 @@ static reloc_howto_type microblaze_elf_h
154 TRUE), /* PC relative offset? */
155
156 /* A 64 bit relocation. Table entry not really used. */
157+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
158+ 0, /* Rightshift. */
159+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
160+ 64, /* Bitsize. */
161+ TRUE, /* PC_relative. */
162+ 0, /* Bitpos. */
163+ complain_overflow_dont, /* Complain on overflow. */
164+ bfd_elf_generic_reloc,/* Special Function. */
165+ "R_MICROBLAZE_IMML_64", /* Name. */
166+ FALSE, /* Partial Inplace. */
167+ 0, /* Source Mask. */
168+ 0x0000ffff, /* Dest Mask. */
169+ TRUE), /* PC relative offset? */
170+
171+ /* A 64 bit relocation. Table entry not really used. */
172 HOWTO (R_MICROBLAZE_64, /* Type. */
173 0, /* Rightshift. */
174 2, /* Size (0 = byte, 1 = short, 2 = long). */
175@@ -265,6 +280,21 @@ static reloc_howto_type microblaze_elf_h
176 0x0000ffff, /* Dest Mask. */
177 TRUE), /* PC relative offset? */
178
179+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
180+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
181+ 0, /* Rightshift. */
182+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
183+ 16, /* Bitsize. */
184+ TRUE, /* PC_relative. */
185+ 0, /* Bitpos. */
186+ complain_overflow_dont, /* Complain on overflow. */
187+ bfd_elf_generic_reloc, /* Special Function. */
188+ "R_MICROBLAZE_GPC_64", /* Name. */
189+ FALSE, /* Partial Inplace. */
190+ 0, /* Source Mask. */
191+ 0x0000ffff, /* Dest Mask. */
192+ TRUE), /* PC relative offset? */
193+
194 /* A 64 bit GOT relocation. Table-entry not really used. */
195 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
196 0, /* Rightshift. */
197@@ -589,9 +619,15 @@ microblaze_elf_reloc_type_lookup (bfd *
198 case BFD_RELOC_VTABLE_ENTRY:
199 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
200 break;
201+ case BFD_RELOC_MICROBLAZE_64:
202+ microblaze_reloc = R_MICROBLAZE_IMML_64;
203+ break;
204 case BFD_RELOC_MICROBLAZE_64_GOTPC:
205 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
206 break;
207+ case BFD_RELOC_MICROBLAZE_64_GPC:
208+ microblaze_reloc = R_MICROBLAZE_GPC_64;
209+ break;
210 case BFD_RELOC_MICROBLAZE_64_GOT:
211 microblaze_reloc = R_MICROBLAZE_GOT_64;
212 break;
213@@ -1172,6 +1208,7 @@ microblaze_elf_relocate_section (bfd *ou
214 break; /* Do nothing. */
215
216 case (int) R_MICROBLAZE_GOTPC_64:
217+ case (int) R_MICROBLAZE_GPC_64:
218 relocation = htab->sgotplt->output_section->vma
219 + htab->sgotplt->output_offset;
220 relocation -= (input_section->output_section->vma
221@@ -1443,7 +1480,7 @@ microblaze_elf_relocate_section (bfd *ou
222 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
223 {
224 relocation += addend;
225- if (r_type == R_MICROBLAZE_32)
226+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
227 bfd_put_32 (input_bfd, relocation, contents + offset);
228 else
229 {
230@@ -1889,6 +1926,28 @@ microblaze_elf_relax_section (bfd *abfd,
231 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
232 }
233 break;
234+ case R_MICROBLAZE_IMML_64:
235+ {
236+ /* This was a PC-relative instruction that was
237+ completely resolved. */
238+ int sfix, efix;
239+ unsigned int val;
240+ bfd_vma target_address;
241+ target_address = irel->r_addend + irel->r_offset;
242+ sfix = calc_fixup (irel->r_offset, 0, sec);
243+ efix = calc_fixup (target_address, 0, sec);
244+
245+ /* Validate the in-band val. */
246+ val = bfd_get_32 (abfd, contents + irel->r_offset);
247+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
248+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
249+ }
250+ irel->r_addend -= (efix - sfix);
251+ /* Should use HOWTO. */
252+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
253+ irel->r_addend);
254+ }
255+ break;
256 case R_MICROBLAZE_NONE:
257 case R_MICROBLAZE_32_NONE:
258 {
259Index: gdb-9.2/bfd/libbfd.h
260===================================================================
261--- gdb-9.2.orig/bfd/libbfd.h
262+++ gdb-9.2/bfd/libbfd.h
263@@ -2905,7 +2905,9 @@ static const char *const bfd_reloc_code_
264 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
265 "BFD_RELOC_MICROBLAZE_32_NONE",
266 "BFD_RELOC_MICROBLAZE_64_NONE",
267+ "BFD_RELOC_MICROBLAZE_64",
268 "BFD_RELOC_MICROBLAZE_64_GOTPC",
269+ "BFD_RELOC_MICROBLAZE_64_GPC",
270 "BFD_RELOC_MICROBLAZE_64_GOT",
271 "BFD_RELOC_MICROBLAZE_64_PLT",
272 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
273Index: gdb-9.2/bfd/reloc.c
274===================================================================
275--- gdb-9.2.orig/bfd/reloc.c
276+++ gdb-9.2/bfd/reloc.c
277@@ -6815,6 +6815,12 @@ ENUMDOC
278 ENUM
279 BFD_RELOC_MICROBLAZE_64_NONE
280 ENUMDOC
281+ This is a 32 bit reloc that stores the 32 bit pc relative
282+ value in two words (with an imml instruction). No relocation is
283+ done here - only used for relaxing
284+ENUM
285+ BFD_RELOC_MICROBLAZE_64
286+ENUMDOC
287 This is a 64 bit reloc that stores the 32 bit pc relative
288 value in two words (with an imm instruction). No relocation is
289 done here - only used for relaxing
290@@ -6822,6 +6828,12 @@ ENUM
291 BFD_RELOC_MICROBLAZE_64_GOTPC
292 ENUMDOC
293 This is a 64 bit reloc that stores the 32 bit pc relative
294+ value in two words (with an imml instruction). No relocation is
295+ done here - only used for relaxing
296+ENUM
297+ BFD_RELOC_MICROBLAZE_64_GPC
298+ENUMDOC
299+ This is a 64 bit reloc that stores the 32 bit pc relative
300 value in two words (with an imm instruction). The relocation is
301 PC-relative GOT offset
302 ENUM
303Index: gdb-9.2/include/elf/microblaze.h
304===================================================================
305--- gdb-9.2.orig/include/elf/microblaze.h
306+++ gdb-9.2/include/elf/microblaze.h
307@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_relo
308 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
309 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
310 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
311+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
312+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
313
314 END_RELOC_NUMBERS (R_MICROBLAZE_max)
315
316Index: gdb-9.2/opcodes/microblaze-opc.h
317===================================================================
318--- gdb-9.2.orig/opcodes/microblaze-opc.h
319+++ gdb-9.2/opcodes/microblaze-opc.h
320@@ -282,10 +282,10 @@ struct op_code_struct
321 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
322 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
323 {"msrclr",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94110000, OPCODE_MASK_H23N, msrclr, special_inst },
324- {"fadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000000, OPCODE_MASK_H4, fadd, arithmetic_inst },
325+ {"fadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000000, OPCODE_MASK_H4, mbi_fadd, arithmetic_inst },
326 {"frsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000080, OPCODE_MASK_H4, frsub, arithmetic_inst },
327- {"fmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000100, OPCODE_MASK_H4, fmul, arithmetic_inst },
328- {"fdiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000180, OPCODE_MASK_H4, fdiv, arithmetic_inst },
329+ {"fmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000100, OPCODE_MASK_H4, mbi_fmul, arithmetic_inst },
330+ {"fdiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000180, OPCODE_MASK_H4, mbi_fdiv, arithmetic_inst },
331 {"fcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000210, OPCODE_MASK_H4, fcmp_lt, arithmetic_inst },
332 {"fcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000220, OPCODE_MASK_H4, fcmp_eq, arithmetic_inst },
333 {"fcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000230, OPCODE_MASK_H4, fcmp_le, arithmetic_inst },
334@@ -538,8 +538,8 @@ struct op_code_struct
335 {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
336 {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
337 {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
338- {"lli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
339- {"sli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
340+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
341+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
342 {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
343 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
344 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
345Index: gdb-9.2/opcodes/microblaze-opcm.h
346===================================================================
347--- gdb-9.2.orig/opcodes/microblaze-opcm.h
348+++ gdb-9.2/opcodes/microblaze-opcm.h
349@@ -40,8 +40,8 @@ enum microblaze_instr
350 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
351 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
352 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
353- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
354- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
355+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
356+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
357 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
358 fint, fsqrt,
359 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
deleted file mode 100644
index a717595b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 8ad2e417691ac2b89ffec9db9026d53600d9a137 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 11 Sep 2018 13:48:33 +0530
4Subject: [PATCH 16/52] [Patch,Microblaze] : negl instruction is overriding
5 rsubl,fixed it by changing the instruction order...
6
7---
8 opcodes/microblaze-opc.h | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-)
10
11Index: gdb-9.2/opcodes/microblaze-opc.h
12===================================================================
13--- gdb-9.2.orig/opcodes/microblaze-opc.h
14+++ gdb-9.2/opcodes/microblaze-opc.h
15@@ -275,9 +275,7 @@ struct op_code_struct
16 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
17 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
18 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
19- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
20 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
21- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
22 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
23 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
24 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
25@@ -555,6 +553,8 @@ struct op_code_struct
26 {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
27 {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
28 {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
29+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
30+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
31
32 {"", 0, 0, 0, 0, 0, 0, 0, 0},
33 };
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch
deleted file mode 100644
index ac9da7a9..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From eccbce1a31ed29dc38fb9ab15b6badcf9412bdb8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 17/52] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9---
10 bfd/bfd-in2.h | 9 +++-
11 bfd/libbfd.h | 4 +-
12 bfd/reloc.c | 26 ++++++-----
13 gas/config/tc-microblaze.c | 90 ++++++++++++++++----------------------
14 4 files changed, 61 insertions(+), 68 deletions(-)
15
16Index: gdb-9.2/bfd/bfd-in2.h
17===================================================================
18--- gdb-9.2.orig/bfd/bfd-in2.h
19+++ gdb-9.2/bfd/bfd-in2.h
20@@ -5371,14 +5371,19 @@ done here - only used for relaxing */
21 /* This is a 64 bit reloc that stores the 32 bit pc relative
22 value in two words (with an imm instruction). No relocation is
23 done here - only used for relaxing */
24- BFD_RELOC_MICROBLAZE_64_NONE,
25+ BFD_RELOC_MICROBLAZE_64_PCREL,
26
27-/* This is a 64 bit reloc that stores the 32 bit pc relative
28+/* This is a 64 bit reloc that stores the 32 bit relative
29 * +value in two words (with an imml instruction). No relocation is
30 * +done here - only used for relaxing */
31 BFD_RELOC_MICROBLAZE_64,
32
33 /* This is a 64 bit reloc that stores the 32 bit pc relative
34+ * +value in two words (with an imm instruction). No relocation is
35+ * +done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_64_NONE,
37+
38+/* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). The relocation is
40 PC-relative GOT offset */
41 BFD_RELOC_MICROBLAZE_64_GOTPC,
42Index: gdb-9.2/bfd/libbfd.h
43===================================================================
44--- gdb-9.2.orig/bfd/libbfd.h
45+++ gdb-9.2/bfd/libbfd.h
46@@ -2905,14 +2905,14 @@ static const char *const bfd_reloc_code_
47 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
48 "BFD_RELOC_MICROBLAZE_32_NONE",
49 "BFD_RELOC_MICROBLAZE_64_NONE",
50- "BFD_RELOC_MICROBLAZE_64",
51 "BFD_RELOC_MICROBLAZE_64_GOTPC",
52- "BFD_RELOC_MICROBLAZE_64_GPC",
53 "BFD_RELOC_MICROBLAZE_64_GOT",
54 "BFD_RELOC_MICROBLAZE_64_PLT",
55 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
56 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
57 "BFD_RELOC_MICROBLAZE_COPY",
58+ "BFD_RELOC_MICROBLAZE_64",
59+ "BFD_RELOC_MICROBLAZE_64_PCREL",
60 "BFD_RELOC_MICROBLAZE_64_TLS",
61 "BFD_RELOC_MICROBLAZE_64_TLSGD",
62 "BFD_RELOC_MICROBLAZE_64_TLSLD",
63Index: gdb-9.2/bfd/reloc.c
64===================================================================
65--- gdb-9.2.orig/bfd/reloc.c
66+++ gdb-9.2/bfd/reloc.c
67@@ -6815,12 +6815,6 @@ ENUMDOC
68 ENUM
69 BFD_RELOC_MICROBLAZE_64_NONE
70 ENUMDOC
71- This is a 32 bit reloc that stores the 32 bit pc relative
72- value in two words (with an imml instruction). No relocation is
73- done here - only used for relaxing
74-ENUM
75- BFD_RELOC_MICROBLAZE_64
76-ENUMDOC
77 This is a 64 bit reloc that stores the 32 bit pc relative
78 value in two words (with an imm instruction). No relocation is
79 done here - only used for relaxing
80@@ -6828,12 +6822,6 @@ ENUM
81 BFD_RELOC_MICROBLAZE_64_GOTPC
82 ENUMDOC
83 This is a 64 bit reloc that stores the 32 bit pc relative
84- value in two words (with an imml instruction). No relocation is
85- done here - only used for relaxing
86-ENUM
87- BFD_RELOC_MICROBLAZE_64_GPC
88-ENUMDOC
89- This is a 64 bit reloc that stores the 32 bit pc relative
90 value in two words (with an imm instruction). The relocation is
91 PC-relative GOT offset
92 ENUM
93@@ -6917,6 +6905,20 @@ ENUMDOC
94 value in two words (with an imm instruction). The relocation is
95 relative offset from start of TEXT.
96
97+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
98+ to two words (uses imml instruction).
99+ENUM
100+BFD_RELOC_MICROBLAZE_64,
101+ENUMDOC
102+ This is a 64 bit reloc that stores the 64 bit pc relative
103+ value in two words (with an imml instruction). No relocation is
104+ done here - only used for relaxing
105+ENUM
106+BFD_RELOC_MICROBLAZE_64_PCREL,
107+ENUMDOC
108+ This is a 32 bit reloc that stores the 32 bit pc relative
109+ value in two words (with an imml instruction). No relocation is
110+ done here - only used for relaxing
111 ENUM
112 BFD_RELOC_AARCH64_RELOC_START
113 ENUMDOC
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch
deleted file mode 100644
index 84a4d316..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1From 0868dedda1b7b8112870dcc69f887d32a51b94b6 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 18/52] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions
6
7---
8 bfd/elf64-microblaze.c | 68 ++++++++++++++---
9 gas/config/tc-microblaze.c | 152 +++++++++++++++++++++++++++----------
10 gas/tc.h | 2 +-
11 3 files changed, 167 insertions(+), 55 deletions(-)
12
13Index: gdb-9.2/bfd/elf64-microblaze.c
14===================================================================
15--- gdb-9.2.orig/bfd/elf64-microblaze.c
16+++ gdb-9.2/bfd/elf64-microblaze.c
17@@ -1488,8 +1488,17 @@ microblaze_elf_relocate_section (bfd *ou
18 relocation -= (input_section->output_section->vma
19 + input_section->output_offset
20 + offset + INST_WORD_SIZE);
21- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
22+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
23+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
24+ {
25+ insn &= ~0x00ffffff;
26+ insn |= (relocation >> 16) & 0xffffff;
27+ bfd_put_32 (input_bfd, insn,
28 contents + offset + endian);
29+ }
30+ else
31+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
32+ contents + offset + endian);
33 bfd_put_16 (input_bfd, relocation & 0xffff,
34 contents + offset + endian + INST_WORD_SIZE);
35 }
36@@ -1580,11 +1589,28 @@ microblaze_elf_relocate_section (bfd *ou
37 else
38 {
39 if (r_type == R_MICROBLAZE_64_PCREL)
40- relocation -= (input_section->output_section->vma
41- + input_section->output_offset
42- + offset + INST_WORD_SIZE);
43- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
44+ {
45+ if (!input_section->output_section->vma &&
46+ !input_section->output_offset && !offset)
47+ relocation -= (input_section->output_section->vma
48+ + input_section->output_offset
49+ + offset);
50+ else
51+ relocation -= (input_section->output_section->vma
52+ + input_section->output_offset
53+ + offset + INST_WORD_SIZE);
54+ }
55+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
56+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
57+ {
58+ insn &= ~0x00ffffff;
59+ insn |= (relocation >> 16) & 0xffffff;
60+ bfd_put_32 (input_bfd, insn,
61 contents + offset + endian);
62+ }
63+ else
64+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
65+ contents + offset + endian);
66 bfd_put_16 (input_bfd, relocation & 0xffff,
67 contents + offset + endian + INST_WORD_SIZE);
68 }
69@@ -1703,9 +1729,19 @@ static void
70 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
71 {
72 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
73- instr &= ~0x0000ffff;
74- instr |= (val & 0x0000ffff);
75- bfd_put_32 (abfd, instr, bfd_addr);
76+
77+ if (instr == 0xb2000000 || instr == 0xb2ffffff)
78+ {
79+ instr &= ~0x00ffffff;
80+ instr |= (val & 0xffffff);
81+ bfd_put_32 (abfd, instr, bfd_addr);
82+ }
83+ else
84+ {
85+ instr &= ~0x0000ffff;
86+ instr |= (val & 0x0000ffff);
87+ bfd_put_32 (abfd, instr, bfd_addr);
88+ }
89 }
90
91 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
92@@ -1717,10 +1753,18 @@ microblaze_bfd_write_imm_value_64 (bfd *
93 unsigned long instr_lo;
94
95 instr_hi = bfd_get_32 (abfd, bfd_addr);
96- instr_hi &= ~0x0000ffff;
97- instr_hi |= ((val >> 16) & 0x0000ffff);
98- bfd_put_32 (abfd, instr_hi, bfd_addr);
99-
100+ if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff)
101+ {
102+ instr_hi &= ~0x00ffffff;
103+ instr_hi |= (val >> 16) & 0xffffff;
104+ bfd_put_32 (abfd, instr_hi,bfd_addr);
105+ }
106+ else
107+ {
108+ instr_hi &= ~0x0000ffff;
109+ instr_hi |= ((val >> 16) & 0x0000ffff);
110+ bfd_put_32 (abfd, instr_hi, bfd_addr);
111+ }
112 instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
113 instr_lo &= ~0x0000ffff;
114 instr_lo |= (val & 0x0000ffff);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixing-the-branch-related-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixing-the-branch-related-issues.patch
deleted file mode 100644
index b3f93845..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixing-the-branch-related-issues.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 5780b5e5f9b5fe64d5172cd99399366e42c67b64 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 17:06:58 +0530
4Subject: [PATCH 19/52] Fixing the branch related issues
5
6Conflicts:
7 bfd/elf64-microblaze.c
8---
9 bfd/elf64-microblaze.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12Index: gdb-9.2/bfd/elf64-microblaze.c
13===================================================================
14--- gdb-9.2.orig/bfd/elf64-microblaze.c
15+++ gdb-9.2/bfd/elf64-microblaze.c
16@@ -2545,6 +2545,9 @@ microblaze_elf_check_relocs (bfd * abfd,
17 while (h->root.type == bfd_link_hash_indirect
18 || h->root.type == bfd_link_hash_warning)
19 h = (struct elf_link_hash_entry *) h->root.u.i.link;
20+ /* PR15323, ref flags aren't set for references in the same
21+ object. */
22+ h->root.non_ir_ref_regular = 1;
23 }
24
25 switch (r_type)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch
deleted file mode 100644
index a2f34b02..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch
+++ /dev/null
@@ -1,98 +0,0 @@
1From fd3df3812f8297133a598802b552252f45c80d0c Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 20/52] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
6
7Conflicts:
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
10---
11 bfd/bfd-in2.h | 5 +++
12 bfd/elf64-microblaze.c | 14 ++++----
13 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
14 opcodes/microblaze-dis.c | 2 +-
15 4 files changed, 79 insertions(+), 16 deletions(-)
16
17Index: gdb-9.2/bfd/bfd-in2.h
18===================================================================
19--- gdb-9.2.orig/bfd/bfd-in2.h
20+++ gdb-9.2/bfd/bfd-in2.h
21@@ -5378,6 +5378,11 @@ done here - only used for relaxing */
22 * +done here - only used for relaxing */
23 BFD_RELOC_MICROBLAZE_64,
24
25+/* This is a 64 bit reloc that stores the 32 bit relative
26+ * +value in two words (with an imml instruction). No relocation is
27+ * +done here - only used for relaxing */
28+ BFD_RELOC_MICROBLAZE_EA64,
29+
30 /* This is a 64 bit reloc that stores the 32 bit pc relative
31 * +value in two words (with an imm instruction). No relocation is
32 * +done here - only used for relaxing */
33Index: gdb-9.2/bfd/elf64-microblaze.c
34===================================================================
35--- gdb-9.2.orig/bfd/elf64-microblaze.c
36+++ gdb-9.2/bfd/elf64-microblaze.c
37@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_h
38 0, /* Rightshift. */
39 4, /* Size (0 = byte, 1 = short, 2 = long). */
40 64, /* Bitsize. */
41- TRUE, /* PC_relative. */
42+ FALSE, /* PC_relative. */
43 0, /* Bitpos. */
44 complain_overflow_dont, /* Complain on overflow. */
45 bfd_elf_generic_reloc,/* Special Function. */
46 "R_MICROBLAZE_IMML_64", /* Name. */
47 FALSE, /* Partial Inplace. */
48 0, /* Source Mask. */
49- 0x0000ffff, /* Dest Mask. */
50- TRUE), /* PC relative offset? */
51+ 0xffffffffffffff, /* Dest Mask. */
52+ FALSE), /* PC relative offset? */
53
54 /* A 64 bit relocation. Table entry not really used. */
55 HOWTO (R_MICROBLAZE_64, /* Type. */
56@@ -585,9 +585,9 @@ microblaze_elf_reloc_type_lookup (bfd *
57 case BFD_RELOC_32:
58 microblaze_reloc = R_MICROBLAZE_32;
59 break;
60- /* RVA is treated the same as 32 */
61+ /* RVA is treated the same as 64 */
62 case BFD_RELOC_RVA:
63- microblaze_reloc = R_MICROBLAZE_32;
64+ microblaze_reloc = R_MICROBLAZE_IMML_64;
65 break;
66 case BFD_RELOC_32_PCREL:
67 microblaze_reloc = R_MICROBLAZE_32_PCREL;
68@@ -619,7 +619,7 @@ microblaze_elf_reloc_type_lookup (bfd *
69 case BFD_RELOC_VTABLE_ENTRY:
70 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
71 break;
72- case BFD_RELOC_MICROBLAZE_64:
73+ case BFD_RELOC_MICROBLAZE_EA64:
74 microblaze_reloc = R_MICROBLAZE_IMML_64;
75 break;
76 case BFD_RELOC_MICROBLAZE_64_GOTPC:
77@@ -1982,7 +1982,7 @@ microblaze_elf_relax_section (bfd *abfd,
78 efix = calc_fixup (target_address, 0, sec);
79
80 /* Validate the in-band val. */
81- val = bfd_get_32 (abfd, contents + irel->r_offset);
82+ val = bfd_get_64 (abfd, contents + irel->r_offset);
83 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
84 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
85 }
86Index: gdb-9.2/opcodes/microblaze-dis.c
87===================================================================
88--- gdb-9.2.orig/opcodes/microblaze-dis.c
89+++ gdb-9.2/opcodes/microblaze-dis.c
90@@ -77,7 +77,7 @@ static char *
91 get_field_imml (struct string_buf *buf, long instr)
92 {
93 char *p = strbuf (buf);
94- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
95+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
96 return p;
97 }
98
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch
deleted file mode 100644
index abfdd8d0..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From 14a54cced8062343b83d7ff0e68f00bca562a509 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sat, 13 Oct 2018 21:17:01 +0530
4Subject: [PATCH 21/52] Adding new relocation to support 64bit rodata
5
6---
7 bfd/elf64-microblaze.c | 11 +++++++--
8 gas/config/tc-microblaze.c | 49 ++++++++++++++++++++++++++++++++++----
9 2 files changed, 54 insertions(+), 6 deletions(-)
10
11Index: gdb-9.2/bfd/elf64-microblaze.c
12===================================================================
13--- gdb-9.2.orig/bfd/elf64-microblaze.c
14+++ gdb-9.2/bfd/elf64-microblaze.c
15@@ -1473,6 +1473,7 @@ microblaze_elf_relocate_section (bfd *ou
16 case (int) R_MICROBLAZE_64_PCREL :
17 case (int) R_MICROBLAZE_64:
18 case (int) R_MICROBLAZE_32:
19+ case (int) R_MICROBLAZE_IMML_64:
20 {
21 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
22 from removed linkonce sections, or sections discarded by
23@@ -1482,6 +1483,8 @@ microblaze_elf_relocate_section (bfd *ou
24 relocation += addend;
25 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
26 bfd_put_32 (input_bfd, relocation, contents + offset);
27+ else if (r_type == R_MICROBLAZE_IMML_64)
28+ bfd_put_64 (input_bfd, relocation, contents + offset);
29 else
30 {
31 if (r_type == R_MICROBLAZE_64_PCREL)
32@@ -1560,7 +1563,7 @@ microblaze_elf_relocate_section (bfd *ou
33 }
34 else
35 {
36- if (r_type == R_MICROBLAZE_32)
37+ if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64)
38 {
39 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
40 outrel.r_addend = relocation + addend;
41@@ -1586,6 +1589,8 @@ microblaze_elf_relocate_section (bfd *ou
42 relocation += addend;
43 if (r_type == R_MICROBLAZE_32)
44 bfd_put_32 (input_bfd, relocation, contents + offset);
45+ else if (r_type == R_MICROBLAZE_IMML_64)
46+ bfd_put_64 (input_bfd, relocation, contents + offset + endian);
47 else
48 {
49 if (r_type == R_MICROBLAZE_64_PCREL)
50@@ -2098,7 +2103,8 @@ microblaze_elf_relax_section (bfd *abfd,
51 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
52 irelscan->r_addend);
53 }
54- if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
55+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
56+ || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
57 {
58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
59
60@@ -2606,6 +2612,7 @@ microblaze_elf_check_relocs (bfd * abfd,
61 case R_MICROBLAZE_64:
62 case R_MICROBLAZE_64_PCREL:
63 case R_MICROBLAZE_32:
64+ case R_MICROBLAZE_IMML_64:
65 {
66 if (h != NULL && !bfd_link_pic (info))
67 {
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch
deleted file mode 100644
index 3bbe2659..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From e9e4d4837cfea27e67fa656ede535f250205eb2c Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 24 Oct 2018 12:34:37 +0530
4Subject: [PATCH 22/52] fixing the .bss relocation issue
5
6---
7 bfd/elf64-microblaze.c | 18 ++++++++++++------
8 1 file changed, 12 insertions(+), 6 deletions(-)
9
10Index: gdb-9.2/bfd/elf64-microblaze.c
11===================================================================
12--- gdb-9.2.orig/bfd/elf64-microblaze.c
13+++ gdb-9.2/bfd/elf64-microblaze.c
14@@ -1492,7 +1492,7 @@ microblaze_elf_relocate_section (bfd *ou
15 + input_section->output_offset
16 + offset + INST_WORD_SIZE);
17 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
18- if (insn == 0xb2000000 || insn == 0xb2ffffff)
19+ if ((insn & 0xff000000) == 0xb2000000)
20 {
21 insn &= ~0x00ffffff;
22 insn |= (relocation >> 16) & 0xffffff;
23@@ -1606,7 +1606,7 @@ microblaze_elf_relocate_section (bfd *ou
24 + offset + INST_WORD_SIZE);
25 }
26 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
27- if (insn == 0xb2000000 || insn == 0xb2ffffff)
28+ if ((insn & 0xff000000) == 0xb2000000)
29 {
30 insn &= ~0x00ffffff;
31 insn |= (relocation >> 16) & 0xffffff;
32@@ -1735,7 +1735,7 @@ microblaze_bfd_write_imm_value_32 (bfd *
33 {
34 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
35
36- if (instr == 0xb2000000 || instr == 0xb2ffffff)
37+ if ((instr & 0xff000000) == 0xb2000000)
38 {
39 instr &= ~0x00ffffff;
40 instr |= (val & 0xffffff);
41@@ -1758,7 +1758,7 @@ microblaze_bfd_write_imm_value_64 (bfd *
42 unsigned long instr_lo;
43
44 instr_hi = bfd_get_32 (abfd, bfd_addr);
45- if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff)
46+ if ((instr_hi & 0xff000000) == 0xb2000000)
47 {
48 instr_hi &= ~0x00ffffff;
49 instr_hi |= (val >> 16) & 0xffffff;
50@@ -2251,7 +2251,10 @@ microblaze_elf_relax_section (bfd *abfd,
51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
52 + irelscan->r_offset
53 + INST_WORD_SIZE);
54- immediate = (instr_hi & 0x0000ffff) << 16;
55+ if ((instr_hi & 0xff000000) == 0xb2000000)
56+ immediate = (instr_hi & 0x00ffffff) << 24;
57+ else
58+ immediate = (instr_hi & 0x0000ffff) << 16;
59 immediate |= (instr_lo & 0x0000ffff);
60 offset = calc_fixup (irelscan->r_addend, 0, sec);
61 immediate -= offset;
62@@ -2295,7 +2298,10 @@ microblaze_elf_relax_section (bfd *abfd,
63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
64 + irelscan->r_offset
65 + INST_WORD_SIZE);
66- immediate = (instr_hi & 0x0000ffff) << 16;
67+ if ((instr_hi & 0xff000000) == 0xb2000000)
68+ immediate = (instr_hi & 0x00ffffff) << 24;
69+ else
70+ immediate = (instr_hi & 0x0000ffff) << 16;
71 immediate |= (instr_lo & 0x0000ffff);
72 target_address = immediate;
73 offset = calc_fixup (target_address, 0, sec);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
deleted file mode 100644
index b359ce72..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 1466dd2c74e38ae6d1dca5cf6d4cad87c94fbc8f Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 28 Nov 2018 14:00:29 +0530
4Subject: [PATCH 23/52] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
5 It was adjusting only lower 16bits.
6
7---
8 bfd/elf32-microblaze.c | 4 ++--
9 bfd/elf64-microblaze.c | 4 ++--
10 2 files changed, 4 insertions(+), 4 deletions(-)
11
12Index: gdb-9.2/bfd/elf32-microblaze.c
13===================================================================
14--- gdb-9.2.orig/bfd/elf32-microblaze.c
15+++ gdb-9.2/bfd/elf32-microblaze.c
16@@ -2023,8 +2023,8 @@ microblaze_elf_relax_section (bfd *abfd,
17 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
18 efix = calc_fixup (target_address, 0, sec);
19 irel->r_addend -= (efix - sfix);
20- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
21- + INST_WORD_SIZE, irel->r_addend);
22+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
23+ irel->r_addend);
24 }
25 break;
26 }
27Index: gdb-9.2/bfd/elf64-microblaze.c
28===================================================================
29--- gdb-9.2.orig/bfd/elf64-microblaze.c
30+++ gdb-9.2/bfd/elf64-microblaze.c
31@@ -2030,8 +2030,8 @@ microblaze_elf_relax_section (bfd *abfd,
32 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
33 efix = calc_fixup (target_address, 0, sec);
34 irel->r_addend -= (efix - sfix);
35- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
36- + INST_WORD_SIZE, irel->r_addend);
37+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
38+ irel->r_addend);
39 }
40 break;
41 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch
deleted file mode 100644
index c2ae39e8..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From f64c95b119637880e8898b459e7665f0d92cef20 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 25/52] fixing the long & long long mingw toolchain issue
5
6---
7 gas/config/tc-microblaze.c | 10 +++++-----
8 opcodes/microblaze-opc.h | 4 ++--
9 2 files changed, 7 insertions(+), 7 deletions(-)
10
11Index: gdb-9.2/opcodes/microblaze-opc.h
12===================================================================
13--- gdb-9.2.orig/opcodes/microblaze-opc.h
14+++ gdb-9.2/opcodes/microblaze-opc.h
15@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr";
16 #define MIN_IMM6_WIDTH ((int) 0x00000001)
17 #define MAX_IMM6_WIDTH ((int) 0x00000040)
18
19-#define MIN_IMML ((long) 0xffffff8000000000L)
20-#define MAX_IMML ((long) 0x0000007fffffffffL)
21+#define MIN_IMML ((long long) 0xffffff8000000000L)
22+#define MAX_IMML ((long long) 0x0000007fffffffffL)
23
24 #endif /* MICROBLAZE_OPC */
25
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0026-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0026-Added-support-to-new-arithmetic-single-register-inst.patch
deleted file mode 100644
index 90094aba..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0026-Added-support-to-new-arithmetic-single-register-inst.patch
+++ /dev/null
@@ -1,169 +0,0 @@
1From b8128385902d88414c354b772828eefe3b59fb06 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 26/52] Added support to new arithmetic single register
5 instructions
6
7Conflicts:
8 opcodes/microblaze-dis.c
9---
10 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
11 opcodes/microblaze-dis.c | 13 +++-
12 opcodes/microblaze-opc.h | 43 ++++++++++-
13 opcodes/microblaze-opcm.h | 5 +-
14 4 files changed, 201 insertions(+), 7 deletions(-)
15
16Index: gdb-9.2/opcodes/microblaze-dis.c
17===================================================================
18--- gdb-9.2.orig/opcodes/microblaze-dis.c
19+++ gdb-9.2/opcodes/microblaze-dis.c
20@@ -130,9 +130,17 @@ get_field_imm15 (struct string_buf *buf,
21 return p;
22 }
23
24+get_field_imm16 (struct string_buf *buf, long instr)
25+{
26+ char *p = strbuf (buf);
27+
28+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
29+ return p;
30+}
31+
32 static char *
33 get_field_special (struct string_buf *buf, long instr,
34- struct op_code_struct *op)
35+ struct op_code_struct *op)
36 {
37 char *p = strbuf (buf);
38 char *spr;
39@@ -454,6 +462,9 @@ print_insn_microblaze (bfd_vma memaddr,
40 /* For mbar 16 or sleep insn. */
41 case INST_TYPE_NONE:
42 break;
43+ case INST_TYPE_RD_IMML:
44+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
45+ break;
46 /* For bit field insns. */
47 case INST_TYPE_RD_R1_IMMW_IMMS:
48 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
49Index: gdb-9.2/opcodes/microblaze-opc.h
50===================================================================
51--- gdb-9.2.orig/opcodes/microblaze-opc.h
52+++ gdb-9.2/opcodes/microblaze-opc.h
53@@ -69,6 +69,7 @@
54 #define INST_TYPE_RD_R1_IMMW_IMMS 21
55
56 #define INST_TYPE_NONE 25
57+#define INST_TYPE_RD_IMML 26
58
59
60
61@@ -84,6 +85,7 @@
62 #define IMMVAL_MASK_MFS 0x0000
63
64 #define OPCODE_MASK_H 0xFC000000 /* High 6 bits only. */
65+#define OPCODE_MASK_LIMM 0xFC1F0000 /* High 6 bits and 12-16 bits */
66 #define OPCODE_MASK_H1 0xFFE00000 /* High 11 bits. */
67 #define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16. */
68 #define OPCODE_MASK_H12 0xFFFF0000 /* High 16. */
69@@ -106,6 +108,33 @@
70 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
71 #define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
72
73+/*Defines to identify 64-bit single reg instructions */
74+#define ADDLI_ONE_REG_MASK 0x68000000
75+#define ADDLIC_ONE_REG_MASK 0x68020000
76+#define ADDLIK_ONE_REG_MASK 0x68040000
77+#define ADDLIKC_ONE_REG_MASK 0x68060000
78+#define RSUBLI_ONE_REG_MASK 0x68010000
79+#define RSUBLIC_ONE_REG_MASK 0x68030000
80+#define RSUBLIK_ONE_REG_MASK 0x68050000
81+#define RSUBLIKC_ONE_REG_MASK 0x68070000
82+#define ORLI_ONE_REG_MASK 0x68100000
83+#define ANDLI_ONE_REG_MASK 0x68110000
84+#define XORLI_ONE_REG_MASK 0x68120000
85+#define ANDLNI_ONE_REG_MASK 0x68130000
86+#define ADDLI_MASK 0x20000000
87+#define ADDLIC_MASK 0x28000000
88+#define ADDLIK_MASK 0x30000000
89+#define ADDLIKC_MASK 0x38000000
90+#define RSUBLI_MASK 0x24000000
91+#define RSUBLIC_MASK 0x2C000000
92+#define RSUBLIK_MASK 0x34000000
93+#define RSUBLIKC_MASK 0x3C000000
94+#define ANDLI_MASK 0xA4000000
95+#define ANDLNI_MASK 0xAC000000
96+#define ORLI_MASK 0xA0000000
97+#define XORLI_MASK 0xA8000000
98+
99+
100 /* New Mask for msrset, msrclr insns. */
101 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
102 /* Mask for mbar insn. */
103@@ -114,7 +143,7 @@
104 #define DELAY_SLOT 1
105 #define NO_DELAY_SLOT 0
106
107-#define MAX_OPCODES 412
108+#define MAX_OPCODES 424
109
110 struct op_code_struct
111 {
112@@ -444,13 +473,21 @@ struct op_code_struct
113 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
114 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
115 {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
116+ {"addli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68000000, OPCODE_MASK_LIMM, addli, arithmetic_inst },
117 {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
118+ {"rsubli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68010000, OPCODE_MASK_LIMM, rsubli, arithmetic_inst },
119 {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
120+ {"addlic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68020000, OPCODE_MASK_LIMM, addlic, arithmetic_inst },
121 {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
122+ {"rsublic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68030000, OPCODE_MASK_LIMM, rsublic, arithmetic_inst },
123 {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
124+ {"addlik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68040000, OPCODE_MASK_LIMM, addlik, arithmetic_inst },
125 {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
126+ {"rsublik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68050000, OPCODE_MASK_LIMM, rsublik, arithmetic_inst },
127 {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
128+ {"addlikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68060000, OPCODE_MASK_LIMM, addlikc, arithmetic_inst },
129 {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
130+ {"rsublikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68070000, OPCODE_MASK_LIMM, rsublikc, arithmetic_inst },
131 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
132 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
133 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
134@@ -501,9 +538,13 @@ struct op_code_struct
135 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
136 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
137 {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
138+ {"orli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68100000, OPCODE_MASK_LIMM, orli, arithmetic_inst },
139 {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
140+ {"andli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68110000, OPCODE_MASK_LIMM, andli, arithmetic_inst },
141 {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
142+ {"xorli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68120000, OPCODE_MASK_LIMM, xorli, arithmetic_inst },
143 {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
144+ {"andnli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68130000, OPCODE_MASK_LIMM, andnli, arithmetic_inst },
145 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
146 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
147 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
148Index: gdb-9.2/opcodes/microblaze-opcm.h
149===================================================================
150--- gdb-9.2.orig/opcodes/microblaze-opcm.h
151+++ gdb-9.2/opcodes/microblaze-opcm.h
152@@ -61,7 +61,9 @@ enum microblaze_instr
153 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
154
155 /* 64-bit instructions */
156- addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
157+ addl, addli, addlic, addlik, addlikc, rsubl, rsubli, rsublic, rsublik, rsublikc,
158+ addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
159+ andli, andnli, orli, xorli,
160 bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
161 andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
162 brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
163@@ -166,5 +168,6 @@ enum microblaze_instr_type
164
165 /* Imm mask for msrset, msrclr instructions. */
166 #define IMM15_MASK 0x00007FFF
167+#define IMM16_MASK 0x0000FFFF
168
169 #endif /* MICROBLAZE-OPCM */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
deleted file mode 100644
index bbcac109..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 41b562250cdac5fd821267c6dac68b799d80dbe3 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 27/52] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values.
6
7---
8 gas/config/tc-microblaze.c | 322 ++++++++++++++++++++++++++++++-------
9 opcodes/microblaze-opc.h | 4 +-
10 2 files changed, 263 insertions(+), 63 deletions(-)
11
12Index: gdb-9.2/opcodes/microblaze-opc.h
13===================================================================
14--- gdb-9.2.orig/opcodes/microblaze-opc.h
15+++ gdb-9.2/opcodes/microblaze-opc.h
16@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
17 #define MIN_IMM6_WIDTH ((int) 0x00000001)
18 #define MAX_IMM6_WIDTH ((int) 0x00000040)
19
20-#define MIN_IMML ((long long) 0xffffff8000000000L)
21-#define MAX_IMML ((long long) 0x0000007fffffffffL)
22+#define MIN_IMML ((long long) -9223372036854775808)
23+#define MAX_IMML ((long long) 9223372036854775807)
24
25 #endif /* MICROBLAZE_OPC */
26
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
deleted file mode 100644
index f5280eba..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From ef6fd1a60979ca1d9fc419ec840641019bc86ac2 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Mon, 30 Nov 2020 16:17:36 -0800
4Subject: [PATCH 32/52] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14---
15 ld/emulparams/elf64microblaze.sh | 2 +-
16 ld/emulparams/elf64microblazeel.sh | 2 +-
17 2 files changed, 2 insertions(+), 2 deletions(-)
18
19Index: gdb-9.2/ld/emulparams/elf64microblaze.sh
20===================================================================
21--- gdb-9.2.orig/ld/emulparams/elf64microblaze.sh
22+++ gdb-9.2/ld/emulparams/elf64microblaze.sh
23@@ -19,5 +19,5 @@ NOP=0x80000000
24 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
25 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
26
27-TEMPLATE_NAME=elf32
28+TEMPLATE_NAME=elf
29 #GENERATE_SHLIB_SCRIPT=yes
30Index: gdb-9.2/ld/emulparams/elf64microblazeel.sh
31===================================================================
32--- gdb-9.2.orig/ld/emulparams/elf64microblazeel.sh
33+++ gdb-9.2/ld/emulparams/elf64microblazeel.sh
34@@ -19,5 +19,5 @@ NOP=0x80000000
35 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
36 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
37
38-TEMPLATE_NAME=elf32
39+TEMPLATE_NAME=elf
40 #GENERATE_SHLIB_SCRIPT=yes
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch
deleted file mode 100644
index cca0c7af..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 097961b044891887fec49824edfc15754e5faf10 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 22 Jul 2013 11:16:05 +1000
4Subject: [PATCH 36/52] revert master-rebase changes to gdbserver
5
6Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
7---
8 gdb/gdbserver/configure.srv | 7 +++++++
9 1 file changed, 7 insertions(+)
10
11Index: gdb-9.2/gdb/gdbserver/configure.srv
12===================================================================
13--- gdb-9.2.orig/gdb/gdbserver/configure.srv
14+++ gdb-9.2/gdb/gdbserver/configure.srv
15@@ -184,6 +184,13 @@ case "${target}" in
16 srv_linux_usrregs=yes
17 srv_linux_thread_db=yes
18 ;;
19+ microblaze*-*-linux*) srv_regobj=microblaze-linux.o
20+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
21+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
22+ srv_linux_regsets=yes
23+ srv_linux_usrregs=yes
24+ srv_linux_thread_db=yes
25+ ;;
26 powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
27 srv_regobj="${srv_regobj} powerpc-altivec32l.o"
28 srv_regobj="${srv_regobj} powerpc-vsx32l.o"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
deleted file mode 100644
index f6c3a060..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From a8b948a7967cbea9b5b2c00ed85d2beb37db53e9 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 30 Apr 2018 17:09:55 +0530
4Subject: [PATCH 37/52] revert master-rebase changes to gdbserver , previous
5 commit typo's
6
7---
8 gdb/gdbserver/Makefile.in | 2 ++
9 1 file changed, 2 insertions(+)
10
11Index: gdb-9.2/gdb/gdbserver/Makefile.in
12===================================================================
13--- gdb-9.2.orig/gdb/gdbserver/Makefile.in
14+++ gdb-9.2/gdb/gdbserver/Makefile.in
15@@ -172,6 +172,7 @@ SFILES = \
16 $(srcdir)/linux-low.c \
17 $(srcdir)/linux-m32r-low.c \
18 $(srcdir)/linux-m68k-low.c \
19+ $(srcdir)/linux-microblaze-low.c \
20 $(srcdir)/linux-mips-low.c \
21 $(srcdir)/linux-nios2-low.c \
22 $(srcdir)/linux-ppc-low.c \
23@@ -232,6 +233,7 @@ SFILES = \
24 $(srcdir)/nat/linux-osdata.c \
25 $(srcdir)/nat/linux-personality.c \
26 $(srcdir)/nat/mips-linux-watch.c \
27+ $(srcdir)/nat/microblaze-linux.c \
28 $(srcdir)/nat/ppc-linux.c \
29 $(srcdir)/nat/fork-inferior.c \
30 $(srcdir)/target/waitstatus.c
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
deleted file mode 100644
index 0c72e792..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
+++ /dev/null
@@ -1,953 +0,0 @@
1From 992c41987cb6c89bb3f9cbc0f6a2b0aa3458e4d2 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 41/52] Adding 64 bit MB support Added new architecture to
5 Microblaze 64-bit support to GDB Signed-off-by :Nagaraju Mekala
6 <nmekala@xilix.com>
7
8Conflicts:
9 gdb/Makefile.in
10---
11 bfd/archures.c | 2 +
12 bfd/bfd-in2.h | 2 +
13 bfd/cpu-microblaze.c | 8 +-
14 gas/config/tc-microblaze.c | 13 ++
15 gas/config/tc-microblaze.h | 4 +
16 gdb/features/Makefile | 3 +
17 gdb/features/microblaze-core.xml | 6 +-
18 gdb/features/microblaze-stack-protect.xml | 4 +-
19 gdb/features/microblaze-with-stack-protect.c | 8 +-
20 gdb/features/microblaze.c | 6 +-
21 gdb/features/microblaze64-core.xml | 69 ++++++
22 gdb/features/microblaze64-stack-protect.xml | 12 +
23 .../microblaze64-with-stack-protect.c | 79 +++++++
24 .../microblaze64-with-stack-protect.xml | 12 +
25 gdb/features/microblaze64.c | 77 +++++++
26 gdb/features/microblaze64.xml | 11 +
27 gdb/microblaze-tdep.c | 207 ++++++++++++++++--
28 gdb/microblaze-tdep.h | 8 +-
29 .../microblaze-with-stack-protect.dat | 4 +-
30 19 files changed, 491 insertions(+), 44 deletions(-)
31 create mode 100644 gdb/features/microblaze64-core.xml
32 create mode 100644 gdb/features/microblaze64-stack-protect.xml
33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
34 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
35 create mode 100644 gdb/features/microblaze64.c
36 create mode 100644 gdb/features/microblaze64.xml
37
38Index: gdb-9.2/bfd/archures.c
39===================================================================
40--- gdb-9.2.orig/bfd/archures.c
41+++ gdb-9.2/bfd/archures.c
42@@ -513,6 +513,8 @@ DESCRIPTION
43 . bfd_arch_lm32, {* Lattice Mico32. *}
44 .#define bfd_mach_lm32 1
45 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
46+.#define bfd_mach_microblaze 1
47+.#define bfd_mach_microblaze64 2
48 . bfd_arch_tilepro, {* Tilera TILEPro. *}
49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
50 .#define bfd_mach_tilepro 1
51Index: gdb-9.2/bfd/bfd-in2.h
52===================================================================
53--- gdb-9.2.orig/bfd/bfd-in2.h
54+++ gdb-9.2/bfd/bfd-in2.h
55@@ -1896,6 +1896,8 @@ enum bfd_architecture
56 bfd_arch_lm32, /* Lattice Mico32. */
57 #define bfd_mach_lm32 1
58 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
59+#define bfd_mach_microblaze 1
60+#define bfd_mach_microblaze64 2
61 bfd_arch_tilepro, /* Tilera TILEPro. */
62 bfd_arch_tilegx, /* Tilera TILE-Gx. */
63 #define bfd_mach_tilepro 1
64Index: gdb-9.2/bfd/cpu-microblaze.c
65===================================================================
66--- gdb-9.2.orig/bfd/cpu-microblaze.c
67+++ gdb-9.2/bfd/cpu-microblaze.c
68@@ -31,7 +31,7 @@ const bfd_arch_info_type bfd_microblaze_
69 64, /* 32 bits in an address. */
70 8, /* 8 bits in a byte. */
71 bfd_arch_microblaze, /* Architecture. */
72- 0, /* Machine number - 0 for now. */
73+ bfd_mach_microblaze64, /* 64 bit Machine */
74 "microblaze", /* Architecture name. */
75 "MicroBlaze", /* Printable name. */
76 3, /* Section align power. */
77@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_
78 32, /* Bits in an address. */
79 8, /* Bits in a byte. */
80 bfd_arch_microblaze, /* Architecture number. */
81- 0, /* Machine number - 0 for now. */
82+ bfd_mach_microblaze, /* 32 bit Machine */
83 "microblaze", /* Architecture name. */
84 "MicroBlaze", /* Printable name. */
85 3, /* Section align power. */
86@@ -63,7 +63,7 @@ const bfd_arch_info_type bfd_microblaze_
87 32, /* 32 bits in an address. */
88 8, /* 8 bits in a byte. */
89 bfd_arch_microblaze, /* Architecture. */
90- 0, /* Machine number - 0 for now. */
91+ bfd_mach_microblaze, /* 32 bit Machine */
92 "microblaze", /* Architecture name. */
93 "MicroBlaze", /* Printable name. */
94 3, /* Section align power. */
95@@ -78,7 +78,7 @@ const bfd_arch_info_type bfd_microblaze_
96 64, /* 32 bits in an address. */
97 8, /* 8 bits in a byte. */
98 bfd_arch_microblaze, /* Architecture. */
99- 0, /* Machine number - 0 for now. */
100+ bfd_mach_microblaze64, /* 64 bit Machine */
101 "microblaze", /* Architecture name. */
102 "MicroBlaze", /* Printable name. */
103 3, /* Section align power. */
104Index: gdb-9.2/gdb/features/Makefile
105===================================================================
106--- gdb-9.2.orig/gdb/features/Makefile
107+++ gdb-9.2/gdb/features/Makefile
108@@ -48,6 +48,7 @@ WHICH = arm/arm-with-iwmmxt arm/arm-with
109 arm/arm-with-neon \
110 mips-linux mips-dsp-linux \
111 microblaze-with-stack-protect \
112+ microblaze64-with-stack-protect \
113 mips64-linux mips64-dsp-linux \
114 nios2-linux \
115 rs6000/powerpc-32 \
116@@ -111,7 +112,9 @@ XMLTOC = \
117 arc-v2.xml \
118 arc-arcompact.xml \
119 microblaze-with-stack-protect.xml \
120+ microblaze64-with-stack-protect.xml \
121 microblaze.xml \
122+ microblaze64.xml \
123 mips-dsp-linux.xml \
124 mips-linux.xml \
125 mips64-dsp-linux.xml \
126Index: gdb-9.2/gdb/features/microblaze-core.xml
127===================================================================
128--- gdb-9.2.orig/gdb/features/microblaze-core.xml
129+++ gdb-9.2/gdb/features/microblaze-core.xml
130@@ -8,7 +8,7 @@
131 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
132 <feature name="org.gnu.gdb.microblaze.core">
133 <reg name="r0" bitsize="32" regnum="0"/>
134- <reg name="r1" bitsize="32" type="data_ptr"/>
135+ <reg name="r1" bitsize="32"/>
136 <reg name="r2" bitsize="32"/>
137 <reg name="r3" bitsize="32"/>
138 <reg name="r4" bitsize="32"/>
139@@ -39,7 +39,7 @@
140 <reg name="r29" bitsize="32"/>
141 <reg name="r30" bitsize="32"/>
142 <reg name="r31" bitsize="32"/>
143- <reg name="rpc" bitsize="32" type="code_ptr"/>
144+ <reg name="rpc" bitsize="32"/>
145 <reg name="rmsr" bitsize="32"/>
146 <reg name="rear" bitsize="32"/>
147 <reg name="resr" bitsize="32"/>
148@@ -64,4 +64,6 @@
149 <reg name="rtlbsx" bitsize="32"/>
150 <reg name="rtlblo" bitsize="32"/>
151 <reg name="rtlbhi" bitsize="32"/>
152+ <reg name="slr" bitsize="32"/>
153+ <reg name="shr" bitsize="32"/>
154 </feature>
155Index: gdb-9.2/gdb/features/microblaze-stack-protect.xml
156===================================================================
157--- gdb-9.2.orig/gdb/features/microblaze-stack-protect.xml
158+++ gdb-9.2/gdb/features/microblaze-stack-protect.xml
159@@ -7,6 +7,6 @@
160
161 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
162 <feature name="org.gnu.gdb.microblaze.stack-protect">
163- <reg name="rslr" bitsize="32"/>
164- <reg name="rshr" bitsize="32"/>
165+ <reg name="slr" bitsize="32"/>
166+ <reg name="shr" bitsize="32"/>
167 </feature>
168Index: gdb-9.2/gdb/features/microblaze-with-stack-protect.c
169===================================================================
170--- gdb-9.2.orig/gdb/features/microblaze-with-stack-protect.c
171+++ gdb-9.2/gdb/features/microblaze-with-stack-protect.c
172@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_p
173
174 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
175 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
176- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
177+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
178 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
179 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
180 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
181@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_p
182 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
183 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
184 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
185- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
186+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
187 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
188 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
189 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
190@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_p
191 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
192
193 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
194- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
195- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
196+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
197+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
198
199 tdesc_microblaze_with_stack_protect = result;
200 }
201Index: gdb-9.2/gdb/features/microblaze.c
202===================================================================
203--- gdb-9.2.orig/gdb/features/microblaze.c
204+++ gdb-9.2/gdb/features/microblaze.c
205@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
206
207 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
208 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
209- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
210+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
211 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
212 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
213 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
214@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
215 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
216 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
217 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
218- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
219+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
220 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
221 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
222 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
223@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
224 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
225 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
226 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
227+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
228+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
229
230 tdesc_microblaze = result;
231 }
232Index: gdb-9.2/gdb/features/microblaze64-core.xml
233===================================================================
234--- /dev/null
235+++ gdb-9.2/gdb/features/microblaze64-core.xml
236@@ -0,0 +1,69 @@
237+<?xml version="1.0"?>
238+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
239+
240+ Copying and distribution of this file, with or without modification,
241+ are permitted in any medium without royalty provided the copyright
242+ notice and this notice are preserved. -->
243+
244+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
245+<feature name="org.gnu.gdb.microblaze64.core">
246+ <reg name="r0" bitsize="64" regnum="0"/>
247+ <reg name="r1" bitsize="64"/>
248+ <reg name="r2" bitsize="64"/>
249+ <reg name="r3" bitsize="64"/>
250+ <reg name="r4" bitsize="64"/>
251+ <reg name="r5" bitsize="64"/>
252+ <reg name="r6" bitsize="64"/>
253+ <reg name="r7" bitsize="64"/>
254+ <reg name="r8" bitsize="64"/>
255+ <reg name="r9" bitsize="64"/>
256+ <reg name="r10" bitsize="64"/>
257+ <reg name="r11" bitsize="64"/>
258+ <reg name="r12" bitsize="64"/>
259+ <reg name="r13" bitsize="64"/>
260+ <reg name="r14" bitsize="64"/>
261+ <reg name="r15" bitsize="64"/>
262+ <reg name="r16" bitsize="64"/>
263+ <reg name="r17" bitsize="64"/>
264+ <reg name="r18" bitsize="64"/>
265+ <reg name="r19" bitsize="64"/>
266+ <reg name="r20" bitsize="64"/>
267+ <reg name="r21" bitsize="64"/>
268+ <reg name="r22" bitsize="64"/>
269+ <reg name="r23" bitsize="64"/>
270+ <reg name="r24" bitsize="64"/>
271+ <reg name="r25" bitsize="64"/>
272+ <reg name="r26" bitsize="64"/>
273+ <reg name="r27" bitsize="64"/>
274+ <reg name="r28" bitsize="64"/>
275+ <reg name="r29" bitsize="64"/>
276+ <reg name="r30" bitsize="64"/>
277+ <reg name="r31" bitsize="64"/>
278+ <reg name="rpc" bitsize="64"/>
279+ <reg name="rmsr" bitsize="32"/>
280+ <reg name="rear" bitsize="64"/>
281+ <reg name="resr" bitsize="32"/>
282+ <reg name="rfsr" bitsize="32"/>
283+ <reg name="rbtr" bitsize="64"/>
284+ <reg name="rpvr0" bitsize="32"/>
285+ <reg name="rpvr1" bitsize="32"/>
286+ <reg name="rpvr2" bitsize="32"/>
287+ <reg name="rpvr3" bitsize="32"/>
288+ <reg name="rpvr4" bitsize="32"/>
289+ <reg name="rpvr5" bitsize="32"/>
290+ <reg name="rpvr6" bitsize="32"/>
291+ <reg name="rpvr7" bitsize="32"/>
292+ <reg name="rpvr8" bitsize="64"/>
293+ <reg name="rpvr9" bitsize="64"/>
294+ <reg name="rpvr10" bitsize="32"/>
295+ <reg name="rpvr11" bitsize="32"/>
296+ <reg name="redr" bitsize="32"/>
297+ <reg name="rpid" bitsize="32"/>
298+ <reg name="rzpr" bitsize="32"/>
299+ <reg name="rtlbx" bitsize="32"/>
300+ <reg name="rtlbsx" bitsize="32"/>
301+ <reg name="rtlblo" bitsize="32"/>
302+ <reg name="rtlbhi" bitsize="32"/>
303+ <reg name="slr" bitsize="64"/>
304+ <reg name="shr" bitsize="64"/>
305+</feature>
306Index: gdb-9.2/gdb/features/microblaze64-stack-protect.xml
307===================================================================
308--- /dev/null
309+++ gdb-9.2/gdb/features/microblaze64-stack-protect.xml
310@@ -0,0 +1,12 @@
311+<?xml version="1.0"?>
312+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
313+
314+ Copying and distribution of this file, with or without modification,
315+ are permitted in any medium without royalty provided the copyright
316+ notice and this notice are preserved. -->
317+
318+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
319+<feature name="org.gnu.gdb.microblaze64.stack-protect">
320+ <reg name="slr" bitsize="64"/>
321+ <reg name="shr" bitsize="64"/>
322+</feature>
323Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
324===================================================================
325--- /dev/null
326+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
327@@ -0,0 +1,79 @@
328+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
329+ Original: microblaze-with-stack-protect.xml */
330+
331+#include "defs.h"
332+#include "osabi.h"
333+#include "target-descriptions.h"
334+
335+struct target_desc *tdesc_microblaze64_with_stack_protect;
336+static void
337+initialize_tdesc_microblaze64_with_stack_protect (void)
338+{
339+ struct target_desc *result = allocate_target_description ();
340+ struct tdesc_feature *feature;
341+
342+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
343+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
344+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
345+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
346+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
347+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
348+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
349+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
350+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
351+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
352+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
353+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
354+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
355+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
356+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
357+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
358+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
359+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
360+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
361+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
362+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
363+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
364+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
365+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
366+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
367+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
368+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
369+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
370+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
371+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
372+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
373+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
374+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
375+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
376+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
377+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
378+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
379+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
380+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
381+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
382+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
383+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
384+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
385+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
386+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
387+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
388+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
389+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
390+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
391+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
392+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
393+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
394+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
395+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
396+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
397+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
398+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
399+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
400+
401+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
402+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
403+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
404+
405+ tdesc_microblaze64_with_stack_protect = result;
406+}
407Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.xml
408===================================================================
409--- /dev/null
410+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.xml
411@@ -0,0 +1,12 @@
412+<?xml version="1.0"?>
413+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
414+
415+ Copying and distribution of this file, with or without modification,
416+ are permitted in any medium without royalty provided the copyright
417+ notice and this notice are preserved. -->
418+
419+<!DOCTYPE target SYSTEM "gdb-target.dtd">
420+<target>
421+ <xi:include href="microblaze64-core.xml"/>
422+ <xi:include href="microblaze64-stack-protect.xml"/>
423+</target>
424Index: gdb-9.2/gdb/features/microblaze64.c
425===================================================================
426--- /dev/null
427+++ gdb-9.2/gdb/features/microblaze64.c
428@@ -0,0 +1,77 @@
429+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
430+ Original: microblaze.xml */
431+
432+#include "defs.h"
433+#include "osabi.h"
434+#include "target-descriptions.h"
435+
436+struct target_desc *tdesc_microblaze64;
437+static void
438+initialize_tdesc_microblaze64 (void)
439+{
440+ struct target_desc *result = allocate_target_description ();
441+ struct tdesc_feature *feature;
442+
443+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
444+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
445+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
446+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
447+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
448+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
449+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
450+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
451+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
452+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
453+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
454+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
455+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
456+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
457+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
458+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
459+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
460+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
461+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
462+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
463+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
464+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
465+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
466+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
467+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
468+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
469+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
470+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
471+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
472+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
473+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
474+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
475+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
476+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
477+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
478+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
479+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
480+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
481+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
482+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
483+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
484+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
485+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
486+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
487+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
488+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
489+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
490+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
491+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
492+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
493+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
494+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
495+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
496+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
497+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
498+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
499+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
500+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
501+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
502+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
503+
504+ tdesc_microblaze64 = result;
505+}
506Index: gdb-9.2/gdb/features/microblaze64.xml
507===================================================================
508--- /dev/null
509+++ gdb-9.2/gdb/features/microblaze64.xml
510@@ -0,0 +1,11 @@
511+<?xml version="1.0"?>
512+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
513+
514+ Copying and distribution of this file, with or without modification,
515+ are permitted in any medium without royalty provided the copyright
516+ notice and this notice are preserved. -->
517+
518+<!DOCTYPE target SYSTEM "gdb-target.dtd">
519+<target>
520+ <xi:include href="microblaze64-core.xml"/>
521+</target>
522Index: gdb-9.2/gdb/microblaze-tdep.c
523===================================================================
524--- gdb-9.2.orig/gdb/microblaze-tdep.c
525+++ gdb-9.2/gdb/microblaze-tdep.c
526@@ -40,7 +40,9 @@
527 #include "remote.h"
528
529 #include "features/microblaze-with-stack-protect.c"
530+#include "features/microblaze64-with-stack-protect.c"
531 #include "features/microblaze.c"
532+#include "features/microblaze64.c"
533
534 /* Instruction macros used for analyzing the prologue. */
535 /* This set of instruction macros need to be changed whenever the
536@@ -75,12 +77,13 @@ static const char *microblaze_register_n
537 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
538 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
539 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
540- "rslr", "rshr"
541+ "slr", "shr"
542 };
543
544 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
545
546 static unsigned int microblaze_debug_flag = 0;
547+int reg_size = 4;
548
549 static void ATTRIBUTE_PRINTF (1, 2)
550 microblaze_debug (const char *fmt, ...)
551@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regca
552 error (_("store_arguments not implemented"));
553 return sp;
554 }
555+#if 0
556 static int
557 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
558 struct bp_target_info *bp_tgt)
559@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoin
560 int val;
561 int bplen;
562 gdb_byte old_contents[BREAKPOINT_MAX];
563- struct cleanup *cleanup;
564+ //struct cleanup *cleanup;
565
566 /* Determine appropriate breakpoint contents and size for this address. */
567 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
568@@ -162,7 +166,8 @@ microblaze_linux_memory_remove_breakpoin
569 error (_("Software breakpoints not implemented for this target."));
570
571 /* Make sure we see the memory breakpoints. */
572- cleanup = make_show_memory_breakpoints_cleanup (1);
573+ scoped_restore
574+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
575 val = target_read_memory (addr, old_contents, bplen);
576
577 /* If our breakpoint is no longer at the address, this means that the
578@@ -178,6 +183,7 @@ microblaze_linux_memory_remove_breakpoin
579 return val;
580 }
581
582+#endif
583 /* Allocate and initialize a frame cache. */
584
585 static struct microblaze_frame_cache *
586@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct
587 gdb_byte *valbuf)
588 {
589 gdb_byte buf[8];
590-
591 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
592 switch (TYPE_LENGTH (type))
593 {
594 case 1: /* return last byte in the register. */
595 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
596- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
597+ memcpy(valbuf, buf + reg_size - 1, 1);
598 return;
599 case 2: /* return last 2 bytes in register. */
600 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
601- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
602+ memcpy(valbuf, buf + reg_size - 2, 2);
603 return;
604 case 4: /* for sizes 4 or 8, copy the required length. */
605 case 8:
606@@ -647,7 +652,119 @@ microblaze_stabs_argument_has_addr (stru
607 return (TYPE_LENGTH (type) == 16);
608 }
609
610-
611+#if 0
612+static std::vector<CORE_ADDR>
613+microblaze_software_single_step (struct regcache *regcache)
614+{
615+// struct gdbarch *arch = get_frame_arch(frame);
616+ struct gdbarch *arch = get_regcache_arch (regcache);
617+ struct address_space *aspace = get_regcache_aspace (regcache);
618+// struct address_space *aspace = get_frame_address_space (frame);
619+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
620+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
621+ static char be_breakp[] = MICROBLAZE_BREAKPOINT;
622+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
623+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
624+ std::vector<CORE_ADDR> ret = 0;
625+
626+ /* Save the address and the values of the next_pc and the target */
627+ static struct sstep_breaks
628+ {
629+ CORE_ADDR address;
630+ bfd_boolean valid;
631+ /* Shadow contents. */
632+ char data[INST_WORD_SIZE];
633+ } stepbreaks[2];
634+ int ii;
635+
636+ if (1)
637+ {
638+ CORE_ADDR pc;
639+ std::vector<CORE_ADDR> *next_pcs = NULL;
640+ long insn;
641+ enum microblaze_instr minstr;
642+ bfd_boolean isunsignednum;
643+ enum microblaze_instr_type insn_type;
644+ short delay_slots;
645+ int imm;
646+ bfd_boolean immfound = FALSE;
647+
648+ /* Set a breakpoint at the next instruction */
649+ /* If the current instruction is an imm, set it at the inst after */
650+ /* If the instruction has a delay slot, skip the delay slot */
651+ pc = regcache_read_pc (regcache);
652+ insn = microblaze_fetch_instruction (pc);
653+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
654+ if (insn_type == immediate_inst)
655+ {
656+ int rd, ra, rb;
657+ immfound = TRUE;
658+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
659+ pc = pc + INST_WORD_SIZE;
660+ insn = microblaze_fetch_instruction (pc);
661+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
662+ }
663+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE;
664+ if (insn_type != return_inst) {
665+ stepbreaks[0].valid = TRUE;
666+ } else {
667+ stepbreaks[0].valid = FALSE;
668+ }
669+
670+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn);
671+ /* Now check for branch or return instructions */
672+ if (insn_type == branch_inst || insn_type == return_inst) {
673+ int limm;
674+ int lrd, lra, lrb;
675+ int ra, rb;
676+ bfd_boolean targetvalid;
677+ bfd_boolean unconditionalbranch;
678+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm);
679+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS)
680+ ra = regcache_raw_get_unsigned(regcache, lra);
681+ else
682+ ra = 0;
683+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
684+ rb = regcache_raw_get_unsigned(regcache, lrb);
685+ else
686+ rb = 0;
687+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
688+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
689+ if (unconditionalbranch)
690+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
691+ if (targetvalid && (stepbreaks[0].valid == FALSE ||
692+ (stepbreaks[0].address != stepbreaks[1].address))
693+ && (stepbreaks[1].address != pc)) {
694+ stepbreaks[1].valid = TRUE;
695+ } else {
696+ stepbreaks[1].valid = FALSE;
697+ }
698+ } else {
699+ stepbreaks[1].valid = FALSE;
700+ }
701+
702+ /* Insert the breakpoints */
703+ for (ii = 0; ii < 2; ++ii)
704+ {
705+
706+ /* ignore invalid breakpoint. */
707+ if (stepbreaks[ii].valid) {
708+ VEC_safe_push (CORE_ADDR, next_pcs, stepbreaks[ii].address);;
709+// insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address);
710+ ret = next_pcs;
711+ }
712+ }
713+ }
714+ return ret;
715+}
716+#endif
717+
718+static void
719+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
720+{
721+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
722+}
723+
724 static int dwarf2_to_reg_map[78] =
725 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
726 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
727@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct
728 static void
729 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
730 {
731+
732 register_remote_g_packet_guess (gdbarch,
733- 4 * MICROBLAZE_NUM_CORE_REGS,
734- tdesc_microblaze);
735+ 4 * MICROBLAZE_NUM_REGS,
736+ tdesc_microblaze64);
737
738 register_remote_g_packet_guess (gdbarch,
739 4 * MICROBLAZE_NUM_REGS,
740- tdesc_microblaze_with_stack_protect);
741+ tdesc_microblaze64_with_stack_protect);
742 }
743
744 void
745@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct
746 struct regcache *regcache,
747 int regnum, const void *gregs)
748 {
749- unsigned int *regs = gregs;
750+ const gdb_byte *regs = (const gdb_byte *) gregs;
751 if (regnum >= 0)
752- regcache_raw_supply (regcache, regnum, regs + regnum);
753+ regcache->raw_supply (regnum, regs + regnum);
754
755 if (regnum == -1) {
756 int i;
757
758 for (i = 0; i < 50; i++) {
759- regcache_raw_supply (regcache, i, regs + i);
760+ regcache->raw_supply (regnum, regs + i);
761 }
762 }
763 }
764@@ -755,6 +873,17 @@ microblaze_regset_from_core_section (str
765 }
766
767
768+static void
769+make_regs (struct gdbarch *arch)
770+{
771+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
772+ int mach = gdbarch_bfd_arch_info (arch)->mach;
773+
774+ if (mach == bfd_mach_microblaze64)
775+ {
776+ set_gdbarch_ptr_bit (arch, 64);
777+ }
778+}
779
780 static struct gdbarch *
781 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
782@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_
783 if (arches != NULL)
784 return arches->gdbarch;
785 if (tdesc == NULL)
786- tdesc = tdesc_microblaze;
787-
788+ {
789+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
790+ {
791+ tdesc = tdesc_microblaze64;
792+ reg_size = 8;
793+ }
794+ else
795+ tdesc = tdesc_microblaze;
796+ }
797 /* Check any target description for validity. */
798 if (tdesc_has_registers (tdesc))
799 {
800@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_
801 int valid_p;
802 int i;
803
804- feature = tdesc_find_feature (tdesc,
805+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
806+ feature = tdesc_find_feature (tdesc,
807+ "org.gnu.gdb.microblaze64.core");
808+ else
809+ feature = tdesc_find_feature (tdesc,
810 "org.gnu.gdb.microblaze.core");
811 if (feature == NULL)
812 return NULL;
813 tdesc_data = tdesc_data_alloc ();
814
815 valid_p = 1;
816- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
817+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
818 valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
819 microblaze_register_names[i]);
820- feature = tdesc_find_feature (tdesc,
821+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
822+ feature = tdesc_find_feature (tdesc,
823+ "org.gnu.gdb.microblaze64.stack-protect");
824+ else
825+ feature = tdesc_find_feature (tdesc,
826 "org.gnu.gdb.microblaze.stack-protect");
827 if (feature != NULL)
828 {
829 valid_p = 1;
830 valid_p &= tdesc_numbered_register (feature, tdesc_data,
831 MICROBLAZE_SLR_REGNUM,
832- "rslr");
833+ "slr");
834 valid_p &= tdesc_numbered_register (feature, tdesc_data,
835 MICROBLAZE_SHR_REGNUM,
836- "rshr");
837+ "shr");
838 }
839
840 if (!valid_p)
841@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_
842 tdesc_data_cleanup (tdesc_data);
843 return NULL;
844 }
845+
846 }
847
848 /* Allocate space for the new architecture. */
849@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_
850 /* Register numbers of various important registers. */
851 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
852 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
853+
854+ /* Register set.
855+ make_regs (gdbarch); */
856+ switch (info.bfd_arch_info->mach)
857+ {
858+ case bfd_mach_microblaze64:
859+ set_gdbarch_ptr_bit (gdbarch, 64);
860+ break;
861+ }
862
863+
864 /* Map Dwarf2 registers to GDB registers. */
865 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
866
867@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_
868 microblaze_breakpoint::kind_from_pc);
869 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
870 microblaze_breakpoint::bp_from_kind);
871- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
872+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
873+
874+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
875
876 set_gdbarch_frame_args_skip (gdbarch, 8);
877
878 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
879
880- microblaze_register_g_packet_guesses (gdbarch);
881+ //microblaze_register_g_packet_guesses (gdbarch);
882
883 frame_base_set_default (gdbarch, &microblaze_frame_base);
884
885@@ -866,11 +1023,11 @@ microblaze_gdbarch_init (struct gdbarch_
886 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
887 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
888
889- /* If we have register sets, enable the generic core file support. */
890+ /* If we have register sets, enable the generic core file support.
891 if (tdep->gregset) {
892 set_gdbarch_regset_from_core_section (gdbarch,
893 microblaze_regset_from_core_section);
894- }
895+ }*/
896
897 return gdbarch;
898 }
899@@ -882,6 +1039,8 @@ _initialize_microblaze_tdep (void)
900
901 initialize_tdesc_microblaze_with_stack_protect ();
902 initialize_tdesc_microblaze ();
903+ initialize_tdesc_microblaze64_with_stack_protect ();
904+ initialize_tdesc_microblaze64 ();
905 /* Debug this files internals. */
906 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
907 &microblaze_debug_flag, _("\
908Index: gdb-9.2/gdb/microblaze-tdep.h
909===================================================================
910--- gdb-9.2.orig/gdb/microblaze-tdep.h
911+++ gdb-9.2/gdb/microblaze-tdep.h
912@@ -27,7 +27,7 @@ struct microblaze_gregset
913 microblaze_gregset() {}
914 unsigned int gregs[32];
915 unsigned int fpregs[32];
916- unsigned int pregs[16];
917+ unsigned int pregs[18];
918 };
919
920 struct gdbarch_tdep
921@@ -101,9 +101,9 @@ enum microblaze_regnum
922 MICROBLAZE_RTLBSX_REGNUM,
923 MICROBLAZE_RTLBLO_REGNUM,
924 MICROBLAZE_RTLBHI_REGNUM,
925- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
926+ MICROBLAZE_SLR_REGNUM,
927 MICROBLAZE_SHR_REGNUM,
928- MICROBLAZE_NUM_REGS
929+ MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS
930 };
931
932 struct microblaze_frame_cache
933@@ -128,7 +128,7 @@ struct microblaze_frame_cache
934 struct trad_frame_saved_reg *saved_regs;
935 };
936 /* All registers are 32 bits. */
937-#define MICROBLAZE_REGISTER_SIZE 4
938+//#define MICROBLAZE_REGISTER_SIZE 8
939
940 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
941 Only used for native debugging. */
942Index: gdb-9.2/gdb/regformats/microblaze-with-stack-protect.dat
943===================================================================
944--- gdb-9.2.orig/gdb/regformats/microblaze-with-stack-protect.dat
945+++ gdb-9.2/gdb/regformats/microblaze-with-stack-protect.dat
946@@ -60,5 +60,5 @@ expedite:r1,rpc
947 32:rtlbsx
948 32:rtlblo
949 32:rtlbhi
950-32:rslr
951-32:rshr
952+32:slr
953+32:shr
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0042-porting-GDB-for-linux.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0042-porting-GDB-for-linux.patch
deleted file mode 100644
index 947ac9a9..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0042-porting-GDB-for-linux.patch
+++ /dev/null
@@ -1,151 +0,0 @@
1From ecccc76dd8ea2e75cc31435b5885173690b3e07a Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Dec 2019 14:56:17 +0530
4Subject: [PATCH 42/52] porting GDB for linux
5
6---
7 gdb/features/microblaze-linux.xml | 12 ++++++++++
8 gdb/gdbserver/Makefile.in | 2 ++
9 gdb/gdbserver/configure.srv | 3 ++-
10 gdb/microblaze-linux-tdep.c | 39 ++++++++++++++++++++++++-------
11 4 files changed, 47 insertions(+), 9 deletions(-)
12 create mode 100644 gdb/features/microblaze-linux.xml
13
14Index: gdb-9.2/gdb/features/microblaze-linux.xml
15===================================================================
16--- /dev/null
17+++ gdb-9.2/gdb/features/microblaze-linux.xml
18@@ -0,0 +1,12 @@
19+<?xml version="1.0"?>
20+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
21+
22+ Copying and distribution of this file, with or without modification,
23+ are permitted in any medium without royalty provided the copyright
24+ notice and this notice are preserved. -->
25+
26+<!DOCTYPE target SYSTEM "gdb-target.dtd">
27+<target>
28+ <osabi>GNU/Linux</osabi>
29+ <xi:include href="microblaze-core.xml"/>
30+</target>
31Index: gdb-9.2/gdb/gdbserver/Makefile.in
32===================================================================
33--- gdb-9.2.orig/gdb/gdbserver/Makefile.in
34+++ gdb-9.2/gdb/gdbserver/Makefile.in
35@@ -659,6 +659,8 @@ gdbsupport/%.o: ../gdbsupport/%.c
36
37 %-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
38 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
39+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
40+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
41
42 #
43 # Dependency tracking.
44Index: gdb-9.2/gdb/gdbserver/configure.srv
45===================================================================
46--- gdb-9.2.orig/gdb/gdbserver/configure.srv
47+++ gdb-9.2/gdb/gdbserver/configure.srv
48@@ -184,8 +184,9 @@ case "${target}" in
49 srv_linux_usrregs=yes
50 srv_linux_thread_db=yes
51 ;;
52- microblaze*-*-linux*) srv_regobj=microblaze-linux.o
53+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
54 srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
55+ srv_xmlfiles="microblaze-linux.xml"
56 srv_linux_regsets=yes
57 srv_linux_usrregs=yes
58 srv_linux_thread_db=yes
59Index: gdb-9.2/gdb/microblaze-linux-tdep.c
60===================================================================
61--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c
62+++ gdb-9.2/gdb/microblaze-linux-tdep.c
63@@ -41,7 +41,7 @@
64
65 #ifndef REGSET_H
66 #define REGSET_H 1
67-
68+int MICROBLAZE_REGISTER_SIZE=4;
69 struct gdbarch;
70 struct regcache;
71
72@@ -115,7 +115,7 @@ microblaze_debug (const char *fmt, ...)
73 va_end (args);
74 }
75 }
76-
77+#if 0
78 static int
79 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
80 struct bp_target_info *bp_tgt)
81@@ -131,7 +131,7 @@ microblaze_linux_memory_remove_breakpoin
82 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
83
84 /* Make sure we see the memory breakpoints. */
85- cleanup = make_show_memory_breakpoints_cleanup (1);
86+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
87 val = target_read_memory (addr, old_contents, bplen);
88
89 /* If our breakpoint is no longer at the address, this means that the
90@@ -146,6 +146,7 @@ microblaze_linux_memory_remove_breakpoin
91 do_cleanups (cleanup);
92 return val;
93 }
94+#endif
95
96 static void
97 microblaze_linux_sigtramp_cache (struct frame_info *next_frame,
98@@ -248,8 +249,8 @@ microblaze_linux_init_abi (struct gdbarc
99
100 linux_init_abi (info, gdbarch);
101
102- set_gdbarch_memory_remove_breakpoint (gdbarch,
103- microblaze_linux_memory_remove_breakpoint);
104+// set_gdbarch_memory_remove_breakpoint (gdbarch,
105+// microblaze_linux_memory_remove_breakpoint);
106
107 /* Shared library handling. */
108 set_solib_svr4_fetch_link_map_offsets (gdbarch,
109@@ -261,10 +262,30 @@ microblaze_linux_init_abi (struct gdbarc
110
111 /* BFD target for core files. */
112 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
113- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
114+ {
115+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
116+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
117+ MICROBLAZE_REGISTER_SIZE=8;
118+ }
119+ else
120+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
121+ }
122 else
123- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
124+ {
125+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
126+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
127+ MICROBLAZE_REGISTER_SIZE=8;
128+ }
129+ else
130+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
131+ }
132
133+ switch (info.bfd_arch_info->mach)
134+ {
135+ case bfd_mach_microblaze64:
136+ set_gdbarch_ptr_bit (gdbarch, 64);
137+ break;
138+ }
139
140 /* Shared library handling. */
141 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
142@@ -278,6 +299,8 @@ microblaze_linux_init_abi (struct gdbarc
143 void
144 _initialize_microblaze_linux_tdep (void)
145 {
146- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
147+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
148+ microblaze_linux_init_abi);
149+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
150 microblaze_linux_init_abi);
151 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0043-Binutils-security-check-is-causing-build-error-for-w.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0043-Binutils-security-check-is-causing-build-error-for-w.patch
deleted file mode 100644
index bfe57a86..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0043-Binutils-security-check-is-causing-build-error-for-w.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 187f46b3a0d31c5b1eac0ce9ddc7c136b2d53d70 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 11 Mar 2019 13:57:42 +0530
4Subject: [PATCH 43/52] Binutils security check is causing build error for
5 windows builds.commenting for now.
6
7---
8 bfd/elf-attrs.c | 4 +++-
9 1 file changed, 3 insertions(+), 1 deletion(-)
10
11Index: gdb-9.2/bfd/elf-attrs.c
12===================================================================
13--- gdb-9.2.orig/bfd/elf-attrs.c
14+++ gdb-9.2/bfd/elf-attrs.c
15@@ -440,7 +440,8 @@ _bfd_elf_parse_attributes (bfd *abfd, El
16 /* PR 17512: file: 2844a11d. */
17 if (hdr->sh_size == 0)
18 return;
19- if (hdr->sh_size > bfd_get_file_size (abfd))
20+#if 0
21+if (hdr->sh_size > bfd_get_file_size (abfd))
22 {
23 /* xgettext:c-format */
24 _bfd_error_handler (_("%pB: error: attribute section '%pA' too big: %#llx"),
25@@ -448,6 +449,7 @@ _bfd_elf_parse_attributes (bfd *abfd, El
26 bfd_set_error (bfd_error_invalid_operation);
27 return;
28 }
29+#endif
30
31 contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1);
32 if (!contents)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
deleted file mode 100644
index a60ed5e7..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
+++ /dev/null
@@ -1,143 +0,0 @@
1From 2c3cd36f5198c5b023f3dd157ef3fa90ab5893d7 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 19 Dec 2019 12:22:04 +0530
4Subject: [PATCH 44/52] Correcting the register names from slr & shr to rslr &
5 rshr
6
7---
8 gdb/features/microblaze-core.xml | 4 ++--
9 gdb/features/microblaze-stack-protect.xml | 4 ++--
10 gdb/features/microblaze-with-stack-protect.c | 4 ++--
11 gdb/features/microblaze.c | 4 ++--
12 gdb/features/microblaze64-core.xml | 4 ++--
13 gdb/features/microblaze64-stack-protect.xml | 4 ++--
14 gdb/features/microblaze64-with-stack-protect.c | 4 ++--
15 gdb/features/microblaze64.c | 4 ++--
16 gdb/microblaze-tdep.c | 2 +-
17 9 files changed, 17 insertions(+), 17 deletions(-)
18
19Index: gdb-9.2/gdb/features/microblaze-core.xml
20===================================================================
21--- gdb-9.2.orig/gdb/features/microblaze-core.xml
22+++ gdb-9.2/gdb/features/microblaze-core.xml
23@@ -64,6 +64,6 @@
24 <reg name="rtlbsx" bitsize="32"/>
25 <reg name="rtlblo" bitsize="32"/>
26 <reg name="rtlbhi" bitsize="32"/>
27- <reg name="slr" bitsize="32"/>
28- <reg name="shr" bitsize="32"/>
29+ <reg name="rslr" bitsize="32"/>
30+ <reg name="rshr" bitsize="32"/>
31 </feature>
32Index: gdb-9.2/gdb/features/microblaze-stack-protect.xml
33===================================================================
34--- gdb-9.2.orig/gdb/features/microblaze-stack-protect.xml
35+++ gdb-9.2/gdb/features/microblaze-stack-protect.xml
36@@ -7,6 +7,6 @@
37
38 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
39 <feature name="org.gnu.gdb.microblaze.stack-protect">
40- <reg name="slr" bitsize="32"/>
41- <reg name="shr" bitsize="32"/>
42+ <reg name="rslr" bitsize="32"/>
43+ <reg name="rshr" bitsize="32"/>
44 </feature>
45Index: gdb-9.2/gdb/features/microblaze-with-stack-protect.c
46===================================================================
47--- gdb-9.2.orig/gdb/features/microblaze-with-stack-protect.c
48+++ gdb-9.2/gdb/features/microblaze-with-stack-protect.c
49@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_p
50 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
51
52 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
53- tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
54- tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
55+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
56+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
57
58 tdesc_microblaze_with_stack_protect = result;
59 }
60Index: gdb-9.2/gdb/features/microblaze.c
61===================================================================
62--- gdb-9.2.orig/gdb/features/microblaze.c
63+++ gdb-9.2/gdb/features/microblaze.c
64@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
65 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
66 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
67 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
68- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
69- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
70+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
71+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
72
73 tdesc_microblaze = result;
74 }
75Index: gdb-9.2/gdb/features/microblaze64-core.xml
76===================================================================
77--- gdb-9.2.orig/gdb/features/microblaze64-core.xml
78+++ gdb-9.2/gdb/features/microblaze64-core.xml
79@@ -64,6 +64,6 @@
80 <reg name="rtlbsx" bitsize="32"/>
81 <reg name="rtlblo" bitsize="32"/>
82 <reg name="rtlbhi" bitsize="32"/>
83- <reg name="slr" bitsize="64"/>
84- <reg name="shr" bitsize="64"/>
85+ <reg name="rslr" bitsize="64"/>
86+ <reg name="rshr" bitsize="64"/>
87 </feature>
88Index: gdb-9.2/gdb/features/microblaze64-stack-protect.xml
89===================================================================
90--- gdb-9.2.orig/gdb/features/microblaze64-stack-protect.xml
91+++ gdb-9.2/gdb/features/microblaze64-stack-protect.xml
92@@ -7,6 +7,6 @@
93
94 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
95 <feature name="org.gnu.gdb.microblaze64.stack-protect">
96- <reg name="slr" bitsize="64"/>
97- <reg name="shr" bitsize="64"/>
98+ <reg name="rslr" bitsize="64"/>
99+ <reg name="rshr" bitsize="64"/>
100 </feature>
101Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
102===================================================================
103--- gdb-9.2.orig/gdb/features/microblaze64-with-stack-protect.c
104+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
105@@ -72,8 +72,8 @@ initialize_tdesc_microblaze64_with_stack
106 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
107
108 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
109- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
110- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
111+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
112+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
113
114 tdesc_microblaze64_with_stack_protect = result;
115 }
116Index: gdb-9.2/gdb/features/microblaze64.c
117===================================================================
118--- gdb-9.2.orig/gdb/features/microblaze64.c
119+++ gdb-9.2/gdb/features/microblaze64.c
120@@ -70,8 +70,8 @@ initialize_tdesc_microblaze64 (void)
121 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
122 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
123 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
124- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
125- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
126+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
127+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
128
129 tdesc_microblaze64 = result;
130 }
131Index: gdb-9.2/gdb/microblaze-tdep.c
132===================================================================
133--- gdb-9.2.orig/gdb/microblaze-tdep.c
134+++ gdb-9.2/gdb/microblaze-tdep.c
135@@ -77,7 +77,7 @@ static const char *microblaze_register_n
136 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
137 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
138 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
139- "slr", "shr"
140+ "rslr", "rshr"
141 };
142
143 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
deleted file mode 100644
index eac20e3d..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
+++ /dev/null
@@ -1,21 +0,0 @@
1From 38e5305c8e008ded46a9f351cd7f79c8f81df8fd Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 17 Jan 2020 15:45:48 +0530
4Subject: [PATCH 45/52] Removing the header "gdb_assert.h" from MB target file
5
6---
7 gdb/microblaze-linux-tdep.c | 1 -
8 1 file changed, 1 deletion(-)
9
10Index: gdb-9.2/gdb/microblaze-linux-tdep.c
11===================================================================
12--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c
13+++ gdb-9.2/gdb/microblaze-linux-tdep.c
14@@ -37,7 +37,6 @@
15 #include "linux-tdep.h"
16 #include "glibc-tdep.h"
17
18-#include "gdb_assert.h"
19
20 #ifndef REGSET_H
21 #define REGSET_H 1
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
deleted file mode 100644
index de93c81e..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From eba7561a36a20c814ca69dc42fa8b0b7f4a33510 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 10:08:53 -0800
4Subject: [PATCH 46/52] bfd/cpu-microblaze.c: Enhance disassembler
5
6See commit aebcfb76fc165795e67917cb67cf985c4dfdc577 for why this is needed.
7
8Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
9---
10 bfd/cpu-microblaze.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13Index: gdb-9.2/bfd/cpu-microblaze.c
14===================================================================
15--- gdb-9.2.orig/bfd/cpu-microblaze.c
16+++ gdb-9.2/bfd/cpu-microblaze.c
17@@ -39,7 +39,8 @@ const bfd_arch_info_type bfd_microblaze_
18 bfd_default_compatible, /* Architecture comparison function. */
19 bfd_default_scan, /* String to architecture conversion. */
20 bfd_arch_default_fill, /* Default fill. */
21- &bfd_microblaze_arch[1] /* Next in list. */
22+ &bfd_microblaze_arch[1], /* Next in list. */
23+ 0 /* Maximum offset of a reloc from the start of an insn. */
24 },
25 {
26 32, /* Bits in a word. */
27@@ -71,7 +72,8 @@ const bfd_arch_info_type bfd_microblaze_
28 bfd_default_compatible, /* Architecture comparison function. */
29 bfd_default_scan, /* String to architecture conversion. */
30 bfd_arch_default_fill, /* Default fill. */
31- &bfd_microblaze_arch[1] /* Next in list. */
32+ &bfd_microblaze_arch[1], /* Next in list. */
33+ 0 /* Maximum offset of a reloc from the start of an insn. */
34 },
35 {
36 64, /* 32 bits in a word. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
deleted file mode 100644
index ad63a72f..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From c848ddceb98359db1efb3ed0d1e7b5a90053dddf Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 11:02:11 -0800
4Subject: [PATCH 47/52] bfd/elf64-microblaze.c: Fix build failures
5
6Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
7---
8 bfd/elf64-microblaze.c | 16 ++++++++--------
9 1 file changed, 8 insertions(+), 8 deletions(-)
10
11Index: gdb-9.2/bfd/elf64-microblaze.c
12===================================================================
13--- gdb-9.2.orig/bfd/elf64-microblaze.c
14+++ gdb-9.2/bfd/elf64-microblaze.c
15@@ -1572,7 +1572,7 @@ microblaze_elf_relocate_section (bfd *ou
16 {
17 BFD_FAIL ();
18 (*_bfd_error_handler)
19- (_("%B: probably compiled without -fPIC?"),
20+ (_("%pB: probably compiled without -fPIC?"),
21 input_bfd);
22 bfd_set_error (bfd_error_bad_value);
23 return FALSE;
24@@ -2691,7 +2691,7 @@ microblaze_elf_check_relocs (bfd * abfd,
25 /* If this is a global symbol, we count the number of
26 relocations we need for this symbol. */
27 if (h != NULL)
28- head = &h->dyn_relocs;
29+ head = &((struct elf64_mb_link_hash_entry *) h)->dyn_relocs;
30 else
31 {
32 /* Track dynamic relocs needed for local syms too.
33@@ -2911,7 +2911,7 @@ microblaze_elf_adjust_dynamic_symbol (st
34
35 /* If we didn't find any dynamic relocs in read-only sections, then
36 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
37- if (!_bfd_elf_readonly_dynrelocs (h))
38+ if (p == NULL)
39 {
40 h->non_got_ref = 0;
41 return TRUE;
42@@ -3096,7 +3096,7 @@ allocate_dynrelocs (struct elf_link_hash
43 else
44 h->got.offset = (bfd_vma) -1;
45
46- if (h->dyn_relocs == NULL)
47+ if (eh->dyn_relocs == NULL)
48 return TRUE;
49
50 /* In the shared -Bsymbolic case, discard space allocated for
51@@ -3113,7 +3113,7 @@ allocate_dynrelocs (struct elf_link_hash
52 {
53 struct elf64_mb_dyn_relocs **pp;
54
55- for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
56+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
57 {
58 p->count -= p->pc_count;
59 p->pc_count = 0;
60@@ -3124,7 +3124,7 @@ allocate_dynrelocs (struct elf_link_hash
61 }
62 }
63 else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
64- h->dyn_relocs = NULL;
65+ eh->dyn_relocs = NULL;
66 }
67 else
68 {
69@@ -3154,13 +3154,13 @@ allocate_dynrelocs (struct elf_link_hash
70 goto keep;
71 }
72
73- h->dyn_relocs = NULL;
74+ eh->dyn_relocs = NULL;
75
76 keep: ;
77 }
78
79 /* Finally, allocate space. */
80- for (p = h->dyn_relocs; p != NULL; p = p->next)
81+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
82 {
83 asection *sreloc = elf_section_data (p->sec)->sreloc;
84 sreloc->size += p->count * sizeof (Elf64_External_Rela);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
deleted file mode 100644
index bee50edf..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
+++ /dev/null
@@ -1,72 +0,0 @@
1From 359ee1650d98372a2f2cd360a7ea9877077f6ece Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 11:23:26 -0800
4Subject: [PATCH 48/52] bfd/elf*-microblaze.c: Remove obsolete entries
5
6Replace microblaze_elf_merge_private_bfd_data with a direct call to
7_bfd_generic_verify_endian_match, this simplifies the implementation.
8
9Remove microblaze_elf_gc_sweep_hook, removed in 2017.
10
11Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
12---
13 bfd/elf64-microblaze.c | 29 +----------------------------
14 1 file changed, 1 insertion(+), 28 deletions(-)
15
16Index: gdb-9.2/bfd/elf64-microblaze.c
17===================================================================
18--- gdb-9.2.orig/bfd/elf64-microblaze.c
19+++ gdb-9.2/bfd/elf64-microblaze.c
20@@ -1690,21 +1690,6 @@ microblaze_elf_relocate_section (bfd *ou
21 return ret;
22 }
23
24-/* Merge backend specific data from an object file to the output
25- object file when linking.
26-
27- Note: We only use this hook to catch endian mismatches. */
28-static bfd_boolean
29-microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
30-{
31- /* Check if we have the same endianess. */
32- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
33- return FALSE;
34-
35- return TRUE;
36-}
37-
38-
39 /* Calculate fixup value for reference. */
40
41 static int
42@@ -2427,17 +2412,6 @@ microblaze_elf_gc_mark_hook (asection *s
43 return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
44 }
45
46-/* Update the got entry reference counts for the section being removed. */
47-
48-static bfd_boolean
49-microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
50- struct bfd_link_info * info ATTRIBUTE_UNUSED,
51- asection * sec ATTRIBUTE_UNUSED,
52- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
53-{
54- return TRUE;
55-}
56-
57 /* PIC support. */
58
59 #define PLT_ENTRY_SIZE 16
60@@ -3704,11 +3678,10 @@ microblaze_elf_add_symbol_hook (bfd *abf
61 #define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
62 #define elf_backend_relocate_section microblaze_elf_relocate_section
63 #define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
64-#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
65+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
66 #define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
67
68 #define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
69-#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
70 #define elf_backend_check_relocs microblaze_elf_check_relocs
71 #define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
72 #define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
deleted file mode 100644
index 9b95e10b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From bee1ab76011aca029f89f98b9388aeb0390ee90f Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 12:02:25 -0800
4Subject: [PATCH 49/52] bfd/elf64-microblaze.c: Resolve various compiler
5 warnings
6
7Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
8---
9 bfd/elf64-microblaze.c | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-)
11
12Index: gdb-9.2/bfd/elf64-microblaze.c
13===================================================================
14--- gdb-9.2.orig/bfd/elf64-microblaze.c
15+++ gdb-9.2/bfd/elf64-microblaze.c
16@@ -1258,6 +1258,7 @@ microblaze_elf_relocate_section (bfd *ou
17 goto dogot;
18 case (int) R_MICROBLAZE_TLSLD:
19 tls_type = (TLS_TLS | TLS_LD);
20+ /* Fall through. */
21 dogot:
22 case (int) R_MICROBLAZE_GOT_64:
23 {
24@@ -2569,6 +2570,7 @@ microblaze_elf_check_relocs (bfd * abfd,
25 tls_type |= (TLS_TLS | TLS_LD);
26 dogottls:
27 sec->has_tls_reloc = 1;
28+ /* Fall through. */
29 case R_MICROBLAZE_GOT_64:
30 if (htab->sgot == NULL)
31 {
32@@ -2802,10 +2804,8 @@ microblaze_elf_adjust_dynamic_symbol (st
33 struct elf64_mb_link_hash_table *htab;
34 struct elf64_mb_link_hash_entry * eh;
35 struct elf64_mb_dyn_relocs *p;
36- asection *sdynbss;
37 asection *s, *srel;
38 unsigned int power_of_two;
39- bfd *dynobj;
40
41 htab = elf64_mb_hash_table (info);
42 if (htab == NULL)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
deleted file mode 100644
index ba8394cc..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From a0d3bb3d528dfb75e54a0b0c6ff0d6095ba1c2c7 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 12:30:09 -0800
4Subject: [PATCH 50/52] opcodes/microblaze-dis.c: Fix compile warnings
5
6Two compiler warnings were evident, it appears both are likely real bugs.
7
8Missing type declaration for a function, and a case statement without a break.
9
10Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
11---
12 opcodes/microblaze-dis.c | 2 ++
13 1 file changed, 2 insertions(+)
14
15Index: gdb-9.2/opcodes/microblaze-dis.c
16===================================================================
17--- gdb-9.2.orig/opcodes/microblaze-dis.c
18+++ gdb-9.2/opcodes/microblaze-dis.c
19@@ -130,6 +130,7 @@ get_field_imm15 (struct string_buf *buf,
20 return p;
21 }
22
23+static char *
24 get_field_imm16 (struct string_buf *buf, long instr)
25 {
26 char *p = strbuf (buf);
27@@ -327,6 +328,7 @@ print_insn_microblaze (bfd_vma memaddr,
28 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
29 get_field_r1 (&buf, inst), get_field_imm (&buf, inst));
30 /* TODO: Also print symbol */
31+ break;
32 case INST_TYPE_RD_R1_IMMS:
33 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
34 get_field_r1(&buf, inst), get_field_imms (&buf, inst));
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
deleted file mode 100644
index f3290157..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
+++ /dev/null
@@ -1,96 +0,0 @@
1From 202c9a6e8c4e3bfe8f84d1066c8993a77e4ad4a8 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 14:51:37 -0800
4Subject: [PATCH 51/52] gdb/microblaze-tdep.c: Remove unused functions
5
6Compiler warns the removed functions are not referenced anywhere.
7
8Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
9---
10 gdb/microblaze-tdep.c | 45 -------------------------------------------
11 1 file changed, 45 deletions(-)
12
13Index: gdb-9.2/gdb/microblaze-tdep.c
14===================================================================
15--- gdb-9.2.orig/gdb/microblaze-tdep.c
16+++ gdb-9.2/gdb/microblaze-tdep.c
17@@ -140,14 +140,6 @@ microblaze_fetch_instruction (CORE_ADDR
18 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
19
20 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
21-static CORE_ADDR
22-microblaze_store_arguments (struct regcache *regcache, int nargs,
23- struct value **args, CORE_ADDR sp,
24- int struct_return, CORE_ADDR struct_addr)
25-{
26- error (_("store_arguments not implemented"));
27- return sp;
28-}
29 #if 0
30 static int
31 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
32@@ -555,12 +547,6 @@ microblaze_frame_base_address (struct fr
33 return cache->base;
34 }
35
36-static const struct frame_unwind *
37-microblaze_frame_sniffer (struct frame_info *next_frame)
38-{
39- return &microblaze_frame_unwind;
40-}
41-
42 static const struct frame_base microblaze_frame_base =
43 {
44 &microblaze_frame_unwind,
45@@ -759,12 +745,6 @@ microblaze_software_single_step (struct
46 }
47 #endif
48
49-static void
50-microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
51-{
52- regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
53-}
54-
55 static int dwarf2_to_reg_map[78] =
56 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
57 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
58@@ -796,19 +776,6 @@ microblaze_dwarf2_reg_to_regnum (struct
59 return -1;
60 }
61
62-static void
63-microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
64-{
65-
66- register_remote_g_packet_guess (gdbarch,
67- 4 * MICROBLAZE_NUM_REGS,
68- tdesc_microblaze64);
69-
70- register_remote_g_packet_guess (gdbarch,
71- 4 * MICROBLAZE_NUM_REGS,
72- tdesc_microblaze64_with_stack_protect);
73-}
74-
75 void
76 microblaze_supply_gregset (const struct microblaze_gregset *gregset,
77 struct regcache *regcache,
78@@ -873,18 +840,6 @@ microblaze_regset_from_core_section (str
79 }
80
81
82-static void
83-make_regs (struct gdbarch *arch)
84-{
85- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
86- int mach = gdbarch_bfd_arch_info (arch)->mach;
87-
88- if (mach == bfd_mach_microblaze64)
89- {
90- set_gdbarch_ptr_bit (arch, 64);
91- }
92-}
93-
94 static struct gdbarch *
95 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
96 {
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch
deleted file mode 100644
index 88095def..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From acee53a9c9b6cbe826dacb9f02102ae4d58e36ba Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 6 Aug 2020 15:37:52 -0500
4Subject: [PATCH 52/52] sim: Allow microblaze* architecture
5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7---
8 sim/configure | 2 +-
9 sim/configure.tgt | 2 +-
10 2 files changed, 2 insertions(+), 2 deletions(-)
11
12Index: gdb-9.2/sim/configure
13===================================================================
14--- gdb-9.2.orig/sim/configure
15+++ gdb-9.2/sim/configure
16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64"
17
18
19 ;;
20- microblaze-*-*)
21+ microblaze*-*-*)
22
23 sim_arch=microblaze
24 subdirs="$subdirs microblaze"
25Index: gdb-9.2/sim/configure.tgt
26===================================================================
27--- gdb-9.2.orig/sim/configure.tgt
28+++ gdb-9.2/sim/configure.tgt
29@@ -59,7 +59,7 @@ case "${target}" in
30 mcore-*-*)
31 SIM_ARCH(mcore)
32 ;;
33- microblaze-*-*)
34+ microblaze*-*-*)
35 SIM_ARCH(microblaze)
36 ;;
37 mips*-*-*)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0054-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0054-Patch-MicroBlaze.patch
deleted file mode 100644
index d5cf929a..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0054-Patch-MicroBlaze.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From 75272152884a0cb003a8e45f8ca9ffa0ac43eea2 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 15 Apr 2021 16:16:11 +0530
4Subject: [PATCH 54] [Patch,MicroBlaze]: 1. set BFD machine to
5 bfd_mach_microblaze64 for 64 bit elf. 2. XSDB and QEMU : agreed to append r
6 to all special registers except slr/shr
7
8---
9 bfd/elf64-microblaze.c | 11 +++++++++++
10 gdb/features/microblaze-core.xml | 4 ++--
11 gdb/features/microblaze-stack-protect.xml | 4 ++--
12 gdb/features/microblaze-with-stack-protect.c | 4 ++--
13 gdb/features/microblaze.c | 4 ++--
14 gdb/features/microblaze64-core.xml | 4 ++--
15 gdb/features/microblaze64-stack-protect.xml | 4 ++--
16 gdb/features/microblaze64-with-stack-protect.c | 4 ++--
17 gdb/features/microblaze64.c | 4 ++--
18 gdb/microblaze-tdep.c | 2 +-
19 10 files changed, 28 insertions(+), 17 deletions(-)
20
21Index: gdb-9.2/bfd/elf64-microblaze.c
22===================================================================
23--- gdb-9.2.orig/bfd/elf64-microblaze.c
24+++ gdb-9.2/bfd/elf64-microblaze.c
25@@ -3631,6 +3631,16 @@ microblaze_elf_finish_dynamic_sections (
26 return TRUE;
27 }
28
29+static bfd_boolean
30+microblaze_elf64_object_p (bfd *abfd)
31+{
32+ bfd_default_set_arch_mach (abfd, bfd_arch_microblaze,
33+ bfd_mach_microblaze64);
34+ return TRUE;
35+}
36+
37+
38+
39 /* Hook called by the linker routine which adds symbols from an object
40 file. We use it to put .comm items in .sbss, and not .bss. */
41
42@@ -3698,5 +3708,6 @@ microblaze_elf_add_symbol_hook (bfd *abf
43 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
44 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
45 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
46+/* #define elf_backend_object_p microblaze_elf64_object_p */
47
48 #include "elf64-target.h"
49Index: gdb-9.2/gdb/features/microblaze-core.xml
50===================================================================
51--- gdb-9.2.orig/gdb/features/microblaze-core.xml
52+++ gdb-9.2/gdb/features/microblaze-core.xml
53@@ -64,6 +64,6 @@
54 <reg name="rtlbsx" bitsize="32"/>
55 <reg name="rtlblo" bitsize="32"/>
56 <reg name="rtlbhi" bitsize="32"/>
57- <reg name="rslr" bitsize="32"/>
58- <reg name="rshr" bitsize="32"/>
59+ <reg name="slr" bitsize="32"/>
60+ <reg name="shr" bitsize="32"/>
61 </feature>
62Index: gdb-9.2/gdb/features/microblaze-stack-protect.xml
63===================================================================
64--- gdb-9.2.orig/gdb/features/microblaze-stack-protect.xml
65+++ gdb-9.2/gdb/features/microblaze-stack-protect.xml
66@@ -7,6 +7,6 @@
67
68 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
69 <feature name="org.gnu.gdb.microblaze.stack-protect">
70- <reg name="rslr" bitsize="32"/>
71- <reg name="rshr" bitsize="32"/>
72+ <reg name="slr" bitsize="32"/>
73+ <reg name="shr" bitsize="32"/>
74 </feature>
75Index: gdb-9.2/gdb/features/microblaze-with-stack-protect.c
76===================================================================
77--- gdb-9.2.orig/gdb/features/microblaze-with-stack-protect.c
78+++ gdb-9.2/gdb/features/microblaze-with-stack-protect.c
79@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_p
80 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
81
82 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
83- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
84- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
85+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
86+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
87
88 tdesc_microblaze_with_stack_protect = result;
89 }
90Index: gdb-9.2/gdb/features/microblaze.c
91===================================================================
92--- gdb-9.2.orig/gdb/features/microblaze.c
93+++ gdb-9.2/gdb/features/microblaze.c
94@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
95 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
96 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
97 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
98- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
99- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
100+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
101+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
102
103 tdesc_microblaze = result;
104 }
105Index: gdb-9.2/gdb/features/microblaze64-core.xml
106===================================================================
107--- gdb-9.2.orig/gdb/features/microblaze64-core.xml
108+++ gdb-9.2/gdb/features/microblaze64-core.xml
109@@ -64,6 +64,6 @@
110 <reg name="rtlbsx" bitsize="32"/>
111 <reg name="rtlblo" bitsize="32"/>
112 <reg name="rtlbhi" bitsize="32"/>
113- <reg name="rslr" bitsize="64"/>
114- <reg name="rshr" bitsize="64"/>
115+ <reg name="slr" bitsize="64"/>
116+ <reg name="shr" bitsize="64"/>
117 </feature>
118Index: gdb-9.2/gdb/features/microblaze64-stack-protect.xml
119===================================================================
120--- gdb-9.2.orig/gdb/features/microblaze64-stack-protect.xml
121+++ gdb-9.2/gdb/features/microblaze64-stack-protect.xml
122@@ -7,6 +7,6 @@
123
124 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
125 <feature name="org.gnu.gdb.microblaze64.stack-protect">
126- <reg name="rslr" bitsize="64"/>
127- <reg name="rshr" bitsize="64"/>
128+ <reg name="slr" bitsize="64"/>
129+ <reg name="shr" bitsize="64"/>
130 </feature>
131Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
132===================================================================
133--- gdb-9.2.orig/gdb/features/microblaze64-with-stack-protect.c
134+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
135@@ -72,8 +72,8 @@ initialize_tdesc_microblaze64_with_stack
136 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
137
138 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
139- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
140- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
141+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
142+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
143
144 tdesc_microblaze64_with_stack_protect = result;
145 }
146Index: gdb-9.2/gdb/features/microblaze64.c
147===================================================================
148--- gdb-9.2.orig/gdb/features/microblaze64.c
149+++ gdb-9.2/gdb/features/microblaze64.c
150@@ -70,8 +70,8 @@ initialize_tdesc_microblaze64 (void)
151 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
152 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
153 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
154- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
155- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
156+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
157+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
158
159 tdesc_microblaze64 = result;
160 }
161Index: gdb-9.2/gdb/microblaze-tdep.c
162===================================================================
163--- gdb-9.2.orig/gdb/microblaze-tdep.c
164+++ gdb-9.2/gdb/microblaze-tdep.c
165@@ -77,7 +77,7 @@ static const char *microblaze_register_n
166 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
167 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
168 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
169- "rslr", "rshr"
170+ "slr", "shr"
171 };
172
173 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb
deleted file mode 100644
index e73e3a2c..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb
+++ /dev/null
@@ -1,28 +0,0 @@
1require gdb.inc
2require gdb-${PV}.inc
3
4inherit python3-dir
5
6EXTRA_OEMAKE:append:libc-musl = "\
7 gt_cv_func_gnugettext1_libc=yes \
8 gt_cv_func_gnugettext2_libc=yes \
9 gl_cv_func_working_strerror=yes \
10 gl_cv_func_strerror_0_works=yes \
11 gl_cv_func_gettimeofday_clobber=no \
12 "
13
14do_configure:prepend() {
15 if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
16 cat > ${WORKDIR}/python << EOF
17#!/bin/sh
18case "\$2" in
19 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;;
20 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;;
21 --exec-prefix) echo "${exec_prefix}" ;;
22 *) exit 1 ;;
23esac
24exit 0
25EOF
26 chmod +x ${WORKDIR}/python
27 fi
28}