summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc82
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0004-Disable-the-warning-message-for-eh_frame_hdr.patch)17
-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/0005-Fix-relaxation-of-assembler-resolved-references.patch64
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch184
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch)51
-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/0009-Add-new-bit-field-instructions.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch)60
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch)678
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch)202
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch)18
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch)88
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch)42
-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.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0020-Various-fixes.patch)64
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch34
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch)16
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0026-Added-support-to-new-arithmetic-single-register-inst.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0027-Added-support-to-new-arithmetic-single-register-inst.patch)72
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch)20
-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/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0034-Add-initial-port-of-linux-gdbserver.patch)155
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0033-Fix-various-compile-warnings.patch60
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch)209
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch)17
-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/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch)32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0039-Fixing-the-issues-related-to-GDB-7.12.patch)148
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch)456
-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.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch)23
48 files changed, 2505 insertions, 1568 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
index 906ef4db..6b23ae5f 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
@@ -5,35 +5,53 @@ LTTNGUST_microblaze = ""
5FILESEXTRAPATHS_append := ":${THISDIR}/gdb" 5FILESEXTRAPATHS_append := ":${THISDIR}/gdb"
6 6
7SRC_URI_append_microblaze = " \ 7SRC_URI_append_microblaze = " \
8 file://0001-sim-Allow-microblaze-architecture.patch \ 8 file://0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \
9 file://0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \ 9 file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \
10 file://0004-Disable-the-warning-message-for-eh_frame_hdr.patch \ 10 file://0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \
11 file://0005-Fix-relaxation-of-assembler-resolved-references.patch \ 11 file://0005-upstream-change-to-garbage-collection-sweep-causes-m.patch \
12 file://0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch \ 12 file://0006-Fix-bug-in-TLSTPREL-Relocation.patch \
13 file://0007-upstream-change-to-garbage-collection-sweep-causes-m.patch \ 13 file://0007-Added-Address-extension-instructions.patch \
14 file://0008-Fix-bug-in-TLSTPREL-Relocation.patch \ 14 file://0008-fixing-the-MAX_OPCODES-to-correct-value.patch \
15 file://0009-Added-Address-extension-instructions.patch \ 15 file://0009-Add-new-bit-field-instructions.patch \
16 file://0010-Add-new-bit-field-instructions.patch \ 16 file://0010-fixing-the-imm-bug.patch \
17 file://0011-fixing-the-imm-bug.patch \ 17 file://0014-intial-commit-of-MB-64-bit.patch \
18 file://0015-intial-commit-of-MB-64-bit.patch \ 18 file://0015-MB-X-initial-commit.patch \
19 file://0016-MB-X-initial-commit.patch \ 19 file://0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
20 file://0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \ 20 file://0017-Added-relocations-for-MB-X.patch \
21 file://0018-Added-relocations-for-MB-X.patch \ 21 file://0018-Fixed-MB-x-relocation-issues.patch \
22 file://0019-Update-MB-x.patch \ 22 file://0019-Fixing-the-branch-related-issues.patch \
23 file://0020-Various-fixes.patch \ 23 file://0020-Fixed-address-computation-issues-with-64bit-address.patch \
24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \ 24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \
25 file://0022-fixing-the-.bss-relocation-issue.patch \ 25 file://0022-fixing-the-.bss-relocation-issue.patch \
26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \ 26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \
27 file://0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch \ 27 file://0025-fixing-the-long-long-long-mingw-toolchain-issue.patch \
28 file://0026-fixing-the-long-long-long-mingw-toolchain-issue.patch \ 28 file://0026-Added-support-to-new-arithmetic-single-register-inst.patch \
29 file://0027-Added-support-to-new-arithmetic-single-register-inst.patch \ 29 file://0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
30 file://0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \ 30 file://0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
31 file://0033-Fix-various-compile-warnings.patch \ 31 file://0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
32 file://0034-Add-initial-port-of-linux-gdbserver.patch \ 32 file://0034-Initial-port-of-core-reading-support-Added-support-f.patch \
33 file://0035-Initial-port-of-core-reading-support.patch \ 33 file://0035-Fix-debug-message-when-register-is-unavailable.patch \
34 file://0036-Fix-debug-message-when-register-is-unavailable.patch \ 34 file://0036-revert-master-rebase-changes-to-gdbserver.patch \
35 file://0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \ 35 file://0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch \
36 file://0038-Initial-support-for-native-gdb.patch \ 36 file://0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
37 file://0039-Fixing-the-issues-related-to-GDB-7.12.patch \ 37 file://0039-Initial-support-for-native-gdb.patch \
38 file://0040-Patch-microblaze-Adding-64-bit-MB-support.patch \ 38 file://0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch \
39 " 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 "
52
53#
54## file://0048-bfd-gas-Use-standard-method-to-set-the-machine-arch.patch \
55## file://0052-opcodes-microblaze-opc.h-Expand-the-size-to-int-to-d.patch \
56## file://0053-opcodes-microblaze-opc.h-MIN_IMML-is-too-large.patch \
57#
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-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
index 6967a3d7..bf8757ae 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-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
@@ -1,7 +1,7 @@
1From d7a3a238edac153f391a65ae45215a117d25bc48 Mon Sep 17 00:00:00 2001 1From fd3110f46b2de34bddfe855aa8830c957e89d815 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000 3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 02/40] Add wdc.ext.clear and wdc.ext.flush insns 4Subject: [PATCH 01/52] Add wdc.ext.clear and wdc.ext.flush insns
5 5
6Added two new instructions, wdc.ext.clear and wdc.ext.flush, 6Added two new instructions, wdc.ext.clear and wdc.ext.flush,
7to enable MicroBlaze to flush an external cache, which is 7to enable MicroBlaze to flush an external cache, which is
@@ -15,7 +15,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15 2 files changed, 6 insertions(+), 3 deletions(-) 15 2 files changed, 6 insertions(+), 3 deletions(-)
16 16
17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
18index 62ee3c9a4d1..865151f95b0 100644 18index 62ee3c9a4d..865151f95b 100644
19--- a/opcodes/microblaze-opc.h 19--- a/opcodes/microblaze-opc.h
20+++ b/opcodes/microblaze-opc.h 20+++ b/opcodes/microblaze-opc.h
21@@ -91,6 +91,7 @@ 21@@ -91,6 +91,7 @@
@@ -46,7 +46,7 @@ index 62ee3c9a4d1..865151f95b0 100644
46 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, 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 }, 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 48diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
49index 5a2d3b0c8bb..42f3dd3be53 100644 49index 5a2d3b0c8b..42f3dd3be5 100644
50--- a/opcodes/microblaze-opcm.h 50--- a/opcodes/microblaze-opcm.h
51+++ b/opcodes/microblaze-opcm.h 51+++ b/opcodes/microblaze-opcm.h
52@@ -33,8 +33,8 @@ enum microblaze_instr 52@@ -33,8 +33,8 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-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
index 78e10261..28d6057a 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-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
@@ -1,18 +1,18 @@
1From 2e87167d8c5d40d8dfbd8d879d78ab0bd6f3bdfd Mon Sep 17 00:00:00 2001 1From 1e223d69ba8c3587c18e57e22dc3b6d2c6ce5cc9 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> 2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200 3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 04/40] Disable the warning message for eh_frame_hdr 4Subject: [PATCH 03/52] Disable the warning message for eh_frame_hdr
5 5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7--- 7---
8 bfd/elf-eh-frame.c | 3 +++ 8 bfd/elf-eh-frame.c | 3 +++
9 1 file changed, 3 insertions(+) 9 1 file changed, 3 insertions(+)
10 10
11diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c 11Index: gdb-9.2/bfd/elf-eh-frame.c
12index b622ffcee2a..26b180f1490 100644 12===================================================================
13--- a/bfd/elf-eh-frame.c 13--- gdb-9.2.orig/bfd/elf-eh-frame.c
14+++ b/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, struct bfd_link_info *info, 15@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
16 goto success; 16 goto success;
17 17
18 free_no_table: 18 free_no_table:
@@ -26,6 +26,3 @@ index b622ffcee2a..26b180f1490 100644
26 hdr_info->u.dwarf.table = FALSE; 26 hdr_info->u.dwarf.table = FALSE;
27 if (sec_info) 27 if (sec_info)
28 free (sec_info); 28 free (sec_info);
29--
302.17.1
31
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
new file mode 100644
index 00000000..d5862d87
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
@@ -0,0 +1,261 @@
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/0005-Fix-relaxation-of-assembler-resolved-references.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Fix-relaxation-of-assembler-resolved-references.patch
deleted file mode 100644
index d851c589..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Fix-relaxation-of-assembler-resolved-references.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From 210bb23010e2c3e65f5f54c220d27da0590bab06 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Tue, 14 Feb 2012 01:00:22 +0100
4Subject: [PATCH 05/40] Fix relaxation of assembler resolved references
5
6---
7 bfd/elf32-microblaze.c | 41 ++++++++++++++++++++++++++++++++++++++
8 2 files changed, 42 insertions(+)
9
10diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
11index c187d83ee04..dfd82438e35 100644
12--- a/bfd/elf32-microblaze.c
13+++ b/bfd/elf32-microblaze.c
14@@ -1973,6 +1973,47 @@ microblaze_elf_relax_section (bfd *abfd,
15 irelscanend = irelocs + o->reloc_count;
16 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
17 {
18+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
19+ {
20+ unsigned int val;
21+
22+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
23+
24+ /* This was a PC-relative instruction that was completely resolved. */
25+ if (ocontents == NULL)
26+ {
27+ if (elf_section_data (o)->this_hdr.contents != NULL)
28+ ocontents = elf_section_data (o)->this_hdr.contents;
29+ else
30+ {
31+ /* We always cache the section contents.
32+ Perhaps, if info->keep_memory is FALSE, we
33+ should free them, if we are permitted to. */
34+
35+ if (o->rawsize == 0)
36+ o->rawsize = o->size;
37+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
38+ if (ocontents == NULL)
39+ goto error_return;
40+ if (!bfd_get_section_contents (abfd, o, ocontents,
41+ (file_ptr) 0,
42+ o->rawsize))
43+ goto error_return;
44+ elf_section_data (o)->this_hdr.contents = ocontents;
45+ }
46+ }
47+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
48+ if (val != irelscan->r_addend) {
49+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
50+ }
51+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
52+ + isym->st_value, 0, sec);
53+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
54+ irelscan->r_addend);
55+ }
56+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
57+ fprintf(stderr, "Unhandled NONE 64\n");
58+ }
59 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
60 {
61 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
62--
632.17.1
64
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-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
index 09a17eda..d5195308 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-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
@@ -1,7 +1,7 @@
1From df187bca3d19a3e5c36182929e7e14bc6a49aad5 Mon Sep 17 00:00:00 2001 1From c78337f4e6459e18e1d2af95d8e313b9dcb3f097 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000 3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 07/40] upstream change to garbage collection sweep causes mb 4Subject: [PATCH 05/52] upstream change to garbage collection sweep causes mb
5 regression 5 regression
6 6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a 7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
@@ -22,11 +22,11 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
22 bfd/elflink.c | 1 - 22 bfd/elflink.c | 1 -
23 1 file changed, 1 deletion(-) 23 1 file changed, 1 deletion(-)
24 24
25diff --git a/bfd/elflink.c b/bfd/elflink.c 25Index: gdb-9.2/bfd/elflink.c
26index 7078a2fb6f4..7926fdf63be 100644 26===================================================================
27--- a/bfd/elflink.c 27--- gdb-9.2.orig/bfd/elflink.c
28+++ b/bfd/elflink.c 28+++ gdb-9.2/bfd/elflink.c
29@@ -6274,7 +6274,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) 29@@ -6274,7 +6274,6 @@ elf_gc_sweep_symbol (struct elf_link_has
30 30
31 inf = (struct elf_gc_sweep_symbol_info *) data; 31 inf = (struct elf_gc_sweep_symbol_info *) data;
32 (*inf->hide_symbol) (inf->info, h, TRUE); 32 (*inf->hide_symbol) (inf->info, h, TRUE);
@@ -34,6 +34,3 @@ index 7078a2fb6f4..7926fdf63be 100644
34 h->ref_regular = 0; 34 h->ref_regular = 0;
35 h->ref_regular_nonweak = 0; 35 h->ref_regular_nonweak = 0;
36 } 36 }
37--
382.17.1
39
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch
index c37a5aed..2843bc2d 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Fix-bug-in-TLSTPREL-Relocation.patch
@@ -1,7 +1,7 @@
1From 0f1d7bd04916af6172780335dc6abc11d45564f2 Mon Sep 17 00:00:00 2001 1From 17ac5acd91e0ef6b103d18018f93fd0fc29a2048 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 15 Jun 2015 16:50:30 +0530 3Date: Mon, 15 Jun 2015 16:50:30 +0530
4Subject: [PATCH 08/40] Fix bug in TLSTPREL Relocation 4Subject: [PATCH 06/52] Fix bug in TLSTPREL Relocation
5 5
6Fixed the problem related to the fixup/relocations TLSTPREL. 6Fixed the problem related to the fixup/relocations TLSTPREL.
7When the fixup is applied the addend is not added at the correct offset 7When the fixup is applied the addend is not added at the correct offset
@@ -12,11 +12,11 @@ big & little-endian compilers
12 bfd/elf32-microblaze.c | 4 ++-- 12 bfd/elf32-microblaze.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
14 14
15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 15Index: gdb-9.2/bfd/elf32-microblaze.c
16index cbba704e691..cc4c0568c68 100644 16===================================================================
17--- a/bfd/elf32-microblaze.c 17--- gdb-9.2.orig/bfd/elf32-microblaze.c
18+++ b/bfd/elf32-microblaze.c 18+++ gdb-9.2/bfd/elf32-microblaze.c
19@@ -1451,9 +1451,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, 19@@ -1451,9 +1451,9 @@ microblaze_elf_relocate_section (bfd *ou
20 relocation += addend; 20 relocation += addend;
21 relocation -= dtprel_base(info); 21 relocation -= dtprel_base(info);
22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
@@ -28,6 +28,3 @@ index cbba704e691..cc4c0568c68 100644
28 break; 28 break;
29 case (int) R_MICROBLAZE_TEXTREL_64: 29 case (int) R_MICROBLAZE_TEXTREL_64:
30 case (int) R_MICROBLAZE_TEXTREL_32_LO: 30 case (int) R_MICROBLAZE_TEXTREL_32_LO:
31--
322.17.1
33
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
deleted file mode 100644
index eea29059..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
+++ /dev/null
@@ -1,184 +0,0 @@
1From d2aee40b9753b783853bf38d36d9b6e50d16cc20 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 6 Feb 2017 15:53:08 +0530
4Subject: [PATCH 06/40] microblaze: Fixup debug_loc sections after linker
5 relaxation
6
7Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing
8reloc info from the assembler to the linker when the linker
9manages to fully resolve a local symbol reference.
10
11This is a workaround for design flaws in the assembler to
12linker interface with regards to linker relaxation.
13
14Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com>
16---
17 bfd/bfd-in2.h | 5 +++++
18 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++-------
19 bfd/libbfd.h | 1 +
20 bfd/reloc.c | 6 ++++++
21 include/elf/microblaze.h | 1 +
22 7 files changed, 52 insertions(+), 7 deletions(-)
23
24diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
25index 6f3e41da376..52c81b10b6d 100644
26--- a/bfd/bfd-in2.h
27+++ b/bfd/bfd-in2.h
28@@ -5363,6 +5363,11 @@ value relative to the read-write small data area anchor */
29 expressions of the form "Symbol Op Symbol" */
30 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
31
32+/* This is a 32 bit reloc that stores the 32 bit pc relative
33+value in two words (with an imm instruction). No relocation is
34+done here - only used for relaxing */
35+ BFD_RELOC_MICROBLAZE_32_NONE,
36+
37 /* This is a 64 bit reloc that stores the 32 bit pc relative
38 value in two words (with an imm instruction). No relocation is
39 done here - only used for relaxing */
40diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
41index dfd82438e35..cbba704e691 100644
42--- a/bfd/elf32-microblaze.c
43+++ b/bfd/elf32-microblaze.c
44@@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
45 0x0000ffff, /* Dest Mask. */
46 FALSE), /* PC relative offset? */
47
48+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
49+ 0, /* Rightshift. */
50+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
51+ 32, /* Bitsize. */
52+ TRUE, /* PC_relative. */
53+ 0, /* Bitpos. */
54+ complain_overflow_bitfield, /* Complain on overflow. */
55+ NULL, /* Special Function. */
56+ "R_MICROBLAZE_32_NONE",/* Name. */
57+ FALSE, /* Partial Inplace. */
58+ 0, /* Source Mask. */
59+ 0, /* Dest Mask. */
60+ FALSE), /* PC relative offset? */
61+
62 /* This reloc does nothing. Used for relaxation. */
63 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
64 0, /* Rightshift. */
65@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
66 case BFD_RELOC_NONE:
67 microblaze_reloc = R_MICROBLAZE_NONE;
68 break;
69+ case BFD_RELOC_MICROBLAZE_32_NONE:
70+ microblaze_reloc = R_MICROBLAZE_32_NONE;
71+ break;
72 case BFD_RELOC_MICROBLAZE_64_NONE:
73 microblaze_reloc = R_MICROBLAZE_64_NONE;
74 break;
75@@ -1918,14 +1935,22 @@ microblaze_elf_relax_section (bfd *abfd,
76 }
77 break;
78 case R_MICROBLAZE_NONE:
79+ case R_MICROBLAZE_32_NONE:
80 {
81 /* This was a PC-relative instruction that was
82 completely resolved. */
83 int sfix, efix;
84+ unsigned int val;
85 bfd_vma target_address;
86 target_address = irel->r_addend + irel->r_offset;
87 sfix = calc_fixup (irel->r_offset, 0, sec);
88 efix = calc_fixup (target_address, 0, sec);
89+
90+ /* Validate the in-band val. */
91+ val = bfd_get_32 (abfd, contents + irel->r_offset);
92+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
93+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
94+ }
95 irel->r_addend -= (efix - sfix);
96 /* Should use HOWTO. */
97 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
98@@ -1973,12 +1998,16 @@ microblaze_elf_relax_section (bfd *abfd,
99 irelscanend = irelocs + o->reloc_count;
100 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
101 {
102- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
103+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
104 {
105 unsigned int val;
106
107 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
108
109+ /* hax: We only do the following fixup for debug location lists. */
110+ if (strcmp(".debug_loc", o->name))
111+ continue;
112+
113 /* This was a PC-relative instruction that was completely resolved. */
114 if (ocontents == NULL)
115 {
116@@ -2006,14 +2035,10 @@ microblaze_elf_relax_section (bfd *abfd,
117 if (val != irelscan->r_addend) {
118 fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
119 }
120- irelscan->r_addend -= calc_fixup (irelscan->r_addend
121- + isym->st_value, 0, sec);
122+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
123 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
124 irelscan->r_addend);
125 }
126- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
127- fprintf(stderr, "Unhandled NONE 64\n");
128- }
129 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
130 {
131 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
132@@ -2073,7 +2098,7 @@ microblaze_elf_relax_section (bfd *abfd,
133 elf_section_data (o)->this_hdr.contents = ocontents;
134 }
135 }
136- irelscan->r_addend -= calc_fixup (irel->r_addend
137+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
138 + isym->st_value,
139 0,
140 sec);
141diff --git a/bfd/libbfd.h b/bfd/libbfd.h
142index 44cefbd66d4..a01891f3423 100644
143--- a/bfd/libbfd.h
144+++ b/bfd/libbfd.h
145@@ -2903,6 +2903,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
146 "BFD_RELOC_MICROBLAZE_32_ROSDA",
147 "BFD_RELOC_MICROBLAZE_32_RWSDA",
148 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
149+ "BFD_RELOC_MICROBLAZE_32_NONE",
150 "BFD_RELOC_MICROBLAZE_64_NONE",
151 "BFD_RELOC_MICROBLAZE_64_GOTPC",
152 "BFD_RELOC_MICROBLAZE_64_GOT",
153diff --git a/bfd/reloc.c b/bfd/reloc.c
154index b00b79f3190..78f13180c71 100644
155--- a/bfd/reloc.c
156+++ b/bfd/reloc.c
157@@ -6806,6 +6806,12 @@ ENUM
158 ENUMDOC
159 This is a 32 bit reloc for the microblaze to handle
160 expressions of the form "Symbol Op Symbol"
161+ENUM
162+ BFD_RELOC_MICROBLAZE_32_NONE
163+ENUMDOC
164+ This is a 32 bit reloc that stores the 32 bit pc relative
165+ value in two words (with an imm instruction). No relocation is
166+ done here - only used for relaxing
167 ENUM
168 BFD_RELOC_MICROBLAZE_64_NONE
169 ENUMDOC
170diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
171index 830b5ad4461..0dba2c0f44f 100644
172--- a/include/elf/microblaze.h
173+++ b/include/elf/microblaze.h
174@@ -61,6 +61,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
175 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
176 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
177 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
178+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
179 END_RELOC_NUMBERS (R_MICROBLAZE_max)
180
181 /* Global base address names. */
182--
1832.17.1
184
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch
index c9903a40..a2584ed4 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Added-Address-extension-instructions.patch
@@ -1,7 +1,7 @@
1From c0bb923f0978d5767048274cd778c8cbcef184ec Mon Sep 17 00:00:00 2001 1From 40107e7f6430aebfeba7e8f4eb6d67863520ebd4 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jan 2016 12:28:21 +0530 3Date: Mon, 18 Jan 2016 12:28:21 +0530
4Subject: [PATCH 09/40] Added Address extension instructions 4Subject: [PATCH 07/52] Added Address extension instructions
5 5
6This patch adds the support of new instructions which are required 6This patch adds the support of new instructions which are required
7for supporting Address extension feature. 7for supporting Address extension feature.
@@ -13,27 +13,17 @@ ChangeLog:
13 13
14 *microblaze-opc.h (op_code_struct): Update 14 *microblaze-opc.h (op_code_struct): Update
15 Added new instructions 15 Added new instructions
16 Set MAX_OPCODES to matching value
17 *microblaze-opcm.h (microblaze_instr): Update 16 *microblaze-opcm.h (microblaze_instr): Update
18 Added new instructions 17 Added new instructions
19--- 18---
20 opcodes/microblaze-opc.h | 19 +++++++++++++++---- 19 opcodes/microblaze-opc.h | 11 +++++++++++
21 opcodes/microblaze-opcm.h | 12 ++++++------ 20 opcodes/microblaze-opcm.h | 12 ++++++------
22 2 files changed, 21 insertions(+), 10 deletions(-) 21 2 files changed, 17 insertions(+), 6 deletions(-)
23 22
24diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 23Index: gdb-9.2/opcodes/microblaze-opc.h
25index 865151f95b0..d9a84e575e8 100644 24===================================================================
26--- a/opcodes/microblaze-opc.h 25--- gdb-9.2.orig/opcodes/microblaze-opc.h
27+++ b/opcodes/microblaze-opc.h 26+++ gdb-9.2/opcodes/microblaze-opc.h
28@@ -102,7 +102,7 @@
29 #define DELAY_SLOT 1
30 #define NO_DELAY_SLOT 0
31
32-#define MAX_OPCODES 291
33+#define MAX_OPCODES 299
34
35 struct op_code_struct
36 {
37@@ -178,8 +178,11 @@ struct op_code_struct 27@@ -178,8 +178,11 @@ struct op_code_struct
38 {"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 }, 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 },
39 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, 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 },
@@ -71,20 +61,6 @@ index 865151f95b0..d9a84e575e8 100644
71 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_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 },
72 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, 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 },
73 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, 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 },
74@@ -258,10 +267,10 @@ struct op_code_struct
75 {"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 },
76 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
77 {"msrclr",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94110000, OPCODE_MASK_H23N, msrclr, special_inst },
78- {"fadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000000, OPCODE_MASK_H4, fadd, arithmetic_inst },
79+ {"fadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000000, OPCODE_MASK_H4, mbi_fadd, arithmetic_inst },
80 {"frsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000080, OPCODE_MASK_H4, frsub, arithmetic_inst },
81- {"fmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000100, OPCODE_MASK_H4, fmul, arithmetic_inst },
82- {"fdiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000180, OPCODE_MASK_H4, fdiv, arithmetic_inst },
83+ {"fmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000100, OPCODE_MASK_H4, mbi_fmul, arithmetic_inst },
84+ {"fdiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000180, OPCODE_MASK_H4, mbi_fdiv, arithmetic_inst },
85 {"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 },
86 {"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 },
87 {"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 },
88@@ -405,6 +414,8 @@ struct op_code_struct 64@@ -405,6 +414,8 @@ struct op_code_struct
89 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst }, 65 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
90 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst }, 66 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
@@ -94,10 +70,10 @@ index 865151f95b0..d9a84e575e8 100644
94 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst }, 70 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
95 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, 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 },
96 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 72 {"", 0, 0, 0, 0, 0, 0, 0, 0},
97diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 73Index: gdb-9.2/opcodes/microblaze-opcm.h
98index 42f3dd3be53..8be6e97a1d5 100644 74===================================================================
99--- a/opcodes/microblaze-opcm.h 75--- gdb-9.2.orig/opcodes/microblaze-opcm.h
100+++ b/opcodes/microblaze-opcm.h 76+++ gdb-9.2/opcodes/microblaze-opcm.h
101@@ -33,14 +33,14 @@ enum microblaze_instr 77@@ -33,14 +33,14 @@ enum microblaze_instr
102 /* 'or/and/xor' are C++ keywords. */ 78 /* 'or/and/xor' are C++ keywords. */
103 microblaze_or, microblaze_and, microblaze_xor, 79 microblaze_or, microblaze_and, microblaze_xor,
@@ -119,6 +95,3 @@ index 42f3dd3be53..8be6e97a1d5 100644
119 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 95 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
120 fint, fsqrt, 96 fint, fsqrt,
121 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, 97 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
122--
1232.17.1
124
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
new file mode 100644
index 00000000..ce2447a5
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-fixing-the-MAX_OPCODES-to-correct-value.patch
@@ -0,0 +1,22 @@
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/0010-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch
index f94410d5..155ef3b5 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Add-new-bit-field-instructions.patch
@@ -1,7 +1,7 @@
1From 32058fa03c18d710b3029108e967be687d00516c Mon Sep 17 00:00:00 2001 1From 01453aca6478379bef05095f64ed79509da3a5ca Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530 3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 10/40] Add new bit-field instructions 4Subject: [PATCH 09/52] Add new bit-field instructions
5 5
6This patches adds new bsefi and bsifi instructions. 6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a 7BSEFI- The instruction shall extract a bit field from a
@@ -12,21 +12,25 @@ from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged 12The rest of the bits in the destination register shall be unchanged
13 13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
15--- 18---
16 opcodes/microblaze-dis.c | 17 +++++++++ 19 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
20 opcodes/microblaze-dis.c | 20 +++++++++--
17 opcodes/microblaze-opc.h | 12 ++++++- 21 opcodes/microblaze-opc.h | 12 ++++++-
18 opcodes/microblaze-opcm.h | 6 +++- 22 opcodes/microblaze-opcm.h | 6 +++-
19 4 files changed, 103 insertions(+), 3 deletions(-) 23 4 files changed, 104 insertions(+), 5 deletions(-)
20 24
21diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 25Index: gdb-9.2/opcodes/microblaze-dis.c
22index 2b3aa8e0786..356f1da22ed 100644 26===================================================================
23--- a/opcodes/microblaze-dis.c 27--- gdb-9.2.orig/opcodes/microblaze-dis.c
24+++ b/opcodes/microblaze-dis.c 28+++ gdb-9.2/opcodes/microblaze-dis.c
25@@ -90,6 +90,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) 29@@ -91,7 +91,19 @@ get_field_imm5_mbar (struct string_buf *
26 return p;
27 } 30 }
28 31
29+static char * 32 static char *
33-get_field_rfsl (struct string_buf *buf, long instr)
30+get_field_imm5width (struct string_buf *buf, long instr) 34+get_field_imm5width (struct string_buf *buf, long instr)
31+{ 35+{
32+ char *p = strbuf (buf); 36+ char *p = strbuf (buf);
@@ -38,25 +42,28 @@ index 2b3aa8e0786..356f1da22ed 100644
38+ return p; 42+ return p;
39+} 43+}
40+ 44+
41 static char * 45+static char *
42 get_field_rfsl (struct string_buf *buf, long instr) 46+get_field_rfsl (struct string_buf *buf,long instr)
43 { 47 {
44@@ -426,6 +438,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 48 char *p = strbuf (buf);
49
50@@ -425,7 +437,11 @@ print_insn_microblaze (bfd_vma memaddr,
51 /* For mbar 16 or sleep insn. */
45 case INST_TYPE_NONE: 52 case INST_TYPE_NONE:
46 break; 53 break;
47 /* For tuqula instruction */ 54- /* For tuqula instruction */
48+ /* For bit field insns. */ 55+ /* For bit field insns. */
49+ case INST_TYPE_RD_R1_IMM5_IMM5: 56+ case INST_TYPE_RD_R1_IMM5_IMM5:
50+ 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)); 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));
51+ break; 58+ break;
52+ /* For tuqula instruction */ 59+ /* For tuqula instruction */
53 case INST_TYPE_RD: 60 case INST_TYPE_RD:
54 print_func (stream, "\t%s", get_field_rd (&buf, inst)); 61 print_func (stream, "\t%s", get_field_rd (&buf, inst));
55 break; 62 break;
56diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 63Index: gdb-9.2/opcodes/microblaze-opc.h
57index d9a84e575e8..d3b234e1fcd 100644 64===================================================================
58--- a/opcodes/microblaze-opc.h 65--- gdb-9.2.orig/opcodes/microblaze-opc.h
59+++ b/opcodes/microblaze-opc.h 66+++ gdb-9.2/opcodes/microblaze-opc.h
60@@ -59,6 +59,9 @@ 67@@ -59,6 +59,9 @@
61 /* For mbar. */ 68 /* For mbar. */
62 #define INST_TYPE_IMM5 20 69 #define INST_TYPE_IMM5 20
@@ -104,10 +111,10 @@ index d9a84e575e8..d3b234e1fcd 100644
104+ 111+
105 #endif /* MICROBLAZE_OPC */ 112 #endif /* MICROBLAZE_OPC */
106 113
107diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 114Index: gdb-9.2/opcodes/microblaze-opcm.h
108index 8be6e97a1d5..c3b2b8f0f6e 100644 115===================================================================
109--- a/opcodes/microblaze-opcm.h 116--- gdb-9.2.orig/opcodes/microblaze-opcm.h
110+++ b/opcodes/microblaze-opcm.h 117+++ gdb-9.2/opcodes/microblaze-opcm.h
111@@ -29,7 +29,7 @@ enum microblaze_instr 118@@ -29,7 +29,7 @@ enum microblaze_instr
112 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 119 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
113 mulh, mulhu, mulhsu,swapb,swaph, 120 mulh, mulhu, mulhsu,swapb,swaph,
@@ -135,6 +142,3 @@ index 8be6e97a1d5..c3b2b8f0f6e 100644
135 /* FSL imm mask for get, put instructions. */ 142 /* FSL imm mask for get, put instructions. */
136 #define RFSL_MASK 0x000000F 143 #define RFSL_MASK 0x000000F
137 144
138--
1392.17.1
140
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch
index 3f3c8141..201dfeb1 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-fixing-the-imm-bug.patch
@@ -1,17 +1,17 @@
1From 121b64d9dafd3119925a7e95a09fa9f388e53922 Mon Sep 17 00:00:00 2001 1From b2dc3bfabd4d80be7d90502e3d2dc26b508679cb Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 10 Jul 2017 16:07:28 +0530 3Date: Mon, 10 Jul 2017 16:07:28 +0530
4Subject: [PATCH 11/40] fixing the imm bug. 4Subject: [PATCH 10/52] fixing the imm bug. with relax option imm -1 is also
5 getting removed this is corrected now.
5 6
6with relax option imm -1 is also getting removed this is corrected now.
7--- 7---
8 bfd/elf32-microblaze.c | 3 +-- 8 bfd/elf32-microblaze.c | 3 +--
9 1 file changed, 1 insertion(+), 2 deletions(-) 9 1 file changed, 1 insertion(+), 2 deletions(-)
10 10
11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 11Index: gdb-9.2/bfd/elf32-microblaze.c
12index cc4c0568c68..cb7271f5017 100644 12===================================================================
13--- a/bfd/elf32-microblaze.c 13--- gdb-9.2.orig/bfd/elf32-microblaze.c
14+++ b/bfd/elf32-microblaze.c 14+++ gdb-9.2/bfd/elf32-microblaze.c
15@@ -1869,8 +1869,7 @@ microblaze_elf_relax_section (bfd *abfd, 15@@ -1869,8 +1869,7 @@ microblaze_elf_relax_section (bfd *abfd,
16 else 16 else
17 symval += irel->r_addend; 17 symval += irel->r_addend;
@@ -22,6 +22,3 @@ index cc4c0568c68..cb7271f5017 100644
22 { 22 {
23 /* We can delete this instruction. */ 23 /* We can delete this instruction. */
24 sec->relax[sec->relax_count].addr = irel->r_offset; 24 sec->relax[sec->relax_count].addr = irel->r_offset;
25--
262.17.1
27
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch
index bda74adc..a2a80d53 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0014-intial-commit-of-MB-64-bit.patch
@@ -1,84 +1,92 @@
1From 48e5b2505d97ca936e9946c3945c72bdcfc1743e Mon Sep 17 00:00:00 2001 1From b6f02b2535c4051db5fdadbf03dbb88438b5d116 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: Sun, 30 Sep 2018 16:28:28 +0530
4Subject: [PATCH 15/40] intial commit of MB 64-bit 4Subject: [PATCH 14/52] intial commit of MB 64-bit
5 5
6Conflicts:
7 bfd/configure
8 bfd/configure.ac
9 bfd/cpu-microblaze.c
10 ld/Makefile.am
11 ld/Makefile.in
12 opcodes/microblaze-dis.c
6--- 13---
7 bfd/Makefile.am | 2 + 14 bfd/Makefile.am | 2 +
8 bfd/Makefile.in | 3 + 15 bfd/Makefile.in | 3 +
9 bfd/config.bfd | 4 + 16 bfd/config.bfd | 4 +
10 bfd/configure | 2 + 17 bfd/configure | 2 +
11 bfd/configure.ac | 2 + 18 bfd/configure.ac | 2 +
12 bfd/cpu-microblaze.c | 55 +- 19 bfd/cpu-microblaze.c | 53 +-
13 bfd/doc/Makefile.in | 1 + 20 bfd/elf64-microblaze.c | 3610 ++++++++++++++++++++++++++++
14 bfd/elf64-microblaze.c | 3560 ++++++++++++++++++++++++++++
15 bfd/targets.c | 6 + 21 bfd/targets.c | 6 +
22 gas/config/tc-microblaze.c | 274 ++-
23 gas/config/tc-microblaze.h | 4 +-
16 include/elf/common.h | 1 + 24 include/elf/common.h | 1 +
17 ld/Makefile.am | 4 + 25 ld/Makefile.am | 4 +
18 ld/Makefile.in | 7 + 26 ld/Makefile.in | 6 +
19 ld/configure.tgt | 3 + 27 ld/configure.tgt | 3 +
20 ld/emulparams/elf64microblaze.sh | 23 + 28 ld/emulparams/elf64microblaze.sh | 23 +
21 ld/emulparams/elf64microblazeel.sh | 23 + 29 ld/emulparams/elf64microblazeel.sh | 23 +
22 opcodes/microblaze-dis.c | 43 +- 30 opcodes/microblaze-dis.c | 35 +-
23 opcodes/microblaze-opc.h | 162 +- 31 opcodes/microblaze-opc.h | 162 +-
24 opcodes/microblaze-opcm.h | 20 +- 32 opcodes/microblaze-opcm.h | 20 +-
25 20 files changed, 4156 insertions(+), 43 deletions(-) 33 19 files changed, 4197 insertions(+), 40 deletions(-)
26 create mode 100644 bfd/elf64-microblaze.c 34 create mode 100644 bfd/elf64-microblaze.c
27 create mode 100644 ld/emulparams/elf64microblaze.sh 35 create mode 100644 ld/emulparams/elf64microblaze.sh
28 create mode 100644 ld/emulparams/elf64microblazeel.sh 36 create mode 100644 ld/emulparams/elf64microblazeel.sh
29 37
30diff --git a/bfd/Makefile.am b/bfd/Makefile.am 38Index: gdb-9.2/bfd/Makefile.am
31index e5bd28f03f5..35ecb83a1a1 100644 39===================================================================
32--- a/bfd/Makefile.am 40--- gdb-9.2.orig/bfd/Makefile.am
33+++ b/bfd/Makefile.am 41+++ gdb-9.2/bfd/Makefile.am
34@@ -558,6 +558,7 @@ BFD64_BACKENDS = \ 42@@ -568,6 +568,7 @@ BFD64_BACKENDS = \
35 elf64-ia64.lo \ 43 elf64-riscv.lo \
36 elf64-ia64-vms.lo \ 44 elfxx-riscv.lo \
37 elfxx-ia64.lo \ 45 elf64-s390.lo \
38+ elf64-microblaze.lo \ 46+ elf64-microblaze.lo \
39 elfn32-mips.lo \ 47 elf64-sparc.lo \
40 elf64-mips.lo \ 48 elf64-tilegx.lo \
41 elfxx-mips.lo \ 49 elf64-x86-64.lo \
42@@ -597,6 +598,7 @@ BFD64_BACKENDS_CFILES = \ 50@@ -602,6 +603,7 @@ BFD64_BACKENDS_CFILES = \
43 elf64-gen.c \
44 elf64-hppa.c \
45 elf64-ia64-vms.c \
46+ elf64-microblaze.c \
47 elf64-mips.c \
48 elf64-mmix.c \
49 elf64-nfp.c \ 51 elf64-nfp.c \
50diff --git a/bfd/Makefile.in b/bfd/Makefile.in 52 elf64-ppc.c \
51index 15334f10c55..89a2470ec8f 100644 53 elf64-s390.c \
52--- a/bfd/Makefile.in
53+++ b/bfd/Makefile.in
54@@ -984,6 +984,7 @@ BFD64_BACKENDS = \
55 elf64-ia64.lo \
56 elf64-ia64-vms.lo \
57 elfxx-ia64.lo \
58+ elf64-microblaze.lo \
59 elfn32-mips.lo \
60 elf64-mips.lo \
61 elfxx-mips.lo \
62@@ -1023,6 +1024,7 @@ BFD64_BACKENDS_CFILES = \
63 elf64-gen.c \
64 elf64-hppa.c \
65 elf64-ia64-vms.c \
66+ elf64-microblaze.c \ 54+ elf64-microblaze.c \
67 elf64-mips.c \ 55 elf64-sparc.c \
68 elf64-mmix.c \ 56 elf64-tilegx.c \
57 elf64-x86-64.c \
58Index: gdb-9.2/bfd/Makefile.in
59===================================================================
60--- gdb-9.2.orig/bfd/Makefile.in
61+++ gdb-9.2/bfd/Makefile.in
62@@ -994,6 +994,7 @@ BFD64_BACKENDS = \
63 elf64-riscv.lo \
64 elfxx-riscv.lo \
65 elf64-s390.lo \
66+ elf64-microblaze.lo \
67 elf64-sparc.lo \
68 elf64-tilegx.lo \
69 elf64-x86-64.lo \
70@@ -1028,6 +1029,7 @@ BFD64_BACKENDS_CFILES = \
69 elf64-nfp.c \ 71 elf64-nfp.c \
70@@ -1504,6 +1506,7 @@ distclean-compile: 72 elf64-ppc.c \
71 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@ 73 elf64-s390.c \
72 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@ 74+ elf64-microblaze.c \
73 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64.Plo@am__quote@ 75 elf64-sparc.c \
76 elf64-tilegx.c \
77 elf64-x86-64.c \
78@@ -1510,6 +1512,7 @@ distclean-compile:
79 @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@
81 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
74+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@ 82+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
75 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@ 83 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
76 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@ 84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-nfp.Plo@am__quote@ 85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
78diff --git a/bfd/config.bfd b/bfd/config.bfd 86Index: gdb-9.2/bfd/config.bfd
79index 0a96927e0ed..1fcae568c36 100644 87===================================================================
80--- a/bfd/config.bfd 88--- gdb-9.2.orig/bfd/config.bfd
81+++ b/bfd/config.bfd 89+++ gdb-9.2/bfd/config.bfd
82@@ -842,11 +842,15 @@ case "${targ}" in 90@@ -842,11 +842,15 @@ case "${targ}" in
83 microblazeel*-*) 91 microblazeel*-*)
84 targ_defvec=microblaze_elf32_le_vec 92 targ_defvec=microblaze_elf32_le_vec
@@ -95,37 +103,37 @@ index 0a96927e0ed..1fcae568c36 100644
95 ;; 103 ;;
96 104
97 #ifdef BFD64 105 #ifdef BFD64
98diff --git a/bfd/configure b/bfd/configure 106Index: gdb-9.2/bfd/configure
99index abd7b2a83e5..731c059eba0 100755 107===================================================================
100--- a/bfd/configure 108--- gdb-9.2.orig/bfd/configure
101+++ b/bfd/configure 109+++ gdb-9.2/bfd/configure
102@@ -14804,6 +14804,8 @@ do 110@@ -14879,6 +14879,8 @@ do
103 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;; 111 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
104 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 112 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
105 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 113 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
106+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 114+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
107+ microblaze_elf64_le_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 ;;
108 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 116 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
109 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 117 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
110 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 118 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
111diff --git a/bfd/configure.ac b/bfd/configure.ac 119Index: gdb-9.2/bfd/configure.ac
112index 7eee83ae4d4..b87f6183b98 100644 120===================================================================
113--- a/bfd/configure.ac 121--- gdb-9.2.orig/bfd/configure.ac
114+++ b/bfd/configure.ac 122+++ gdb-9.2/bfd/configure.ac
115@@ -540,6 +540,8 @@ do 123@@ -615,6 +615,8 @@ do
116 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;; 124 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
117 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 125 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
118 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 126 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
119+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 127+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
120+ microblaze_elf64_le_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 ;;
121 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 129 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
122 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 130 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
123 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 131 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
124diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 132Index: gdb-9.2/bfd/cpu-microblaze.c
125index 4e05d73f01b..4b48b310c6a 100644 133===================================================================
126--- a/bfd/cpu-microblaze.c 134--- gdb-9.2.orig/bfd/cpu-microblaze.c
127+++ b/bfd/cpu-microblaze.c 135+++ gdb-9.2/bfd/cpu-microblaze.c
128@@ -23,7 +23,25 @@ 136@@ -23,7 +23,24 @@
129 #include "bfd.h" 137 #include "bfd.h"
130 #include "libbfd.h" 138 #include "libbfd.h"
131 139
@@ -146,13 +154,12 @@ index 4e05d73f01b..4b48b310c6a 100644
146+ bfd_default_compatible, /* Architecture comparison function. */ 154+ bfd_default_compatible, /* Architecture comparison function. */
147+ bfd_default_scan, /* String to architecture conversion. */ 155+ bfd_default_scan, /* String to architecture conversion. */
148+ bfd_arch_default_fill, /* Default fill. */ 156+ bfd_arch_default_fill, /* Default fill. */
149+ &bfd_microblaze_arch[1], /* Next in list. */ 157+ &bfd_microblaze_arch[1] /* Next in list. */
150+ 0 /* Maximum offset of a reloc from the start of an insn. */
151+}, 158+},
152 { 159 {
153 32, /* Bits in a word. */ 160 32, /* Bits in a word. */
154 32, /* Bits in an address. */ 161 32, /* Bits in an address. */
155@@ -39,4 +57,39 @@ const bfd_arch_info_type bfd_microblaze_arch = 162@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_
156 bfd_arch_default_fill, /* Default fill. */ 163 bfd_arch_default_fill, /* Default fill. */
157 NULL, /* Next in list. */ 164 NULL, /* Next in list. */
158 0 /* Maximum offset of a reloc from the start of an insn. */ 165 0 /* Maximum offset of a reloc from the start of an insn. */
@@ -171,8 +178,7 @@ index 4e05d73f01b..4b48b310c6a 100644
171+ bfd_default_compatible, /* Architecture comparison function. */ 178+ bfd_default_compatible, /* Architecture comparison function. */
172+ bfd_default_scan, /* String to architecture conversion. */ 179+ bfd_default_scan, /* String to architecture conversion. */
173+ bfd_arch_default_fill, /* Default fill. */ 180+ bfd_arch_default_fill, /* Default fill. */
174+ &bfd_microblaze_arch[1], /* Next in list. */ 181+ &bfd_microblaze_arch[1] /* Next in list. */
175+ 0 /* Maximum offset of a reloc from the start of an insn. */
176+}, 182+},
177+{ 183+{
178+ 64, /* 32 bits in a word. */ 184+ 64, /* 32 bits in a word. */
@@ -187,29 +193,16 @@ index 4e05d73f01b..4b48b310c6a 100644
187+ bfd_default_compatible, /* Architecture comparison function. */ 193+ bfd_default_compatible, /* Architecture comparison function. */
188+ bfd_default_scan, /* String to architecture conversion. */ 194+ bfd_default_scan, /* String to architecture conversion. */
189+ bfd_arch_default_fill, /* Default fill. */ 195+ bfd_arch_default_fill, /* Default fill. */
190+ NULL, /* Next in list. */ 196+ NULL, /* Next in list. */
191+ 0 /* Maximum offset of a reloc from the start of an insn. */ 197+ 0 /* Maximum offset of a reloc from the start of an insn. */
192+} 198+}
193+#endif 199+#endif
194 }; 200 };
195diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in 201Index: gdb-9.2/bfd/elf64-microblaze.c
196index 0115dfc406c..d75411d2af7 100644 202===================================================================
197--- a/bfd/doc/Makefile.in
198+++ b/bfd/doc/Makefile.in
199@@ -375,6 +375,7 @@ pdfdir = @pdfdir@
200 prefix = @prefix@
201 program_transform_name = @program_transform_name@
202 psdir = @psdir@
203+runstatedir = @runstatedir@
204 sbindir = @sbindir@
205 sharedstatedir = @sharedstatedir@
206 srcdir = @srcdir@
207diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
208new file mode 100644
209index 00000000000..fa4b95e47e0
210--- /dev/null 203--- /dev/null
211+++ b/bfd/elf64-microblaze.c 204+++ gdb-9.2/bfd/elf64-microblaze.c
212@@ -0,0 +1,3560 @@ 205@@ -0,0 +1,3610 @@
213+/* Xilinx MicroBlaze-specific support for 32-bit ELF 206+/* Xilinx MicroBlaze-specific support for 32-bit ELF
214+ 207+
215+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 208+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -868,7 +861,7 @@ index 00000000000..fa4b95e47e0
868+/* Set the howto pointer for a RCE ELF reloc. */ 861+/* Set the howto pointer for a RCE ELF reloc. */
869+ 862+
870+static bfd_boolean 863+static bfd_boolean
871+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, 864+microblaze_elf_info_to_howto (bfd * abfd,
872+ arelent * cache_ptr, 865+ arelent * cache_ptr,
873+ Elf_Internal_Rela * dst) 866+ Elf_Internal_Rela * dst)
874+{ 867+{
@@ -881,14 +874,15 @@ index 00000000000..fa4b95e47e0
881+ r_type = ELF64_R_TYPE (dst->r_info); 874+ r_type = ELF64_R_TYPE (dst->r_info);
882+ if (r_type >= R_MICROBLAZE_max) 875+ if (r_type >= R_MICROBLAZE_max)
883+ { 876+ {
884+ (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"), 877+ /* xgettext:c-format */
885+ abfd, r_type); 878+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
879+ abfd, r_type);
886+ bfd_set_error (bfd_error_bad_value); 880+ bfd_set_error (bfd_error_bad_value);
887+ return FALSE; 881+ return FALSE;
888+ } 882+ }
889+ 883+
890+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 884+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
891+ return TRUE; 885+ return TRUE;
892+} 886+}
893+ 887+
894+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 888+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
@@ -1011,7 +1005,6 @@ index 00000000000..fa4b95e47e0
1011+ struct elf64_mb_link_hash_entry *eh; 1005+ struct elf64_mb_link_hash_entry *eh;
1012+ 1006+
1013+ eh = (struct elf64_mb_link_hash_entry *) entry; 1007+ eh = (struct elf64_mb_link_hash_entry *) entry;
1014+ eh->dyn_relocs = NULL;
1015+ eh->tls_mask = 0; 1008+ eh->tls_mask = 0;
1016+ } 1009+ }
1017+ 1010+
@@ -1024,7 +1017,7 @@ index 00000000000..fa4b95e47e0
1024+microblaze_elf_link_hash_table_create (bfd *abfd) 1017+microblaze_elf_link_hash_table_create (bfd *abfd)
1025+{ 1018+{
1026+ struct elf64_mb_link_hash_table *ret; 1019+ struct elf64_mb_link_hash_table *ret;
1027+ bfd_size_type amt = sizeof (struct elf64_mb_link_hash_table); 1020+ size_t amt = sizeof (struct elf64_mb_link_hash_table);
1028+ 1021+
1029+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt); 1022+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt);
1030+ if (ret == NULL) 1023+ if (ret == NULL)
@@ -1239,6 +1232,7 @@ index 00000000000..fa4b95e47e0
1239+ else 1232+ else
1240+ { 1233+ {
1241+ bfd_vma relocation; 1234+ bfd_vma relocation;
1235+ bfd_boolean resolved_to_zero;
1242+ 1236+
1243+ /* This is a final link. */ 1237+ /* This is a final link. */
1244+ sym = NULL; 1238+ sym = NULL;
@@ -1278,6 +1272,9 @@ index 00000000000..fa4b95e47e0
1278+ goto check_reloc; 1272+ goto check_reloc;
1279+ } 1273+ }
1280+ 1274+
1275+ resolved_to_zero = (h != NULL
1276+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
1277+
1281+ switch ((int) r_type) 1278+ switch ((int) r_type)
1282+ { 1279+ {
1283+ case (int) R_MICROBLAZE_SRO32 : 1280+ case (int) R_MICROBLAZE_SRO32 :
@@ -1312,11 +1309,14 @@ index 00000000000..fa4b95e47e0
1312+ } 1309+ }
1313+ else 1310+ else
1314+ { 1311+ {
1315+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1312+ _bfd_error_handler
1316+ bfd_get_filename (input_bfd), 1313+ /* xgettext:c-format */
1317+ sym_name, 1314+ (_("%pB: the target (%s) of an %s relocation"
1318+ microblaze_elf_howto_table[(int) r_type]->name, 1315+ " is in the wrong section (%pA)"),
1319+ bfd_section_name (sec)); 1316+ input_bfd,
1317+ sym_name,
1318+ microblaze_elf_howto_table[(int) r_type]->name,
1319+ sec);
1320+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1320+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1321+ ret = FALSE; 1321+ ret = FALSE;
1322+ continue; 1322+ continue;
@@ -1357,11 +1357,14 @@ index 00000000000..fa4b95e47e0
1357+ } 1357+ }
1358+ else 1358+ else
1359+ { 1359+ {
1360+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1360+ _bfd_error_handler
1361+ bfd_get_filename (input_bfd), 1361+ /* xgettext:c-format */
1362+ sym_name, 1362+ (_("%pB: the target (%s) of an %s relocation"
1363+ microblaze_elf_howto_table[(int) r_type]->name, 1363+ " is in the wrong section (%pA)"),
1364+ bfd_section_name (sec)); 1364+ input_bfd,
1365+ sym_name,
1366+ microblaze_elf_howto_table[(int) r_type]->name,
1367+ sec);
1365+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1368+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1366+ ret = FALSE; 1369+ ret = FALSE;
1367+ continue; 1370+ continue;
@@ -1423,7 +1426,6 @@ index 00000000000..fa4b95e47e0
1423+ goto dogot; 1426+ goto dogot;
1424+ case (int) R_MICROBLAZE_TLSLD: 1427+ case (int) R_MICROBLAZE_TLSLD:
1425+ tls_type = (TLS_TLS | TLS_LD); 1428+ tls_type = (TLS_TLS | TLS_LD);
1426+ /* Fall through. */
1427+ dogot: 1429+ dogot:
1428+ case (int) R_MICROBLAZE_GOT_64: 1430+ case (int) R_MICROBLAZE_GOT_64:
1429+ { 1431+ {
@@ -1487,7 +1489,8 @@ index 00000000000..fa4b95e47e0
1487+ /* Need to generate relocs ? */ 1489+ /* Need to generate relocs ? */
1488+ if ((bfd_link_pic (info) || indx != 0) 1490+ if ((bfd_link_pic (info) || indx != 0)
1489+ && (h == NULL 1491+ && (h == NULL
1490+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1492+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1493+ && !resolved_to_zero)
1491+ || h->root.type != bfd_link_hash_undefweak)) 1494+ || h->root.type != bfd_link_hash_undefweak))
1492+ need_relocs = TRUE; 1495+ need_relocs = TRUE;
1493+ 1496+
@@ -1549,47 +1552,47 @@ index 00000000000..fa4b95e47e0
1549+ } 1552+ }
1550+ else if (IS_TLS_GD(tls_type)) 1553+ else if (IS_TLS_GD(tls_type))
1551+ { 1554+ {
1552+ *offp |= 1; 1555+ *offp |= 1;
1553+ static_value -= dtprel_base(info); 1556+ static_value -= dtprel_base(info);
1554+ if (need_relocs) 1557+ if (need_relocs)
1555+ { 1558+ microblaze_elf_output_dynamic_relocation
1556+ microblaze_elf_output_dynamic_relocation (output_bfd, 1559+ (output_bfd,
1557+ htab->srelgot, htab->srelgot->reloc_count++, 1560+ htab->elf.srelgot,
1558+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32, 1561+ htab->elf.srelgot->reloc_count++,
1559+ got_offset, indx ? 0 : static_value); 1562+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
1560+ } 1563+ got_offset, indx ? 0 : static_value);
1561+ else 1564+ else
1562+ { 1565+ bfd_put_32 (output_bfd, static_value,
1563+ bfd_put_32 (output_bfd, static_value, 1566+ htab->elf.sgot->contents + off2);
1564+ htab->sgot->contents + off2);
1565+ }
1566+ } 1567+ }
1567+ else 1568+ else
1568+ { 1569+ {
1569+ bfd_put_32 (output_bfd, static_value, 1570+ bfd_put_32 (output_bfd, static_value,
1570+ htab->sgot->contents + off2); 1571+ htab->elf.sgot->contents + off2);
1571+ 1572+
1572+ /* Relocs for dyn symbols generated by 1573+ /* Relocs for dyn symbols generated by
1573+ finish_dynamic_symbols */ 1574+ finish_dynamic_symbols */
1574+ if (bfd_link_pic (info) && h == NULL) 1575+ if (bfd_link_pic (info) && h == NULL)
1575+ { 1576+ {
1576+ *offp |= 1; 1577+ *offp |= 1;
1577+ microblaze_elf_output_dynamic_relocation (output_bfd, 1578+ microblaze_elf_output_dynamic_relocation
1578+ htab->srelgot, htab->srelgot->reloc_count++, 1579+ (output_bfd,
1579+ /* symindex= */ indx, R_MICROBLAZE_REL, 1580+ htab->elf.srelgot,
1580+ got_offset, static_value); 1581+ htab->elf.srelgot->reloc_count++,
1581+ } 1582+ /* symindex= */ indx, R_MICROBLAZE_REL,
1583+ got_offset, static_value);
1584+ }
1582+ } 1585+ }
1583+ } 1586+ }
1584+ 1587+
1585+ /* 4. Fixup Relocation with GOT offset value 1588+ /* 4. Fixup Relocation with GOT offset value
1586+ Compute relative address of GOT entry for applying 1589+ Compute relative address of GOT entry for applying
1587+ the current relocation */ 1590+ the current relocation */
1588+ relocation = htab->sgot->output_section->vma 1591+ relocation = htab->elf.sgot->output_section->vma
1589+ + htab->sgot->output_offset 1592+ + htab->elf.sgot->output_offset
1590+ + off 1593+ + off
1591+ - htab->sgotplt->output_section->vma 1594+ - htab->elf.sgotplt->output_section->vma
1592+ - htab->sgotplt->output_offset; 1595+ - htab->elf.sgotplt->output_offset;
1593+ 1596+
1594+ /* Apply Current Relocation */ 1597+ /* Apply Current Relocation */
1595+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 1598+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
@@ -1606,8 +1609,8 @@ index 00000000000..fa4b95e47e0
1606+ bfd_vma immediate; 1609+ bfd_vma immediate;
1607+ unsigned short lo, high; 1610+ unsigned short lo, high;
1608+ relocation += addend; 1611+ relocation += addend;
1609+ relocation -= htab->sgotplt->output_section->vma 1612+ relocation -= (htab->elf.sgotplt->output_section->vma
1610+ + htab->sgotplt->output_offset; 1613+ + htab->elf.sgotplt->output_offset);
1611+ /* Write this value into correct location. */ 1614+ /* Write this value into correct location. */
1612+ immediate = relocation; 1615+ immediate = relocation;
1613+ lo = immediate & 0x0000ffff; 1616+ lo = immediate & 0x0000ffff;
@@ -1620,8 +1623,8 @@ index 00000000000..fa4b95e47e0
1620+ case (int) R_MICROBLAZE_GOTOFF_32: 1623+ case (int) R_MICROBLAZE_GOTOFF_32:
1621+ { 1624+ {
1622+ relocation += addend; 1625+ relocation += addend;
1623+ relocation -= htab->sgotplt->output_section->vma 1626+ relocation -= (htab->elf.sgotplt->output_section->vma
1624+ + htab->sgotplt->output_offset; 1627+ + htab->elf.sgotplt->output_offset);
1625+ /* Write this value into correct location. */ 1628+ /* Write this value into correct location. */
1626+ bfd_put_32 (input_bfd, relocation, contents + offset); 1629+ bfd_put_32 (input_bfd, relocation, contents + offset);
1627+ break; 1630+ break;
@@ -1663,7 +1666,8 @@ index 00000000000..fa4b95e47e0
1663+ 1666+
1664+ if ((bfd_link_pic (info) 1667+ if ((bfd_link_pic (info)
1665+ && (h == NULL 1668+ && (h == NULL
1666+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1669+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1670+ && !resolved_to_zero)
1667+ || h->root.type != bfd_link_hash_undefweak) 1671+ || h->root.type != bfd_link_hash_undefweak)
1668+ && (!howto->pc_relative 1672+ && (!howto->pc_relative
1669+ || (h != NULL 1673+ || (h != NULL
@@ -1724,7 +1728,7 @@ index 00000000000..fa4b95e47e0
1724+ { 1728+ {
1725+ BFD_FAIL (); 1729+ BFD_FAIL ();
1726+ (*_bfd_error_handler) 1730+ (*_bfd_error_handler)
1727+ (_("%pB: probably compiled without -fPIC?"), 1731+ (_("%B: probably compiled without -fPIC?"),
1728+ input_bfd); 1732+ input_bfd);
1729+ bfd_set_error (bfd_error_bad_value); 1733+ bfd_set_error (bfd_error_bad_value);
1730+ return FALSE; 1734+ return FALSE;
@@ -1823,6 +1827,21 @@ index 00000000000..fa4b95e47e0
1823+ return ret; 1827+ return ret;
1824+} 1828+}
1825+ 1829+
1830+/* Merge backend specific data from an object file to the output
1831+ object file when linking.
1832+
1833+ Note: We only use this hook to catch endian mismatches. */
1834+static bfd_boolean
1835+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
1836+{
1837+ /* Check if we have the same endianess. */
1838+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
1839+ return FALSE;
1840+
1841+ return TRUE;
1842+}
1843+
1844+
1826+/* Calculate fixup value for reference. */ 1845+/* Calculate fixup value for reference. */
1827+ 1846+
1828+static int 1847+static int
@@ -2139,7 +2158,7 @@ index 00000000000..fa4b95e47e0
2139+ irelscanend = irelocs + o->reloc_count; 2158+ irelscanend = irelocs + o->reloc_count;
2140+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 2159+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2141+ { 2160+ {
2142+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 2161+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2143+ { 2162+ {
2144+ unsigned int val; 2163+ unsigned int val;
2145+ 2164+
@@ -2498,6 +2517,17 @@ index 00000000000..fa4b95e47e0
2498+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); 2517+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2499+} 2518+}
2500+ 2519+
2520+/* Update the got entry reference counts for the section being removed. */
2521+
2522+static bfd_boolean
2523+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
2524+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
2525+ asection * sec ATTRIBUTE_UNUSED,
2526+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
2527+{
2528+ return TRUE;
2529+}
2530+
2501+/* PIC support. */ 2531+/* PIC support. */
2502+ 2532+
2503+#define PLT_ENTRY_SIZE 16 2533+#define PLT_ENTRY_SIZE 16
@@ -2614,10 +2644,9 @@ index 00000000000..fa4b95e47e0
2614+ else 2644+ else
2615+ { 2645+ {
2616+ h = sym_hashes [r_symndx - symtab_hdr->sh_info]; 2646+ h = sym_hashes [r_symndx - symtab_hdr->sh_info];
2617+ 2647+ while (h->root.type == bfd_link_hash_indirect
2618+ /* PR15323, ref flags aren't set for references in the same 2648+ || h->root.type == bfd_link_hash_warning)
2619+ object. */ 2649+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
2620+ h->root.non_ir_ref_regular = 1;
2621+ } 2650+ }
2622+ 2651+
2623+ switch (r_type) 2652+ switch (r_type)
@@ -2653,7 +2682,6 @@ index 00000000000..fa4b95e47e0
2653+ tls_type |= (TLS_TLS | TLS_LD); 2682+ tls_type |= (TLS_TLS | TLS_LD);
2654+ dogottls: 2683+ dogottls:
2655+ sec->has_tls_reloc = 1; 2684+ sec->has_tls_reloc = 1;
2656+ /* Fall through. */
2657+ case R_MICROBLAZE_GOT_64: 2685+ case R_MICROBLAZE_GOT_64:
2658+ if (htab->sgot == NULL) 2686+ if (htab->sgot == NULL)
2659+ { 2687+ {
@@ -2749,7 +2777,7 @@ index 00000000000..fa4b95e47e0
2749+ /* If this is a global symbol, we count the number of 2777+ /* If this is a global symbol, we count the number of
2750+ relocations we need for this symbol. */ 2778+ relocations we need for this symbol. */
2751+ if (h != NULL) 2779+ if (h != NULL)
2752+ head = &((struct elf64_mb_link_hash_entry *) h)->dyn_relocs; 2780+ head = &h->dyn_relocs;
2753+ else 2781+ else
2754+ { 2782+ {
2755+ /* Track dynamic relocs needed for local syms too. 2783+ /* Track dynamic relocs needed for local syms too.
@@ -2776,7 +2804,7 @@ index 00000000000..fa4b95e47e0
2776+ p = *head; 2804+ p = *head;
2777+ if (p == NULL || p->sec != sec) 2805+ if (p == NULL || p->sec != sec)
2778+ { 2806+ {
2779+ bfd_size_type amt = sizeof *p; 2807+ size_t amt = sizeof *p;
2780+ p = ((struct elf64_mb_dyn_relocs *) 2808+ p = ((struct elf64_mb_dyn_relocs *)
2781+ bfd_alloc (htab->elf.dynobj, amt)); 2809+ bfd_alloc (htab->elf.dynobj, amt));
2782+ if (p == NULL) 2810+ if (p == NULL)
@@ -2886,7 +2914,8 @@ index 00000000000..fa4b95e47e0
2886+ struct elf64_mb_link_hash_table *htab; 2914+ struct elf64_mb_link_hash_table *htab;
2887+ struct elf64_mb_link_hash_entry * eh; 2915+ struct elf64_mb_link_hash_entry * eh;
2888+ struct elf64_mb_dyn_relocs *p; 2916+ struct elf64_mb_dyn_relocs *p;
2889+ asection *sdynbss, *s; 2917+ asection *sdynbss;
2918+ asection *s, *srel;
2890+ unsigned int power_of_two; 2919+ unsigned int power_of_two;
2891+ bfd *dynobj; 2920+ bfd *dynobj;
2892+ 2921+
@@ -2968,7 +2997,7 @@ index 00000000000..fa4b95e47e0
2968+ 2997+
2969+ /* If we didn't find any dynamic relocs in read-only sections, then 2998+ /* If we didn't find any dynamic relocs in read-only sections, then
2970+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ 2999+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
2971+ if (p == NULL) 3000+ if (!_bfd_elf_readonly_dynrelocs (h))
2972+ { 3001+ {
2973+ h->non_got_ref = 0; 3002+ h->non_got_ref = 0;
2974+ return TRUE; 3003+ return TRUE;
@@ -2987,11 +3016,19 @@ index 00000000000..fa4b95e47e0
2987+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker 3016+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
2988+ to copy the initial value out of the dynamic object and into the 3017+ to copy the initial value out of the dynamic object and into the
2989+ runtime process image. */ 3018+ runtime process image. */
2990+ dynobj = elf_hash_table (info)->dynobj; 3019+ if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
2991+ BFD_ASSERT (dynobj != NULL); 3020+ {
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+ }
2992+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) 3029+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
2993+ { 3030+ {
2994+ htab->srelbss->size += sizeof (Elf64_External_Rela); 3031+ srel->size += sizeof (Elf64_External_Rela);
2995+ h->needs_copy = 1; 3032+ h->needs_copy = 1;
2996+ } 3033+ }
2997+ 3034+
@@ -3001,21 +3038,20 @@ index 00000000000..fa4b95e47e0
3001+ if (power_of_two > 3) 3038+ if (power_of_two > 3)
3002+ power_of_two = 3; 3039+ power_of_two = 3;
3003+ 3040+
3004+ sdynbss = htab->sdynbss;
3005+ /* Apply the required alignment. */ 3041+ /* Apply the required alignment. */
3006+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two)); 3042+ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
3007+ if (power_of_two > bfd_section_alignment (sdynbss)) 3043+ if (power_of_two > s->alignment_power)
3008+ { 3044+ {
3009+ if (! bfd_set_section_alignment (sdynbss, power_of_two)) 3045+ if (!bfd_set_section_alignment (s, power_of_two))
3010+ return FALSE; 3046+ return FALSE;
3011+ } 3047+ }
3012+ 3048+
3013+ /* Define the symbol as being at this point in the section. */ 3049+ /* Define the symbol as being at this point in the section. */
3014+ h->root.u.def.section = sdynbss; 3050+ h->root.u.def.section = s;
3015+ h->root.u.def.value = sdynbss->size; 3051+ h->root.u.def.value = s->size;
3016+ 3052+
3017+ /* Increment the section size to make room for the symbol. */ 3053+ /* Increment the section size to make room for the symbol. */
3018+ sdynbss->size += h->size; 3054+ s->size += h->size;
3019+ return TRUE; 3055+ return TRUE;
3020+} 3056+}
3021+ 3057+
@@ -3075,13 +3111,13 @@ index 00000000000..fa4b95e47e0
3075+ /* Make room for this entry. */ 3111+ /* Make room for this entry. */
3076+ s->size += PLT_ENTRY_SIZE; 3112+ s->size += PLT_ENTRY_SIZE;
3077+ 3113+
3078+ /* We also need to make an entry in the .got.plt section, which 3114+ /* We also need to make an entry in the .got.plt section, which
3079+ will be placed in the .got section by the linker script. */ 3115+ will be placed in the .got section by the linker script. */
3080+ htab->sgotplt->size += 4; 3116+ htab->elf.sgotplt->size += 4;
3081+ 3117+
3082+ /* We also need to make an entry in the .rel.plt section. */ 3118+ /* We also need to make an entry in the .rel.plt section. */
3083+ htab->srelplt->size += sizeof (Elf64_External_Rela); 3119+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
3084+ } 3120+ }
3085+ else 3121+ else
3086+ { 3122+ {
3087+ h->plt.offset = (bfd_vma) -1; 3123+ h->plt.offset = (bfd_vma) -1;
@@ -3136,17 +3172,17 @@ index 00000000000..fa4b95e47e0
3136+ h->got.offset = (bfd_vma) -1; 3172+ h->got.offset = (bfd_vma) -1;
3137+ } 3173+ }
3138+ else 3174+ else
3139+ { 3175+ {
3140+ s = htab->sgot; 3176+ s = htab->elf.sgot;
3141+ h->got.offset = s->size; 3177+ h->got.offset = s->size;
3142+ s->size += need; 3178+ s->size += need;
3143+ htab->srelgot->size += need * (sizeof (Elf64_External_Rela) / 4); 3179+ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4);
3144+ } 3180+ }
3145+ } 3181+ }
3146+ else 3182+ else
3147+ h->got.offset = (bfd_vma) -1; 3183+ h->got.offset = (bfd_vma) -1;
3148+ 3184+
3149+ if (eh->dyn_relocs == NULL) 3185+ if (h->dyn_relocs == NULL)
3150+ return TRUE; 3186+ return TRUE;
3151+ 3187+
3152+ /* In the shared -Bsymbolic case, discard space allocated for 3188+ /* In the shared -Bsymbolic case, discard space allocated for
@@ -3163,7 +3199,7 @@ index 00000000000..fa4b95e47e0
3163+ { 3199+ {
3164+ struct elf64_mb_dyn_relocs **pp; 3200+ struct elf64_mb_dyn_relocs **pp;
3165+ 3201+
3166+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) 3202+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
3167+ { 3203+ {
3168+ p->count -= p->pc_count; 3204+ p->count -= p->pc_count;
3169+ p->pc_count = 0; 3205+ p->pc_count = 0;
@@ -3173,6 +3209,8 @@ index 00000000000..fa4b95e47e0
3173+ pp = &p->next; 3209+ pp = &p->next;
3174+ } 3210+ }
3175+ } 3211+ }
3212+ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
3213+ h->dyn_relocs = NULL;
3176+ } 3214+ }
3177+ else 3215+ else
3178+ { 3216+ {
@@ -3202,13 +3240,13 @@ index 00000000000..fa4b95e47e0
3202+ goto keep; 3240+ goto keep;
3203+ } 3241+ }
3204+ 3242+
3205+ eh->dyn_relocs = NULL; 3243+ h->dyn_relocs = NULL;
3206+ 3244+
3207+ keep: ; 3245+ keep: ;
3208+ } 3246+ }
3209+ 3247+
3210+ /* Finally, allocate space. */ 3248+ /* Finally, allocate space. */
3211+ for (p = eh->dyn_relocs; p != NULL; p = p->next) 3249+ for (p = h->dyn_relocs; p != NULL; p = p->next)
3212+ { 3250+ {
3213+ asection *sreloc = elf_section_data (p->sec)->sreloc; 3251+ asection *sreloc = elf_section_data (p->sec)->sreloc;
3214+ sreloc->size += p->count * sizeof (Elf64_External_Rela); 3252+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
@@ -3284,8 +3322,8 @@ index 00000000000..fa4b95e47e0
3284+ locsymcount = symtab_hdr->sh_info; 3322+ locsymcount = symtab_hdr->sh_info;
3285+ end_local_got = local_got + locsymcount; 3323+ end_local_got = local_got + locsymcount;
3286+ lgot_masks = (unsigned char *) end_local_got; 3324+ lgot_masks = (unsigned char *) end_local_got;
3287+ s = htab->sgot; 3325+ s = htab->elf.sgot;
3288+ srel = htab->srelgot; 3326+ srel = htab->elf.srelgot;
3289+ 3327+
3290+ for (; local_got < end_local_got; ++local_got, ++lgot_masks) 3328+ for (; local_got < end_local_got; ++local_got, ++lgot_masks)
3291+ { 3329+ {
@@ -3325,10 +3363,10 @@ index 00000000000..fa4b95e47e0
3325+ 3363+
3326+ if (htab->tlsld_got.refcount > 0) 3364+ if (htab->tlsld_got.refcount > 0)
3327+ { 3365+ {
3328+ htab->tlsld_got.offset = htab->sgot->size; 3366+ htab->tlsld_got.offset = htab->elf.sgot->size;
3329+ htab->sgot->size += 8; 3367+ htab->elf.sgot->size += 8;
3330+ if (bfd_link_pic (info)) 3368+ if (bfd_link_pic (info))
3331+ htab->srelgot->size += sizeof (Elf64_External_Rela); 3369+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
3332+ } 3370+ }
3333+ else 3371+ else
3334+ htab->tlsld_got.offset = (bfd_vma) -1; 3372+ htab->tlsld_got.offset = (bfd_vma) -1;
@@ -3336,8 +3374,8 @@ index 00000000000..fa4b95e47e0
3336+ if (elf_hash_table (info)->dynamic_sections_created) 3374+ if (elf_hash_table (info)->dynamic_sections_created)
3337+ { 3375+ {
3338+ /* Make space for the trailing nop in .plt. */ 3376+ /* Make space for the trailing nop in .plt. */
3339+ if (htab->splt->size > 0) 3377+ if (htab->elf.splt->size > 0)
3340+ htab->splt->size += 4; 3378+ htab->elf.splt->size += 4;
3341+ } 3379+ }
3342+ 3380+
3343+ /* The check_relocs and adjust_dynamic_symbol entry points have 3381+ /* The check_relocs and adjust_dynamic_symbol entry points have
@@ -3352,36 +3390,40 @@ index 00000000000..fa4b95e47e0
3352+ continue; 3390+ continue;
3353+ 3391+
3354+ /* It's OK to base decisions on the section name, because none 3392+ /* It's OK to base decisions on the section name, because none
3355+ of the dynobj section names depend upon the input files. */ 3393+ of the dynobj section names depend upon the input files. */
3356+ name = bfd_section_name (s); 3394+ name = bfd_section_name (s);
3357+ 3395+
3358+ if (strncmp (name, ".rela", 5) == 0) 3396+ if (strncmp (name, ".rela", 5) == 0)
3359+ { 3397+ {
3360+ if (s->size == 0) 3398+ if (s->size == 0)
3361+ { 3399+ {
3362+ /* If we don't need this section, strip it from the 3400+ /* If we don't need this section, strip it from the
3363+ output file. This is to handle .rela.bss and 3401+ output file. This is to handle .rela.bss and
3364+ .rela.plt. We must create it in 3402+ .rela.plt. We must create it in
3365+ create_dynamic_sections, because it must be created 3403+ create_dynamic_sections, because it must be created
3366+ before the linker maps input sections to output 3404+ before the linker maps input sections to output
3367+ sections. The linker does that before 3405+ sections. The linker does that before
3368+ adjust_dynamic_symbol is called, and it is that 3406+ adjust_dynamic_symbol is called, and it is that
3369+ function which decides whether anything needs to go 3407+ function which decides whether anything needs to go
3370+ into these sections. */ 3408+ into these sections. */
3371+ strip = TRUE; 3409+ strip = TRUE;
3372+ } 3410+ }
3373+ else 3411+ else
3374+ { 3412+ {
3375+ /* We use the reloc_count field as a counter if we need 3413+ /* We use the reloc_count field as a counter if we need
3376+ to copy relocs into the output file. */ 3414+ to copy relocs into the output file. */
3377+ s->reloc_count = 0; 3415+ s->reloc_count = 0;
3378+ } 3416+ }
3379+ } 3417+ }
3380+ else if (s != htab->splt && s != htab->sgot && s != htab->sgotplt) 3418+ else if (s != htab->elf.splt
3381+ { 3419+ && s != htab->elf.sgot
3382+ /* It's not one of our sections, so don't allocate space. */ 3420+ && s != htab->elf.sgotplt
3383+ continue; 3421+ && s != htab->elf.sdynbss
3384+ } 3422+ && s != htab->elf.sdynrelro)
3423+ {
3424+ /* It's not one of our sections, so don't allocate space. */
3425+ continue;
3426+ }
3385+ 3427+
3386+ if (strip) 3428+ if (strip)
3387+ { 3429+ {
@@ -3483,7 +3525,7 @@ index 00000000000..fa4b95e47e0
3483+ 3525+
3484+ /* For non-PIC objects we need absolute address of the GOT entry. */ 3526+ /* For non-PIC objects we need absolute address of the GOT entry. */
3485+ if (!bfd_link_pic (info)) 3527+ if (!bfd_link_pic (info))
3486+ got_addr += htab->sgotplt->output_section->vma + sgotplt->output_offset; 3528+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset;
3487+ 3529+
3488+ /* Fill in the entry in the procedure linkage table. */ 3530+ /* Fill in the entry in the procedure linkage table. */
3489+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), 3531+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
@@ -3535,8 +3577,8 @@ index 00000000000..fa4b95e47e0
3535+ /* This symbol has an entry in the global offset table. Set it 3577+ /* This symbol has an entry in the global offset table. Set it
3536+ up. */ 3578+ up. */
3537+ 3579+
3538+ sgot = htab->sgot; 3580+ sgot = htab->elf.sgot;
3539+ srela = htab->srelgot; 3581+ srela = htab->elf.srelgot;
3540+ BFD_ASSERT (sgot != NULL && srela != NULL); 3582+ BFD_ASSERT (sgot != NULL && srela != NULL);
3541+ 3583+
3542+ offset = (sgot->output_section->vma + sgot->output_offset 3584+ offset = (sgot->output_section->vma + sgot->output_offset
@@ -3683,7 +3725,7 @@ index 00000000000..fa4b95e47e0
3683+ 3725+
3684+ /* Set the first entry in the global offset table to the address of 3726+ /* Set the first entry in the global offset table to the address of
3685+ the dynamic section. */ 3727+ the dynamic section. */
3686+ sgot = bfd_get_linker_section (dynobj, ".got.plt"); 3728+ sgot = htab->elf.sgotplt;
3687+ if (sgot && sgot->size > 0) 3729+ if (sgot && sgot->size > 0)
3688+ { 3730+ {
3689+ if (sdyn == NULL) 3731+ if (sdyn == NULL)
@@ -3695,8 +3737,8 @@ index 00000000000..fa4b95e47e0
3695+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; 3737+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
3696+ } 3738+ }
3697+ 3739+
3698+ if (htab->sgot && htab->sgot->size > 0) 3740+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
3699+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4; 3741+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
3700+ 3742+
3701+ return TRUE; 3743+ return TRUE;
3702+} 3744+}
@@ -3721,8 +3763,8 @@ index 00000000000..fa4b95e47e0
3721+ put into .sbss. */ 3763+ put into .sbss. */
3722+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 3764+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3723+ if (*secp == NULL 3765+ if (*secp == NULL
3724+ || ! bfd_set_section_flags (*secp, SEC_IS_COMMON)) 3766+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON))
3725+ return FALSE; 3767+ return FALSE;
3726+ 3768+
3727+ *valp = sym->st_size; 3769+ *valp = sym->st_size;
3728+ } 3770+ }
@@ -3748,10 +3790,11 @@ index 00000000000..fa4b95e47e0
3748+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name 3790+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3749+#define elf_backend_relocate_section microblaze_elf_relocate_section 3791+#define elf_backend_relocate_section microblaze_elf_relocate_section
3750+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section 3792+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3751+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match 3793+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
3752+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup 3794+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3753+ 3795+
3754+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook 3796+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3797+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
3755+#define elf_backend_check_relocs microblaze_elf_check_relocs 3798+#define elf_backend_check_relocs microblaze_elf_check_relocs
3756+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol 3799+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3757+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create 3800+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
@@ -3770,11 +3813,11 @@ index 00000000000..fa4b95e47e0
3770+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 3813+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
3771+ 3814+
3772+#include "elf64-target.h" 3815+#include "elf64-target.h"
3773diff --git a/bfd/targets.c b/bfd/targets.c 3816Index: gdb-9.2/bfd/targets.c
3774index fb0c669e7f7..97b0e473e16 100644 3817===================================================================
3775--- a/bfd/targets.c 3818--- gdb-9.2.orig/bfd/targets.c
3776+++ b/bfd/targets.c 3819+++ gdb-9.2/bfd/targets.c
3777@@ -779,6 +779,8 @@ extern const bfd_target mep_elf32_le_vec; 3820@@ -779,6 +779,8 @@ extern const bfd_target mep_elf32_le_vec
3778 extern const bfd_target metag_elf32_vec; 3821 extern const bfd_target metag_elf32_vec;
3779 extern const bfd_target microblaze_elf32_vec; 3822 extern const bfd_target microblaze_elf32_vec;
3780 extern const bfd_target microblaze_elf32_le_vec; 3823 extern const bfd_target microblaze_elf32_le_vec;
@@ -3783,7 +3826,7 @@ index fb0c669e7f7..97b0e473e16 100644
3783 extern const bfd_target mips_ecoff_be_vec; 3826 extern const bfd_target mips_ecoff_be_vec;
3784 extern const bfd_target mips_ecoff_le_vec; 3827 extern const bfd_target mips_ecoff_le_vec;
3785 extern const bfd_target mips_ecoff_bele_vec; 3828 extern const bfd_target mips_ecoff_bele_vec;
3786@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_target_vector[] = 3829@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_tar
3787 3830
3788 &metag_elf32_vec, 3831 &metag_elf32_vec,
3789 3832
@@ -3794,10 +3837,10 @@ index fb0c669e7f7..97b0e473e16 100644
3794 &microblaze_elf32_vec, 3837 &microblaze_elf32_vec,
3795 3838
3796 &mips_ecoff_be_vec, 3839 &mips_ecoff_be_vec,
3797diff --git a/include/elf/common.h b/include/elf/common.h 3840Index: gdb-9.2/include/elf/common.h
3798index 75c4fb7e9d7..1584e1c87d0 100644 3841===================================================================
3799--- a/include/elf/common.h 3842--- gdb-9.2.orig/include/elf/common.h
3800+++ b/include/elf/common.h 3843+++ gdb-9.2/include/elf/common.h
3801@@ -339,6 +339,7 @@ 3844@@ -339,6 +339,7 @@
3802 #define EM_RISCV 243 /* RISC-V */ 3845 #define EM_RISCV 243 /* RISC-V */
3803 #define EM_LANAI 244 /* Lanai 32-bit processor. */ 3846 #define EM_LANAI 244 /* Lanai 32-bit processor. */
@@ -3806,10 +3849,66 @@ index 75c4fb7e9d7..1584e1c87d0 100644
3806 #define EM_NFP 250 /* Netronome Flow Processor. */ 3849 #define EM_NFP 250 /* Netronome Flow Processor. */
3807 #define EM_CSKY 252 /* C-SKY processor family. */ 3850 #define EM_CSKY 252 /* C-SKY processor family. */
3808 3851
3809diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 3852Index: gdb-9.2/ld/emulparams/elf64microblaze.sh
3810index 356f1da22ed..437f536e96a 100644 3853===================================================================
3811--- a/opcodes/microblaze-dis.c 3854--- /dev/null
3812+++ b/opcodes/microblaze-dis.c 3855+++ gdb-9.2/ld/emulparams/elf64microblaze.sh
3856@@ -0,0 +1,23 @@
3857+SCRIPT_NAME=elfmicroblaze
3858+OUTPUT_FORMAT="elf64-microblazeel"
3859+#BIG_OUTPUT_FORMAT="elf64-microblaze"
3860+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
3861+#TEXT_START_ADDR=0
3862+NONPAGED_TEXT_START_ADDR=0x28
3863+ALIGNMENT=4
3864+MAXPAGESIZE=4
3865+ARCH=microblaze
3866+EMBEDDED=yes
3867+
3868+NOP=0x80000000
3869+
3870+# Hmmm, there's got to be a better way. This sets the stack to the
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
3813@@ -33,6 +33,7 @@ 3912@@ -33,6 +33,7 @@
3814 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW) 3913 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
3815 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW) 3914 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
@@ -3818,30 +3917,29 @@ index 356f1da22ed..437f536e96a 100644
3818 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) 3917 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
3819 3918
3820 #define NUM_STRBUFS 3 3919 #define NUM_STRBUFS 3
3821@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr) 3920@@ -73,11 +74,19 @@ get_field_imm (struct string_buf *buf, l
3822 } 3921 }
3823 3922
3824 static char * 3923 static char *
3825-get_field_imm5 (struct string_buf *buf, long instr) 3924-get_field_imm5 (struct string_buf *buf, long instr)
3826+get_field_imml (struct string_buf *buf, long instr) 3925+get_field_imml (struct string_buf *buf, long instr)
3827 { 3926+{
3828 char *p = strbuf (buf); 3927+ char *p = strbuf (buf);
3829
3830- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
3831+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 3928+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
3832+ return p; 3929+ return p;
3833+} 3930+}
3834+ 3931+
3835+static char * 3932+static char *
3836+get_field_imms (struct string_buf *buf, long instr) 3933+get_field_imms (struct string_buf *buf, long instr)
3837+{ 3934 {
3838+ char *p = strbuf (buf); 3935 char *p = strbuf (buf);
3839+ 3936
3937- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
3840+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW)); 3938+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
3841 return p; 3939 return p;
3842 } 3940 }
3843 3941
3844@@ -91,14 +101,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) 3942@@ -91,14 +100,14 @@ get_field_imm5_mbar (struct string_buf *
3845 } 3943 }
3846 3944
3847 static char * 3945 static char *
@@ -3859,55 +3957,48 @@ index 356f1da22ed..437f536e96a 100644
3859 return p; 3957 return p;
3860 } 3958 }
3861 3959
3862@@ -306,9 +316,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3960@@ -306,9 +315,13 @@ print_insn_microblaze (bfd_vma memaddr,
3863 } 3961 }
3864 } 3962 }
3865 break; 3963 break;
3866- case INST_TYPE_RD_R1_IMM5: 3964- case INST_TYPE_RD_R1_IMM5:
3867+ case INST_TYPE_RD_R1_IMML: 3965+ case INST_TYPE_RD_R1_IMML:
3868 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 3966+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3869- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst)); 3967+ get_field_r1 (&buf, inst), get_field_imm (&buf, inst));
3870+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
3871+ /* TODO: Also print symbol */ 3968+ /* TODO: Also print symbol */
3872+ break;
3873+ case INST_TYPE_RD_R1_IMMS: 3969+ case INST_TYPE_RD_R1_IMMS:
3874+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 3970 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3971- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
3875+ get_field_r1(&buf, inst), get_field_imms (&buf, inst)); 3972+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
3876 break; 3973 break;
3877 case INST_TYPE_RD_RFSL: 3974 case INST_TYPE_RD_RFSL:
3878 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 3975 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3879@@ -412,9 +427,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3976@@ -415,6 +428,10 @@ print_insn_microblaze (bfd_vma memaddr,
3880 } 3977 case INST_TYPE_RD_R2:
3881 } 3978 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3882 break; 3979 get_field_r2 (&buf, inst));
3883- case INST_TYPE_RD_R2: 3980+ break;
3884- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3885- get_field_r2 (&buf, inst));
3886+ case INST_TYPE_IMML: 3981+ case INST_TYPE_IMML:
3887+ print_func (stream, "\t%s", get_field_imml (&buf, inst)); 3982+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
3888+ /* TODO: Also print symbol */ 3983+ /* TODO: Also print symbol */
3889+ break;
3890+ case INST_TYPE_RD_R2:
3891+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
3892 break; 3984 break;
3893 case INST_TYPE_R2: 3985 case INST_TYPE_R2:
3894 print_func (stream, "\t%s", get_field_r2 (&buf, inst)); 3986 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
3895@@ -439,8 +457,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3987@@ -438,8 +455,8 @@ print_insn_microblaze (bfd_vma memaddr,
3988 case INST_TYPE_NONE:
3896 break; 3989 break;
3897 /* For tuqula instruction */
3898 /* For bit field insns. */ 3990 /* For bit field insns. */
3899- case INST_TYPE_RD_R1_IMM5_IMM5: 3991- case INST_TYPE_RD_R1_IMM5_IMM5:
3900- 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)); 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));
3901+ case INST_TYPE_RD_R1_IMMW_IMMS: 3993+ case INST_TYPE_RD_R1_IMMW_IMMS:
3902+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst), 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));
3903+ get_field_immw (&buf, inst), get_field_imms (&buf, inst)); 3995 break;
3904 break;
3905 /* For tuqula instruction */ 3996 /* For tuqula instruction */
3906 case INST_TYPE_RD: 3997 case INST_TYPE_RD:
3907diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 3998Index: gdb-9.2/opcodes/microblaze-opc.h
3908index d3b234e1fcd..28dc991c430 100644 3999===================================================================
3909--- a/opcodes/microblaze-opc.h 4000--- gdb-9.2.orig/opcodes/microblaze-opc.h
3910+++ b/opcodes/microblaze-opc.h 4001+++ gdb-9.2/opcodes/microblaze-opc.h
3911@@ -40,7 +40,7 @@ 4002@@ -40,7 +40,7 @@
3912 #define INST_TYPE_RD_SPECIAL 11 4003 #define INST_TYPE_RD_SPECIAL 11
3913 #define INST_TYPE_R1 12 4004 #define INST_TYPE_R1 12
@@ -4132,10 +4223,10 @@ index d3b234e1fcd..28dc991c430 100644
4132+ 4223+
4133 #endif /* MICROBLAZE_OPC */ 4224 #endif /* MICROBLAZE_OPC */
4134 4225
4135diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 4226Index: gdb-9.2/opcodes/microblaze-opcm.h
4136index c3b2b8f0f6e..ad475a4af15 100644 4227===================================================================
4137--- a/opcodes/microblaze-opcm.h 4228--- gdb-9.2.orig/opcodes/microblaze-opcm.h
4138+++ b/opcodes/microblaze-opcm.h 4229+++ gdb-9.2/opcodes/microblaze-opcm.h
4139@@ -25,6 +25,7 @@ 4230@@ -25,6 +25,7 @@
4140 4231
4141 enum microblaze_instr 4232 enum microblaze_instr
@@ -4184,6 +4275,3 @@ index c3b2b8f0f6e..ad475a4af15 100644
4184 4275
4185 /* FSL imm mask for get, put instructions. */ 4276 /* FSL imm mask for get, put instructions. */
4186 #define RFSL_MASK 0x000000F 4277 #define RFSL_MASK 0x000000F
4187--
41882.17.1
4189
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch
index 8bf07398..6f5e0b6c 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0015-MB-X-initial-commit.patch
@@ -1,50 +1,55 @@
1From f82b24b2685d0cde8f8fdd0a1dcffe7b76b2027c Mon Sep 17 00:00:00 2001 1From 070b7b1f35dedc41b1ba9a228d701485b2239ac0 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:31:26 +0530 3Date: Sun, 30 Sep 2018 16:31:26 +0530
4Subject: [PATCH 16/40] MB-X initial commit code cleanup is needed. 4Subject: [PATCH 15/52] MB-X initial commit code cleanup is needed.
5 5
6Conflicts:
7 bfd/elf32-microblaze.c
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-opcm.h
6--- 10---
7 bfd/bfd-in2.h | 10 +++ 11 bfd/bfd-in2.h | 10 +++
8 bfd/elf32-microblaze.c | 63 +++++++++++++++++- 12 bfd/elf32-microblaze.c | 59 +++++++++++++-
9 bfd/elf64-microblaze.c | 59 +++++++++++++++++ 13 bfd/elf64-microblaze.c | 61 ++++++++++++++-
10 bfd/libbfd.h | 2 + 14 bfd/libbfd.h | 2 +
11 bfd/reloc.c | 12 ++++ 15 bfd/reloc.c | 12 +++
16 gas/config/tc-microblaze.c | 154 ++++++++++++++++++++++++++++++-------
12 include/elf/microblaze.h | 2 + 17 include/elf/microblaze.h | 2 +
13 opcodes/microblaze-opc.h | 4 +- 18 opcodes/microblaze-opc.h | 10 +--
14 opcodes/microblaze-opcm.h | 4 +- 19 opcodes/microblaze-opcm.h | 4 +-
15 9 files changed, 243 insertions(+), 40 deletions(-) 20 9 files changed, 278 insertions(+), 36 deletions(-)
16 21
17diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 22Index: gdb-9.2/bfd/bfd-in2.h
18index 52c81b10b6d..c6738960bb2 100644 23===================================================================
19--- a/bfd/bfd-in2.h 24--- gdb-9.2.orig/bfd/bfd-in2.h
20+++ b/bfd/bfd-in2.h 25+++ gdb-9.2/bfd/bfd-in2.h
21@@ -5373,11 +5373,21 @@ value in two words (with an imm instruction). No relocation is 26@@ -5374,11 +5374,21 @@ done here - only used for relaxing */
22 done here - only used for relaxing */
23 BFD_RELOC_MICROBLAZE_64_NONE, 27 BFD_RELOC_MICROBLAZE_64_NONE,
24 28
25+/* This is a 64 bit reloc that stores the 32 bit pc relative
26+value in two words (with an imml instruction). No relocation is
27+done here - only used for relaxing */
28+ BFD_RELOC_MICROBLAZE_64,
29+
30 /* This is a 64 bit reloc that stores the 32 bit pc relative 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
31 value in two words (with an imm instruction). The relocation is 35 value in two words (with an imm instruction). The relocation is
32 PC-relative GOT offset */ 36 PC-relative GOT offset */
33 BFD_RELOC_MICROBLAZE_64_GOTPC, 37 BFD_RELOC_MICROBLAZE_64_GOTPC,
34 38
35+/* This is a 64 bit reloc that stores the 32 bit pc relative 39 /* This is a 64 bit reloc that stores the 32 bit pc relative
36+value in two words (with an imml instruction). The relocation is 40+value in two words (with an imml instruction). The relocation is
37+PC-relative GOT offset */ 41+PC-relative GOT offset */
38+ BFD_RELOC_MICROBLAZE_64_GPC, 42+ BFD_RELOC_MICROBLAZE_64_GPC,
39+ 43+
40 /* This is a 64 bit reloc that stores the 32 bit pc relative 44+/* This is a 64 bit reloc that stores the 32 bit pc relative
41 value in two words (with an imm instruction). The relocation is 45 value in two words (with an imm instruction). The relocation is
42 GOT offset */ 46 GOT offset */
43diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 47 BFD_RELOC_MICROBLAZE_64_GOT,
44index cb7271f5017..a31b407cfbf 100644 48Index: gdb-9.2/bfd/elf32-microblaze.c
45--- a/bfd/elf32-microblaze.c 49===================================================================
46+++ b/bfd/elf32-microblaze.c 50--- gdb-9.2.orig/bfd/elf32-microblaze.c
47@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 51+++ gdb-9.2/bfd/elf32-microblaze.c
52@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_h
48 0x0000ffff, /* Dest Mask. */ 53 0x0000ffff, /* Dest Mask. */
49 TRUE), /* PC relative offset? */ 54 TRUE), /* PC relative offset? */
50 55
@@ -65,7 +70,7 @@ index cb7271f5017..a31b407cfbf 100644
65 /* A 64 bit relocation. Table entry not really used. */ 70 /* A 64 bit relocation. Table entry not really used. */
66 HOWTO (R_MICROBLAZE_64, /* Type. */ 71 HOWTO (R_MICROBLAZE_64, /* Type. */
67 0, /* Rightshift. */ 72 0, /* Rightshift. */
68@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 73@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_h
69 0x0000ffff, /* Dest Mask. */ 74 0x0000ffff, /* Dest Mask. */
70 TRUE), /* PC relative offset? */ 75 TRUE), /* PC relative offset? */
71 76
@@ -87,7 +92,7 @@ index cb7271f5017..a31b407cfbf 100644
87 /* A 64 bit GOT relocation. Table-entry not really used. */ 92 /* A 64 bit GOT relocation. Table-entry not really used. */
88 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ 93 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
89 0, /* Rightshift. */ 94 0, /* Rightshift. */
90@@ -619,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 95@@ -619,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd *
91 case BFD_RELOC_VTABLE_ENTRY: 96 case BFD_RELOC_VTABLE_ENTRY:
92 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 97 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
93 break; 98 break;
@@ -103,6 +108,15 @@ index cb7271f5017..a31b407cfbf 100644
103 case BFD_RELOC_MICROBLAZE_64_GOT: 108 case BFD_RELOC_MICROBLAZE_64_GOT:
104 microblaze_reloc = R_MICROBLAZE_GOT_64; 109 microblaze_reloc = R_MICROBLAZE_GOT_64;
105 break; 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 {
106@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd, 120@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd,
107 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 121 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
108 } 122 }
@@ -110,7 +124,7 @@ index cb7271f5017..a31b407cfbf 100644
110+ case R_MICROBLAZE_IMML_64: 124+ case R_MICROBLAZE_IMML_64:
111+ { 125+ {
112+ /* This was a PC-relative instruction that was 126+ /* This was a PC-relative instruction that was
113+ completely resolved. */ 127+ completely resolved. */
114+ int sfix, efix; 128+ int sfix, efix;
115+ unsigned int val; 129+ unsigned int val;
116+ bfd_vma target_address; 130+ bfd_vma target_address;
@@ -132,28 +146,14 @@ index cb7271f5017..a31b407cfbf 100644
132 case R_MICROBLAZE_NONE: 146 case R_MICROBLAZE_NONE:
133 case R_MICROBLAZE_32_NONE: 147 case R_MICROBLAZE_32_NONE:
134 { 148 {
135@@ -2038,9 +2095,9 @@ microblaze_elf_relax_section (bfd *abfd, 149Index: gdb-9.2/bfd/elf64-microblaze.c
136 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 150===================================================================
137 irelscan->r_addend); 151--- gdb-9.2.orig/bfd/elf64-microblaze.c
138 } 152+++ gdb-9.2/bfd/elf64-microblaze.c
139- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 153@@ -117,6 +117,21 @@ static reloc_howto_type microblaze_elf_h
140- {
141- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
142+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
143+ {
144+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
145
146 /* Look at the reloc only if the value has been resolved. */
147 if (isym->st_shndx == shndx
148diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
149index fa4b95e47e0..d55700fc513 100644
150--- a/bfd/elf64-microblaze.c
151+++ b/bfd/elf64-microblaze.c
152@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
153 0x0000ffff, /* Dest Mask. */
154 TRUE), /* PC relative offset? */ 154 TRUE), /* PC relative offset? */
155 155
156+ /* A 64 bit relocation. Table entry not really used. */ 156 /* A 64 bit relocation. Table entry not really used. */
157+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */ 157+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
158+ 0, /* Rightshift. */ 158+ 0, /* Rightshift. */
159+ 4, /* Size (0 = byte, 1 = short, 2 = long). */ 159+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
@@ -168,10 +168,11 @@ index fa4b95e47e0..d55700fc513 100644
168+ 0x0000ffff, /* Dest Mask. */ 168+ 0x0000ffff, /* Dest Mask. */
169+ TRUE), /* PC relative offset? */ 169+ TRUE), /* PC relative offset? */
170+ 170+
171 /* A 64 bit relocation. Table entry not really used. */ 171+ /* A 64 bit relocation. Table entry not really used. */
172 HOWTO (R_MICROBLAZE_64, /* Type. */ 172 HOWTO (R_MICROBLAZE_64, /* Type. */
173 0, /* Rightshift. */ 173 0, /* Rightshift. */
174@@ -265,6 +280,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 174 2, /* Size (0 = byte, 1 = short, 2 = long). */
175@@ -265,6 +280,21 @@ static reloc_howto_type microblaze_elf_h
175 0x0000ffff, /* Dest Mask. */ 176 0x0000ffff, /* Dest Mask. */
176 TRUE), /* PC relative offset? */ 177 TRUE), /* PC relative offset? */
177 178
@@ -193,7 +194,7 @@ index fa4b95e47e0..d55700fc513 100644
193 /* A 64 bit GOT relocation. Table-entry not really used. */ 194 /* A 64 bit GOT relocation. Table-entry not really used. */
194 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ 195 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
195 0, /* Rightshift. */ 196 0, /* Rightshift. */
196@@ -589,9 +619,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 197@@ -589,9 +619,15 @@ microblaze_elf_reloc_type_lookup (bfd *
197 case BFD_RELOC_VTABLE_ENTRY: 198 case BFD_RELOC_VTABLE_ENTRY:
198 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 199 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
199 break; 200 break;
@@ -209,7 +210,7 @@ index fa4b95e47e0..d55700fc513 100644
209 case BFD_RELOC_MICROBLAZE_64_GOT: 210 case BFD_RELOC_MICROBLAZE_64_GOT:
210 microblaze_reloc = R_MICROBLAZE_GOT_64; 211 microblaze_reloc = R_MICROBLAZE_GOT_64;
211 break; 212 break;
212@@ -1162,6 +1198,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 213@@ -1172,6 +1208,7 @@ microblaze_elf_relocate_section (bfd *ou
213 break; /* Do nothing. */ 214 break; /* Do nothing. */
214 215
215 case (int) R_MICROBLAZE_GOTPC_64: 216 case (int) R_MICROBLAZE_GOTPC_64:
@@ -217,14 +218,23 @@ index fa4b95e47e0..d55700fc513 100644
217 relocation = htab->sgotplt->output_section->vma 218 relocation = htab->sgotplt->output_section->vma
218 + htab->sgotplt->output_offset; 219 + htab->sgotplt->output_offset;
219 relocation -= (input_section->output_section->vma 220 relocation -= (input_section->output_section->vma
220@@ -1863,6 +1900,28 @@ microblaze_elf_relax_section (bfd *abfd, 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,
221 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 231 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
222 } 232 }
223 break; 233 break;
224+ case R_MICROBLAZE_IMML_64: 234+ case R_MICROBLAZE_IMML_64:
225+ { 235+ {
226+ /* This was a PC-relative instruction that was 236+ /* This was a PC-relative instruction that was
227+ completely resolved. */ 237+ completely resolved. */
228+ int sfix, efix; 238+ int sfix, efix;
229+ unsigned int val; 239+ unsigned int val;
230+ bfd_vma target_address; 240+ bfd_vma target_address;
@@ -246,11 +256,11 @@ index fa4b95e47e0..d55700fc513 100644
246 case R_MICROBLAZE_NONE: 256 case R_MICROBLAZE_NONE:
247 case R_MICROBLAZE_32_NONE: 257 case R_MICROBLAZE_32_NONE:
248 { 258 {
249diff --git a/bfd/libbfd.h b/bfd/libbfd.h 259Index: gdb-9.2/bfd/libbfd.h
250index a01891f3423..4e71991273e 100644 260===================================================================
251--- a/bfd/libbfd.h 261--- gdb-9.2.orig/bfd/libbfd.h
252+++ b/bfd/libbfd.h 262+++ gdb-9.2/bfd/libbfd.h
253@@ -2905,7 +2905,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 263@@ -2905,7 +2905,9 @@ static const char *const bfd_reloc_code_
254 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 264 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
255 "BFD_RELOC_MICROBLAZE_32_NONE", 265 "BFD_RELOC_MICROBLAZE_32_NONE",
256 "BFD_RELOC_MICROBLAZE_64_NONE", 266 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -260,52 +270,67 @@ index a01891f3423..4e71991273e 100644
260 "BFD_RELOC_MICROBLAZE_64_GOT", 270 "BFD_RELOC_MICROBLAZE_64_GOT",
261 "BFD_RELOC_MICROBLAZE_64_PLT", 271 "BFD_RELOC_MICROBLAZE_64_PLT",
262 "BFD_RELOC_MICROBLAZE_64_GOTOFF", 272 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
263diff --git a/bfd/reloc.c b/bfd/reloc.c 273Index: gdb-9.2/bfd/reloc.c
264index 78f13180c71..8b3cc604738 100644 274===================================================================
265--- a/bfd/reloc.c 275--- gdb-9.2.orig/bfd/reloc.c
266+++ b/bfd/reloc.c 276+++ gdb-9.2/bfd/reloc.c
267@@ -6814,12 +6814,24 @@ ENUMDOC 277@@ -6815,6 +6815,12 @@ ENUMDOC
268 done here - only used for relaxing
269 ENUM 278 ENUM
270 BFD_RELOC_MICROBLAZE_64_NONE 279 BFD_RELOC_MICROBLAZE_64_NONE
271+ENUMDOC 280 ENUMDOC
272+ This is a 32 bit reloc that stores the 32 bit pc relative 281+ This is a 32 bit reloc that stores the 32 bit pc relative
273+ value in two words (with an imml instruction). No relocation is 282+ value in two words (with an imml instruction). No relocation is
274+ done here - only used for relaxing 283+ done here - only used for relaxing
275+ENUM 284+ENUM
276+ BFD_RELOC_MICROBLAZE_64 285+ BFD_RELOC_MICROBLAZE_64
277 ENUMDOC 286+ENUMDOC
278 This is a 64 bit reloc that stores the 32 bit pc relative 287 This is a 64 bit reloc that stores the 32 bit pc relative
279 value in two words (with an imm instruction). No relocation is 288 value in two words (with an imm instruction). No relocation is
280 done here - only used for relaxing 289 done here - only used for relaxing
281 ENUM 290@@ -6822,6 +6828,12 @@ ENUM
282 BFD_RELOC_MICROBLAZE_64_GOTPC 291 BFD_RELOC_MICROBLAZE_64_GOTPC
283+ENUMDOC 292 ENUMDOC
284+ This is a 64 bit reloc that stores the 32 bit pc relative 293 This is a 64 bit reloc that stores the 32 bit pc relative
285+ value in two words (with an imml instruction). No relocation is 294+ value in two words (with an imml instruction). No relocation is
286+ done here - only used for relaxing 295+ done here - only used for relaxing
287+ENUM 296+ENUM
288+ BFD_RELOC_MICROBLAZE_64_GPC 297+ BFD_RELOC_MICROBLAZE_64_GPC
289 ENUMDOC 298+ENUMDOC
290 This is a 64 bit reloc that stores the 32 bit pc relative 299+ This is a 64 bit reloc that stores the 32 bit pc relative
291 value in two words (with an imm instruction). The relocation is 300 value in two words (with an imm instruction). The relocation is
292diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 301 PC-relative GOT offset
293index 0dba2c0f44f..030eb99a1a0 100644 302 ENUM
294--- a/include/elf/microblaze.h 303Index: gdb-9.2/include/elf/microblaze.h
295+++ b/include/elf/microblaze.h 304===================================================================
296@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 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
297 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ 308 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
298 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ 309 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
299 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 310 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
300+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) 311+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
301+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ 312+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
313
302 END_RELOC_NUMBERS (R_MICROBLAZE_max) 314 END_RELOC_NUMBERS (R_MICROBLAZE_max)
303 315
304 /* Global base address names. */ 316Index: gdb-9.2/opcodes/microblaze-opc.h
305diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 317===================================================================
306index 28dc991c430..46263bc7e16 100644 318--- gdb-9.2.orig/opcodes/microblaze-opc.h
307--- a/opcodes/microblaze-opc.h 319+++ gdb-9.2/opcodes/microblaze-opc.h
308+++ b/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 },
309@@ -538,8 +538,8 @@ struct op_code_struct 334@@ -538,8 +538,8 @@ struct op_code_struct
310 {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst }, 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 },
311 {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_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 },
@@ -317,10 +342,10 @@ index 28dc991c430..46263bc7e16 100644
317 {"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 */ 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 */
318 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 343 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
319 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, 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 },
320diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 345Index: gdb-9.2/opcodes/microblaze-opcm.h
321index ad475a4af15..ee01cdb7d9b 100644 346===================================================================
322--- a/opcodes/microblaze-opcm.h 347--- gdb-9.2.orig/opcodes/microblaze-opcm.h
323+++ b/opcodes/microblaze-opcm.h 348+++ gdb-9.2/opcodes/microblaze-opcm.h
324@@ -40,8 +40,8 @@ enum microblaze_instr 349@@ -40,8 +40,8 @@ enum microblaze_instr
325 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, 350 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
326 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, 351 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
@@ -328,10 +353,7 @@ index ad475a4af15..ee01cdb7d9b 100644
328- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, 353- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
329- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, 354- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
330+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, 355+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
331+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, 356+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
332 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 357 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
333 fint, fsqrt, 358 fint, fsqrt,
334 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, 359 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
335--
3362.17.1
337
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
index eaf24505..a717595b 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
@@ -1,18 +1,17 @@
1From b6ec3e2295ba33d2c8f48500d75a147ffd84a656 Mon Sep 17 00:00:00 2001 1From 8ad2e417691ac2b89ffec9db9026d53600d9a137 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 11 Sep 2018 13:48:33 +0530 3Date: Tue, 11 Sep 2018 13:48:33 +0530
4Subject: [PATCH 17/40] [Patch,Microblaze] : negl instruction is overriding 4Subject: [PATCH 16/52] [Patch,Microblaze] : negl instruction is overriding
5 rsubl 5 rsubl,fixed it by changing the instruction order...
6 6
7fixed it by changing the instruction order...
8--- 7---
9 opcodes/microblaze-opc.h | 4 ++-- 8 opcodes/microblaze-opc.h | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-) 9 1 file changed, 2 insertions(+), 2 deletions(-)
11 10
12diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 11Index: gdb-9.2/opcodes/microblaze-opc.h
13index 46263bc7e16..f4ee8f43372 100644 12===================================================================
14--- a/opcodes/microblaze-opc.h 13--- gdb-9.2.orig/opcodes/microblaze-opc.h
15+++ b/opcodes/microblaze-opc.h 14+++ gdb-9.2/opcodes/microblaze-opc.h
16@@ -275,9 +275,7 @@ struct op_code_struct 15@@ -275,9 +275,7 @@ struct op_code_struct
17 {"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. */ 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. */
18 {"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. */ 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. */
@@ -32,6 +31,3 @@ index 46263bc7e16..f4ee8f43372 100644
32 31
33 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 32 {"", 0, 0, 0, 0, 0, 0, 0, 0},
34 }; 33 };
35--
362.17.1
37
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch
index 742f9e34..ac9da7a9 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0017-Added-relocations-for-MB-X.patch
@@ -1,47 +1,49 @@
1From 982f37caabea84cee52426844e73365f0cb93f3d Mon Sep 17 00:00:00 2001 1From eccbce1a31ed29dc38fb9ab15b6badcf9412bdb8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530 3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 18/40] Added relocations for MB-X 4Subject: [PATCH 17/52] Added relocations for MB-X
5 5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
6--- 9---
7 bfd/bfd-in2.h | 11 +++++--- 10 bfd/bfd-in2.h | 9 +++-
8 bfd/libbfd.h | 4 +-- 11 bfd/libbfd.h | 4 +-
9 bfd/reloc.c | 26 +++++++++--------- 12 bfd/reloc.c | 26 ++++++-----
10 4 files changed, 63 insertions(+), 32 deletions(-) 13 gas/config/tc-microblaze.c | 90 ++++++++++++++++----------------------
14 4 files changed, 61 insertions(+), 68 deletions(-)
11 15
12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 16Index: gdb-9.2/bfd/bfd-in2.h
13index c6738960bb2..3899352b1d5 100644 17===================================================================
14--- a/bfd/bfd-in2.h 18--- gdb-9.2.orig/bfd/bfd-in2.h
15+++ b/bfd/bfd-in2.h 19+++ gdb-9.2/bfd/bfd-in2.h
16@@ -5369,15 +5369,20 @@ done here - only used for relaxing */ 20@@ -5371,14 +5371,19 @@ done here - only used for relaxing */
17 BFD_RELOC_MICROBLAZE_32_NONE,
18
19 /* This is a 64 bit reloc that stores the 32 bit pc relative 21 /* This is a 64 bit reloc that stores the 32 bit pc relative
20-value in two words (with an imm instruction). No relocation is 22 value in two words (with an imm instruction). No relocation is
21+value in two words (with an imml instruction). No relocation is
22 done here - only used for relaxing */ 23 done here - only used for relaxing */
23- BFD_RELOC_MICROBLAZE_64_NONE, 24- BFD_RELOC_MICROBLAZE_64_NONE,
24+ BFD_RELOC_MICROBLAZE_64_PCREL, 25+ BFD_RELOC_MICROBLAZE_64_PCREL,
25 26
26-/* This is a 64 bit reloc that stores the 32 bit pc relative 27-/* This is a 64 bit reloc that stores the 32 bit pc relative
27+/* This is a 64 bit reloc that stores the 32 bit relative 28+/* This is a 64 bit reloc that stores the 32 bit relative
28 value in two words (with an imml instruction). No relocation is 29 * +value in two words (with an imml instruction). No relocation is
29 done here - only used for relaxing */ 30 * +done here - only used for relaxing */
30 BFD_RELOC_MICROBLAZE_64, 31 BFD_RELOC_MICROBLAZE_64,
31 32
32+/* This is a 64 bit reloc that stores the 32 bit pc relative
33+value in two words (with an imm instruction). No relocation is
34+done here - only used for relaxing */
35+ BFD_RELOC_MICROBLAZE_64_NONE,
36+
37 /* This is a 64 bit reloc that stores the 32 bit pc relative 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
38 value in two words (with an imm instruction). The relocation is 39 value in two words (with an imm instruction). The relocation is
39 PC-relative GOT offset */ 40 PC-relative GOT offset */
40diff --git a/bfd/libbfd.h b/bfd/libbfd.h 41 BFD_RELOC_MICROBLAZE_64_GOTPC,
41index 4e71991273e..46be3891390 100644 42Index: gdb-9.2/bfd/libbfd.h
42--- a/bfd/libbfd.h 43===================================================================
43+++ b/bfd/libbfd.h 44--- gdb-9.2.orig/bfd/libbfd.h
44@@ -2905,14 +2905,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 45+++ gdb-9.2/bfd/libbfd.h
46@@ -2905,14 +2905,14 @@ static const char *const bfd_reloc_code_
45 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 47 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
46 "BFD_RELOC_MICROBLAZE_32_NONE", 48 "BFD_RELOC_MICROBLAZE_32_NONE",
47 "BFD_RELOC_MICROBLAZE_64_NONE", 49 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -58,35 +60,36 @@ index 4e71991273e..46be3891390 100644
58 "BFD_RELOC_MICROBLAZE_64_TLS", 60 "BFD_RELOC_MICROBLAZE_64_TLS",
59 "BFD_RELOC_MICROBLAZE_64_TLSGD", 61 "BFD_RELOC_MICROBLAZE_64_TLSGD",
60 "BFD_RELOC_MICROBLAZE_64_TLSLD", 62 "BFD_RELOC_MICROBLAZE_64_TLSLD",
61diff --git a/bfd/reloc.c b/bfd/reloc.c 63Index: gdb-9.2/bfd/reloc.c
62index 8b3cc604738..98a156f061f 100644 64===================================================================
63--- a/bfd/reloc.c 65--- gdb-9.2.orig/bfd/reloc.c
64+++ b/bfd/reloc.c 66+++ gdb-9.2/bfd/reloc.c
65@@ -6814,24 +6814,12 @@ ENUMDOC 67@@ -6815,12 +6815,6 @@ ENUMDOC
66 done here - only used for relaxing
67 ENUM 68 ENUM
68 BFD_RELOC_MICROBLAZE_64_NONE 69 BFD_RELOC_MICROBLAZE_64_NONE
69-ENUMDOC 70 ENUMDOC
70- This is a 32 bit reloc that stores the 32 bit pc relative 71- This is a 32 bit reloc that stores the 32 bit pc relative
71- value in two words (with an imml instruction). No relocation is 72- value in two words (with an imml instruction). No relocation is
72- done here - only used for relaxing 73- done here - only used for relaxing
73-ENUM 74-ENUM
74- BFD_RELOC_MICROBLAZE_64 75- BFD_RELOC_MICROBLAZE_64
75 ENUMDOC 76-ENUMDOC
76 This is a 64 bit reloc that stores the 32 bit pc relative 77 This is a 64 bit reloc that stores the 32 bit pc relative
77 value in two words (with an imm instruction). No relocation is 78 value in two words (with an imm instruction). No relocation is
78 done here - only used for relaxing 79 done here - only used for relaxing
79 ENUM 80@@ -6828,12 +6822,6 @@ ENUM
80 BFD_RELOC_MICROBLAZE_64_GOTPC 81 BFD_RELOC_MICROBLAZE_64_GOTPC
81-ENUMDOC 82 ENUMDOC
82- This is a 64 bit reloc that stores the 32 bit pc relative 83 This is a 64 bit reloc that stores the 32 bit pc relative
83- value in two words (with an imml instruction). No relocation is 84- value in two words (with an imml instruction). No relocation is
84- done here - only used for relaxing 85- done here - only used for relaxing
85-ENUM 86-ENUM
86- BFD_RELOC_MICROBLAZE_64_GPC 87- BFD_RELOC_MICROBLAZE_64_GPC
87 ENUMDOC 88-ENUMDOC
88 This is a 64 bit reloc that stores the 32 bit pc relative 89- This is a 64 bit reloc that stores the 32 bit pc relative
89 value in two words (with an imm instruction). The relocation is 90 value in two words (with an imm instruction). The relocation is
91 PC-relative GOT offset
92 ENUM
90@@ -6917,6 +6905,20 @@ ENUMDOC 93@@ -6917,6 +6905,20 @@ ENUMDOC
91 value in two words (with an imm instruction). The relocation is 94 value in two words (with an imm instruction). The relocation is
92 relative offset from start of TEXT. 95 relative offset from start of TEXT.
@@ -108,6 +111,3 @@ index 8b3cc604738..98a156f061f 100644
108 ENUM 111 ENUM
109 BFD_RELOC_AARCH64_RELOC_START 112 BFD_RELOC_AARCH64_RELOC_START
110 ENUMDOC 113 ENUMDOC
111--
1122.17.1
113
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch
index fc5c9464..84a4d316 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0018-Fixed-MB-x-relocation-issues.patch
@@ -1,27 +1,28 @@
1From 0bb779328b8564b008a6134826f043b4326f4904 Mon Sep 17 00:00:00 2001 1From 0868dedda1b7b8112870dcc69f887d32a51b94b6 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530 3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 19/40] Update MB-x 4Subject: [PATCH 18/52] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions
5 6
6-Fixed MB-x relocation issues
7-Added imml for required MB-x instructions
8--- 7---
9 bfd/elf64-microblaze.c | 68 ++++++++++-- 8 bfd/elf64-microblaze.c | 68 ++++++++++++++---
10 3 files changed, 209 insertions(+), 82 deletions(-) 9 gas/config/tc-microblaze.c | 152 +++++++++++++++++++++++++++----------
10 gas/tc.h | 2 +-
11 3 files changed, 167 insertions(+), 55 deletions(-)
11 12
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 13Index: gdb-9.2/bfd/elf64-microblaze.c
13index d55700fc513..f8f52870639 100644 14===================================================================
14--- a/bfd/elf64-microblaze.c 15--- gdb-9.2.orig/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c 16+++ gdb-9.2/bfd/elf64-microblaze.c
16@@ -1478,8 +1478,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, 17@@ -1488,8 +1488,17 @@ microblaze_elf_relocate_section (bfd *ou
17 relocation -= (input_section->output_section->vma 18 relocation -= (input_section->output_section->vma
18 + input_section->output_offset 19 + input_section->output_offset
19 + offset + INST_WORD_SIZE); 20 + offset + INST_WORD_SIZE);
20- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 21- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
21+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 22+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
22+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 23+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
23+ { 24+ {
24+ insn &= ~0x00ffffff; 25+ insn &= ~0x00ffffff;
25+ insn |= (relocation >> 16) & 0xffffff; 26+ insn |= (relocation >> 16) & 0xffffff;
26+ bfd_put_32 (input_bfd, insn, 27+ bfd_put_32 (input_bfd, insn,
27 contents + offset + endian); 28 contents + offset + endian);
@@ -32,7 +33,7 @@ index d55700fc513..f8f52870639 100644
32 bfd_put_16 (input_bfd, relocation & 0xffff, 33 bfd_put_16 (input_bfd, relocation & 0xffff,
33 contents + offset + endian + INST_WORD_SIZE); 34 contents + offset + endian + INST_WORD_SIZE);
34 } 35 }
35@@ -1569,11 +1578,28 @@ microblaze_elf_relocate_section (bfd *output_bfd, 36@@ -1580,11 +1589,28 @@ microblaze_elf_relocate_section (bfd *ou
36 else 37 else
37 { 38 {
38 if (r_type == R_MICROBLAZE_64_PCREL) 39 if (r_type == R_MICROBLAZE_64_PCREL)
@@ -42,7 +43,7 @@ index d55700fc513..f8f52870639 100644
42- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 43- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
43+ { 44+ {
44+ if (!input_section->output_section->vma && 45+ if (!input_section->output_section->vma &&
45+ !input_section->output_offset && !offset) 46+ !input_section->output_offset && !offset)
46+ relocation -= (input_section->output_section->vma 47+ relocation -= (input_section->output_section->vma
47+ + input_section->output_offset 48+ + input_section->output_offset
48+ + offset); 49+ + offset);
@@ -52,9 +53,9 @@ index d55700fc513..f8f52870639 100644
52+ + offset + INST_WORD_SIZE); 53+ + offset + INST_WORD_SIZE);
53+ } 54+ }
54+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 55+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
55+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 56+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
56+ { 57+ {
57+ insn &= ~0x00ffffff; 58+ insn &= ~0x00ffffff;
58+ insn |= (relocation >> 16) & 0xffffff; 59+ insn |= (relocation >> 16) & 0xffffff;
59+ bfd_put_32 (input_bfd, insn, 60+ bfd_put_32 (input_bfd, insn,
60 contents + offset + endian); 61 contents + offset + endian);
@@ -65,7 +66,7 @@ index d55700fc513..f8f52870639 100644
65 bfd_put_16 (input_bfd, relocation & 0xffff, 66 bfd_put_16 (input_bfd, relocation & 0xffff,
66 contents + offset + endian + INST_WORD_SIZE); 67 contents + offset + endian + INST_WORD_SIZE);
67 } 68 }
68@@ -1677,9 +1703,19 @@ static void 69@@ -1703,9 +1729,19 @@ static void
69 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 70 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
70 { 71 {
71 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 72 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
@@ -88,7 +89,7 @@ index d55700fc513..f8f52870639 100644
88 } 89 }
89 90
90 /* Read-modify-write into the bfd, an immediate value into appropriate fields of 91 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
91@@ -1691,10 +1727,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 92@@ -1717,10 +1753,18 @@ microblaze_bfd_write_imm_value_64 (bfd *
92 unsigned long instr_lo; 93 unsigned long instr_lo;
93 94
94 instr_hi = bfd_get_32 (abfd, bfd_addr); 95 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -111,6 +112,3 @@ index d55700fc513..f8f52870639 100644
111 instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE); 112 instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
112 instr_lo &= ~0x0000ffff; 113 instr_lo &= ~0x0000ffff;
113 instr_lo |= (val & 0x0000ffff); 114 instr_lo |= (val & 0x0000ffff);
114--
1152.17.1
116
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
new file mode 100644
index 00000000..b3f93845
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixing-the-branch-related-issues.patch
@@ -0,0 +1,25 @@
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-Various-fixes.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch
index eb0bc982..a2f34b02 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0020-Various-fixes.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixed-address-computation-issues-with-64bit-address.patch
@@ -1,37 +1,40 @@
1From 188a60b441711f663f07dc3c3902c8c5d590eb6c Mon Sep 17 00:00:00 2001 1From fd3df3812f8297133a598802b552252f45c80d0c Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530 3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 20/40] Various fixes 4Subject: [PATCH 20/52] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
5 6
6- Fixed address computation issues with 64bit address 7Conflicts:
7- Fixed imml dissassamble issue 8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
8--- 10---
9 bfd/bfd-in2.h | 5 +++ 11 bfd/bfd-in2.h | 5 +++
10 bfd/elf64-microblaze.c | 14 ++++---- 12 bfd/elf64-microblaze.c | 14 ++++----
13 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
11 opcodes/microblaze-dis.c | 2 +- 14 opcodes/microblaze-dis.c | 2 +-
12 4 files changed, 79 insertions(+), 16 deletions(-) 15 4 files changed, 79 insertions(+), 16 deletions(-)
13 16
14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 17Index: gdb-9.2/bfd/bfd-in2.h
15index 3899352b1d5..91761bf6964 100644 18===================================================================
16--- a/bfd/bfd-in2.h 19--- gdb-9.2.orig/bfd/bfd-in2.h
17+++ b/bfd/bfd-in2.h 20+++ gdb-9.2/bfd/bfd-in2.h
18@@ -5378,6 +5378,11 @@ value in two words (with an imml instruction). No relocation is 21@@ -5378,6 +5378,11 @@ done here - only used for relaxing */
19 done here - only used for relaxing */ 22 * +done here - only used for relaxing */
20 BFD_RELOC_MICROBLAZE_64, 23 BFD_RELOC_MICROBLAZE_64,
21 24
22+/* This is a 64 bit reloc that stores the 32 bit relative 25+/* This is a 64 bit reloc that stores the 32 bit relative
23+value in two words (with an imml instruction). No relocation is 26+ * +value in two words (with an imml instruction). No relocation is
24+done here - only used for relaxing */ 27+ * +done here - only used for relaxing */
25+ BFD_RELOC_MICROBLAZE_EA64, 28+ BFD_RELOC_MICROBLAZE_EA64,
26+ 29+
27 /* This is a 64 bit reloc that stores the 32 bit pc relative 30 /* This is a 64 bit reloc that stores the 32 bit pc relative
28 value in two words (with an imm instruction). No relocation is 31 * +value in two words (with an imm instruction). No relocation is
29 done here - only used for relaxing */ 32 * +done here - only used for relaxing */
30diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 33Index: gdb-9.2/bfd/elf64-microblaze.c
31index f8f52870639..17e58748a0b 100644 34===================================================================
32--- a/bfd/elf64-microblaze.c 35--- gdb-9.2.orig/bfd/elf64-microblaze.c
33+++ b/bfd/elf64-microblaze.c 36+++ gdb-9.2/bfd/elf64-microblaze.c
34@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 37@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_h
35 0, /* Rightshift. */ 38 0, /* Rightshift. */
36 4, /* Size (0 = byte, 1 = short, 2 = long). */ 39 4, /* Size (0 = byte, 1 = short, 2 = long). */
37 64, /* Bitsize. */ 40 64, /* Bitsize. */
@@ -50,7 +53,7 @@ index f8f52870639..17e58748a0b 100644
50 53
51 /* A 64 bit relocation. Table entry not really used. */ 54 /* A 64 bit relocation. Table entry not really used. */
52 HOWTO (R_MICROBLAZE_64, /* Type. */ 55 HOWTO (R_MICROBLAZE_64, /* Type. */
53@@ -585,9 +585,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 56@@ -585,9 +585,9 @@ microblaze_elf_reloc_type_lookup (bfd *
54 case BFD_RELOC_32: 57 case BFD_RELOC_32:
55 microblaze_reloc = R_MICROBLAZE_32; 58 microblaze_reloc = R_MICROBLAZE_32;
56 break; 59 break;
@@ -62,7 +65,7 @@ index f8f52870639..17e58748a0b 100644
62 break; 65 break;
63 case BFD_RELOC_32_PCREL: 66 case BFD_RELOC_32_PCREL:
64 microblaze_reloc = R_MICROBLAZE_32_PCREL; 67 microblaze_reloc = R_MICROBLAZE_32_PCREL;
65@@ -619,7 +619,7 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 68@@ -619,7 +619,7 @@ microblaze_elf_reloc_type_lookup (bfd *
66 case BFD_RELOC_VTABLE_ENTRY: 69 case BFD_RELOC_VTABLE_ENTRY:
67 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 70 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
68 break; 71 break;
@@ -71,7 +74,7 @@ index f8f52870639..17e58748a0b 100644
71 microblaze_reloc = R_MICROBLAZE_IMML_64; 74 microblaze_reloc = R_MICROBLAZE_IMML_64;
72 break; 75 break;
73 case BFD_RELOC_MICROBLAZE_64_GOTPC: 76 case BFD_RELOC_MICROBLAZE_64_GOTPC:
74@@ -1956,7 +1956,7 @@ microblaze_elf_relax_section (bfd *abfd, 77@@ -1982,7 +1982,7 @@ microblaze_elf_relax_section (bfd *abfd,
75 efix = calc_fixup (target_address, 0, sec); 78 efix = calc_fixup (target_address, 0, sec);
76 79
77 /* Validate the in-band val. */ 80 /* Validate the in-band val. */
@@ -80,19 +83,16 @@ index f8f52870639..17e58748a0b 100644
80 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { 83 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
81 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); 84 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
82 } 85 }
83diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 86Index: gdb-9.2/opcodes/microblaze-dis.c
84index 437f536e96a..24ede714858 100644 87===================================================================
85--- a/opcodes/microblaze-dis.c 88--- gdb-9.2.orig/opcodes/microblaze-dis.c
86+++ b/opcodes/microblaze-dis.c 89+++ gdb-9.2/opcodes/microblaze-dis.c
87@@ -78,7 +78,7 @@ get_field_imml (struct string_buf *buf, long instr) 90@@ -77,7 +77,7 @@ static char *
91 get_field_imml (struct string_buf *buf, long instr)
88 { 92 {
89 char *p = strbuf (buf); 93 char *p = strbuf (buf);
90
91- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 94- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
92+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW)); 95+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
93 return p; 96 return p;
94 } 97 }
95 98
96--
972.17.1
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
index 0d212ccc..abfdd8d0 100644
--- 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
@@ -1,17 +1,18 @@
1From a485fdf959afb6cd079f482eeea9d3186e6393f8 Mon Sep 17 00:00:00 2001 1From 14a54cced8062343b83d7ff0e68f00bca562a509 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sat, 13 Oct 2018 21:17:01 +0530 3Date: Sat, 13 Oct 2018 21:17:01 +0530
4Subject: [PATCH 21/40] Adding new relocation to support 64bit rodata 4Subject: [PATCH 21/52] Adding new relocation to support 64bit rodata
5 5
6--- 6---
7 bfd/elf64-microblaze.c | 11 +++++++-- 7 bfd/elf64-microblaze.c | 11 +++++++--
8 gas/config/tc-microblaze.c | 49 ++++++++++++++++++++++++++++++++++----
8 2 files changed, 54 insertions(+), 6 deletions(-) 9 2 files changed, 54 insertions(+), 6 deletions(-)
9 10
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 11Index: gdb-9.2/bfd/elf64-microblaze.c
11index 17e58748a0b..b62c47e8514 100644 12===================================================================
12--- a/bfd/elf64-microblaze.c 13--- gdb-9.2.orig/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c 14+++ gdb-9.2/bfd/elf64-microblaze.c
14@@ -1463,6 +1463,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 15@@ -1473,6 +1473,7 @@ microblaze_elf_relocate_section (bfd *ou
15 case (int) R_MICROBLAZE_64_PCREL : 16 case (int) R_MICROBLAZE_64_PCREL :
16 case (int) R_MICROBLAZE_64: 17 case (int) R_MICROBLAZE_64:
17 case (int) R_MICROBLAZE_32: 18 case (int) R_MICROBLAZE_32:
@@ -19,16 +20,16 @@ index 17e58748a0b..b62c47e8514 100644
19 { 20 {
20 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols 21 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
21 from removed linkonce sections, or sections discarded by 22 from removed linkonce sections, or sections discarded by
22@@ -1472,6 +1473,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1482,6 +1483,8 @@ microblaze_elf_relocate_section (bfd *ou
23 relocation += addend; 24 relocation += addend;
24 if (r_type == R_MICROBLAZE_32) 25 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
25 bfd_put_32 (input_bfd, relocation, contents + offset); 26 bfd_put_32 (input_bfd, relocation, contents + offset);
26+ else if (r_type == R_MICROBLAZE_IMML_64) 27+ else if (r_type == R_MICROBLAZE_IMML_64)
27+ bfd_put_64 (input_bfd, relocation, contents + offset); 28+ bfd_put_64 (input_bfd, relocation, contents + offset);
28 else 29 else
29 { 30 {
30 if (r_type == R_MICROBLAZE_64_PCREL) 31 if (r_type == R_MICROBLAZE_64_PCREL)
31@@ -1549,7 +1552,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 32@@ -1560,7 +1563,7 @@ microblaze_elf_relocate_section (bfd *ou
32 } 33 }
33 else 34 else
34 { 35 {
@@ -37,7 +38,7 @@ index 17e58748a0b..b62c47e8514 100644
37 { 38 {
38 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); 39 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
39 outrel.r_addend = relocation + addend; 40 outrel.r_addend = relocation + addend;
40@@ -1575,6 +1578,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 41@@ -1586,6 +1589,8 @@ microblaze_elf_relocate_section (bfd *ou
41 relocation += addend; 42 relocation += addend;
42 if (r_type == R_MICROBLAZE_32) 43 if (r_type == R_MICROBLAZE_32)
43 bfd_put_32 (input_bfd, relocation, contents + offset); 44 bfd_put_32 (input_bfd, relocation, contents + offset);
@@ -46,7 +47,7 @@ index 17e58748a0b..b62c47e8514 100644
46 else 47 else
47 { 48 {
48 if (r_type == R_MICROBLAZE_64_PCREL) 49 if (r_type == R_MICROBLAZE_64_PCREL)
49@@ -2072,7 +2077,8 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2098,7 +2103,8 @@ microblaze_elf_relax_section (bfd *abfd,
50 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 51 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
51 irelscan->r_addend); 52 irelscan->r_addend);
52 } 53 }
@@ -56,7 +57,7 @@ index 17e58748a0b..b62c47e8514 100644
56 { 57 {
57 isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
58 59
59@@ -2568,6 +2574,7 @@ microblaze_elf_check_relocs (bfd * abfd, 60@@ -2606,6 +2612,7 @@ microblaze_elf_check_relocs (bfd * abfd,
60 case R_MICROBLAZE_64: 61 case R_MICROBLAZE_64:
61 case R_MICROBLAZE_64_PCREL: 62 case R_MICROBLAZE_64_PCREL:
62 case R_MICROBLAZE_32: 63 case R_MICROBLAZE_32:
@@ -64,6 +65,3 @@ index 17e58748a0b..b62c47e8514 100644
64 { 65 {
65 if (h != NULL && !bfd_link_pic (info)) 66 if (h != NULL && !bfd_link_pic (info))
66 { 67 {
67--
682.17.1
69
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
index aa512b87..3bbe2659 100644
--- 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
@@ -1,35 +1,35 @@
1From 24f96f4e86895b41aae21f775599a857939d002f Mon Sep 17 00:00:00 2001 1From e9e4d4837cfea27e67fa656ede535f250205eb2c Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 24 Oct 2018 12:34:37 +0530 3Date: Wed, 24 Oct 2018 12:34:37 +0530
4Subject: [PATCH 22/40] fixing the .bss relocation issue 4Subject: [PATCH 22/52] fixing the .bss relocation issue
5 5
6--- 6---
7 bfd/elf64-microblaze.c | 18 ++++++++++++------ 7 bfd/elf64-microblaze.c | 18 ++++++++++++------
8 1 file changed, 12 insertions(+), 6 deletions(-) 8 1 file changed, 12 insertions(+), 6 deletions(-)
9 9
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 10Index: gdb-9.2/bfd/elf64-microblaze.c
11index b62c47e8514..cb3b40b574c 100644 11===================================================================
12--- a/bfd/elf64-microblaze.c 12--- gdb-9.2.orig/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c 13+++ gdb-9.2/bfd/elf64-microblaze.c
14@@ -1482,7 +1482,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 14@@ -1492,7 +1492,7 @@ microblaze_elf_relocate_section (bfd *ou
15 + input_section->output_offset 15 + input_section->output_offset
16 + offset + INST_WORD_SIZE); 16 + offset + INST_WORD_SIZE);
17 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 17 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
18- if (insn == 0xb2000000 || insn == 0xb2ffffff) 18- if (insn == 0xb2000000 || insn == 0xb2ffffff)
19+ if ((insn & 0xff000000) == 0xb2000000) 19+ if ((insn & 0xff000000) == 0xb2000000)
20 { 20 {
21 insn &= ~0x00ffffff; 21 insn &= ~0x00ffffff;
22 insn |= (relocation >> 16) & 0xffffff; 22 insn |= (relocation >> 16) & 0xffffff;
23@@ -1595,7 +1595,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1606,7 +1606,7 @@ microblaze_elf_relocate_section (bfd *ou
24 + offset + INST_WORD_SIZE); 24 + offset + INST_WORD_SIZE);
25 } 25 }
26 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 26 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
27- if (insn == 0xb2000000 || insn == 0xb2ffffff) 27- if (insn == 0xb2000000 || insn == 0xb2ffffff)
28+ if ((insn & 0xff000000) == 0xb2000000) 28+ if ((insn & 0xff000000) == 0xb2000000)
29 { 29 {
30 insn &= ~0x00ffffff; 30 insn &= ~0x00ffffff;
31 insn |= (relocation >> 16) & 0xffffff; 31 insn |= (relocation >> 16) & 0xffffff;
32@@ -1709,7 +1709,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 32@@ -1735,7 +1735,7 @@ microblaze_bfd_write_imm_value_32 (bfd *
33 { 33 {
34 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 34 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
35 35
@@ -38,7 +38,7 @@ index b62c47e8514..cb3b40b574c 100644
38 { 38 {
39 instr &= ~0x00ffffff; 39 instr &= ~0x00ffffff;
40 instr |= (val & 0xffffff); 40 instr |= (val & 0xffffff);
41@@ -1732,7 +1732,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 41@@ -1758,7 +1758,7 @@ microblaze_bfd_write_imm_value_64 (bfd *
42 unsigned long instr_lo; 42 unsigned long instr_lo;
43 43
44 instr_hi = bfd_get_32 (abfd, bfd_addr); 44 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -47,7 +47,7 @@ index b62c47e8514..cb3b40b574c 100644
47 { 47 {
48 instr_hi &= ~0x00ffffff; 48 instr_hi &= ~0x00ffffff;
49 instr_hi |= (val >> 16) & 0xffffff; 49 instr_hi |= (val >> 16) & 0xffffff;
50@@ -2225,7 +2225,10 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2251,7 +2251,10 @@ microblaze_elf_relax_section (bfd *abfd,
51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
52 + irelscan->r_offset 52 + irelscan->r_offset
53 + INST_WORD_SIZE); 53 + INST_WORD_SIZE);
@@ -59,7 +59,7 @@ index b62c47e8514..cb3b40b574c 100644
59 immediate |= (instr_lo & 0x0000ffff); 59 immediate |= (instr_lo & 0x0000ffff);
60 offset = calc_fixup (irelscan->r_addend, 0, sec); 60 offset = calc_fixup (irelscan->r_addend, 0, sec);
61 immediate -= offset; 61 immediate -= offset;
62@@ -2269,7 +2272,10 @@ microblaze_elf_relax_section (bfd *abfd, 62@@ -2295,7 +2298,10 @@ microblaze_elf_relax_section (bfd *abfd,
63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
64 + irelscan->r_offset 64 + irelscan->r_offset
65 + INST_WORD_SIZE); 65 + INST_WORD_SIZE);
@@ -71,6 +71,3 @@ index b62c47e8514..cb3b40b574c 100644
71 immediate |= (instr_lo & 0x0000ffff); 71 immediate |= (instr_lo & 0x0000ffff);
72 target_address = immediate; 72 target_address = immediate;
73 offset = calc_fixup (target_address, 0, sec); 73 offset = calc_fixup (target_address, 0, sec);
74--
752.17.1
76
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
index c645781e..b359ce72 100644
--- 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
@@ -1,7 +1,7 @@
1From cd5868dca5b4a728e6418459d871f5c9ca68253e Mon Sep 17 00:00:00 2001 1From 1466dd2c74e38ae6d1dca5cf6d4cad87c94fbc8f Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 28 Nov 2018 14:00:29 +0530 3Date: Wed, 28 Nov 2018 14:00:29 +0530
4Subject: [PATCH 23/40] Fixed the bug in the R_MICROBLAZE_64_NONE relocation. 4Subject: [PATCH 23/52] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
5 It was adjusting only lower 16bits. 5 It was adjusting only lower 16bits.
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 23/40] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
9 bfd/elf64-microblaze.c | 4 ++-- 9 bfd/elf64-microblaze.c | 4 ++--
10 2 files changed, 4 insertions(+), 4 deletions(-) 10 2 files changed, 4 insertions(+), 4 deletions(-)
11 11
12diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 12Index: gdb-9.2/bfd/elf32-microblaze.c
13index a31b407cfbf..04816a4a187 100644 13===================================================================
14--- a/bfd/elf32-microblaze.c 14--- gdb-9.2.orig/bfd/elf32-microblaze.c
15+++ b/bfd/elf32-microblaze.c 15+++ gdb-9.2/bfd/elf32-microblaze.c
16@@ -2023,8 +2023,8 @@ microblaze_elf_relax_section (bfd *abfd, 16@@ -2023,8 +2023,8 @@ microblaze_elf_relax_section (bfd *abfd,
17 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); 17 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
18 efix = calc_fixup (target_address, 0, sec); 18 efix = calc_fixup (target_address, 0, sec);
@@ -24,11 +24,11 @@ index a31b407cfbf..04816a4a187 100644
24 } 24 }
25 break; 25 break;
26 } 26 }
27diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 27Index: gdb-9.2/bfd/elf64-microblaze.c
28index cb3b40b574c..b002b414d64 100644 28===================================================================
29--- a/bfd/elf64-microblaze.c 29--- gdb-9.2.orig/bfd/elf64-microblaze.c
30+++ b/bfd/elf64-microblaze.c 30+++ gdb-9.2/bfd/elf64-microblaze.c
31@@ -2004,8 +2004,8 @@ microblaze_elf_relax_section (bfd *abfd, 31@@ -2030,8 +2030,8 @@ microblaze_elf_relax_section (bfd *abfd,
32 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); 32 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
33 efix = calc_fixup (target_address, 0, sec); 33 efix = calc_fixup (target_address, 0, sec);
34 irel->r_addend -= (efix - sfix); 34 irel->r_addend -= (efix - sfix);
@@ -39,6 +39,3 @@ index cb3b40b574c..b002b414d64 100644
39 } 39 }
40 break; 40 break;
41 } 41 }
42--
432.17.1
44
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
deleted file mode 100644
index f5bf917a..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 25a67af22ad040f87b3c14185c338828d4e26908 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 11 Mar 2019 14:23:58 +0530
4Subject: [PATCH 25/40] [Patch,Microblaze] : Binutils security check is causing
5 build error for windows builds.commenting for now.
6
7---
8 bfd/elf-attrs.c | 3 +++
9 1 file changed, 3 insertions(+)
10
11diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
12index bfe135e7fbb..abf267ad42e 100644
13--- a/bfd/elf-attrs.c
14+++ b/bfd/elf-attrs.c
15@@ -440,6 +440,8 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
16 /* PR 17512: file: 2844a11d. */
17 if (hdr->sh_size == 0)
18 return;
19+
20+ #if 0
21 if (hdr->sh_size > bfd_get_file_size (abfd))
22 {
23 /* xgettext:c-format */
24@@ -448,6 +450,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
25 bfd_set_error (bfd_error_invalid_operation);
26 return;
27 }
28+ #endif
29
30 contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1);
31 if (!contents)
32--
332.17.1
34
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0026-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
index f5ddce41..c2ae39e8 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0026-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
@@ -1,16 +1,17 @@
1From b9e89f0698fd0e3b0e965986681f9fd90d3dc313 Mon Sep 17 00:00:00 2001 1From f64c95b119637880e8898b459e7665f0d92cef20 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530 3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 26/40] fixing the long & long long mingw toolchain issue 4Subject: [PATCH 25/52] fixing the long & long long mingw toolchain issue
5 5
6--- 6---
7 gas/config/tc-microblaze.c | 10 +++++-----
7 opcodes/microblaze-opc.h | 4 ++-- 8 opcodes/microblaze-opc.h | 4 ++--
8 2 files changed, 7 insertions(+), 7 deletions(-) 9 2 files changed, 7 insertions(+), 7 deletions(-)
9 10
10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 11Index: gdb-9.2/opcodes/microblaze-opc.h
11index f4ee8f43372..c8c2addc351 100644 12===================================================================
12--- a/opcodes/microblaze-opc.h 13--- gdb-9.2.orig/opcodes/microblaze-opc.h
13+++ b/opcodes/microblaze-opc.h 14+++ gdb-9.2/opcodes/microblaze-opc.h
14@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr"; 15@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr";
15 #define MIN_IMM6_WIDTH ((int) 0x00000001) 16 #define MIN_IMM6_WIDTH ((int) 0x00000001)
16 #define MAX_IMM6_WIDTH ((int) 0x00000040) 17 #define MAX_IMM6_WIDTH ((int) 0x00000040)
@@ -22,6 +23,3 @@ index f4ee8f43372..c8c2addc351 100644
22 23
23 #endif /* MICROBLAZE_OPC */ 24 #endif /* MICROBLAZE_OPC */
24 25
25--
262.17.1
27
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0027-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
index bf05816d..90094aba 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0027-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
@@ -1,24 +1,26 @@
1From efc3fd518cdb7e8bf82ac27b98b946001f83a2bf Mon Sep 17 00:00:00 2001 1From b8128385902d88414c354b772828eefe3b59fb06 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530 3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 27/40] Added support to new arithmetic single register 4Subject: [PATCH 26/52] Added support to new arithmetic single register
5 instructions 5 instructions
6 6
7Conflicts:
8 opcodes/microblaze-dis.c
7--- 9---
10 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
8 opcodes/microblaze-dis.c | 13 +++- 11 opcodes/microblaze-dis.c | 13 +++-
9 opcodes/microblaze-opc.h | 45 +++++++++++- 12 opcodes/microblaze-opc.h | 43 ++++++++++-
10 opcodes/microblaze-opcm.h | 5 +- 13 opcodes/microblaze-opcm.h | 5 +-
11 4 files changed, 201 insertions(+), 7 deletions(-) 14 4 files changed, 201 insertions(+), 7 deletions(-)
12 15
13diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 16Index: gdb-9.2/opcodes/microblaze-dis.c
14index 24ede714858..e93d9b890ba 100644 17===================================================================
15--- a/opcodes/microblaze-dis.c 18--- gdb-9.2.orig/opcodes/microblaze-dis.c
16+++ b/opcodes/microblaze-dis.c 19+++ gdb-9.2/opcodes/microblaze-dis.c
17@@ -131,6 +131,15 @@ get_field_imm15 (struct string_buf *buf, long instr) 20@@ -130,9 +130,17 @@ get_field_imm15 (struct string_buf *buf,
18 return p; 21 return p;
19 } 22 }
20 23
21+static char *
22+get_field_imm16 (struct string_buf *buf, long instr) 24+get_field_imm16 (struct string_buf *buf, long instr)
23+{ 25+{
24+ char *p = strbuf (buf); 26+ char *p = strbuf (buf);
@@ -29,29 +31,25 @@ index 24ede714858..e93d9b890ba 100644
29+ 31+
30 static char * 32 static char *
31 get_field_special (struct string_buf *buf, long instr, 33 get_field_special (struct string_buf *buf, long instr,
32 struct op_code_struct *op) 34- struct op_code_struct *op)
33@@ -448,6 +457,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 35+ struct op_code_struct *op)
34 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 36 {
35 get_field_imm15 (&buf, inst)); 37 char *p = strbuf (buf);
36 break; 38 char *spr;
37+ case INST_TYPE_RD_IMML: 39@@ -454,6 +462,9 @@ print_insn_microblaze (bfd_vma memaddr,
38+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
39+ break;
40 /* For mbar insn. */
41 case INST_TYPE_IMM5:
42 print_func (stream, "\t%s", get_field_imm5_mbar (&buf, inst));
43@@ -455,7 +467,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
44 /* For mbar 16 or sleep insn. */ 40 /* For mbar 16 or sleep insn. */
45 case INST_TYPE_NONE: 41 case INST_TYPE_NONE:
46 break; 42 break;
47- /* For tuqula instruction */ 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;
48 /* For bit field insns. */ 46 /* For bit field insns. */
49 case INST_TYPE_RD_R1_IMMW_IMMS: 47 case INST_TYPE_RD_R1_IMMW_IMMS:
50 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst), 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));
51diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 49Index: gdb-9.2/opcodes/microblaze-opc.h
52index c8c2addc351..eaf4a1bd9f9 100644 50===================================================================
53--- a/opcodes/microblaze-opc.h 51--- gdb-9.2.orig/opcodes/microblaze-opc.h
54+++ b/opcodes/microblaze-opc.h 52+++ gdb-9.2/opcodes/microblaze-opc.h
55@@ -69,6 +69,7 @@ 53@@ -69,6 +69,7 @@
56 #define INST_TYPE_RD_R1_IMMW_IMMS 21 54 #define INST_TYPE_RD_R1_IMMW_IMMS 21
57 55
@@ -102,7 +100,7 @@ index c8c2addc351..eaf4a1bd9f9 100644
102 /* New Mask for msrset, msrclr insns. */ 100 /* New Mask for msrset, msrclr insns. */
103 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ 101 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
104 /* Mask for mbar insn. */ 102 /* Mask for mbar insn. */
105@@ -114,13 +143,13 @@ 103@@ -114,7 +143,7 @@
106 #define DELAY_SLOT 1 104 #define DELAY_SLOT 1
107 #define NO_DELAY_SLOT 0 105 #define NO_DELAY_SLOT 0
108 106
@@ -111,13 +109,6 @@ index c8c2addc351..eaf4a1bd9f9 100644
111 109
112 struct op_code_struct 110 struct op_code_struct
113 { 111 {
114 const char * name;
115 short inst_type; /* Registers and immediate values involved. */
116- short inst_offset_type; /* Immediate vals offset from PC? (= 1 for branches). */
117+ int inst_offset_type; /* Immediate vals offset from PC? (= 1 for branches). */
118 short delay_slots; /* Info about delay slots needed after this instr. */
119 short immval_mask;
120 unsigned long bit_sequence; /* All the fixed bits for the op are set and
121@@ -444,13 +473,21 @@ struct op_code_struct 112@@ -444,13 +473,21 @@ struct op_code_struct
122 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst }, 113 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
123 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, 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 },
@@ -154,10 +145,10 @@ index c8c2addc351..eaf4a1bd9f9 100644
154 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst }, 145 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
155 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst }, 146 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
156 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst }, 147 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
157diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 148Index: gdb-9.2/opcodes/microblaze-opcm.h
158index ee01cdb7d9b..31726c9b01a 100644 149===================================================================
159--- a/opcodes/microblaze-opcm.h 150--- gdb-9.2.orig/opcodes/microblaze-opcm.h
160+++ b/opcodes/microblaze-opcm.h 151+++ gdb-9.2/opcodes/microblaze-opcm.h
161@@ -61,7 +61,9 @@ enum microblaze_instr 152@@ -61,7 +61,9 @@ enum microblaze_instr
162 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd, 153 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
163 154
@@ -176,6 +167,3 @@ index ee01cdb7d9b..31726c9b01a 100644
176+#define IMM16_MASK 0x0000FFFF 167+#define IMM16_MASK 0x0000FFFF
177 168
178 #endif /* MICROBLAZE-OPCM */ 169 #endif /* MICROBLAZE-OPCM */
179--
1802.17.1
181
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0028-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
index 01d615da..bbcac109 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0028-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
@@ -1,28 +1,26 @@
1From 953a4eb8152c0aca3e36ccc22a8950c9e68965b5 Mon Sep 17 00:00:00 2001 1From 41b562250cdac5fd821267c6dac68b799d80dbe3 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530 3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 28/40] [Patch,MicroBlaze] : double imml generation for 64 bit 4Subject: [PATCH 27/52] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values. 5 values.
6 6
7--- 7---
8 gas/config/tc-microblaze.c | 322 ++++++++++++++++++++++++++++++-------
8 opcodes/microblaze-opc.h | 4 +- 9 opcodes/microblaze-opc.h | 4 +-
9 2 files changed, 264 insertions(+), 64 deletions(-) 10 2 files changed, 263 insertions(+), 63 deletions(-)
10 11
11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 12Index: gdb-9.2/opcodes/microblaze-opc.h
12index eaf4a1bd9f9..79c3cf0d1a1 100644 13===================================================================
13--- a/opcodes/microblaze-opc.h 14--- gdb-9.2.orig/opcodes/microblaze-opc.h
14+++ b/opcodes/microblaze-opc.h 15+++ gdb-9.2/opcodes/microblaze-opc.h
15@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; 16@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
16 #define MIN_IMM6_WIDTH ((int) 0x00000001) 17 #define MIN_IMM6_WIDTH ((int) 0x00000001)
17 #define MAX_IMM6_WIDTH ((int) 0x00000040) 18 #define MAX_IMM6_WIDTH ((int) 0x00000040)
18 19
19-#define MIN_IMML ((long long) 0xffffff8000000000L) 20-#define MIN_IMML ((long long) 0xffffff8000000000L)
20-#define MAX_IMML ((long long) 0x0000007fffffffffL) 21-#define MAX_IMML ((long long) 0x0000007fffffffffL)
21+#define MIN_IMML ((long long) -9223372036854775807) 22+#define MIN_IMML ((long long) -9223372036854775808)
22+#define MAX_IMML ((long long) 9223372036854775807) 23+#define MAX_IMML ((long long) 9223372036854775807)
23 24
24 #endif /* MICROBLAZE_OPC */ 25 #endif /* MICROBLAZE_OPC */
25 26
26--
272.17.1
28
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
new file mode 100644
index 00000000..f5280eba
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
@@ -0,0 +1,40 @@
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/0034-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
index ff1c606c..c82a9883 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0034-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -1,7 +1,7 @@
1From c5eee33cd39dbb9c44bdad2025a5c848139c55f2 Mon Sep 17 00:00:00 2001 1From d495e03657b25b793f7c9bdd689fdc2d1633a47b 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 34/40] Add initial port of linux gdbserver add 4Subject: [PATCH 33/52] 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
@@ -21,23 +21,19 @@ Signed-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--- 22---
23 gdb/configure.host | 3 + 23 gdb/configure.host | 3 +
24 gdb/features/microblaze-linux.xml | 12 ++
25 gdb/gdbserver/Makefile.in | 4 +
26 gdb/gdbserver/configure.srv | 8 ++
27 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++ 24 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++
28 gdb/microblaze-linux-tdep.c | 29 +++- 25 gdb/microblaze-linux-tdep.c | 29 +++-
29 gdb/microblaze-tdep.c | 35 ++++- 26 gdb/microblaze-tdep.c | 35 ++++-
30 gdb/microblaze-tdep.h | 4 +- 27 gdb/microblaze-tdep.h | 4 +-
31 gdb/regformats/reg-microblaze.dat | 41 ++++++ 28 gdb/regformats/reg-microblaze.dat | 41 ++++++
32 9 files changed, 322 insertions(+), 3 deletions(-) 29 6 files changed, 298 insertions(+), 3 deletions(-)
33 create mode 100644 gdb/features/microblaze-linux.xml
34 create mode 100644 gdb/gdbserver/linux-microblaze-low.c 30 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
35 create mode 100644 gdb/regformats/reg-microblaze.dat 31 create mode 100644 gdb/regformats/reg-microblaze.dat
36 32
37diff --git a/gdb/configure.host b/gdb/configure.host 33Index: gdb-9.2/gdb/configure.host
38index ce528237291..cf1a08e8b28 100644 34===================================================================
39--- a/gdb/configure.host 35--- gdb-9.2.orig/gdb/configure.host
40+++ b/gdb/configure.host 36+++ gdb-9.2/gdb/configure.host
41@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;; 37@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;;
42 i[34567]86*) gdb_host_cpu=i386 ;; 38 i[34567]86*) gdb_host_cpu=i386 ;;
43 m68*) gdb_host_cpu=m68k ;; 39 m68*) gdb_host_cpu=m68k ;;
@@ -55,77 +51,10 @@ index ce528237291..cf1a08e8b28 100644
55 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) 51 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
56 gdb_host=aix ;; 52 gdb_host=aix ;;
57 powerpc*-*-freebsd*) gdb_host=fbsd ;; 53 powerpc*-*-freebsd*) gdb_host=fbsd ;;
58diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml 54Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
59new file mode 100644 55===================================================================
60index 00000000000..8983e66eb3d
61--- /dev/null 56--- /dev/null
62+++ b/gdb/features/microblaze-linux.xml 57+++ gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
63@@ -0,0 +1,12 @@
64+<?xml version="1.0"?>
65+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
66+
67+ Copying and distribution of this file, with or without modification,
68+ are permitted in any medium without royalty provided the copyright
69+ notice and this notice are preserved. -->
70+
71+<!DOCTYPE target SYSTEM "gdb-target.dtd">
72+<target>
73+ <osabi>GNU/Linux</osabi>
74+ <xi:include href="microblaze-core.xml"/>
75+</target>
76diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
77index 16a9f2fd380..fb4762a22d5 100644
78--- a/gdb/gdbserver/Makefile.in
79+++ b/gdb/gdbserver/Makefile.in
80@@ -172,6 +172,7 @@ SFILES = \
81 $(srcdir)/linux-low.c \
82 $(srcdir)/linux-m32r-low.c \
83 $(srcdir)/linux-m68k-low.c \
84+ $(srcdir)/linux-microblaze-low.c \
85 $(srcdir)/linux-mips-low.c \
86 $(srcdir)/linux-nios2-low.c \
87 $(srcdir)/linux-ppc-low.c \
88@@ -231,6 +232,7 @@ SFILES = \
89 $(srcdir)/nat/linux-namespaces.c \
90 $(srcdir)/nat/linux-osdata.c \
91 $(srcdir)/nat/linux-personality.c \
92+ $(srcdir)/nat/microblaze-linux.c \
93 $(srcdir)/nat/mips-linux-watch.c \
94 $(srcdir)/nat/ppc-linux.c \
95 $(srcdir)/nat/fork-inferior.c \
96@@ -657,6 +659,8 @@ gdbsupport/%.o: ../gdbsupport/%.c
97
98 %-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
99 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
100+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
101+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
102
103 #
104 # Dependency tracking.
105diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
106index 1a4ab8e3361..e0d2b2fe04a 100644
107--- a/gdb/gdbserver/configure.srv
108+++ b/gdb/gdbserver/configure.srv
109@@ -184,6 +184,14 @@ case "${target}" in
110 srv_linux_usrregs=yes
111 srv_linux_thread_db=yes
112 ;;
113+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
114+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
115+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
116+ srv_xmlfiles="microblaze-linux.xml"
117+ srv_linux_regsets=yes
118+ srv_linux_usrregs=yes
119+ srv_linux_thread_db=yes
120+ ;;
121 powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
122 srv_regobj="${srv_regobj} powerpc-altivec32l.o"
123 srv_regobj="${srv_regobj} powerpc-vsx32l.o"
124diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
125new file mode 100644
126index 00000000000..cba5d6fc585
127--- /dev/null
128+++ b/gdb/gdbserver/linux-microblaze-low.c
129@@ -0,0 +1,189 @@ 58@@ -0,0 +1,189 @@
130+/* GNU/Linux/Microblaze specific low level interface, for the remote server for 59+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
131+ GDB. 60+ GDB.
@@ -316,10 +245,10 @@ index 00000000000..cba5d6fc585
316+ microblaze_collect_ptrace_register, 245+ microblaze_collect_ptrace_register,
317+ microblaze_supply_ptrace_register, 246+ microblaze_supply_ptrace_register,
318+}; 247+};
319diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 248Index: gdb-9.2/gdb/microblaze-linux-tdep.c
320index 3bb9b5682ac..42c219d32f3 100644 249===================================================================
321--- a/gdb/microblaze-linux-tdep.c 250--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c
322+++ b/gdb/microblaze-linux-tdep.c 251+++ gdb-9.2/gdb/microblaze-linux-tdep.c
323@@ -37,6 +37,22 @@ 252@@ -37,6 +37,22 @@
324 #include "tramp-frame.h" 253 #include "tramp-frame.h"
325 #include "linux-tdep.h" 254 #include "linux-tdep.h"
@@ -343,14 +272,17 @@ index 3bb9b5682ac..42c219d32f3 100644
343 static int 272 static int
344 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 273 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
345 struct bp_target_info *bp_tgt) 274 struct bp_target_info *bp_tgt)
346@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 275@@ -46,18 +62,25 @@ microblaze_linux_memory_remove_breakpoin
276 int val;
277 int bplen;
278 gdb_byte old_contents[BREAKPOINT_MAX];
279+ struct cleanup *cleanup;
280
347 /* Determine appropriate breakpoint contents and size for this address. */ 281 /* Determine appropriate breakpoint contents and size for this address. */
348 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 282 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
349 283
350+ /* Make sure we see the memory breakpoints. */ 284+ /* Make sure we see the memory breakpoints. */
351+ scoped_restore restore_memory 285+ cleanup = make_show_memory_breakpoints_cleanup (1);
352+ = make_scoped_restore_show_memory_breakpoints (1);
353+
354 val = target_read_memory (addr, old_contents, bplen); 286 val = target_read_memory (addr, old_contents, bplen);
355 287
356 /* If our breakpoint is no longer at the address, this means that the 288 /* If our breakpoint is no longer at the address, this means that the
@@ -363,9 +295,11 @@ index 3bb9b5682ac..42c219d32f3 100644
363+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 295+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
364+ } 296+ }
365 297
298+ do_cleanups (cleanup);
366 return val; 299 return val;
367 } 300 }
368@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info, 301
302@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarc
369 /* Trampolines. */ 303 /* Trampolines. */
370 tramp_frame_prepend_unwinder (gdbarch, 304 tramp_frame_prepend_unwinder (gdbarch,
371 &microblaze_linux_sighandler_tramp_frame); 305 &microblaze_linux_sighandler_tramp_frame);
@@ -376,15 +310,14 @@ index 3bb9b5682ac..42c219d32f3 100644
376 } 310 }
377 311
378 void 312 void
379diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 313Index: gdb-9.2/gdb/microblaze-tdep.c
380index 17871229c80..0168e4881ed 100644 314===================================================================
381--- a/gdb/microblaze-tdep.c 315--- gdb-9.2.orig/gdb/microblaze-tdep.c
382+++ b/gdb/microblaze-tdep.c 316+++ gdb-9.2/gdb/microblaze-tdep.c
383@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) 317@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR
384 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; 318 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
385 319
386 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; 320 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
387-
388+static int 321+static int
389+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 322+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
390+ struct bp_target_info *bp_tgt) 323+ struct bp_target_info *bp_tgt)
@@ -394,6 +327,7 @@ index 17871229c80..0168e4881ed 100644
394+ int val; 327+ int val;
395+ int bplen; 328+ int bplen;
396+ gdb_byte old_contents[BREAKPOINT_MAX]; 329+ gdb_byte old_contents[BREAKPOINT_MAX];
330+ struct cleanup *cleanup;
397+ 331+
398+ /* Determine appropriate breakpoint contents and size for this address. */ 332+ /* Determine appropriate breakpoint contents and size for this address. */
399+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 333+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
@@ -401,9 +335,7 @@ index 17871229c80..0168e4881ed 100644
401+ error (_("Software breakpoints not implemented for this target.")); 335+ error (_("Software breakpoints not implemented for this target."));
402+ 336+
403+ /* Make sure we see the memory breakpoints. */ 337+ /* Make sure we see the memory breakpoints. */
404+ scoped_restore restore_memory 338+ cleanup = make_show_memory_breakpoints_cleanup (1);
405+ = make_scoped_restore_show_memory_breakpoints (1);
406+
407+ val = target_read_memory (addr, old_contents, bplen); 339+ val = target_read_memory (addr, old_contents, bplen);
408+ 340+
409+ /* If our breakpoint is no longer at the address, this means that the 341+ /* If our breakpoint is no longer at the address, this means that the
@@ -414,13 +346,14 @@ index 17871229c80..0168e4881ed 100644
414+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen); 346+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
415+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 347+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
416+ } 348+ }
417+ 349
350+ do_cleanups (cleanup);
418+ return val; 351+ return val;
419+} 352+}
420 353
421 /* Allocate and initialize a frame cache. */ 354 /* Allocate and initialize a frame cache. */
422 355
423@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 356@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_
424 microblaze_breakpoint::kind_from_pc); 357 microblaze_breakpoint::kind_from_pc);
425 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 358 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
426 microblaze_breakpoint::bp_from_kind); 359 microblaze_breakpoint::bp_from_kind);
@@ -428,16 +361,16 @@ index 17871229c80..0168e4881ed 100644
428 361
429 set_gdbarch_frame_args_skip (gdbarch, 8); 362 set_gdbarch_frame_args_skip (gdbarch, 8);
430 363
431@@ -770,4 +802,5 @@ When non-zero, microblaze specific debugging is enabled."), 364@@ -770,4 +802,5 @@ When non-zero, microblaze specific debug
432 NULL, 365 NULL,
433 &setdebuglist, &showdebuglist); 366 &setdebuglist, &showdebuglist);
434 367
435+ 368+
436 } 369 }
437diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 370Index: gdb-9.2/gdb/microblaze-tdep.h
438index 4fbdf9933f0..db0772643dc 100644 371===================================================================
439--- a/gdb/microblaze-tdep.h 372--- gdb-9.2.orig/gdb/microblaze-tdep.h
440+++ b/gdb/microblaze-tdep.h 373+++ gdb-9.2/gdb/microblaze-tdep.h
441@@ -117,6 +117,8 @@ struct microblaze_frame_cache 374@@ -117,6 +117,8 @@ struct microblaze_frame_cache
442 375
443 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 376 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
@@ -448,11 +381,10 @@ index 4fbdf9933f0..db0772643dc 100644
448+ 381+
449 382
450 #endif /* microblaze-tdep.h */ 383 #endif /* microblaze-tdep.h */
451diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat 384Index: gdb-9.2/gdb/regformats/reg-microblaze.dat
452new file mode 100644 385===================================================================
453index 00000000000..bd8a4384424
454--- /dev/null 386--- /dev/null
455+++ b/gdb/regformats/reg-microblaze.dat 387+++ gdb-9.2/gdb/regformats/reg-microblaze.dat
456@@ -0,0 +1,41 @@ 388@@ -0,0 +1,41 @@
457+name:microblaze 389+name:microblaze
458+expedite:r1,pc 390+expedite:r1,pc
@@ -495,6 +427,3 @@ index 00000000000..bd8a4384424
495+32:fsr 427+32:fsr
496+32:slr 428+32:slr
497+32:shr 429+32:shr
498--
4992.17.1
500
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Fix-various-compile-warnings.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0033-Fix-various-compile-warnings.patch
deleted file mode 100644
index 4172595b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Fix-various-compile-warnings.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From c59684852ecd37d6f82363f2cf0e1de1f770aab7 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Fri, 17 Jul 2020 09:20:54 -0500
4Subject: [PATCH 33/40] Fix various compile warnings
5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7---
8 bfd/elf64-microblaze.c | 9 +++++----
9 2 files changed, 10 insertions(+), 10 deletions(-)
10
11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
12index b002b414d64..8308f1ebd09 100644
13--- a/bfd/elf64-microblaze.c
14+++ b/bfd/elf64-microblaze.c
15@@ -692,7 +692,7 @@ microblaze_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
16 /* Set the howto pointer for a RCE ELF reloc. */
17
18 static bfd_boolean
19-microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
20+microblaze_elf_info_to_howto (bfd * abfd,
21 arelent * cache_ptr,
22 Elf_Internal_Rela * dst)
23 {
24@@ -705,14 +705,14 @@ microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
25 r_type = ELF64_R_TYPE (dst->r_info);
26 if (r_type >= R_MICROBLAZE_max)
27 {
28- (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"),
29+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
30 abfd, r_type);
31 bfd_set_error (bfd_error_bad_value);
32 return FALSE;
33 }
34
35 cache_ptr->howto = microblaze_elf_howto_table [r_type];
36- return TRUE;
37+ return TRUE;
38 }
39
40 /* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
41@@ -1560,7 +1560,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
42 else
43 {
44 BFD_FAIL ();
45- (*_bfd_error_handler)
46+ _bfd_error_handler
47 (_("%pB: probably compiled without -fPIC?"),
48 input_bfd);
49 bfd_set_error (bfd_error_bad_value);
50@@ -2554,6 +2554,7 @@ microblaze_elf_check_relocs (bfd * abfd,
51 goto dogottls;
52 case R_MICROBLAZE_TLSLD:
53 tls_type |= (TLS_TLS | TLS_LD);
54+ /* Fall through. */
55 dogottls:
56 sec->has_tls_reloc = 1;
57 /* Fall through. */
58--
592.17.1
60
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch
index 171a0bf4..d32b501c 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0034-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -1,25 +1,25 @@
1From f8cbcd1ef78f6ce9ae8d3382bf2bb0d1e770d201 Mon Sep 17 00:00:00 2001 1From e6929fae6b3850eb925ef147bf0d0b09ca80cdf8 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 35/40] Initial port of core reading support Added support for 4Subject: [PATCH 34/52] 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 | 17 +++++++- 13 gdb/microblaze-linux-tdep.c | 57 +++++++++++++++++++++++
14 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++ 14 gdb/microblaze-tdep.c | 90 +++++++++++++++++++++++++++++++++++++
15 gdb/microblaze-tdep.h | 27 ++++++++++++ 15 gdb/microblaze-tdep.h | 27 +++++++++++
16 5 files changed, 176 insertions(+), 2 deletions(-) 16 5 files changed, 259 insertions(+), 1 deletion(-)
17 17
18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 18Index: gdb-9.2/bfd/elf32-microblaze.c
19index 04816a4a187..cb7a98d307e 100644 19===================================================================
20--- a/bfd/elf32-microblaze.c 20--- gdb-9.2.orig/bfd/elf32-microblaze.c
21+++ b/bfd/elf32-microblaze.c 21+++ gdb-9.2/bfd/elf32-microblaze.c
22@@ -767,6 +767,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 22@@ -767,6 +767,87 @@ microblaze_elf_is_local_label_name (bfd
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 04816a4a187..cb7a98d307e 100644
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@@ -3673,4 +3754,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 110@@ -3675,4 +3756,7 @@ microblaze_elf_add_symbol_hook (bfd *abf
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 04816a4a187..cb7a98d307e 100644
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"
118diff --git a/gdb/configure.tgt b/gdb/configure.tgt 118Index: gdb-9.2/gdb/configure.tgt
119index caa42be1c01..f0386568460 100644 119===================================================================
120--- a/gdb/configure.tgt 120--- gdb-9.2.orig/gdb/configure.tgt
121+++ b/gdb/configure.tgt 121+++ gdb-9.2/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,35 +128,66 @@ index caa42be1c01..f0386568460 100644
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 ;;
131diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 131Index: gdb-9.2/gdb/microblaze-linux-tdep.c
132index 42c219d32f3..0afb6efeba3 100644 132===================================================================
133--- a/gdb/microblaze-linux-tdep.c 133--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c
134+++ b/gdb/microblaze-linux-tdep.c 134+++ gdb-9.2/gdb/microblaze-linux-tdep.c
135@@ -36,6 +36,7 @@ 135@@ -135,11 +135,54 @@ static struct tramp_frame microblaze_lin
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 =
144 microblaze_linux_sighandler_cache_init 136 microblaze_linux_sighandler_cache_init
145 }; 137 };
146 138
147- 139+const struct microblaze_gregset microblaze_linux_core_gregset;
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
148 static void 177 static void
149 microblaze_linux_init_abi (struct gdbarch_info info, 178 microblaze_linux_init_abi (struct gdbarch_info info,
150 struct gdbarch *gdbarch) 179 struct gdbarch *gdbarch)
151 { 180 {
152+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 181+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
153+ 182+
183+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
184+ microblaze_linux_collect_core_gregset);
154+ tdep->sizeof_gregset = 200; 185+ tdep->sizeof_gregset = 200;
155+ 186+
156 linux_init_abi (info, gdbarch); 187 linux_init_abi (info, gdbarch);
157 188
158 set_gdbarch_memory_remove_breakpoint (gdbarch, 189 set_gdbarch_memory_remove_breakpoint (gdbarch,
159@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info, 190@@ -153,6 +196,20 @@ microblaze_linux_init_abi (struct gdbarc
160 tramp_frame_prepend_unwinder (gdbarch, 191 tramp_frame_prepend_unwinder (gdbarch,
161 &microblaze_linux_sighandler_tramp_frame); 192 &microblaze_linux_sighandler_tramp_frame);
162 193
@@ -171,50 +202,109 @@ index 42c219d32f3..0afb6efeba3 100644
171+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 202+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
172+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); 203+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
173+ 204+
205+ set_gdbarch_regset_from_core_section (gdbarch,
206+ microblaze_regset_from_core_section);
207+
174 /* Enable TLS support. */ 208 /* Enable TLS support. */
175 set_gdbarch_fetch_tls_load_module_address (gdbarch, 209 set_gdbarch_fetch_tls_load_module_address (gdbarch,
176 svr4_fetch_objfile_link_map); 210 svr4_fetch_objfile_link_map);
177diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 211Index: gdb-9.2/gdb/microblaze-tdep.c
178index 0168e4881ed..98944f38d2a 100644 212===================================================================
179--- a/gdb/microblaze-tdep.c 213--- gdb-9.2.orig/gdb/microblaze-tdep.c
180+++ b/gdb/microblaze-tdep.c 214+++ gdb-9.2/gdb/microblaze-tdep.c
181@@ -677,6 +677,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 215@@ -137,6 +137,14 @@ microblaze_fetch_instruction (CORE_ADDR
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
182 tdesc_microblaze_with_stack_protect); 244 tdesc_microblaze_with_stack_protect);
183 } 245 }
184 246
185+void 247+void
186+microblaze_supply_gregset (const struct regset *regset, 248+microblaze_supply_gregset (const struct microblaze_gregset *gregset,
187+ struct regcache *regcache, 249+ struct regcache *regcache,
188+ int regnum, const void *gregs) 250+ int regnum, const void *gregs)
189+{ 251+{
190+ const unsigned int *regs = (const unsigned int *)gregs; 252+ unsigned int *regs = gregs;
191+ if (regnum >= 0) 253+ if (regnum >= 0)
192+ regcache->raw_supply (regnum, regs + regnum); 254+ regcache_raw_supply (regcache, regnum, regs + regnum);
193+ 255+
194+ if (regnum == -1) { 256+ if (regnum == -1) {
195+ int i; 257+ int i;
196+ 258+
197+ for (i = 0; i < 50; i++) { 259+ for (i = 0; i < 50; i++) {
198+ regcache->raw_supply (i, regs + i); 260+ regcache_raw_supply (regcache, i, regs + i);
199+ } 261+ }
200+ } 262+ }
201+} 263+}
202+ 264+
203+ 265+
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+
204+/* Return the appropriate register set for the core section identified 289+/* Return the appropriate register set for the core section identified
205+ by SECT_NAME and SECT_SIZE. */ 290+ by SECT_NAME and SECT_SIZE. */
206+ 291+
207+static void 292+const struct regset *
208+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, 293+microblaze_regset_from_core_section (struct gdbarch *gdbarch,
209+ iterate_over_regset_sections_cb *cb, 294+ const char *sect_name, size_t sect_size)
210+ void *cb_data,
211+ const struct regcache *regcache)
212+{ 295+{
213+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 296+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
214+ 297+
215+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data); 298+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name);
216+ 299+
217+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data); 300+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
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;
218+} 308+}
219+ 309+
220+ 310+
@@ -222,7 +312,7 @@ index 0168e4881ed..98944f38d2a 100644
222 static struct gdbarch * 312 static struct gdbarch *
223 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 313 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
224 { 314 {
225@@ -733,6 +770,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 315@@ -733,6 +812,10 @@ microblaze_gdbarch_init (struct gdbarch_
226 tdep = XCNEW (struct gdbarch_tdep); 316 tdep = XCNEW (struct gdbarch_tdep);
227 gdbarch = gdbarch_alloc (&info, tdep); 317 gdbarch = gdbarch_alloc (&info, tdep);
228 318
@@ -233,7 +323,7 @@ index 0168e4881ed..98944f38d2a 100644
233 set_gdbarch_long_double_bit (gdbarch, 128); 323 set_gdbarch_long_double_bit (gdbarch, 128);
234 324
235 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 325 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
236@@ -781,6 +822,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 326@@ -781,6 +864,13 @@ microblaze_gdbarch_init (struct gdbarch_
237 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 327 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
238 if (tdesc_data != NULL) 328 if (tdesc_data != NULL)
239 tdesc_use_registers (gdbarch, tdesc, tdesc_data); 329 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
@@ -241,16 +331,16 @@ index 0168e4881ed..98944f38d2a 100644
241+ 331+
242+ /* If we have register sets, enable the generic core file support. */ 332+ /* If we have register sets, enable the generic core file support. */
243+ if (tdep->gregset) { 333+ if (tdep->gregset) {
244+ set_gdbarch_iterate_over_regset_sections (gdbarch, 334+ set_gdbarch_regset_from_core_section (gdbarch,
245+ microblaze_iterate_over_regset_sections); 335+ microblaze_regset_from_core_section);
246+ } 336+ }
247 337
248 return gdbarch; 338 return gdbarch;
249 } 339 }
250diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 340Index: gdb-9.2/gdb/microblaze-tdep.h
251index db0772643dc..8f41ba19351 100644 341===================================================================
252--- a/gdb/microblaze-tdep.h 342--- gdb-9.2.orig/gdb/microblaze-tdep.h
253+++ b/gdb/microblaze-tdep.h 343+++ gdb-9.2/gdb/microblaze-tdep.h
254@@ -22,8 +22,22 @@ 344@@ -22,8 +22,22 @@
255 345
256 346
@@ -278,10 +368,10 @@ index db0772643dc..8f41ba19351 100644
278 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} 368 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
279 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} 369 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
280 370
281+extern void microblaze_supply_gregset (const struct regset *regset, 371+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
282+ struct regcache *regcache, 372+ struct regcache *regcache,
283+ int regnum, const void *gregs); 373+ int regnum, const void *gregs);
284+extern void microblaze_collect_gregset (const struct regset *regset, 374+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset,
285+ const struct regcache *regcache, 375+ const struct regcache *regcache,
286+ int regnum, void *gregs); 376+ int regnum, void *gregs);
287+extern void microblaze_supply_fpregset (struct regcache *regcache, 377+extern void microblaze_supply_fpregset (struct regcache *regcache,
@@ -293,6 +383,3 @@ index db0772643dc..8f41ba19351 100644
293+ const char *sect_name, size_t sect_size); 383+ const char *sect_name, size_t sect_size);
294 384
295 #endif /* microblaze-tdep.h */ 385 #endif /* microblaze-tdep.h */
296--
2972.17.1
298
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch
index f0c182d3..9983f17f 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0035-Fix-debug-message-when-register-is-unavailable.patch
@@ -1,18 +1,18 @@
1From 41fd9d3645d610ff65171e9a44427711232cb4b8 Mon Sep 17 00:00:00 2001 1From c6da374fbce33b35b060a07ee446aaf1803b1e1d 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 36/40] Fix debug message when register is unavailable 4Subject: [PATCH 35/52] 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
11diff --git a/gdb/frame.c b/gdb/frame.c 11Index: gdb-9.2/gdb/frame.c
12index c746a6a231e..571722c7351 100644 12===================================================================
13--- a/gdb/frame.c 13--- gdb-9.2.orig/gdb/frame.c
14+++ b/gdb/frame.c 14+++ gdb-9.2/gdb/frame.c
15@@ -1255,12 +1255,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) 15@@ -1255,12 +1255,19 @@ frame_unwind_register_value (frame_info
16 else 16 else
17 { 17 {
18 int i; 18 int i;
@@ -35,6 +35,3 @@ index c746a6a231e..571722c7351 100644
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/0036-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch
new file mode 100644
index 00000000..cca0c7af
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver.patch
@@ -0,0 +1,28 @@
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
new file mode 100644
index 00000000..f6c3a060
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
@@ -0,0 +1,30 @@
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/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index 1e0bffbe..37a9646f 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 7b22823ae82445f52384e6c0bd85431294868eb7 Mon Sep 17 00:00:00 2001 1From 6474cf4147887529ccb506b80f945aa67178f5bd 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 37/40] microblaze: Add build_gdbserver=yes to top level 4Subject: [PATCH 38/52] 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
18diff --git a/gdb/configure.tgt b/gdb/configure.tgt 18Index: gdb-9.2/gdb/configure.tgt
19index f0386568460..ae238c17cd5 100644 19===================================================================
20--- a/gdb/configure.tgt 20--- gdb-9.2.orig/gdb/configure.tgt
21+++ b/gdb/configure.tgt 21+++ gdb-9.2/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,6 +27,3 @@ index f0386568460..ae238c17cd5 100644
27 ;; 27 ;;
28 28
29 mips*-*-linux*) 29 mips*-*-linux*)
30--
312.17.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch
index afde3ce8..669b5927 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-support-for-native-gdb.patch
@@ -1,12 +1,15 @@
1From a06b9c4860af1f8f18ccb7c0653c76c623636034 Mon Sep 17 00:00:00 2001 1From db3c0a8a59b292eea6ed1f532f4097c40cafd7df 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 38/40] Initial support for native gdb 4Subject: [PATCH 39/52] 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
10--- 13---
11 gdb/Makefile.in | 2 + 14 gdb/Makefile.in | 2 +
12 gdb/config/microblaze/linux.mh | 9 + 15 gdb/config/microblaze/linux.mh | 9 +
@@ -15,10 +18,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
15 create mode 100644 gdb/config/microblaze/linux.mh 18 create mode 100644 gdb/config/microblaze/linux.mh
16 create mode 100644 gdb/microblaze-linux-nat.c 19 create mode 100644 gdb/microblaze-linux-nat.c
17 20
18diff --git a/gdb/Makefile.in b/gdb/Makefile.in 21Index: gdb-9.2/gdb/Makefile.in
19index c3e074b21fe..cbcd8f43326 100644 22===================================================================
20--- a/gdb/Makefile.in 23--- gdb-9.2.orig/gdb/Makefile.in
21+++ b/gdb/Makefile.in 24+++ gdb-9.2/gdb/Makefile.in
22@@ -1337,6 +1337,7 @@ HFILES_NO_SRCDIR = \ 25@@ -1337,6 +1337,7 @@ HFILES_NO_SRCDIR = \
23 memory-map.h \ 26 memory-map.h \
24 memrange.h \ 27 memrange.h \
@@ -35,11 +38,10 @@ index c3e074b21fe..cbcd8f43326 100644
35 mingw-hdep.c \ 38 mingw-hdep.c \
36 mips-fbsd-nat.c \ 39 mips-fbsd-nat.c \
37 mips-fbsd-tdep.c \ 40 mips-fbsd-tdep.c \
38diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 41Index: gdb-9.2/gdb/config/microblaze/linux.mh
39new file mode 100644 42===================================================================
40index 00000000000..a4eaf540e1d
41--- /dev/null 43--- /dev/null
42+++ b/gdb/config/microblaze/linux.mh 44+++ gdb-9.2/gdb/config/microblaze/linux.mh
43@@ -0,0 +1,9 @@ 45@@ -0,0 +1,9 @@
44+# Host: Microblaze, running Linux 46+# Host: Microblaze, running Linux
45+ 47+
@@ -50,11 +52,10 @@ index 00000000000..a4eaf540e1d
50+NAT_CDEPS = $(srcdir)/proc-service.list 52+NAT_CDEPS = $(srcdir)/proc-service.list
51+ 53+
52+LOADLIBES = -ldl $(RDYNAMIC) 54+LOADLIBES = -ldl $(RDYNAMIC)
53diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 55Index: gdb-9.2/gdb/microblaze-linux-nat.c
54new file mode 100644 56===================================================================
55index 00000000000..e9b8c9c5221
56--- /dev/null 57--- /dev/null
57+++ b/gdb/microblaze-linux-nat.c 58+++ gdb-9.2/gdb/microblaze-linux-nat.c
58@@ -0,0 +1,431 @@ 59@@ -0,0 +1,431 @@
59+/* Microblaze GNU/Linux native support. 60+/* Microblaze GNU/Linux native support.
60+ 61+
@@ -487,6 +488,3 @@ index 00000000000..e9b8c9c5221
487+ /* Register the target. */ 488+ /* Register the target. */
488+ linux_nat_add_target (t); 489+ linux_nat_add_target (t);
489+} 490+}
490--
4912.17.1
492
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Fixing-the-issues-related-to-GDB-7.12.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
index fb4b35e5..85f8174a 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Fixing-the-issues-related-to-GDB-7.12.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
@@ -1,21 +1,22 @@
1From f13ffe15c10e5d4b5c87761ae9735144d4c8da17 Mon Sep 17 00:00:00 2001 1From bf3c50c95c4dcca6c5c07a3c082bdd9d687f1496 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 39/40] Fixing the issues related to GDB-7.12 4Subject: [PATCH 40/52] Fixing the issues related to GDB-7.12 added all the
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
5 7
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 +- 10 gdb/gdbserver/configure.srv | 3 +-
11 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++---- 11 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
12 gdb/microblaze-linux-tdep.c | 68 +++++++++++++++++--
12 gdb/microblaze-tdep.h | 1 + 13 gdb/microblaze-tdep.h | 1 +
13 4 files changed, 89 insertions(+), 16 deletions(-) 14 5 files changed, 153 insertions(+), 20 deletions(-)
14 15
15diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 16Index: gdb-9.2/gdb/config/microblaze/linux.mh
16index a4eaf540e1d..74a53b854a4 100644 17===================================================================
17--- a/gdb/config/microblaze/linux.mh 18--- gdb-9.2.orig/gdb/config/microblaze/linux.mh
18+++ b/gdb/config/microblaze/linux.mh 19+++ gdb-9.2/gdb/config/microblaze/linux.mh
19@@ -1,9 +1,11 @@ 20@@ -1,9 +1,11 @@
20 # Host: Microblaze, running Linux 21 # Host: Microblaze, running Linux
21 22
@@ -29,24 +30,24 @@ index a4eaf540e1d..74a53b854a4 100644
29 NAT_CDEPS = $(srcdir)/proc-service.list 30 NAT_CDEPS = $(srcdir)/proc-service.list
30 31
31 LOADLIBES = -ldl $(RDYNAMIC) 32 LOADLIBES = -ldl $(RDYNAMIC)
32diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv 33Index: gdb-9.2/gdb/gdbserver/configure.srv
33index e0d2b2fe04a..26db2dd2461 100644 34===================================================================
34--- a/gdb/gdbserver/configure.srv 35--- gdb-9.2.orig/gdb/gdbserver/configure.srv
35+++ b/gdb/gdbserver/configure.srv 36+++ gdb-9.2/gdb/gdbserver/configure.srv
36@@ -185,8 +185,7 @@ case "${target}" in 37@@ -185,8 +185,7 @@ case "${target}" in
37 srv_linux_thread_db=yes 38 srv_linux_thread_db=yes
38 ;; 39 ;;
39 microblaze*-*-linux*) srv_regobj="microblaze-linux.o" 40 microblaze*-*-linux*) srv_regobj=microblaze-linux.o
40- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o " 41- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
41- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o" 42- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
42+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o " 43+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
43 srv_xmlfiles="microblaze-linux.xml"
44 srv_linux_regsets=yes 44 srv_linux_regsets=yes
45 srv_linux_usrregs=yes 45 srv_linux_usrregs=yes
46diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 46 srv_linux_thread_db=yes
47index cba5d6fc585..a2733f3c21c 100644 47Index: gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
48--- a/gdb/gdbserver/linux-microblaze-low.c 48===================================================================
49+++ b/gdb/gdbserver/linux-microblaze-low.c 49--- gdb-9.2.orig/gdb/gdbserver/linux-microblaze-low.c
50+++ gdb-9.2/gdb/gdbserver/linux-microblaze-low.c
50@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 51@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
51 PT_FSR 52 PT_FSR
52 }; 53 };
@@ -60,7 +61,7 @@ index cba5d6fc585..a2733f3c21c 100644
60 61
61 static int 62 static int
62 microblaze_cannot_store_register (int regno) 63 microblaze_cannot_store_register (int regno)
63@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc) 64@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regc
64 static const unsigned long microblaze_breakpoint = 0xba0c0018; 65 static const unsigned long microblaze_breakpoint = 0xba0c0018;
65 #define microblaze_breakpoint_len 4 66 #define microblaze_breakpoint_len 4
66 67
@@ -76,7 +77,7 @@ index cba5d6fc585..a2733f3c21c 100644
76 static int 77 static int
77 microblaze_breakpoint_at (CORE_ADDR where) 78 microblaze_breakpoint_at (CORE_ADDR where)
78 { 79 {
79@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcache *regcache) 80@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcach
80 static void 81 static void
81 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf) 82 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
82 { 83 {
@@ -94,7 +95,7 @@ index cba5d6fc585..a2733f3c21c 100644
94 95
95 if (regno == 0) { 96 if (regno == 0) {
96 unsigned long regbuf_0 = 0; 97 unsigned long regbuf_0 = 0;
97@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcache *regcache, const void *buf) 98@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcach
98 99
99 #endif /* HAVE_PTRACE_GETREGS */ 100 #endif /* HAVE_PTRACE_GETREGS */
100 101
@@ -199,10 +200,102 @@ index cba5d6fc585..a2733f3c21c 100644
199+{ 200+{
200+ init_registers_microblaze (); 201+ init_registers_microblaze ();
201+} 202+}
202diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 203Index: gdb-9.2/gdb/microblaze-linux-tdep.c
203index 8f41ba19351..d2112dc07e1 100644 204===================================================================
204--- a/gdb/microblaze-tdep.h 205--- gdb-9.2.orig/gdb/microblaze-linux-tdep.c
205+++ b/gdb/microblaze-tdep.h 206+++ gdb-9.2/gdb/microblaze-linux-tdep.c
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
206@@ -24,6 +24,7 @@ 299@@ -24,6 +24,7 @@
207 /* Microblaze architecture-specific information. */ 300 /* Microblaze architecture-specific information. */
208 struct microblaze_gregset 301 struct microblaze_gregset
@@ -211,6 +304,3 @@ index 8f41ba19351..d2112dc07e1 100644
211 unsigned int gregs[32]; 304 unsigned int gregs[32];
212 unsigned int fpregs[32]; 305 unsigned int fpregs[32];
213 unsigned int pregs[16]; 306 unsigned int pregs[16];
214--
2152.17.1
216
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
index 7ac8f07f..0c72e792 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
@@ -1,31 +1,33 @@
1From 4e5a4e94cb1dd61646230100f883bd27a39cd896 Mon Sep 17 00:00:00 2001 1From 992c41987cb6c89bb3f9cbc0f6a2b0aa3458e4d2 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530 3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 40/40] [Patch, microblaze]: Adding 64 bit MB support 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>
5 7
6Added new architecture to Microblaze 64-bit support to GDB 8Conflicts:
7 9 gdb/Makefile.in
8Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
9--- 10---
10 bfd/archures.c | 2 + 11 bfd/archures.c | 2 +
11 bfd/bfd-in2.h | 2 + 12 bfd/bfd-in2.h | 2 +
12 bfd/cpu-microblaze.c | 16 +- 13 bfd/cpu-microblaze.c | 8 +-
13 bfd/elf32-microblaze.c | 9 + 14 gas/config/tc-microblaze.c | 13 ++
15 gas/config/tc-microblaze.h | 4 +
14 gdb/features/Makefile | 3 + 16 gdb/features/Makefile | 3 +
15 gdb/features/microblaze-core.xml | 6 +- 17 gdb/features/microblaze-core.xml | 6 +-
16 gdb/features/microblaze-with-stack-protect.c | 4 +- 18 gdb/features/microblaze-stack-protect.xml | 4 +-
19 gdb/features/microblaze-with-stack-protect.c | 8 +-
17 gdb/features/microblaze.c | 6 +- 20 gdb/features/microblaze.c | 6 +-
18 gdb/features/microblaze64-core.xml | 69 +++++++ 21 gdb/features/microblaze64-core.xml | 69 ++++++
19 gdb/features/microblaze64-stack-protect.xml | 12 ++ 22 gdb/features/microblaze64-stack-protect.xml | 12 +
20 .../microblaze64-with-stack-protect.c | 79 ++++++++ 23 .../microblaze64-with-stack-protect.c | 79 +++++++
21 .../microblaze64-with-stack-protect.xml | 12 ++ 24 .../microblaze64-with-stack-protect.xml | 12 +
22 gdb/features/microblaze64.c | 77 ++++++++ 25 gdb/features/microblaze64.c | 77 +++++++
23 gdb/features/microblaze64.xml | 11 ++ 26 gdb/features/microblaze64.xml | 11 +
24 gdb/microblaze-linux-tdep.c | 29 ++- 27 gdb/microblaze-tdep.c | 207 ++++++++++++++++--
25 gdb/microblaze-tdep.c | 176 ++++++++++++++++-- 28 gdb/microblaze-tdep.h | 8 +-
26 gdb/microblaze-tdep.h | 9 +-
27 .../microblaze-with-stack-protect.dat | 4 +- 29 .../microblaze-with-stack-protect.dat | 4 +-
28 20 files changed, 504 insertions(+), 40 deletions(-) 30 19 files changed, 491 insertions(+), 44 deletions(-)
29 create mode 100644 gdb/features/microblaze64-core.xml 31 create mode 100644 gdb/features/microblaze64-core.xml
30 create mode 100644 gdb/features/microblaze64-stack-protect.xml 32 create mode 100644 gdb/features/microblaze64-stack-protect.xml
31 create mode 100644 gdb/features/microblaze64-with-stack-protect.c 33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
@@ -33,10 +35,10 @@ Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
33 create mode 100644 gdb/features/microblaze64.c 35 create mode 100644 gdb/features/microblaze64.c
34 create mode 100644 gdb/features/microblaze64.xml 36 create mode 100644 gdb/features/microblaze64.xml
35 37
36diff --git a/bfd/archures.c b/bfd/archures.c 38Index: gdb-9.2/bfd/archures.c
37index 7866c6095b5..abc1541afe6 100644 39===================================================================
38--- a/bfd/archures.c 40--- gdb-9.2.orig/bfd/archures.c
39+++ b/bfd/archures.c 41+++ gdb-9.2/bfd/archures.c
40@@ -513,6 +513,8 @@ DESCRIPTION 42@@ -513,6 +513,8 @@ DESCRIPTION
41 . bfd_arch_lm32, {* Lattice Mico32. *} 43 . bfd_arch_lm32, {* Lattice Mico32. *}
42 .#define bfd_mach_lm32 1 44 .#define bfd_mach_lm32 1
@@ -46,10 +48,10 @@ index 7866c6095b5..abc1541afe6 100644
46 . bfd_arch_tilepro, {* Tilera TILEPro. *} 48 . bfd_arch_tilepro, {* Tilera TILEPro. *}
47 . bfd_arch_tilegx, {* Tilera TILE-Gx. *} 49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
48 .#define bfd_mach_tilepro 1 50 .#define bfd_mach_tilepro 1
49diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 51Index: gdb-9.2/bfd/bfd-in2.h
50index 91761bf6964..cc34ce0d8c3 100644 52===================================================================
51--- a/bfd/bfd-in2.h 53--- gdb-9.2.orig/bfd/bfd-in2.h
52+++ b/bfd/bfd-in2.h 54+++ gdb-9.2/bfd/bfd-in2.h
53@@ -1896,6 +1896,8 @@ enum bfd_architecture 55@@ -1896,6 +1896,8 @@ enum bfd_architecture
54 bfd_arch_lm32, /* Lattice Mico32. */ 56 bfd_arch_lm32, /* Lattice Mico32. */
55 #define bfd_mach_lm32 1 57 #define bfd_mach_lm32 1
@@ -59,38 +61,29 @@ index 91761bf6964..cc34ce0d8c3 100644
59 bfd_arch_tilepro, /* Tilera TILEPro. */ 61 bfd_arch_tilepro, /* Tilera TILEPro. */
60 bfd_arch_tilegx, /* Tilera TILE-Gx. */ 62 bfd_arch_tilegx, /* Tilera TILE-Gx. */
61 #define bfd_mach_tilepro 1 63 #define bfd_mach_tilepro 1
62diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 64Index: gdb-9.2/bfd/cpu-microblaze.c
63index 4b48b310c6a..a32c4a33d75 100644 65===================================================================
64--- a/bfd/cpu-microblaze.c 66--- gdb-9.2.orig/bfd/cpu-microblaze.c
65+++ b/bfd/cpu-microblaze.c 67+++ gdb-9.2/bfd/cpu-microblaze.c
66@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 68@@ -31,7 +31,7 @@ const bfd_arch_info_type bfd_microblaze_
67 64, /* 32 bits in a word. */
68 64, /* 32 bits in an address. */ 69 64, /* 32 bits in an address. */
69 8, /* 8 bits in a byte. */ 70 8, /* 8 bits in a byte. */
70- bfd_arch_microblaze, /* Architecture. */ 71 bfd_arch_microblaze, /* Architecture. */
71- 0, /* Machine number - 0 for now. */ 72- 0, /* Machine number - 0 for now. */
72+ bfd_arch_microblaze, /* Architecture. */ 73+ bfd_mach_microblaze64, /* 64 bit Machine */
73+ bfd_mach_microblaze64, /* 64 bit Machine */
74 "microblaze", /* Architecture name. */ 74 "microblaze", /* Architecture name. */
75 "MicroBlaze", /* Printable name. */ 75 "MicroBlaze", /* Printable name. */
76 3, /* Section align power. */ 76 3, /* Section align power. */
77@@ -43,11 +43,11 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 77@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_
78 0 /* Maximum offset of a reloc from the start of an insn. */ 78 32, /* Bits in an address. */
79 }, 79 8, /* Bits in a byte. */
80 {
81- 32, /* Bits in a word. */
82- 32, /* Bits in an address. */
83- 8, /* Bits in a byte. */
84+ 32, /* 32 bits in a word. */
85+ 32, /* 32 bits in an address. */
86+ 8, /* 8 bits in a byte. */
87 bfd_arch_microblaze, /* Architecture number. */ 80 bfd_arch_microblaze, /* Architecture number. */
88- 0, /* Machine number - 0 for now. */ 81- 0, /* Machine number - 0 for now. */
89+ bfd_mach_microblaze, /* 32 bit Machine */ 82+ bfd_mach_microblaze, /* 32 bit Machine */
90 "microblaze", /* Architecture name. */ 83 "microblaze", /* Architecture name. */
91 "MicroBlaze", /* Printable name. */ 84 "MicroBlaze", /* Printable name. */
92 3, /* Section align power. */ 85 3, /* Section align power. */
93@@ -64,7 +64,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 86@@ -63,7 +63,7 @@ const bfd_arch_info_type bfd_microblaze_
94 32, /* 32 bits in an address. */ 87 32, /* 32 bits in an address. */
95 8, /* 8 bits in a byte. */ 88 8, /* 8 bits in a byte. */
96 bfd_arch_microblaze, /* Architecture. */ 89 bfd_arch_microblaze, /* Architecture. */
@@ -99,7 +92,7 @@ index 4b48b310c6a..a32c4a33d75 100644
99 "microblaze", /* Architecture name. */ 92 "microblaze", /* Architecture name. */
100 "MicroBlaze", /* Printable name. */ 93 "MicroBlaze", /* Printable name. */
101 3, /* Section align power. */ 94 3, /* Section align power. */
102@@ -80,7 +80,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 95@@ -78,7 +78,7 @@ const bfd_arch_info_type bfd_microblaze_
103 64, /* 32 bits in an address. */ 96 64, /* 32 bits in an address. */
104 8, /* 8 bits in a byte. */ 97 8, /* 8 bits in a byte. */
105 bfd_arch_microblaze, /* Architecture. */ 98 bfd_arch_microblaze, /* Architecture. */
@@ -108,37 +101,11 @@ index 4b48b310c6a..a32c4a33d75 100644
108 "microblaze", /* Architecture name. */ 101 "microblaze", /* Architecture name. */
109 "MicroBlaze", /* Printable name. */ 102 "MicroBlaze", /* Printable name. */
110 3, /* Section align power. */ 103 3, /* Section align power. */
111diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 104Index: gdb-9.2/gdb/features/Makefile
112index cb7a98d307e..e4a70150190 100644 105===================================================================
113--- a/bfd/elf32-microblaze.c 106--- gdb-9.2.orig/gdb/features/Makefile
114+++ b/bfd/elf32-microblaze.c 107+++ gdb-9.2/gdb/features/Makefile
115@@ -3684,6 +3684,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd, 108@@ -48,6 +48,7 @@ WHICH = arm/arm-with-iwmmxt arm/arm-with
116 return TRUE;
117 }
118
119+
120+static bfd_boolean
121+elf_microblaze_object_p (bfd *abfd)
122+{
123+ /* Set the right machine number for an s390 elf32 file. */
124+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
125+}
126+
127 /* Hook called by the linker routine which adds symbols from an object
128 file. We use it to put .comm items in .sbss, and not .bss. */
129
130@@ -3756,5 +3764,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
131
132 #define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
133 #define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
134+#define elf_backend_object_p elf_microblaze_object_p
135
136 #include "elf32-target.h"
137diff --git a/gdb/features/Makefile b/gdb/features/Makefile
138index 9a98b0542c4..438e0c5a3fe 100644
139--- a/gdb/features/Makefile
140+++ b/gdb/features/Makefile
141@@ -48,6 +48,7 @@ WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
142 arm/arm-with-neon \ 109 arm/arm-with-neon \
143 mips-linux mips-dsp-linux \ 110 mips-linux mips-dsp-linux \
144 microblaze-with-stack-protect \ 111 microblaze-with-stack-protect \
@@ -156,10 +123,10 @@ index 9a98b0542c4..438e0c5a3fe 100644
156 mips-dsp-linux.xml \ 123 mips-dsp-linux.xml \
157 mips-linux.xml \ 124 mips-linux.xml \
158 mips64-dsp-linux.xml \ 125 mips64-dsp-linux.xml \
159diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml 126Index: gdb-9.2/gdb/features/microblaze-core.xml
160index f272650a41b..d1f2282fd1e 100644 127===================================================================
161--- a/gdb/features/microblaze-core.xml 128--- gdb-9.2.orig/gdb/features/microblaze-core.xml
162+++ b/gdb/features/microblaze-core.xml 129+++ gdb-9.2/gdb/features/microblaze-core.xml
163@@ -8,7 +8,7 @@ 130@@ -8,7 +8,7 @@
164 <!DOCTYPE feature SYSTEM "gdb-target.dtd"> 131 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
165 <feature name="org.gnu.gdb.microblaze.core"> 132 <feature name="org.gnu.gdb.microblaze.core">
@@ -182,14 +149,27 @@ index f272650a41b..d1f2282fd1e 100644
182 <reg name="rtlbsx" bitsize="32"/> 149 <reg name="rtlbsx" bitsize="32"/>
183 <reg name="rtlblo" bitsize="32"/> 150 <reg name="rtlblo" bitsize="32"/>
184 <reg name="rtlbhi" bitsize="32"/> 151 <reg name="rtlbhi" bitsize="32"/>
185+ <reg name="rslr" bitsize="32"/> 152+ <reg name="slr" bitsize="32"/>
186+ <reg name="rshr" bitsize="32"/> 153+ <reg name="shr" bitsize="32"/>
187 </feature> 154 </feature>
188diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c 155Index: gdb-9.2/gdb/features/microblaze-stack-protect.xml
189index b39aa198874..ab162fd2588 100644 156===================================================================
190--- a/gdb/features/microblaze-with-stack-protect.c 157--- gdb-9.2.orig/gdb/features/microblaze-stack-protect.xml
191+++ b/gdb/features/microblaze-with-stack-protect.c 158+++ gdb-9.2/gdb/features/microblaze-stack-protect.xml
192@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) 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
193 173
194 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core"); 174 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
195 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int"); 175 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
@@ -198,7 +178,7 @@ index b39aa198874..ab162fd2588 100644
198 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int"); 178 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
199 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int"); 179 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
200 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int"); 180 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
201@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) 181@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_p
202 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int"); 182 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
203 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int"); 183 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
204 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int"); 184 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
@@ -207,10 +187,21 @@ index b39aa198874..ab162fd2588 100644
207 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); 187 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
208 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); 188 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
209 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); 189 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
210diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c 190@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_p
211index 6c86fc07700..7919ac96e62 100644 191 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
212--- a/gdb/features/microblaze.c 192
213+++ b/gdb/features/microblaze.c 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
214@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void) 205@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
215 206
216 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core"); 207 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
@@ -233,16 +224,15 @@ index 6c86fc07700..7919ac96e62 100644
233 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 224 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
234 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 225 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
235 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 226 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
236+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 227+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
237+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 228+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
238 229
239 tdesc_microblaze = result; 230 tdesc_microblaze = result;
240 } 231 }
241diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml 232Index: gdb-9.2/gdb/features/microblaze64-core.xml
242new file mode 100644 233===================================================================
243index 00000000000..b9adadfade6
244--- /dev/null 234--- /dev/null
245+++ b/gdb/features/microblaze64-core.xml 235+++ gdb-9.2/gdb/features/microblaze64-core.xml
246@@ -0,0 +1,69 @@ 236@@ -0,0 +1,69 @@
247+<?xml version="1.0"?> 237+<?xml version="1.0"?>
248+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. 238+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
@@ -310,14 +300,13 @@ index 00000000000..b9adadfade6
310+ <reg name="rtlbsx" bitsize="32"/> 300+ <reg name="rtlbsx" bitsize="32"/>
311+ <reg name="rtlblo" bitsize="32"/> 301+ <reg name="rtlblo" bitsize="32"/>
312+ <reg name="rtlbhi" bitsize="32"/> 302+ <reg name="rtlbhi" bitsize="32"/>
313+ <reg name="rslr" bitsize="64"/> 303+ <reg name="slr" bitsize="64"/>
314+ <reg name="rshr" bitsize="64"/> 304+ <reg name="shr" bitsize="64"/>
315+</feature> 305+</feature>
316diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml 306Index: gdb-9.2/gdb/features/microblaze64-stack-protect.xml
317new file mode 100644 307===================================================================
318index 00000000000..9d7ea8b9fd7
319--- /dev/null 308--- /dev/null
320+++ b/gdb/features/microblaze64-stack-protect.xml 309+++ gdb-9.2/gdb/features/microblaze64-stack-protect.xml
321@@ -0,0 +1,12 @@ 310@@ -0,0 +1,12 @@
322+<?xml version="1.0"?> 311+<?xml version="1.0"?>
323+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. 312+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
@@ -328,14 +317,13 @@ index 00000000000..9d7ea8b9fd7
328+ 317+
329+<!DOCTYPE feature SYSTEM "gdb-target.dtd"> 318+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
330+<feature name="org.gnu.gdb.microblaze64.stack-protect"> 319+<feature name="org.gnu.gdb.microblaze64.stack-protect">
331+ <reg name="rslr" bitsize="64"/> 320+ <reg name="slr" bitsize="64"/>
332+ <reg name="rshr" bitsize="64"/> 321+ <reg name="shr" bitsize="64"/>
333+</feature> 322+</feature>
334diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c 323Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
335new file mode 100644 324===================================================================
336index 00000000000..249cb534daa
337--- /dev/null 325--- /dev/null
338+++ b/gdb/features/microblaze64-with-stack-protect.c 326+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
339@@ -0,0 +1,79 @@ 327@@ -0,0 +1,79 @@
340+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: 328+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
341+ Original: microblaze-with-stack-protect.xml */ 329+ Original: microblaze-with-stack-protect.xml */
@@ -411,16 +399,15 @@ index 00000000000..249cb534daa
411+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 399+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
412+ 400+
413+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect"); 401+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
414+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 402+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
415+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 403+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
416+ 404+
417+ tdesc_microblaze64_with_stack_protect = result; 405+ tdesc_microblaze64_with_stack_protect = result;
418+} 406+}
419diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml 407Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.xml
420new file mode 100644 408===================================================================
421index 00000000000..0e9f01611f3
422--- /dev/null 409--- /dev/null
423+++ b/gdb/features/microblaze64-with-stack-protect.xml 410+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.xml
424@@ -0,0 +1,12 @@ 411@@ -0,0 +1,12 @@
425+<?xml version="1.0"?> 412+<?xml version="1.0"?>
426+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. 413+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
@@ -434,11 +421,10 @@ index 00000000000..0e9f01611f3
434+ <xi:include href="microblaze64-core.xml"/> 421+ <xi:include href="microblaze64-core.xml"/>
435+ <xi:include href="microblaze64-stack-protect.xml"/> 422+ <xi:include href="microblaze64-stack-protect.xml"/>
436+</target> 423+</target>
437diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c 424Index: gdb-9.2/gdb/features/microblaze64.c
438new file mode 100644 425===================================================================
439index 00000000000..5d3e2c8cd91
440--- /dev/null 426--- /dev/null
441+++ b/gdb/features/microblaze64.c 427+++ gdb-9.2/gdb/features/microblaze64.c
442@@ -0,0 +1,77 @@ 428@@ -0,0 +1,77 @@
443+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: 429+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
444+ Original: microblaze.xml */ 430+ Original: microblaze.xml */
@@ -512,16 +498,15 @@ index 00000000000..5d3e2c8cd91
512+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 498+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
513+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 499+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
514+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 500+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
515+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 501+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
516+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 502+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
517+ 503+
518+ tdesc_microblaze64 = result; 504+ tdesc_microblaze64 = result;
519+} 505+}
520diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml 506Index: gdb-9.2/gdb/features/microblaze64.xml
521new file mode 100644 507===================================================================
522index 00000000000..515d18e65cf
523--- /dev/null 508--- /dev/null
524+++ b/gdb/features/microblaze64.xml 509+++ gdb-9.2/gdb/features/microblaze64.xml
525@@ -0,0 +1,11 @@ 510@@ -0,0 +1,11 @@
526+<?xml version="1.0"?> 511+<?xml version="1.0"?>
527+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. 512+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
@@ -534,57 +519,10 @@ index 00000000000..515d18e65cf
534+<target> 519+<target>
535+ <xi:include href="microblaze64-core.xml"/> 520+ <xi:include href="microblaze64-core.xml"/>
536+</target> 521+</target>
537diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 522Index: gdb-9.2/gdb/microblaze-tdep.c
538index 0afb6efeba3..48459a76991 100644 523===================================================================
539--- a/gdb/microblaze-linux-tdep.c 524--- gdb-9.2.orig/gdb/microblaze-tdep.c
540+++ b/gdb/microblaze-linux-tdep.c 525+++ gdb-9.2/gdb/microblaze-tdep.c
541@@ -159,9 +159,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
542
543 /* BFD target for core files. */
544 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
545- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
546+ {
547+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
548+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
549+ MICROBLAZE_REGISTER_SIZE=8;
550+ }
551+ else
552+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
553+ }
554 else
555- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
556+ {
557+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
558+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
559+ MICROBLAZE_REGISTER_SIZE=8;
560+ }
561+ else
562+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
563+ }
564+
565+ switch (info.bfd_arch_info->mach)
566+ {
567+ case bfd_mach_microblaze64:
568+ set_gdbarch_ptr_bit (gdbarch, 64);
569+ break;
570+ }
571
572
573 /* Shared library handling. */
574@@ -176,6 +197,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
575 void
576 _initialize_microblaze_linux_tdep (void)
577 {
578- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
579+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
580+ microblaze_linux_init_abi);
581+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
582 microblaze_linux_init_abi);
583 }
584diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
585index 98944f38d2a..5c0d6dd48ae 100644
586--- a/gdb/microblaze-tdep.c
587+++ b/gdb/microblaze-tdep.c
588@@ -40,7 +40,9 @@ 526@@ -40,7 +40,9 @@
589 #include "remote.h" 527 #include "remote.h"
590 528
@@ -595,34 +533,57 @@ index 98944f38d2a..5c0d6dd48ae 100644
595 533
596 /* Instruction macros used for analyzing the prologue. */ 534 /* Instruction macros used for analyzing the prologue. */
597 /* This set of instruction macros need to be changed whenever the 535 /* This set of instruction macros need to be changed whenever the
598@@ -79,8 +81,9 @@ static const char *microblaze_register_names[] = 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"
599 }; 542 };
600 543
601 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) 544 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
602- 545
603+
604 static unsigned int microblaze_debug_flag = 0; 546 static unsigned int microblaze_debug_flag = 0;
605+int MICROBLAZE_REGISTER_SIZE = 4; 547+int reg_size = 4;
606 548
607 static void ATTRIBUTE_PRINTF (1, 2) 549 static void ATTRIBUTE_PRINTF (1, 2)
608 microblaze_debug (const char *fmt, ...) 550 microblaze_debug (const char *fmt, ...)
609@@ -137,6 +140,7 @@ microblaze_fetch_instruction (CORE_ADDR pc) 551@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regca
610 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; 552 error (_("store_arguments not implemented"));
611 553 return sp;
612 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; 554 }
613+#if 0 555+#if 0
614 static int 556 static int
615 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 557 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
616 struct bp_target_info *bp_tgt) 558 struct bp_target_info *bp_tgt)
617@@ -169,6 +173,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 559@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoin
618 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
619 return val; 579 return val;
620 } 580 }
621+#endif
622 581
582+#endif
623 /* Allocate and initialize a frame cache. */ 583 /* Allocate and initialize a frame cache. */
624 584
625@@ -556,7 +561,6 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache, 585 static struct microblaze_frame_cache *
586@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct
626 gdb_byte *valbuf) 587 gdb_byte *valbuf)
627 { 588 {
628 gdb_byte buf[8]; 589 gdb_byte buf[8];
@@ -630,7 +591,19 @@ index 98944f38d2a..5c0d6dd48ae 100644
630 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ 591 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
631 switch (TYPE_LENGTH (type)) 592 switch (TYPE_LENGTH (type))
632 { 593 {
633@@ -633,7 +637,113 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) 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
634 return (TYPE_LENGTH (type) == 16); 607 return (TYPE_LENGTH (type) == 16);
635 } 608 }
636 609
@@ -742,14 +715,16 @@ index 98944f38d2a..5c0d6dd48ae 100644
742+} 715+}
743+#endif 716+#endif
744+ 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+
745 static int dwarf2_to_reg_map[78] = 724 static int dwarf2_to_reg_map[78] =
746 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 725 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
747 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 726 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
748@@ -665,24 +775,27 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) 727@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct
749 return -1;
750 }
751
752+#if 0
753 static void 728 static void
754 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 729 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
755 { 730 {
@@ -765,27 +740,46 @@ index 98944f38d2a..5c0d6dd48ae 100644
765- tdesc_microblaze_with_stack_protect); 740- tdesc_microblaze_with_stack_protect);
766+ tdesc_microblaze64_with_stack_protect); 741+ tdesc_microblaze64_with_stack_protect);
767 } 742 }
768+#endif
769 743
770 void 744 void
771 microblaze_supply_gregset (const struct regset *regset, 745@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct
772 struct regcache *regcache, 746 struct regcache *regcache,
773 int regnum, const void *gregs) 747 int regnum, const void *gregs)
774 { 748 {
775- const unsigned int *regs = (const unsigned int *)gregs; 749- unsigned int *regs = gregs;
776+ const gdb_byte *regs = (const gdb_byte *) gregs; 750+ const gdb_byte *regs = (const gdb_byte *) gregs;
777 if (regnum >= 0) 751 if (regnum >= 0)
778 regcache->raw_supply (regnum, regs + regnum); 752- regcache_raw_supply (regcache, regnum, regs + regnum);
753+ regcache->raw_supply (regnum, regs + regnum);
754
755 if (regnum == -1) {
756 int i;
779 757
780@@ -713,7 +826,6 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, 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
781 } 765 }
782 766
783 767
784- 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
785 static struct gdbarch * 780 static struct gdbarch *
786 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 781 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
787 { 782@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_
788@@ -727,8 +839,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
789 if (arches != NULL) 783 if (arches != NULL)
790 return arches->gdbarch; 784 return arches->gdbarch;
791 if (tdesc == NULL) 785 if (tdesc == NULL)
@@ -795,7 +789,7 @@ index 98944f38d2a..5c0d6dd48ae 100644
795+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 789+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
796+ { 790+ {
797+ tdesc = tdesc_microblaze64; 791+ tdesc = tdesc_microblaze64;
798+ MICROBLAZE_REGISTER_SIZE = 8; 792+ reg_size = 8;
799+ } 793+ }
800+ else 794+ else
801+ tdesc = tdesc_microblaze; 795+ tdesc = tdesc_microblaze;
@@ -803,7 +797,7 @@ index 98944f38d2a..5c0d6dd48ae 100644
803 /* Check any target description for validity. */ 797 /* Check any target description for validity. */
804 if (tdesc_has_registers (tdesc)) 798 if (tdesc_has_registers (tdesc))
805 { 799 {
806@@ -736,27 +855,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 800@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_
807 int valid_p; 801 int valid_p;
808 int i; 802 int i;
809 803
@@ -844,7 +838,7 @@ index 98944f38d2a..5c0d6dd48ae 100644
844 } 838 }
845 839
846 if (!valid_p) 840 if (!valid_p)
847@@ -764,6 +891,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 841@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_
848 tdesc_data_cleanup (tdesc_data); 842 tdesc_data_cleanup (tdesc_data);
849 return NULL; 843 return NULL;
850 } 844 }
@@ -852,7 +846,7 @@ index 98944f38d2a..5c0d6dd48ae 100644
852 } 846 }
853 847
854 /* Allocate space for the new architecture. */ 848 /* Allocate space for the new architecture. */
855@@ -783,7 +911,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 849@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_
856 /* Register numbers of various important registers. */ 850 /* Register numbers of various important registers. */
857 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM); 851 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
858 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM); 852 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
@@ -870,7 +864,7 @@ index 98944f38d2a..5c0d6dd48ae 100644
870 /* Map Dwarf2 registers to GDB registers. */ 864 /* Map Dwarf2 registers to GDB registers. */
871 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 865 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
872 866
873@@ -803,13 +941,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 867@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_
874 microblaze_breakpoint::kind_from_pc); 868 microblaze_breakpoint::kind_from_pc);
875 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 869 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
876 microblaze_breakpoint::bp_from_kind); 870 microblaze_breakpoint::bp_from_kind);
@@ -888,7 +882,21 @@ index 98944f38d2a..5c0d6dd48ae 100644
888 882
889 frame_base_set_default (gdbarch, &microblaze_frame_base); 883 frame_base_set_default (gdbarch, &microblaze_frame_base);
890 884
891@@ -840,6 +980,8 @@ _initialize_microblaze_tdep (void) 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)
892 900
893 initialize_tdesc_microblaze_with_stack_protect (); 901 initialize_tdesc_microblaze_with_stack_protect ();
894 initialize_tdesc_microblaze (); 902 initialize_tdesc_microblaze ();
@@ -897,10 +905,10 @@ index 98944f38d2a..5c0d6dd48ae 100644
897 /* Debug this files internals. */ 905 /* Debug this files internals. */
898 add_setshow_zuinteger_cmd ("microblaze", class_maintenance, 906 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
899 &microblaze_debug_flag, _("\ 907 &microblaze_debug_flag, _("\
900diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 908Index: gdb-9.2/gdb/microblaze-tdep.h
901index d2112dc07e1..bd03e969b9b 100644 909===================================================================
902--- a/gdb/microblaze-tdep.h 910--- gdb-9.2.orig/gdb/microblaze-tdep.h
903+++ b/gdb/microblaze-tdep.h 911+++ gdb-9.2/gdb/microblaze-tdep.h
904@@ -27,7 +27,7 @@ struct microblaze_gregset 912@@ -27,7 +27,7 @@ struct microblaze_gregset
905 microblaze_gregset() {} 913 microblaze_gregset() {}
906 unsigned int gregs[32]; 914 unsigned int gregs[32];
@@ -922,20 +930,19 @@ index d2112dc07e1..bd03e969b9b 100644
922 }; 930 };
923 931
924 struct microblaze_frame_cache 932 struct microblaze_frame_cache
925@@ -128,7 +128,8 @@ struct microblaze_frame_cache 933@@ -128,7 +128,7 @@ struct microblaze_frame_cache
926 struct trad_frame_saved_reg *saved_regs; 934 struct trad_frame_saved_reg *saved_regs;
927 }; 935 };
928 /* All registers are 32 bits. */ 936 /* All registers are 32 bits. */
929-#define MICROBLAZE_REGISTER_SIZE 4 937-#define MICROBLAZE_REGISTER_SIZE 4
930+extern int microblaze_reg_size; 938+//#define MICROBLAZE_REGISTER_SIZE 8
931+#define MICROBLAZE_REGISTER_SIZE microblaze_reg_size
932 939
933 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 940 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
934 Only used for native debugging. */ 941 Only used for native debugging. */
935diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat 942Index: gdb-9.2/gdb/regformats/microblaze-with-stack-protect.dat
936index 8040a7b3fd0..450e321d49e 100644 943===================================================================
937--- a/gdb/regformats/microblaze-with-stack-protect.dat 944--- gdb-9.2.orig/gdb/regformats/microblaze-with-stack-protect.dat
938+++ b/gdb/regformats/microblaze-with-stack-protect.dat 945+++ gdb-9.2/gdb/regformats/microblaze-with-stack-protect.dat
939@@ -60,5 +60,5 @@ expedite:r1,rpc 946@@ -60,5 +60,5 @@ expedite:r1,rpc
940 32:rtlbsx 947 32:rtlbsx
941 32:rtlblo 948 32:rtlblo
@@ -944,6 +951,3 @@ index 8040a7b3fd0..450e321d49e 100644
944-32:rshr 951-32:rshr
945+32:slr 952+32:slr
946+32:shr 953+32:shr
947--
9482.17.1
949
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
new file mode 100644
index 00000000..947ac9a9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0042-porting-GDB-for-linux.patch
@@ -0,0 +1,151 @@
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
new file mode 100644
index 00000000..bfe57a86
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0043-Binutils-security-check-is-causing-build-error-for-w.patch
@@ -0,0 +1,32 @@
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
new file mode 100644
index 00000000..a60ed5e7
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
@@ -0,0 +1,143 @@
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
new file mode 100644
index 00000000..eac20e3d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
@@ -0,0 +1,21 @@
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
new file mode 100644
index 00000000..de93c81e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
@@ -0,0 +1,36 @@
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
new file mode 100644
index 00000000..ad63a72f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
@@ -0,0 +1,84 @@
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
new file mode 100644
index 00000000..bee50edf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
@@ -0,0 +1,72 @@
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
new file mode 100644
index 00000000..9b95e10b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
@@ -0,0 +1,42 @@
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
new file mode 100644
index 00000000..ba8394cc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
@@ -0,0 +1,34 @@
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
new file mode 100644
index 00000000..f3290157
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
@@ -0,0 +1,96 @@
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/0001-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch
index 6f054720..88095def 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0052-sim-Allow-microblaze-architecture.patch
@@ -1,7 +1,7 @@
1From d23be47051b4410e2e74c6db6bf9a1a9f7195f6d Mon Sep 17 00:00:00 2001 1From acee53a9c9b6cbe826dacb9f02102ae4d58e36ba Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org> 2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 6 Aug 2020 15:37:52 -0500 3Date: Thu, 6 Aug 2020 15:37:52 -0500
4Subject: [PATCH 01/40] sim: Allow microblaze* architecture 4Subject: [PATCH 52/52] sim: Allow microblaze* architecture
5 5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> 6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7--- 7---
@@ -9,10 +9,10 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
9 sim/configure.tgt | 2 +- 9 sim/configure.tgt | 2 +-
10 2 files changed, 2 insertions(+), 2 deletions(-) 10 2 files changed, 2 insertions(+), 2 deletions(-)
11 11
12diff --git a/sim/configure b/sim/configure 12Index: gdb-9.2/sim/configure
13index 72f95cd5c7a..9e28cc78687 100755 13===================================================================
14--- a/sim/configure 14--- gdb-9.2.orig/sim/configure
15+++ b/sim/configure 15+++ gdb-9.2/sim/configure
16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64" 16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64"
17 17
18 18
@@ -22,10 +22,10 @@ index 72f95cd5c7a..9e28cc78687 100755
22 22
23 sim_arch=microblaze 23 sim_arch=microblaze
24 subdirs="$subdirs microblaze" 24 subdirs="$subdirs microblaze"
25diff --git a/sim/configure.tgt b/sim/configure.tgt 25Index: gdb-9.2/sim/configure.tgt
26index 8a8e03d96f4..f6743fe8d41 100644 26===================================================================
27--- a/sim/configure.tgt 27--- gdb-9.2.orig/sim/configure.tgt
28+++ b/sim/configure.tgt 28+++ gdb-9.2/sim/configure.tgt
29@@ -59,7 +59,7 @@ case "${target}" in 29@@ -59,7 +59,7 @@ case "${target}" in
30 mcore-*-*) 30 mcore-*-*)
31 SIM_ARCH(mcore) 31 SIM_ARCH(mcore)
@@ -35,6 +35,3 @@ index 8a8e03d96f4..f6743fe8d41 100644
35 SIM_ARCH(microblaze) 35 SIM_ARCH(microblaze)
36 ;; 36 ;;
37 mips*-*-*) 37 mips*-*-*)
38--
392.17.1
40