summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/gdb')
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc70
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch40
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-Disable-the-warning-message-for-eh_frame_hdr.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-Fix-relaxation-of-assembler-resolved-references.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-relaxation-of-assembler-resolved-references.patch)19
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch)105
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0007-Fix-bug-in-TLSTPREL-Relocation.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-Address-extension-instructions.patch)44
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-fixing-the-MAX_OPCODES-to-correct-value.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch49
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch355
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch9
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch48
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixed-MB-x-relocation-issues.patch)31
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixing-the-branch-related-issues.patch25
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0020-Various-fixes.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0021-Fixed-address-computation-issues-with-64bit-address.patch)39
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0021-Adding-new-relocation-to-support-64bit-rodata.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0022-Adding-new-relocation-to-support-64bit-rodata.patch)20
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0023-fixing-the-.bss-relocation-issue.patch)26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0024-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch51
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch31
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0027-Added-support-to-new-arithmetic-single-register-inst.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0030-Added-support-to-new-arithmetic-single-register-inst.patch)65
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch)10
-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-Add-initial-port-of-linux-gdbserver.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0032-Add-initial-port-of-linux-gdbserver.patch)107
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0033-Initial-port-of-core-reading-support.patch)176
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0035-revert-master-rebase-changes-to-gdbserver.patch31
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0034-Fix-debug-message-when-register-is-unavailable.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch33
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch8
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch41
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0039-Fixing-the-issues-related-to-GDB-7.12.patch117
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch467
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0041-patch-MicroBlaze-porting-GDB-for-linux.patch155
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch146
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch24
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch363
42 files changed, 936 insertions, 2015 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
index 4db9957c..906ef4db 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
@@ -5,43 +5,35 @@ LTTNGUST_microblaze = ""
5FILESEXTRAPATHS_append := ":${THISDIR}/gdb" 5FILESEXTRAPATHS_append := ":${THISDIR}/gdb"
6 6
7SRC_URI_append_microblaze = " \ 7SRC_URI_append_microblaze = " \
8 file://0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \ 8 file://0001-sim-Allow-microblaze-architecture.patch \
9 file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \ 9 file://0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \
10 file://0004-Fix-relaxation-of-assembler-resolved-references.patch \ 10 file://0004-Disable-the-warning-message-for-eh_frame_hdr.patch \
11 file://0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch \ 11 file://0005-Fix-relaxation-of-assembler-resolved-references.patch \
12 file://0006-upstream-change-to-garbage-collection-sweep-causes-m.patch \ 12 file://0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch \
13 file://0007-Fix-bug-in-TLSTPREL-Relocation.patch \ 13 file://0007-upstream-change-to-garbage-collection-sweep-causes-m.patch \
14 file://0008-Added-Address-extension-instructions.patch \ 14 file://0008-Fix-bug-in-TLSTPREL-Relocation.patch \
15 file://0009-fixing-the-MAX_OPCODES-to-correct-value.patch \ 15 file://0009-Added-Address-extension-instructions.patch \
16 file://0010-Add-new-bit-field-instructions.patch \ 16 file://0010-Add-new-bit-field-instructions.patch \
17 file://0011-fixing-the-imm-bug.patch \ 17 file://0011-fixing-the-imm-bug.patch \
18 file://0015-intial-commit-of-MB-64-bit.patch \ 18 file://0015-intial-commit-of-MB-64-bit.patch \
19 file://0016-MB-X-initial-commit.patch \ 19 file://0016-MB-X-initial-commit.patch \
20 file://0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \ 20 file://0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
21 file://0018-Added-relocations-for-MB-X.patch \ 21 file://0018-Added-relocations-for-MB-X.patch \
22 file://0019-Fixed-MB-x-relocation-issues.patch \ 22 file://0019-Update-MB-x.patch \
23 file://0020-Fixing-the-branch-related-issues.patch \ 23 file://0020-Various-fixes.patch \
24 file://0021-Fixed-address-computation-issues-with-64bit-address.patch \ 24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \
25 file://0022-Adding-new-relocation-to-support-64bit-rodata.patch \ 25 file://0022-fixing-the-.bss-relocation-issue.patch \
26 file://0023-fixing-the-.bss-relocation-issue.patch \ 26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \
27 file://0024-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \ 27 file://0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch \
28 file://0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch \ 28 file://0026-fixing-the-long-long-long-mingw-toolchain-issue.patch \
29 file://0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch \ 29 file://0027-Added-support-to-new-arithmetic-single-register-inst.patch \
30 file://0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch \ 30 file://0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
31 file://0029-fixing-the-long-long-long-mingw-toolchain-issue.patch \ 31 file://0033-Fix-various-compile-warnings.patch \
32 file://0030-Added-support-to-new-arithmetic-single-register-inst.patch \ 32 file://0034-Add-initial-port-of-linux-gdbserver.patch \
33 file://0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \ 33 file://0035-Initial-port-of-core-reading-support.patch \
34 file://0032-Add-initial-port-of-linux-gdbserver.patch \ 34 file://0036-Fix-debug-message-when-register-is-unavailable.patch \
35 file://0033-Initial-port-of-core-reading-support.patch \ 35 file://0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
36 file://0034-Fix-debug-message-when-register-is-unavailable.patch \ 36 file://0038-Initial-support-for-native-gdb.patch \
37 file://0035-revert-master-rebase-changes-to-gdbserver.patch \ 37 file://0039-Fixing-the-issues-related-to-GDB-7.12.patch \
38 file://0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch \ 38 file://0040-Patch-microblaze-Adding-64-bit-MB-support.patch \
39 file://0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
40 file://0038-Initial-support-for-native-gdb.patch \
41 file://0039-Fixing-the-issues-related-to-GDB-7.12.patch \
42 file://0040-Patch-microblaze-Adding-64-bit-MB-support.patch \
43 file://0041-patch-MicroBlaze-porting-GDB-for-linux.patch \
44 file://0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch \
45 file://0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch \
46 file://0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch \
47 " 39 "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch
new file mode 100644
index 00000000..6f054720
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-sim-Allow-microblaze-architecture.patch
@@ -0,0 +1,40 @@
1From d23be47051b4410e2e74c6db6bf9a1a9f7195f6d Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 6 Aug 2020 15:37:52 -0500
4Subject: [PATCH 01/40] sim: Allow microblaze* architecture
5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7---
8 sim/configure | 2 +-
9 sim/configure.tgt | 2 +-
10 2 files changed, 2 insertions(+), 2 deletions(-)
11
12diff --git a/sim/configure b/sim/configure
13index 72f95cd5c7a..9e28cc78687 100755
14--- a/sim/configure
15+++ b/sim/configure
16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64"
17
18
19 ;;
20- microblaze-*-*)
21+ microblaze*-*-*)
22
23 sim_arch=microblaze
24 subdirs="$subdirs microblaze"
25diff --git a/sim/configure.tgt b/sim/configure.tgt
26index 8a8e03d96f4..f6743fe8d41 100644
27--- a/sim/configure.tgt
28+++ b/sim/configure.tgt
29@@ -59,7 +59,7 @@ case "${target}" in
30 mcore-*-*)
31 SIM_ARCH(mcore)
32 ;;
33- microblaze-*-*)
34+ microblaze*-*-*)
35 SIM_ARCH(microblaze)
36 ;;
37 mips*-*-*)
38--
392.17.1
40
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
index 4b85d7c9..6967a3d7 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
@@ -1,7 +1,7 @@
1From f1cb2126c751d6c2526ea969918d5b51dd5b851f Mon Sep 17 00:00:00 2001 1From d7a3a238edac153f391a65ae45215a117d25bc48 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 01/43] Add wdc.ext.clear and wdc.ext.flush insns 4Subject: [PATCH 02/40] 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 62ee3c9a4d..865151f95b 100644 18index 62ee3c9a4d1..865151f95b0 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 62ee3c9a4d..865151f95b 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 5a2d3b0c8b..42f3dd3be5 100644 49index 5a2d3b0c8bb..42f3dd3be53 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/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Disable-the-warning-message-for-eh_frame_hdr.patch
index 53415370..78e10261 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -1,7 +1,7 @@
1From 68fe2e975f229cce08029b3a5afb06132f1cb31c Mon Sep 17 00:00:00 2001 1From 2e87167d8c5d40d8dfbd8d879d78ab0bd6f3bdfd 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 03/43] Disable the warning message for eh_frame_hdr 4Subject: [PATCH 04/40] 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---
@@ -9,7 +9,7 @@ Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
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 11diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
12index a13e81ebb8..1824ba6e5b 100644 12index b622ffcee2a..26b180f1490 100644
13--- a/bfd/elf-eh-frame.c 13--- a/bfd/elf-eh-frame.c
14+++ b/bfd/elf-eh-frame.c 14+++ b/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, struct bfd_link_info *info,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-relaxation-of-assembler-resolved-references.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Fix-relaxation-of-assembler-resolved-references.patch
index 7ba07a0c..d851c589 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-relaxation-of-assembler-resolved-references.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Fix-relaxation-of-assembler-resolved-references.patch
@@ -1,17 +1,17 @@
1From 1ea25f31c38e606603bf406efebfb6cfc26aec38 Mon Sep 17 00:00:00 2001 1From 210bb23010e2c3e65f5f54c220d27da0590bab06 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> 2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Tue, 14 Feb 2012 01:00:22 +0100 3Date: Tue, 14 Feb 2012 01:00:22 +0100
4Subject: [PATCH 04/43] Fix relaxation of assembler resolved references 4Subject: [PATCH 05/40] Fix relaxation of assembler resolved references
5 5
6--- 6---
7 bfd/elf32-microblaze.c | 38 ++++++++++++++++++++++++++++++++++++++ 7 bfd/elf32-microblaze.c | 41 ++++++++++++++++++++++++++++++++++++++
8 2 files changed, 39 insertions(+) 8 2 files changed, 42 insertions(+)
9 9
10diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 10diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
11index e3c8027248..359484dd5e 100644 11index c187d83ee04..dfd82438e35 100644
12--- a/bfd/elf32-microblaze.c 12--- a/bfd/elf32-microblaze.c
13+++ b/bfd/elf32-microblaze.c 13+++ b/bfd/elf32-microblaze.c
14@@ -1973,6 +1973,44 @@ microblaze_elf_relax_section (bfd *abfd, 14@@ -1973,6 +1973,47 @@ microblaze_elf_relax_section (bfd *abfd,
15 irelscanend = irelocs + o->reloc_count; 15 irelscanend = irelocs + o->reloc_count;
16 for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 16 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
17 { 17 {
@@ -44,9 +44,12 @@ index e3c8027248..359484dd5e 100644
44+ elf_section_data (o)->this_hdr.contents = ocontents; 44+ elf_section_data (o)->this_hdr.contents = ocontents;
45+ } 45+ }
46+ } 46+ }
47+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
48+ + isym->st_value, sec);
49+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); 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);
50+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 53+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
51+ irelscan->r_addend); 54+ irelscan->r_addend);
52+ } 55+ }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
index 18646195..eea29059 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
@@ -1,10 +1,12 @@
1From 62859c17077c559ad5e5db1cfbb496d5e8c3da68 Mon Sep 17 00:00:00 2001 1From d2aee40b9753b783853bf38d36d9b6e50d16cc20 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 6 Feb 2017 15:53:08 +0530 3Date: Mon, 6 Feb 2017 15:53:08 +0530
4Subject: [PATCH 05/43] [LOCAL]: Fixup debug_loc sections after linker 4Subject: [PATCH 06/40] microblaze: Fixup debug_loc sections after linker
5 relaxation Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing reloc 5 relaxation
6 info from the assembler to the linker when the linker manages to fully 6
7 resolve a local symbol reference. 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.
8 10
9This is a workaround for design flaws in the assembler to 11This is a workaround for design flaws in the assembler to
10linker interface with regards to linker relaxation. 12linker interface with regards to linker relaxation.
@@ -12,44 +14,37 @@ linker interface with regards to linker relaxation.
12Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 14Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> 15Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com>
14--- 16---
15 bfd/bfd-in2.h | 9 +++++-- 17 bfd/bfd-in2.h | 5 +++++
16 bfd/elf32-microblaze.c | 53 ++++++++++++++++++++++++++++---------- 18 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++-------
17 bfd/libbfd.h | 1 + 19 bfd/libbfd.h | 1 +
18 bfd/reloc.c | 6 +++++ 20 bfd/reloc.c | 6 ++++++
19 include/elf/microblaze.h | 2 ++ 21 include/elf/microblaze.h | 1 +
20 7 files changed, 64 insertions(+), 16 deletions(-) 22 7 files changed, 52 insertions(+), 7 deletions(-)
21 23
22diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 24diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
23index e25da50aaf..721531886a 100644 25index 6f3e41da376..52c81b10b6d 100644
24--- a/bfd/bfd-in2.h 26--- a/bfd/bfd-in2.h
25+++ b/bfd/bfd-in2.h 27+++ b/bfd/bfd-in2.h
26@@ -5866,10 +5866,15 @@ value relative to the read-write small data area anchor */ 28@@ -5363,6 +5363,11 @@ value relative to the read-write small data area anchor */
27 expressions of the form "Symbol Op Symbol" */ 29 expressions of the form "Symbol Op Symbol" */
28 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, 30 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
29 31
30-/* This is a 64 bit reloc that stores the 32 bit pc relative
31+/* This is a 32 bit reloc that stores the 32 bit pc relative 32+/* This is a 32 bit reloc that stores the 32 bit pc relative
32 value in two words (with an imm instruction). No relocation is 33+value in two words (with an imm instruction). No relocation is
33 done here - only used for relaxing */ 34+done here - only used for relaxing */
34- BFD_RELOC_MICROBLAZE_64_NONE,
35+ BFD_RELOC_MICROBLAZE_32_NONE, 35+ BFD_RELOC_MICROBLAZE_32_NONE,
36+ 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 */
40+ BFD_RELOC_MICROBLAZE_64_NONE,
41
42 /* This is a 64 bit reloc that stores the 32 bit pc relative 37 /* This is a 64 bit reloc that stores the 32 bit pc relative
43 value in two words (with an imm instruction). The relocation is 38 value in two words (with an imm instruction). No relocation is
39 done here - only used for relaxing */
44diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 40diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
45index 359484dd5e..1c69c269c7 100644 41index dfd82438e35..cbba704e691 100644
46--- a/bfd/elf32-microblaze.c 42--- a/bfd/elf32-microblaze.c
47+++ b/bfd/elf32-microblaze.c 43+++ b/bfd/elf32-microblaze.c
48@@ -176,7 +176,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 44@@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
49 0x0000ffff, /* Dest Mask. */ 45 0x0000ffff, /* Dest Mask. */
50 FALSE), /* PC relative offset? */ 46 FALSE), /* PC relative offset? */
51 47
52- /* This reloc does nothing. Used for relaxation. */
53+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ 48+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
54+ 0, /* Rightshift. */ 49+ 0, /* Rightshift. */
55+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 50+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
@@ -64,10 +59,9 @@ index 359484dd5e..1c69c269c7 100644
64+ 0, /* Dest Mask. */ 59+ 0, /* Dest Mask. */
65+ FALSE), /* PC relative offset? */ 60+ FALSE), /* PC relative offset? */
66+ 61+
67+ /* This reloc does nothing. Used for relaxation. */ 62 /* This reloc does nothing. Used for relaxation. */
68 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ 63 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
69 0, /* Rightshift. */ 64 0, /* Rightshift. */
70 3, /* Size (0 = byte, 1 = short, 2 = long). */
71@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 65@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
72 case BFD_RELOC_NONE: 66 case BFD_RELOC_NONE:
73 microblaze_reloc = R_MICROBLAZE_NONE; 67 microblaze_reloc = R_MICROBLAZE_NONE;
@@ -78,7 +72,7 @@ index 359484dd5e..1c69c269c7 100644
78 case BFD_RELOC_MICROBLAZE_64_NONE: 72 case BFD_RELOC_MICROBLAZE_64_NONE:
79 microblaze_reloc = R_MICROBLAZE_64_NONE; 73 microblaze_reloc = R_MICROBLAZE_64_NONE;
80 break; 74 break;
81@@ -1918,6 +1935,7 @@ microblaze_elf_relax_section (bfd *abfd, 75@@ -1918,14 +1935,22 @@ microblaze_elf_relax_section (bfd *abfd,
82 } 76 }
83 break; 77 break;
84 case R_MICROBLAZE_NONE: 78 case R_MICROBLAZE_NONE:
@@ -86,7 +80,9 @@ index 359484dd5e..1c69c269c7 100644
86 { 80 {
87 /* This was a PC-relative instruction that was 81 /* This was a PC-relative instruction that was
88 completely resolved. */ 82 completely resolved. */
89@@ -1926,12 +1944,18 @@ microblaze_elf_relax_section (bfd *abfd, 83 int sfix, efix;
84+ unsigned int val;
85 bfd_vma target_address;
90 target_address = irel->r_addend + irel->r_offset; 86 target_address = irel->r_addend + irel->r_offset;
91 sfix = calc_fixup (irel->r_offset, 0, sec); 87 sfix = calc_fixup (irel->r_offset, 0, sec);
92 efix = calc_fixup (target_address, 0, sec); 88 efix = calc_fixup (target_address, 0, sec);
@@ -99,20 +95,12 @@ index 359484dd5e..1c69c269c7 100644
99 irel->r_addend -= (efix - sfix); 95 irel->r_addend -= (efix - sfix);
100 /* Should use HOWTO. */ 96 /* Should use HOWTO. */
101 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, 97 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
102 irel->r_addend); 98@@ -1973,12 +1998,16 @@ microblaze_elf_relax_section (bfd *abfd,
103- }
104- break;
105+ }
106+ break;
107 case R_MICROBLAZE_64_NONE:
108 {
109 /* This was a PC-relative 64-bit instruction that was
110@@ -1973,12 +1997,16 @@ microblaze_elf_relax_section (bfd *abfd,
111 irelscanend = irelocs + o->reloc_count; 99 irelscanend = irelocs + o->reloc_count;
112 for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 100 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
113 { 101 {
114- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) 102- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
115+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 103+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
116 { 104 {
117 unsigned int val; 105 unsigned int val;
118 106
@@ -125,22 +113,12 @@ index 359484dd5e..1c69c269c7 100644
125 /* This was a PC-relative instruction that was completely resolved. */ 113 /* This was a PC-relative instruction that was completely resolved. */
126 if (ocontents == NULL) 114 if (ocontents == NULL)
127 { 115 {
128@@ -1999,18 +2027,17 @@ microblaze_elf_relax_section (bfd *abfd, 116@@ -2006,14 +2035,10 @@ microblaze_elf_relax_section (bfd *abfd,
129 (file_ptr) 0, 117 if (val != irelscan->r_addend) {
130 o->rawsize)) 118 fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
131 goto error_return; 119 }
132- elf_section_data (o)->this_hdr.contents = ocontents; 120- irelscan->r_addend -= calc_fixup (irelscan->r_addend
133- } 121- + isym->st_value, 0, sec);
134- }
135- irelscan->r_addend -= calc_fixup (irelscan->r_addend
136- + isym->st_value, sec);
137+ elf_section_data (o)->this_hdr.contents = ocontents;
138+ }
139+ }
140 val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
141+ if (val != irelscan->r_addend) {
142+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
143+ }
144+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); 122+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
145 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 123 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
146 irelscan->r_addend); 124 irelscan->r_addend);
@@ -151,20 +129,20 @@ index 359484dd5e..1c69c269c7 100644
151 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 129 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
152 { 130 {
153 isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 131 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
154@@ -2070,7 +2097,7 @@ microblaze_elf_relax_section (bfd *abfd, 132@@ -2073,7 +2098,7 @@ microblaze_elf_relax_section (bfd *abfd,
155 elf_section_data (o)->this_hdr.contents = ocontents; 133 elf_section_data (o)->this_hdr.contents = ocontents;
156 } 134 }
157 } 135 }
158- irelscan->r_addend -= calc_fixup (irel->r_addend 136- irelscan->r_addend -= calc_fixup (irel->r_addend
159+ irelscan->r_addend -= calc_fixup (irelscan->r_addend 137+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
160 + isym->st_value, 138 + isym->st_value,
161 0, 139 0,
162 sec); 140 sec);
163diff --git a/bfd/libbfd.h b/bfd/libbfd.h 141diff --git a/bfd/libbfd.h b/bfd/libbfd.h
164index 36284d71a9..feb9fada1e 100644 142index 44cefbd66d4..a01891f3423 100644
165--- a/bfd/libbfd.h 143--- a/bfd/libbfd.h
166+++ b/bfd/libbfd.h 144+++ b/bfd/libbfd.h
167@@ -2901,6 +2901,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 145@@ -2903,6 +2903,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
168 "BFD_RELOC_MICROBLAZE_32_ROSDA", 146 "BFD_RELOC_MICROBLAZE_32_ROSDA",
169 "BFD_RELOC_MICROBLAZE_32_RWSDA", 147 "BFD_RELOC_MICROBLAZE_32_RWSDA",
170 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 148 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
@@ -173,10 +151,10 @@ index 36284d71a9..feb9fada1e 100644
173 "BFD_RELOC_MICROBLAZE_64_GOTPC", 151 "BFD_RELOC_MICROBLAZE_64_GOTPC",
174 "BFD_RELOC_MICROBLAZE_64_GOT", 152 "BFD_RELOC_MICROBLAZE_64_GOT",
175diff --git a/bfd/reloc.c b/bfd/reloc.c 153diff --git a/bfd/reloc.c b/bfd/reloc.c
176index e6446a7809..87753ae4f0 100644 154index b00b79f3190..78f13180c71 100644
177--- a/bfd/reloc.c 155--- a/bfd/reloc.c
178+++ b/bfd/reloc.c 156+++ b/bfd/reloc.c
179@@ -6795,6 +6795,12 @@ ENUM 157@@ -6806,6 +6806,12 @@ ENUM
180 ENUMDOC 158 ENUMDOC
181 This is a 32 bit reloc for the microblaze to handle 159 This is a 32 bit reloc for the microblaze to handle
182 expressions of the form "Symbol Op Symbol" 160 expressions of the form "Symbol Op Symbol"
@@ -190,15 +168,14 @@ index e6446a7809..87753ae4f0 100644
190 BFD_RELOC_MICROBLAZE_64_NONE 168 BFD_RELOC_MICROBLAZE_64_NONE
191 ENUMDOC 169 ENUMDOC
192diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 170diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
193index 830b5ad446..6ee0966444 100644 171index 830b5ad4461..0dba2c0f44f 100644
194--- a/include/elf/microblaze.h 172--- a/include/elf/microblaze.h
195+++ b/include/elf/microblaze.h 173+++ b/include/elf/microblaze.h
196@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 174@@ -61,6 +61,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
197 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */ 175 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
198 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ 176 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
199 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ 177 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
200+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 178+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
201+
202 END_RELOC_NUMBERS (R_MICROBLAZE_max) 179 END_RELOC_NUMBERS (R_MICROBLAZE_max)
203 180
204 /* Global base address names. */ 181 /* Global base address names. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch
index 35d44be4..09a17eda 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -1,7 +1,7 @@
1From 72fe91edf03a0270ecd9df795f1a1eaded3b7d15 Mon Sep 17 00:00:00 2001 1From df187bca3d19a3e5c36182929e7e14bc6a49aad5 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 06/43] upstream change to garbage collection sweep causes mb 4Subject: [PATCH 07/40] 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
@@ -23,10 +23,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
23 1 file changed, 1 deletion(-) 23 1 file changed, 1 deletion(-)
24 24
25diff --git a/bfd/elflink.c b/bfd/elflink.c 25diff --git a/bfd/elflink.c b/bfd/elflink.c
26index e50c0e4b38..09d43e3ca5 100644 26index 7078a2fb6f4..7926fdf63be 100644
27--- a/bfd/elflink.c 27--- a/bfd/elflink.c
28+++ b/bfd/elflink.c 28+++ b/bfd/elflink.c
29@@ -6187,7 +6187,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_hash_entry *h, void *data)
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);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch
index a5cc8114..c37a5aed 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Fix-bug-in-TLSTPREL-Relocation.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-bug-in-TLSTPREL-Relocation.patch
@@ -1,7 +1,7 @@
1From 2ea146401a9aed9e3b6cc07e1b6c0f81e5a0527c Mon Sep 17 00:00:00 2001 1From 0f1d7bd04916af6172780335dc6abc11d45564f2 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 07/43] Fix bug in TLSTPREL Relocation 4Subject: [PATCH 08/40] 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
@@ -13,7 +13,7 @@ big & little-endian compilers
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 15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
16index 1c69c269c7..d19a6dca84 100644 16index cbba704e691..cc4c0568c68 100644
17--- a/bfd/elf32-microblaze.c 17--- a/bfd/elf32-microblaze.c
18+++ b/bfd/elf32-microblaze.c 18+++ b/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 *output_bfd,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch
index 933e51e1..c9903a40 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-Address-extension-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Added-Address-extension-instructions.patch
@@ -1,7 +1,7 @@
1From a4b50cb6f4b8d2f4e7d3b28bbc2f8110277e441d Mon Sep 17 00:00:00 2001 1From c0bb923f0978d5767048274cd778c8cbcef184ec 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 08/43] Added Address extension instructions 4Subject: [PATCH 09/40] 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,17 +13,27 @@ 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
16 *microblaze-opcm.h (microblaze_instr): Update 17 *microblaze-opcm.h (microblaze_instr): Update
17 Added new instructions 18 Added new instructions
18--- 19---
19 opcodes/microblaze-opc.h | 11 +++++++++++ 20 opcodes/microblaze-opc.h | 19 +++++++++++++++----
20 opcodes/microblaze-opcm.h | 10 +++++----- 21 opcodes/microblaze-opcm.h | 12 ++++++------
21 2 files changed, 16 insertions(+), 5 deletions(-) 22 2 files changed, 21 insertions(+), 10 deletions(-)
22 23
23diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 24diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
24index 865151f95b..330f1040e7 100644 25index 865151f95b0..d9a84e575e8 100644
25--- a/opcodes/microblaze-opc.h 26--- a/opcodes/microblaze-opc.h
26+++ b/opcodes/microblaze-opc.h 27+++ b/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 {
27@@ -178,8 +178,11 @@ struct op_code_struct 37@@ -178,8 +178,11 @@ struct op_code_struct
28 {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, 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 },
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 }, 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 },
@@ -61,6 +71,20 @@ index 865151f95b..330f1040e7 100644
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 }, 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 },
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 }, 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 },
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 }, 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 },
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 },
64@@ -405,6 +414,8 @@ struct op_code_struct 88@@ -405,6 +414,8 @@ struct op_code_struct
65 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst }, 89 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
66 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst }, 90 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
@@ -71,10 +95,10 @@ index 865151f95b..330f1040e7 100644
71 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, 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 },
72 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 96 {"", 0, 0, 0, 0, 0, 0, 0, 0},
73diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 97diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
74index 42f3dd3be5..1c39dbf50b 100644 98index 42f3dd3be53..8be6e97a1d5 100644
75--- a/opcodes/microblaze-opcm.h 99--- a/opcodes/microblaze-opcm.h
76+++ b/opcodes/microblaze-opcm.h 100+++ b/opcodes/microblaze-opcm.h
77@@ -33,13 +33,13 @@ enum microblaze_instr 101@@ -33,14 +33,14 @@ enum microblaze_instr
78 /* 'or/and/xor' are C++ keywords. */ 102 /* 'or/and/xor' are C++ keywords. */
79 microblaze_or, microblaze_and, microblaze_xor, 103 microblaze_or, microblaze_and, microblaze_xor,
80 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, 104 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
@@ -88,11 +112,13 @@ index 42f3dd3be5..1c39dbf50b 100644
88 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, 112 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
89- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh, 113- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
90- shr, sw, swr, swx, lbui, lhui, lwi, 114- shr, sw, swr, swx, lbui, lhui, lwi,
115- sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv,
91+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, 116+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
92+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, 117+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
93 sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 118+ sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
94 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 119 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
95 fint, fsqrt, 120 fint, fsqrt,
121 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
96-- 122--
972.17.1 1232.17.1
98 124
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-fixing-the-MAX_OPCODES-to-correct-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-fixing-the-MAX_OPCODES-to-correct-value.patch
deleted file mode 100644
index 8b51a7a7..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-fixing-the-MAX_OPCODES-to-correct-value.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 9c7c893866ab6b63942b86be6134c34b96272306 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 28 Jan 2016 14:07:34 +0530
4Subject: [PATCH 09/43] fixing the MAX_OPCODES to correct value
5
6---
7 opcodes/microblaze-opc.h | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
11index 330f1040e7..2a6b841232 100644
12--- a/opcodes/microblaze-opc.h
13+++ b/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 {
23--
242.17.1
25
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch
index 11d45a23..f94410d5 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Add-new-bit-field-instructions.patch
@@ -1,7 +1,7 @@
1From 55acba095458b872b500e978af946733a9f33021 Mon Sep 17 00:00:00 2001 1From 32058fa03c18d710b3029108e967be687d00516c 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/43] Add new bit-field instructions 4Subject: [PATCH 10/40] 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
@@ -13,47 +13,48 @@ The 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--- 15---
16 opcodes/microblaze-dis.c | 16 +++++++++ 16 opcodes/microblaze-dis.c | 17 +++++++++
17 opcodes/microblaze-opc.h | 12 ++++++- 17 opcodes/microblaze-opc.h | 12 ++++++-
18 opcodes/microblaze-opcm.h | 6 +++- 18 opcodes/microblaze-opcm.h | 6 +++-
19 4 files changed, 102 insertions(+), 3 deletions(-) 19 4 files changed, 103 insertions(+), 3 deletions(-)
20 20
21diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 21diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
22index f691740dfd..f8aaf27873 100644 22index 2b3aa8e0786..356f1da22ed 100644
23--- a/opcodes/microblaze-dis.c 23--- a/opcodes/microblaze-dis.c
24+++ b/opcodes/microblaze-dis.c 24+++ b/opcodes/microblaze-dis.c
25@@ -73,6 +73,18 @@ get_field_imm5_mbar (long instr) 25@@ -90,6 +90,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
26 return(strdup(tmpstr)); 26 return p;
27 } 27 }
28 28
29+static char * 29+static char *
30+get_field_imm5width (long instr) 30+get_field_imm5width (struct string_buf *buf, long instr)
31+{ 31+{
32+ char tmpstr[25]; 32+ char *p = strbuf (buf);
33+ 33+
34+ if (instr & 0x00004000) 34+ if (instr & 0x00004000)
35+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 35+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
36+ else 36+ else
37+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */ 37+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
38+ return (strdup (tmpstr)); 38+ return p;
39+} 39+}
40+ 40+
41 static char * 41 static char *
42 get_field_rfsl (long instr) 42 get_field_rfsl (struct string_buf *buf, long instr)
43 { 43 {
44@@ -396,6 +408,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 44@@ -426,6 +438,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
45 /* For mbar 16 or sleep insn. */ 45 case INST_TYPE_NONE:
46 case INST_TYPE_NONE: 46 break;
47 break; 47 /* For tuqula instruction */
48+ /* For bit field insns. */ 48+ /* For bit field insns. */
49+ case INST_TYPE_RD_R1_IMM5_IMM5: 49+ case INST_TYPE_RD_R1_IMM5_IMM5:
50+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst),get_field_r1(inst),get_field_imm5width (inst), get_field_imm5 (inst)); 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));
51+ break; 51+ break;
52 /* For tuqula instruction */ 52+ /* For tuqula instruction */
53 case INST_TYPE_RD: 53 case INST_TYPE_RD:
54 print_func (stream, "\t%s", get_field_rd (inst)); 54 print_func (stream, "\t%s", get_field_rd (&buf, inst));
55 break;
55diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 56diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
56index 2a6b841232..ce8ac351b5 100644 57index d9a84e575e8..d3b234e1fcd 100644
57--- a/opcodes/microblaze-opc.h 58--- a/opcodes/microblaze-opc.h
58+++ b/opcodes/microblaze-opc.h 59+++ b/opcodes/microblaze-opc.h
59@@ -59,6 +59,9 @@ 60@@ -59,6 +59,9 @@
@@ -104,7 +105,7 @@ index 2a6b841232..ce8ac351b5 100644
104 #endif /* MICROBLAZE_OPC */ 105 #endif /* MICROBLAZE_OPC */
105 106
106diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 107diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
107index 1c39dbf50b..28662694cd 100644 108index 8be6e97a1d5..c3b2b8f0f6e 100644
108--- a/opcodes/microblaze-opcm.h 109--- a/opcodes/microblaze-opcm.h
109+++ b/opcodes/microblaze-opcm.h 110+++ b/opcodes/microblaze-opcm.h
110@@ -29,7 +29,7 @@ enum microblaze_instr 111@@ -29,7 +29,7 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch
index b6f2920a..3f3c8141 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fixing-the-imm-bug.patch
@@ -1,15 +1,15 @@
1From f42a99be023e3f933c0a228ac8e08d59c59ec8d7 Mon Sep 17 00:00:00 2001 1From 121b64d9dafd3119925a7e95a09fa9f388e53922 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/43] fixing the imm bug. with relax option imm -1 is also 4Subject: [PATCH 11/40] fixing the imm bug.
5 getting removed this is corrected now.
6 5
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 11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
12index d19a6dca84..d001437b3f 100644 12index cc4c0568c68..cb7271f5017 100644
13--- a/bfd/elf32-microblaze.c 13--- a/bfd/elf32-microblaze.c
14+++ b/bfd/elf32-microblaze.c 14+++ b/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,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch
index 96cab28a..bda74adc 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0015-intial-commit-of-MB-64-bit.patch
@@ -1,7 +1,7 @@
1From b42fae987795bb210476dcaa5e086f42602208f8 Mon Sep 17 00:00:00 2001 1From 48e5b2505d97ca936e9946c3945c72bdcfc1743e 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/43] intial commit of MB 64-bit 4Subject: [PATCH 15/40] intial commit of MB 64-bit
5 5
6--- 6---
7 bfd/Makefile.am | 2 + 7 bfd/Makefile.am | 2 +
@@ -9,69 +9,77 @@ Subject: [PATCH 15/43] intial commit of MB 64-bit
9 bfd/config.bfd | 4 + 9 bfd/config.bfd | 4 +
10 bfd/configure | 2 + 10 bfd/configure | 2 +
11 bfd/configure.ac | 2 + 11 bfd/configure.ac | 2 +
12 bfd/cpu-microblaze.c | 52 +- 12 bfd/cpu-microblaze.c | 55 +-
13 bfd/elf64-microblaze.c | 3584 ++++++++++++++++++++++++++++ 13 bfd/doc/Makefile.in | 1 +
14 bfd/elf64-microblaze.c | 3560 ++++++++++++++++++++++++++++
14 bfd/targets.c | 6 + 15 bfd/targets.c | 6 +
15 include/elf/common.h | 1 + 16 include/elf/common.h | 1 +
16 opcodes/microblaze-dis.c | 39 +- 17 ld/Makefile.am | 4 +
18 ld/Makefile.in | 7 +
19 ld/configure.tgt | 3 +
20 ld/emulparams/elf64microblaze.sh | 23 +
21 ld/emulparams/elf64microblazeel.sh | 23 +
22 opcodes/microblaze-dis.c | 43 +-
17 opcodes/microblaze-opc.h | 162 +- 23 opcodes/microblaze-opc.h | 162 +-
18 opcodes/microblaze-opcm.h | 20 +- 24 opcodes/microblaze-opcm.h | 20 +-
19 19 files changed, 4181 insertions(+), 41 deletions(-) 25 20 files changed, 4156 insertions(+), 43 deletions(-)
20 create mode 100644 bfd/elf64-microblaze.c 26 create mode 100644 bfd/elf64-microblaze.c
27 create mode 100644 ld/emulparams/elf64microblaze.sh
28 create mode 100644 ld/emulparams/elf64microblazeel.sh
21 29
22diff --git a/bfd/Makefile.am b/bfd/Makefile.am 30diff --git a/bfd/Makefile.am b/bfd/Makefile.am
23index a9191555ad..c5fd250812 100644 31index e5bd28f03f5..35ecb83a1a1 100644
24--- a/bfd/Makefile.am 32--- a/bfd/Makefile.am
25+++ b/bfd/Makefile.am 33+++ b/bfd/Makefile.am
26@@ -570,6 +570,7 @@ BFD64_BACKENDS = \ 34@@ -558,6 +558,7 @@ BFD64_BACKENDS = \
27 elf64-riscv.lo \ 35 elf64-ia64.lo \
28 elfxx-riscv.lo \ 36 elf64-ia64-vms.lo \
29 elf64-s390.lo \ 37 elfxx-ia64.lo \
30+ elf64-microblaze.lo \ 38+ elf64-microblaze.lo \
31 elf64-sparc.lo \ 39 elfn32-mips.lo \
32 elf64-tilegx.lo \ 40 elf64-mips.lo \
33 elf64-x86-64.lo \ 41 elfxx-mips.lo \
34@@ -603,6 +604,7 @@ BFD64_BACKENDS_CFILES = \ 42@@ -597,6 +598,7 @@ BFD64_BACKENDS_CFILES = \
35 elf64-nfp.c \ 43 elf64-gen.c \
36 elf64-ppc.c \ 44 elf64-hppa.c \
37 elf64-s390.c \ 45 elf64-ia64-vms.c \
38+ elf64-microblaze.c \ 46+ elf64-microblaze.c \
39 elf64-sparc.c \ 47 elf64-mips.c \
40 elf64-tilegx.c \ 48 elf64-mmix.c \
41 elf64-x86-64.c \ 49 elf64-nfp.c \
42diff --git a/bfd/Makefile.in b/bfd/Makefile.in 50diff --git a/bfd/Makefile.in b/bfd/Makefile.in
43index 896df52042..fd457cba1e 100644 51index 15334f10c55..89a2470ec8f 100644
44--- a/bfd/Makefile.in 52--- a/bfd/Makefile.in
45+++ b/bfd/Makefile.in 53+++ b/bfd/Makefile.in
46@@ -995,6 +995,7 @@ BFD64_BACKENDS = \ 54@@ -984,6 +984,7 @@ BFD64_BACKENDS = \
47 elf64-riscv.lo \ 55 elf64-ia64.lo \
48 elfxx-riscv.lo \ 56 elf64-ia64-vms.lo \
49 elf64-s390.lo \ 57 elfxx-ia64.lo \
50+ elf64-microblaze.lo \ 58+ elf64-microblaze.lo \
51 elf64-sparc.lo \ 59 elfn32-mips.lo \
52 elf64-tilegx.lo \ 60 elf64-mips.lo \
53 elf64-x86-64.lo \ 61 elfxx-mips.lo \
54@@ -1028,6 +1029,7 @@ BFD64_BACKENDS_CFILES = \ 62@@ -1023,6 +1024,7 @@ BFD64_BACKENDS_CFILES = \
55 elf64-nfp.c \ 63 elf64-gen.c \
56 elf64-ppc.c \ 64 elf64-hppa.c \
57 elf64-s390.c \ 65 elf64-ia64-vms.c \
58+ elf64-microblaze.c \ 66+ elf64-microblaze.c \
59 elf64-sparc.c \ 67 elf64-mips.c \
60 elf64-tilegx.c \ 68 elf64-mmix.c \
61 elf64-x86-64.c \ 69 elf64-nfp.c \
62@@ -1494,6 +1496,7 @@ distclean-compile: 70@@ -1504,6 +1506,7 @@ distclean-compile:
63 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@ 71 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
64 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@ 72 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@
65 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@ 73 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64.Plo@am__quote@
66+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@ 74+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
67 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@ 75 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@
68 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@ 76 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@
69 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@ 77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-nfp.Plo@am__quote@
70diff --git a/bfd/config.bfd b/bfd/config.bfd 78diff --git a/bfd/config.bfd b/bfd/config.bfd
71index f13812b7c7..a98c220db5 100644 79index 0a96927e0ed..1fcae568c36 100644
72--- a/bfd/config.bfd 80--- a/bfd/config.bfd
73+++ b/bfd/config.bfd 81+++ b/bfd/config.bfd
74@@ -850,11 +850,15 @@ case "${targ}" in 82@@ -842,11 +842,15 @@ case "${targ}" in
75 microblazeel*-*) 83 microblazeel*-*)
76 targ_defvec=microblaze_elf32_le_vec 84 targ_defvec=microblaze_elf32_le_vec
77 targ_selvecs=microblaze_elf32_vec 85 targ_selvecs=microblaze_elf32_vec
@@ -88,36 +96,36 @@ index f13812b7c7..a98c220db5 100644
88 96
89 #ifdef BFD64 97 #ifdef BFD64
90diff --git a/bfd/configure b/bfd/configure 98diff --git a/bfd/configure b/bfd/configure
91index 8d6c94aef2..3defb1f784 100755 99index abd7b2a83e5..731c059eba0 100755
92--- a/bfd/configure 100--- a/bfd/configure
93+++ b/bfd/configure 101+++ b/bfd/configure
94@@ -14847,6 +14847,8 @@ do 102@@ -14804,6 +14804,8 @@ do
95 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;; 103 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;;
96 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; 104 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
97 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 105 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
98+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 106+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
99+ microblaze_elf64_le_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 ;;
100 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 108 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
101 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 109 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
102 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; 110 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
103diff --git a/bfd/configure.ac b/bfd/configure.ac 111diff --git a/bfd/configure.ac b/bfd/configure.ac
104index 5f02c41520..d3010b47dc 100644 112index 7eee83ae4d4..b87f6183b98 100644
105--- a/bfd/configure.ac 113--- a/bfd/configure.ac
106+++ b/bfd/configure.ac 114+++ b/bfd/configure.ac
107@@ -615,6 +615,8 @@ do 115@@ -540,6 +540,8 @@ do
108 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;; 116 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;;
109 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; 117 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
110 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 118 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
111+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 119+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
112+ microblaze_elf64_le_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 ;;
113 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 121 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
114 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 122 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
115 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; 123 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
116diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 124diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
117index 9bc2eb3de9..c91ba46f75 100644 125index 4e05d73f01b..4b48b310c6a 100644
118--- a/bfd/cpu-microblaze.c 126--- a/bfd/cpu-microblaze.c
119+++ b/bfd/cpu-microblaze.c 127+++ b/bfd/cpu-microblaze.c
120@@ -23,7 +23,24 @@ 128@@ -23,7 +23,25 @@
121 #include "bfd.h" 129 #include "bfd.h"
122 #include "libbfd.h" 130 #include "libbfd.h"
123 131
@@ -138,15 +146,16 @@ index 9bc2eb3de9..c91ba46f75 100644
138+ bfd_default_compatible, /* Architecture comparison function. */ 146+ bfd_default_compatible, /* Architecture comparison function. */
139+ bfd_default_scan, /* String to architecture conversion. */ 147+ bfd_default_scan, /* String to architecture conversion. */
140+ bfd_arch_default_fill, /* Default fill. */ 148+ bfd_arch_default_fill, /* Default fill. */
141+ &bfd_microblaze_arch[1] /* Next in list. */ 149+ &bfd_microblaze_arch[1], /* Next in list. */
150+ 0 /* Maximum offset of a reloc from the start of an insn. */
142+}, 151+},
143 { 152 {
144 32, /* 32 bits in a word. */ 153 32, /* Bits in a word. */
145 32, /* 32 bits in an address. */ 154 32, /* Bits in an address. */
146@@ -38,4 +55,37 @@ const bfd_arch_info_type bfd_microblaze_arch = 155@@ -39,4 +57,39 @@ const bfd_arch_info_type bfd_microblaze_arch =
147 bfd_default_scan, /* String to architecture conversion. */
148 bfd_arch_default_fill, /* Default fill. */ 156 bfd_arch_default_fill, /* Default fill. */
149 NULL /* Next in list. */ 157 NULL, /* Next in list. */
158 0 /* Maximum offset of a reloc from the start of an insn. */
150+} 159+}
151+#else 160+#else
152+{ 161+{
@@ -162,7 +171,8 @@ index 9bc2eb3de9..c91ba46f75 100644
162+ bfd_default_compatible, /* Architecture comparison function. */ 171+ bfd_default_compatible, /* Architecture comparison function. */
163+ bfd_default_scan, /* String to architecture conversion. */ 172+ bfd_default_scan, /* String to architecture conversion. */
164+ bfd_arch_default_fill, /* Default fill. */ 173+ bfd_arch_default_fill, /* Default fill. */
165+ &bfd_microblaze_arch[1] /* Next in list. */ 174+ &bfd_microblaze_arch[1], /* Next in list. */
175+ 0 /* Maximum offset of a reloc from the start of an insn. */
166+}, 176+},
167+{ 177+{
168+ 64, /* 32 bits in a word. */ 178+ 64, /* 32 bits in a word. */
@@ -177,16 +187,29 @@ index 9bc2eb3de9..c91ba46f75 100644
177+ bfd_default_compatible, /* Architecture comparison function. */ 187+ bfd_default_compatible, /* Architecture comparison function. */
178+ bfd_default_scan, /* String to architecture conversion. */ 188+ bfd_default_scan, /* String to architecture conversion. */
179+ bfd_arch_default_fill, /* Default fill. */ 189+ bfd_arch_default_fill, /* Default fill. */
180+ NULL /* Next in list. */ 190+ NULL, /* Next in list. */
191+ 0 /* Maximum offset of a reloc from the start of an insn. */
181+} 192+}
182+#endif 193+#endif
183 }; 194 };
195diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
196index 0115dfc406c..d75411d2af7 100644
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@
184diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 207diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
185new file mode 100644 208new file mode 100644
186index 0000000000..0f43ae6ea8 209index 00000000000..fa4b95e47e0
187--- /dev/null 210--- /dev/null
188+++ b/bfd/elf64-microblaze.c 211+++ b/bfd/elf64-microblaze.c
189@@ -0,0 +1,3584 @@ 212@@ -0,0 +1,3560 @@
190+/* Xilinx MicroBlaze-specific support for 32-bit ELF 213+/* Xilinx MicroBlaze-specific support for 32-bit ELF
191+ 214+
192+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 215+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -844,7 +867,7 @@ index 0000000000..0f43ae6ea8
844+ 867+
845+/* Set the howto pointer for a RCE ELF reloc. */ 868+/* Set the howto pointer for a RCE ELF reloc. */
846+ 869+
847+static void 870+static bfd_boolean
848+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, 871+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
849+ arelent * cache_ptr, 872+ arelent * cache_ptr,
850+ Elf_Internal_Rela * dst) 873+ Elf_Internal_Rela * dst)
@@ -858,13 +881,14 @@ index 0000000000..0f43ae6ea8
858+ r_type = ELF64_R_TYPE (dst->r_info); 881+ r_type = ELF64_R_TYPE (dst->r_info);
859+ if (r_type >= R_MICROBLAZE_max) 882+ if (r_type >= R_MICROBLAZE_max)
860+ { 883+ {
861+ (*_bfd_error_handler) (_("%B: unrecognised MicroBlaze reloc number: %d"), 884+ (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"),
862+ abfd, r_type); 885+ abfd, r_type);
863+ bfd_set_error (bfd_error_bad_value); 886+ bfd_set_error (bfd_error_bad_value);
864+ r_type = R_MICROBLAZE_NONE; 887+ return FALSE;
865+ } 888+ }
866+ 889+
867+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 890+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
891+ return TRUE;
868+} 892+}
869+ 893+
870+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 894+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
@@ -1263,7 +1287,7 @@ index 0000000000..0f43ae6ea8
1263+ /* Only relocate if the symbol is defined. */ 1287+ /* Only relocate if the symbol is defined. */
1264+ if (sec) 1288+ if (sec)
1265+ { 1289+ {
1266+ name = bfd_get_section_name (sec->owner, sec); 1290+ name = bfd_section_name (sec);
1267+ 1291+
1268+ if (strcmp (name, ".sdata2") == 0 1292+ if (strcmp (name, ".sdata2") == 0
1269+ || strcmp (name, ".sbss2") == 0) 1293+ || strcmp (name, ".sbss2") == 0)
@@ -1292,7 +1316,7 @@ index 0000000000..0f43ae6ea8
1292+ bfd_get_filename (input_bfd), 1316+ bfd_get_filename (input_bfd),
1293+ sym_name, 1317+ sym_name,
1294+ microblaze_elf_howto_table[(int) r_type]->name, 1318+ microblaze_elf_howto_table[(int) r_type]->name,
1295+ bfd_get_section_name (sec->owner, sec)); 1319+ bfd_section_name (sec));
1296+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1320+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1297+ ret = FALSE; 1321+ ret = FALSE;
1298+ continue; 1322+ continue;
@@ -1308,7 +1332,7 @@ index 0000000000..0f43ae6ea8
1308+ /* Only relocate if the symbol is defined. */ 1332+ /* Only relocate if the symbol is defined. */
1309+ if (sec) 1333+ if (sec)
1310+ { 1334+ {
1311+ name = bfd_get_section_name (sec->owner, sec); 1335+ name = bfd_section_name (sec);
1312+ 1336+
1313+ if (strcmp (name, ".sdata") == 0 1337+ if (strcmp (name, ".sdata") == 0
1314+ || strcmp (name, ".sbss") == 0) 1338+ || strcmp (name, ".sbss") == 0)
@@ -1337,7 +1361,7 @@ index 0000000000..0f43ae6ea8
1337+ bfd_get_filename (input_bfd), 1361+ bfd_get_filename (input_bfd),
1338+ sym_name, 1362+ sym_name,
1339+ microblaze_elf_howto_table[(int) r_type]->name, 1363+ microblaze_elf_howto_table[(int) r_type]->name,
1340+ bfd_get_section_name (sec->owner, sec)); 1364+ bfd_section_name (sec));
1341+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1365+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1342+ ret = FALSE; 1366+ ret = FALSE;
1343+ continue; 1367+ continue;
@@ -1399,6 +1423,7 @@ index 0000000000..0f43ae6ea8
1399+ goto dogot; 1423+ goto dogot;
1400+ case (int) R_MICROBLAZE_TLSLD: 1424+ case (int) R_MICROBLAZE_TLSLD:
1401+ tls_type = (TLS_TLS | TLS_LD); 1425+ tls_type = (TLS_TLS | TLS_LD);
1426+ /* Fall through. */
1402+ dogot: 1427+ dogot:
1403+ case (int) R_MICROBLAZE_GOT_64: 1428+ case (int) R_MICROBLAZE_GOT_64:
1404+ { 1429+ {
@@ -1699,7 +1724,7 @@ index 0000000000..0f43ae6ea8
1699+ { 1724+ {
1700+ BFD_FAIL (); 1725+ BFD_FAIL ();
1701+ (*_bfd_error_handler) 1726+ (*_bfd_error_handler)
1702+ (_("%B: probably compiled without -fPIC?"), 1727+ (_("%pB: probably compiled without -fPIC?"),
1703+ input_bfd); 1728+ input_bfd);
1704+ bfd_set_error (bfd_error_bad_value); 1729+ bfd_set_error (bfd_error_bad_value);
1705+ return FALSE; 1730+ return FALSE;
@@ -1753,7 +1778,7 @@ index 0000000000..0f43ae6ea8
1753+ name = (bfd_elf_string_from_elf_section 1778+ name = (bfd_elf_string_from_elf_section
1754+ (input_bfd, symtab_hdr->sh_link, sym->st_name)); 1779+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
1755+ if (name == NULL || *name == '\0') 1780+ if (name == NULL || *name == '\0')
1756+ name = bfd_section_name (input_bfd, sec); 1781+ name = bfd_section_name (sec);
1757+ } 1782+ }
1758+ 1783+
1759+ if (errmsg != NULL) 1784+ if (errmsg != NULL)
@@ -1798,21 +1823,6 @@ index 0000000000..0f43ae6ea8
1798+ return ret; 1823+ return ret;
1799+} 1824+}
1800+ 1825+
1801+/* Merge backend specific data from an object file to the output
1802+ object file when linking.
1803+
1804+ Note: We only use this hook to catch endian mismatches. */
1805+static bfd_boolean
1806+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
1807+{
1808+ /* Check if we have the same endianess. */
1809+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
1810+ return FALSE;
1811+
1812+ return TRUE;
1813+}
1814+
1815+
1816+/* Calculate fixup value for reference. */ 1826+/* Calculate fixup value for reference. */
1817+ 1827+
1818+static int 1828+static int
@@ -2129,7 +2139,7 @@ index 0000000000..0f43ae6ea8
2129+ irelscanend = irelocs + o->reloc_count; 2139+ irelscanend = irelocs + o->reloc_count;
2130+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 2140+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2131+ { 2141+ {
2132+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 2142+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2133+ { 2143+ {
2134+ unsigned int val; 2144+ unsigned int val;
2135+ 2145+
@@ -2488,17 +2498,6 @@ index 0000000000..0f43ae6ea8
2488+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); 2498+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2489+} 2499+}
2490+ 2500+
2491+/* Update the got entry reference counts for the section being removed. */
2492+
2493+static bfd_boolean
2494+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
2495+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
2496+ asection * sec ATTRIBUTE_UNUSED,
2497+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
2498+{
2499+ return TRUE;
2500+}
2501+
2502+/* PIC support. */ 2501+/* PIC support. */
2503+ 2502+
2504+#define PLT_ENTRY_SIZE 16 2503+#define PLT_ENTRY_SIZE 16
@@ -2531,13 +2530,13 @@ index 0000000000..0f43ae6ea8
2531+ if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL) 2530+ if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL)
2532+ htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got"); 2531+ htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got");
2533+ if (htab->srelgot == NULL 2532+ if (htab->srelgot == NULL
2534+ || ! bfd_set_section_flags (dynobj, htab->srelgot, SEC_ALLOC 2533+ || ! bfd_set_section_flags (htab->srelgot, SEC_ALLOC
2535+ | SEC_LOAD 2534+ | SEC_LOAD
2536+ | SEC_HAS_CONTENTS 2535+ | SEC_HAS_CONTENTS
2537+ | SEC_IN_MEMORY 2536+ | SEC_IN_MEMORY
2538+ | SEC_LINKER_CREATED 2537+ | SEC_LINKER_CREATED
2539+ | SEC_READONLY) 2538+ | SEC_READONLY)
2540+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) 2539+ || ! bfd_set_section_alignment (htab->srelgot, 2))
2541+ return FALSE; 2540+ return FALSE;
2542+ return TRUE; 2541+ return TRUE;
2543+} 2542+}
@@ -2618,7 +2617,7 @@ index 0000000000..0f43ae6ea8
2618+ 2617+
2619+ /* PR15323, ref flags aren't set for references in the same 2618+ /* PR15323, ref flags aren't set for references in the same
2620+ object. */ 2619+ object. */
2621+ h->root.non_ir_ref = 1; 2620+ h->root.non_ir_ref_regular = 1;
2622+ } 2621+ }
2623+ 2622+
2624+ switch (r_type) 2623+ switch (r_type)
@@ -2654,6 +2653,7 @@ index 0000000000..0f43ae6ea8
2654+ tls_type |= (TLS_TLS | TLS_LD); 2653+ tls_type |= (TLS_TLS | TLS_LD);
2655+ dogottls: 2654+ dogottls:
2656+ sec->has_tls_reloc = 1; 2655+ sec->has_tls_reloc = 1;
2656+ /* Fall through. */
2657+ case R_MICROBLAZE_GOT_64: 2657+ case R_MICROBLAZE_GOT_64:
2658+ if (htab->sgot == NULL) 2658+ if (htab->sgot == NULL)
2659+ { 2659+ {
@@ -2927,12 +2927,12 @@ index 0000000000..0f43ae6ea8
2927+ /* If this is a weak symbol, and there is a real definition, the 2927+ /* If this is a weak symbol, and there is a real definition, the
2928+ processor independent code will have arranged for us to see the 2928+ processor independent code will have arranged for us to see the
2929+ real definition first, and we can just use the same value. */ 2929+ real definition first, and we can just use the same value. */
2930+ if (h->u.weakdef != NULL) 2930+ if (h->is_weakalias)
2931+ { 2931+ {
2932+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined 2932+ struct elf_link_hash_entry *def = weakdef (h);
2933+ || h->u.weakdef->root.type == bfd_link_hash_defweak); 2933+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
2934+ h->root.u.def.section = h->u.weakdef->root.u.def.section; 2934+ h->root.u.def.section = def->root.u.def.section;
2935+ h->root.u.def.value = h->u.weakdef->root.u.def.value; 2935+ h->root.u.def.value = def->root.u.def.value;
2936+ return TRUE; 2936+ return TRUE;
2937+ } 2937+ }
2938+ 2938+
@@ -3004,9 +3004,9 @@ index 0000000000..0f43ae6ea8
3004+ sdynbss = htab->sdynbss; 3004+ sdynbss = htab->sdynbss;
3005+ /* Apply the required alignment. */ 3005+ /* Apply the required alignment. */
3006+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two)); 3006+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
3007+ if (power_of_two > bfd_get_section_alignment (dynobj, sdynbss)) 3007+ if (power_of_two > bfd_section_alignment (sdynbss))
3008+ { 3008+ {
3009+ if (! bfd_set_section_alignment (dynobj, sdynbss, power_of_two)) 3009+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
3010+ return FALSE; 3010+ return FALSE;
3011+ } 3011+ }
3012+ 3012+
@@ -3353,7 +3353,7 @@ index 0000000000..0f43ae6ea8
3353+ 3353+
3354+ /* It's OK to base decisions on the section name, because none 3354+ /* It's OK to base decisions on the section name, because none
3355+ of the dynobj section names depend upon the input files. */ 3355+ of the dynobj section names depend upon the input files. */
3356+ name = bfd_get_section_name (dynobj, s); 3356+ name = bfd_section_name (s);
3357+ 3357+
3358+ if (strncmp (name, ".rela", 5) == 0) 3358+ if (strncmp (name, ".rela", 5) == 0)
3359+ { 3359+ {
@@ -3721,7 +3721,7 @@ index 0000000000..0f43ae6ea8
3721+ put into .sbss. */ 3721+ put into .sbss. */
3722+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 3722+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3723+ if (*secp == NULL 3723+ if (*secp == NULL
3724+ || ! bfd_set_section_flags (abfd, *secp, SEC_IS_COMMON)) 3724+ || ! bfd_set_section_flags (*secp, SEC_IS_COMMON))
3725+ return FALSE; 3725+ return FALSE;
3726+ 3726+
3727+ *valp = sym->st_size; 3727+ *valp = sym->st_size;
@@ -3748,11 +3748,10 @@ index 0000000000..0f43ae6ea8
3748+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name 3748+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3749+#define elf_backend_relocate_section microblaze_elf_relocate_section 3749+#define elf_backend_relocate_section microblaze_elf_relocate_section
3750+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section 3750+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3751+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data 3751+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
3752+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup 3752+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3753+ 3753+
3754+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook 3754+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3755+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
3756+#define elf_backend_check_relocs microblaze_elf_check_relocs 3755+#define elf_backend_check_relocs microblaze_elf_check_relocs
3757+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol 3756+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3758+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create 3757+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
@@ -3772,10 +3771,10 @@ index 0000000000..0f43ae6ea8
3772+ 3771+
3773+#include "elf64-target.h" 3772+#include "elf64-target.h"
3774diff --git a/bfd/targets.c b/bfd/targets.c 3773diff --git a/bfd/targets.c b/bfd/targets.c
3775index 158168cb3b..ef567a30c8 100644 3774index fb0c669e7f7..97b0e473e16 100644
3776--- a/bfd/targets.c 3775--- a/bfd/targets.c
3777+++ b/bfd/targets.c 3776+++ b/bfd/targets.c
3778@@ -706,6 +706,8 @@ extern const bfd_target mep_elf32_le_vec; 3777@@ -779,6 +779,8 @@ extern const bfd_target mep_elf32_le_vec;
3779 extern const bfd_target metag_elf32_vec; 3778 extern const bfd_target metag_elf32_vec;
3780 extern const bfd_target microblaze_elf32_vec; 3779 extern const bfd_target microblaze_elf32_vec;
3781 extern const bfd_target microblaze_elf32_le_vec; 3780 extern const bfd_target microblaze_elf32_le_vec;
@@ -3784,7 +3783,7 @@ index 158168cb3b..ef567a30c8 100644
3784 extern const bfd_target mips_ecoff_be_vec; 3783 extern const bfd_target mips_ecoff_be_vec;
3785 extern const bfd_target mips_ecoff_le_vec; 3784 extern const bfd_target mips_ecoff_le_vec;
3786 extern const bfd_target mips_ecoff_bele_vec; 3785 extern const bfd_target mips_ecoff_bele_vec;
3787@@ -1073,6 +1075,10 @@ static const bfd_target * const _bfd_target_vector[] = 3786@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_target_vector[] =
3788 3787
3789 &metag_elf32_vec, 3788 &metag_elf32_vec,
3790 3789
@@ -3796,7 +3795,7 @@ index 158168cb3b..ef567a30c8 100644
3796 3795
3797 &mips_ecoff_be_vec, 3796 &mips_ecoff_be_vec,
3798diff --git a/include/elf/common.h b/include/elf/common.h 3797diff --git a/include/elf/common.h b/include/elf/common.h
3799index e8faf67be3..ca89da1631 100644 3798index 75c4fb7e9d7..1584e1c87d0 100644
3800--- a/include/elf/common.h 3799--- a/include/elf/common.h
3801+++ b/include/elf/common.h 3800+++ b/include/elf/common.h
3802@@ -339,6 +339,7 @@ 3801@@ -339,6 +339,7 @@
@@ -3808,101 +3807,105 @@ index e8faf67be3..ca89da1631 100644
3808 #define EM_CSKY 252 /* C-SKY processor family. */ 3807 #define EM_CSKY 252 /* C-SKY processor family. */
3809 3808
3810diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 3809diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
3811index f8aaf27873..20ea6a885a 100644 3810index 356f1da22ed..437f536e96a 100644
3812--- a/opcodes/microblaze-dis.c 3811--- a/opcodes/microblaze-dis.c
3813+++ b/opcodes/microblaze-dis.c 3812+++ b/opcodes/microblaze-dis.c
3814@@ -33,6 +33,7 @@ 3813@@ -33,6 +33,7 @@
3815 #define get_field_r1(instr) get_field (instr, RA_MASK, RA_LOW) 3814 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
3816 #define get_field_r2(instr) get_field (instr, RB_MASK, RB_LOW) 3815 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
3817 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW) 3816 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
3818+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW) 3817+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
3819 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) 3818 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
3820 3819
3821 3820 #define NUM_STRBUFS 3
3822@@ -56,11 +57,20 @@ get_field_imm (long instr) 3821@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
3823 } 3822 }
3824 3823
3825 static char * 3824 static char *
3826-get_field_imm5 (long instr) 3825-get_field_imm5 (struct string_buf *buf, long instr)
3827+get_field_imml (long instr) 3826+get_field_imml (struct string_buf *buf, long instr)
3828 { 3827 {
3829 char tmpstr[25]; 3828 char *p = strbuf (buf);
3830 3829
3831- sprintf (tmpstr, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW)); 3830- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
3832+ sprintf (tmpstr, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 3831+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
3833+ return (strdup (tmpstr)); 3832+ return p;
3834+} 3833+}
3835+ 3834+
3836+static char * 3835+static char *
3837+get_field_imms (long instr) 3836+get_field_imms (struct string_buf *buf, long instr)
3838+{ 3837+{
3839+ char tmpstr[25]; 3838+ char *p = strbuf (buf);
3840+ 3839+
3841+ sprintf (tmpstr, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW)); 3840+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
3842 return (strdup (tmpstr)); 3841 return p;
3843 } 3842 }
3844 3843
3845@@ -74,14 +84,14 @@ get_field_imm5_mbar (long instr) 3844@@ -91,14 +101,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
3846 } 3845 }
3847 3846
3848 static char * 3847 static char *
3849-get_field_imm5width (long instr) 3848-get_field_imm5width (struct string_buf *buf, long instr)
3850+get_field_immw (long instr) 3849+get_field_immw (struct string_buf *buf, long instr)
3851 { 3850 {
3852 char tmpstr[25]; 3851 char *p = strbuf (buf);
3853 3852
3854 if (instr & 0x00004000) 3853 if (instr & 0x00004000)
3855- sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 3854- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
3856+ sprintf (tmpstr, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 3855+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
3857 else 3856 else
3858- sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */ 3857- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
3859+ sprintf (tmpstr, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */ 3858+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
3860 return (strdup (tmpstr)); 3859 return p;
3861 } 3860 }
3862 3861
3863@@ -286,9 +296,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3862@@ -306,9 +316,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
3864 } 3863 }
3865 } 3864 }
3866 break; 3865 break;
3867- case INST_TYPE_RD_R1_IMM5: 3866- case INST_TYPE_RD_R1_IMM5:
3868+ case INST_TYPE_RD_R1_IMML: 3867+ case INST_TYPE_RD_R1_IMML:
3869+ print_func (stream, "\t%s, %s, %s", get_field_rd (inst), 3868 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3870+ get_field_r1(inst), get_field_imm (inst)); 3869- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
3870+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
3871+ /* TODO: Also print symbol */ 3871+ /* TODO: Also print symbol */
3872+ break;
3872+ case INST_TYPE_RD_R1_IMMS: 3873+ case INST_TYPE_RD_R1_IMMS:
3873 print_func (stream, "\t%s, %s, %s", get_field_rd (inst), 3874+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
3874- get_field_r1(inst), get_field_imm5 (inst)); 3875+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
3875+ get_field_r1(inst), get_field_imms (inst));
3876 break; 3876 break;
3877 case INST_TYPE_RD_RFSL: 3877 case INST_TYPE_RD_RFSL:
3878 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst)); 3878 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3879@@ -386,6 +400,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3879@@ -412,9 +427,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
3880 } 3880 }
3881 } 3881 }
3882 break; 3882 break;
3883- case INST_TYPE_RD_R2:
3884- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
3885- get_field_r2 (&buf, inst));
3883+ case INST_TYPE_IMML: 3886+ case INST_TYPE_IMML:
3884+ print_func (stream, "\t%s", get_field_imml (inst)); 3887+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
3885+ /* TODO: Also print symbol */ 3888+ /* TODO: Also print symbol */
3886+ break; 3889+ break;
3887 case INST_TYPE_RD_R2: 3890+ case INST_TYPE_RD_R2:
3888 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); 3891+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
3889 break; 3892 break;
3890@@ -409,9 +427,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 3893 case INST_TYPE_R2:
3891 case INST_TYPE_NONE: 3894 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
3892 break; 3895@@ -439,8 +457,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
3896 break;
3897 /* For tuqula instruction */
3893 /* For bit field insns. */ 3898 /* For bit field insns. */
3894- case INST_TYPE_RD_R1_IMM5_IMM5: 3899- case INST_TYPE_RD_R1_IMM5_IMM5:
3895- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst),get_field_r1(inst),get_field_imm5width (inst), get_field_imm5 (inst)); 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));
3896- break;
3897+ case INST_TYPE_RD_R1_IMMW_IMMS: 3901+ case INST_TYPE_RD_R1_IMMW_IMMS:
3898+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst), get_field_r1(inst), 3902+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
3899+ get_field_immw (inst), get_field_imms (inst)); 3903+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
3900+ break; 3904 break;
3901 /* For tuqula instruction */ 3905 /* For tuqula instruction */
3902 case INST_TYPE_RD: 3906 case INST_TYPE_RD:
3903 print_func (stream, "\t%s", get_field_rd (inst));
3904diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 3907diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
3905index ce8ac351b5..985834b8df 100644 3908index d3b234e1fcd..28dc991c430 100644
3906--- a/opcodes/microblaze-opc.h 3909--- a/opcodes/microblaze-opc.h
3907+++ b/opcodes/microblaze-opc.h 3910+++ b/opcodes/microblaze-opc.h
3908@@ -40,7 +40,7 @@ 3911@@ -40,7 +40,7 @@
@@ -4130,7 +4133,7 @@ index ce8ac351b5..985834b8df 100644
4130 #endif /* MICROBLAZE_OPC */ 4133 #endif /* MICROBLAZE_OPC */
4131 4134
4132diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 4135diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
4133index 28662694cd..076dbcd0b3 100644 4136index c3b2b8f0f6e..ad475a4af15 100644
4134--- a/opcodes/microblaze-opcm.h 4137--- a/opcodes/microblaze-opcm.h
4135+++ b/opcodes/microblaze-opcm.h 4138+++ b/opcodes/microblaze-opcm.h
4136@@ -25,6 +25,7 @@ 4139@@ -25,6 +25,7 @@
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch
index d4441443..8bf07398 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0016-MB-X-initial-commit.patch
@@ -1,31 +1,31 @@
1From 92419bfa472c29b96ff85a9769b9301539867364 Mon Sep 17 00:00:00 2001 1From f82b24b2685d0cde8f8fdd0a1dcffe7b76b2027c 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/43] MB-X initial commit code cleanup is needed. 4Subject: [PATCH 16/40] MB-X initial commit code cleanup is needed.
5 5
6--- 6---
7 bfd/bfd-in2.h | 10 +++ 7 bfd/bfd-in2.h | 10 +++
8 bfd/elf32-microblaze.c | 65 +++++++++++++++- 8 bfd/elf32-microblaze.c | 63 +++++++++++++++++-
9 bfd/elf64-microblaze.c | 61 ++++++++++++++- 9 bfd/elf64-microblaze.c | 59 +++++++++++++++++
10 bfd/libbfd.h | 2 + 10 bfd/libbfd.h | 2 +
11 bfd/reloc.c | 12 +++ 11 bfd/reloc.c | 12 ++++
12 include/elf/microblaze.h | 2 + 12 include/elf/microblaze.h | 2 +
13 opcodes/microblaze-opc.h | 4 +- 13 opcodes/microblaze-opc.h | 4 +-
14 opcodes/microblaze-opcm.h | 4 +- 14 opcodes/microblaze-opcm.h | 4 +-
15 9 files changed, 277 insertions(+), 35 deletions(-) 15 9 files changed, 243 insertions(+), 40 deletions(-)
16 16
17diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 17diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
18index 721531886a..4f777059d8 100644 18index 52c81b10b6d..c6738960bb2 100644
19--- a/bfd/bfd-in2.h 19--- a/bfd/bfd-in2.h
20+++ b/bfd/bfd-in2.h 20+++ b/bfd/bfd-in2.h
21@@ -5876,11 +5876,21 @@ done here - only used for relaxing */ 21@@ -5373,11 +5373,21 @@ value in two words (with an imm instruction). No relocation is
22 * +done here - only used for relaxing */ 22 done here - only used for relaxing */
23 BFD_RELOC_MICROBLAZE_64_NONE, 23 BFD_RELOC_MICROBLAZE_64_NONE,
24 24
25+/* This is a 64 bit reloc that stores the 32 bit pc relative 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 26+value in two words (with an imml instruction). No relocation is
27+ * +done here - only used for relaxing */ 27+done here - only used for relaxing */
28+ BFD_RELOC_MICROBLAZE_64, 28+ BFD_RELOC_MICROBLAZE_64,
29+ 29+
30 /* 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
31 value in two words (with an imm instruction). The relocation is 31 value in two words (with an imm instruction). The relocation is
@@ -41,7 +41,7 @@ index 721531886a..4f777059d8 100644
41 value in two words (with an imm instruction). The relocation is 41 value in two words (with an imm instruction). The relocation is
42 GOT offset */ 42 GOT offset */
43diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 43diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
44index d001437b3f..035e71f311 100644 44index cb7271f5017..a31b407cfbf 100644
45--- a/bfd/elf32-microblaze.c 45--- a/bfd/elf32-microblaze.c
46+++ b/bfd/elf32-microblaze.c 46+++ b/bfd/elf32-microblaze.c
47@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 47@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -67,7 +67,7 @@ index d001437b3f..035e71f311 100644
67 0, /* Rightshift. */ 67 0, /* Rightshift. */
68@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 68@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
69 0x0000ffff, /* Dest Mask. */ 69 0x0000ffff, /* Dest Mask. */
70 TRUE), /* PC relative offset? */ 70 TRUE), /* PC relative offset? */
71 71
72+ /* A 64 bit GOTPC relocation. Table-entry not really used. */ 72+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
73+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ 73+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
@@ -103,15 +103,6 @@ index d001437b3f..035e71f311 100644
103 case BFD_RELOC_MICROBLAZE_64_GOT: 103 case BFD_RELOC_MICROBLAZE_64_GOT:
104 microblaze_reloc = R_MICROBLAZE_GOT_64; 104 microblaze_reloc = R_MICROBLAZE_GOT_64;
105 break; 105 break;
106@@ -1467,7 +1502,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
107 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
108 {
109 relocation += addend;
110- if (r_type == R_MICROBLAZE_32)
111+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
112 bfd_put_32 (input_bfd, relocation, contents + offset);
113 else
114 {
115@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd, 106@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd,
116 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 107 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
117 } 108 }
@@ -119,7 +110,7 @@ index d001437b3f..035e71f311 100644
119+ case R_MICROBLAZE_IMML_64: 110+ case R_MICROBLAZE_IMML_64:
120+ { 111+ {
121+ /* This was a PC-relative instruction that was 112+ /* This was a PC-relative instruction that was
122+ completely resolved. */ 113+ completely resolved. */
123+ int sfix, efix; 114+ int sfix, efix;
124+ unsigned int val; 115+ unsigned int val;
125+ bfd_vma target_address; 116+ bfd_vma target_address;
@@ -141,21 +132,21 @@ index d001437b3f..035e71f311 100644
141 case R_MICROBLAZE_NONE: 132 case R_MICROBLAZE_NONE:
142 case R_MICROBLAZE_32_NONE: 133 case R_MICROBLAZE_32_NONE:
143 { 134 {
144@@ -2037,9 +2094,9 @@ microblaze_elf_relax_section (bfd *abfd, 135@@ -2038,9 +2095,9 @@ microblaze_elf_relax_section (bfd *abfd,
145 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 136 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
146 irelscan->r_addend); 137 irelscan->r_addend);
147 } 138 }
148- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 139- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
149- { 140- {
150- isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 141- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
151+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64) 142+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
152+ { 143+ {
153+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 144+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
154 145
155 /* Look at the reloc only if the value has been resolved. */ 146 /* Look at the reloc only if the value has been resolved. */
156 if (isym->st_shndx == shndx 147 if (isym->st_shndx == shndx
157diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 148diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
158index 0f43ae6ea8..56a45f2a05 100644 149index fa4b95e47e0..d55700fc513 100644
159--- a/bfd/elf64-microblaze.c 150--- a/bfd/elf64-microblaze.c
160+++ b/bfd/elf64-microblaze.c 151+++ b/bfd/elf64-microblaze.c
161@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 152@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -218,7 +209,7 @@ index 0f43ae6ea8..56a45f2a05 100644
218 case BFD_RELOC_MICROBLAZE_64_GOT: 209 case BFD_RELOC_MICROBLAZE_64_GOT:
219 microblaze_reloc = R_MICROBLAZE_GOT_64; 210 microblaze_reloc = R_MICROBLAZE_GOT_64;
220 break; 211 break;
221@@ -1161,6 +1197,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 212@@ -1162,6 +1198,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
222 break; /* Do nothing. */ 213 break; /* Do nothing. */
223 214
224 case (int) R_MICROBLAZE_GOTPC_64: 215 case (int) R_MICROBLAZE_GOTPC_64:
@@ -226,23 +217,14 @@ index 0f43ae6ea8..56a45f2a05 100644
226 relocation = htab->sgotplt->output_section->vma 217 relocation = htab->sgotplt->output_section->vma
227 + htab->sgotplt->output_offset; 218 + htab->sgotplt->output_offset;
228 relocation -= (input_section->output_section->vma 219 relocation -= (input_section->output_section->vma
229@@ -1431,7 +1468,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 220@@ -1863,6 +1900,28 @@ microblaze_elf_relax_section (bfd *abfd,
230 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
231 {
232 relocation += addend;
233- if (r_type == R_MICROBLAZE_32)
234+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
235 bfd_put_32 (input_bfd, relocation, contents + offset);
236 else
237 {
238@@ -1876,6 +1913,28 @@ microblaze_elf_relax_section (bfd *abfd,
239 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 221 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
240 } 222 }
241 break; 223 break;
242+ case R_MICROBLAZE_IMML_64: 224+ case R_MICROBLAZE_IMML_64:
243+ { 225+ {
244+ /* This was a PC-relative instruction that was 226+ /* This was a PC-relative instruction that was
245+ completely resolved. */ 227+ completely resolved. */
246+ int sfix, efix; 228+ int sfix, efix;
247+ unsigned int val; 229+ unsigned int val;
248+ bfd_vma target_address; 230+ bfd_vma target_address;
@@ -265,10 +247,10 @@ index 0f43ae6ea8..56a45f2a05 100644
265 case R_MICROBLAZE_32_NONE: 247 case R_MICROBLAZE_32_NONE:
266 { 248 {
267diff --git a/bfd/libbfd.h b/bfd/libbfd.h 249diff --git a/bfd/libbfd.h b/bfd/libbfd.h
268index feb9fada1e..450653f2d8 100644 250index a01891f3423..4e71991273e 100644
269--- a/bfd/libbfd.h 251--- a/bfd/libbfd.h
270+++ b/bfd/libbfd.h 252+++ b/bfd/libbfd.h
271@@ -2903,7 +2903,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 253@@ -2905,7 +2905,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
272 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 254 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
273 "BFD_RELOC_MICROBLAZE_32_NONE", 255 "BFD_RELOC_MICROBLAZE_32_NONE",
274 "BFD_RELOC_MICROBLAZE_64_NONE", 256 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -279,10 +261,10 @@ index feb9fada1e..450653f2d8 100644
279 "BFD_RELOC_MICROBLAZE_64_PLT", 261 "BFD_RELOC_MICROBLAZE_64_PLT",
280 "BFD_RELOC_MICROBLAZE_64_GOTOFF", 262 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
281diff --git a/bfd/reloc.c b/bfd/reloc.c 263diff --git a/bfd/reloc.c b/bfd/reloc.c
282index 87753ae4f0..ccf29f54cf 100644 264index 78f13180c71..8b3cc604738 100644
283--- a/bfd/reloc.c 265--- a/bfd/reloc.c
284+++ b/bfd/reloc.c 266+++ b/bfd/reloc.c
285@@ -6803,12 +6803,24 @@ ENUMDOC 267@@ -6814,12 +6814,24 @@ ENUMDOC
286 done here - only used for relaxing 268 done here - only used for relaxing
287 ENUM 269 ENUM
288 BFD_RELOC_MICROBLAZE_64_NONE 270 BFD_RELOC_MICROBLAZE_64_NONE
@@ -308,7 +290,7 @@ index 87753ae4f0..ccf29f54cf 100644
308 This is a 64 bit reloc that stores the 32 bit pc relative 290 This is a 64 bit reloc that stores the 32 bit pc relative
309 value in two words (with an imm instruction). The relocation is 291 value in two words (with an imm instruction). The relocation is
310diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 292diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
311index 6ee0966444..16b2736577 100644 293index 0dba2c0f44f..030eb99a1a0 100644
312--- a/include/elf/microblaze.h 294--- a/include/elf/microblaze.h
313+++ b/include/elf/microblaze.h 295+++ b/include/elf/microblaze.h
314@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 296@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
@@ -317,11 +299,11 @@ index 6ee0966444..16b2736577 100644
317 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 299 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
318+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) 300+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
319+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ 301+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
320
321 END_RELOC_NUMBERS (R_MICROBLAZE_max) 302 END_RELOC_NUMBERS (R_MICROBLAZE_max)
322 303
304 /* Global base address names. */
323diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 305diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
324index 985834b8df..9b6264b61c 100644 306index 28dc991c430..46263bc7e16 100644
325--- a/opcodes/microblaze-opc.h 307--- a/opcodes/microblaze-opc.h
326+++ b/opcodes/microblaze-opc.h 308+++ b/opcodes/microblaze-opc.h
327@@ -538,8 +538,8 @@ struct op_code_struct 309@@ -538,8 +538,8 @@ struct op_code_struct
@@ -336,7 +318,7 @@ index 985834b8df..9b6264b61c 100644
336 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 318 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
337 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, 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 },
338diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 320diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
339index 076dbcd0b3..5f2e190d23 100644 321index ad475a4af15..ee01cdb7d9b 100644
340--- a/opcodes/microblaze-opcm.h 322--- a/opcodes/microblaze-opcm.h
341+++ b/opcodes/microblaze-opcm.h 323+++ b/opcodes/microblaze-opcm.h
342@@ -40,8 +40,8 @@ enum microblaze_instr 324@@ -40,8 +40,8 @@ enum microblaze_instr
@@ -344,9 +326,9 @@ index 076dbcd0b3..5f2e190d23 100644
344 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, 326 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
345 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, 327 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
346- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, 328- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
347- sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 329- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
348+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, 330+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
349+ sbi, shi, sli, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 331+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
350 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 332 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
351 fint, fsqrt, 333 fint, fsqrt,
352 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, 334 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
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/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
index 26938396..eaf24505 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
@@ -1,15 +1,16 @@
1From 4010e83aa48f0415e4478d70871aa87cb204d350 Mon Sep 17 00:00:00 2001 1From b6ec3e2295ba33d2c8f48500d75a147ffd84a656 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/43] [Patch,Microblaze] : negl instruction is overriding 4Subject: [PATCH 17/40] [Patch,Microblaze] : negl instruction is overriding
5 rsubl,fixed it by changing the instruction order... 5 rsubl
6 6
7fixed it by changing the instruction order...
7--- 8---
8 opcodes/microblaze-opc.h | 4 ++-- 9 opcodes/microblaze-opc.h | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-) 10 1 file changed, 2 insertions(+), 2 deletions(-)
10 11
11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 12diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
12index 9b6264b61c..824afc0ab0 100644 13index 46263bc7e16..f4ee8f43372 100644
13--- a/opcodes/microblaze-opc.h 14--- a/opcodes/microblaze-opc.h
14+++ b/opcodes/microblaze-opc.h 15+++ b/opcodes/microblaze-opc.h
15@@ -275,9 +275,7 @@ struct op_code_struct 16@@ -275,9 +275,7 @@ struct op_code_struct
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch
index 93ec10fd..742f9e34 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0018-Added-relocations-for-MB-X.patch
@@ -1,47 +1,47 @@
1From b625d19f8b86dd81c32f21793cc3e038ca275e57 Mon Sep 17 00:00:00 2001 1From 982f37caabea84cee52426844e73365f0cb93f3d 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/43] Added relocations for MB-X 4Subject: [PATCH 18/40] Added relocations for MB-X
5 5
6--- 6---
7 bfd/bfd-in2.h | 11 +++-- 7 bfd/bfd-in2.h | 11 +++++---
8 bfd/libbfd.h | 4 +- 8 bfd/libbfd.h | 4 +--
9 bfd/reloc.c | 26 ++++++----- 9 bfd/reloc.c | 26 +++++++++---------
10 4 files changed, 62 insertions(+), 69 deletions(-) 10 4 files changed, 63 insertions(+), 32 deletions(-)
11 11
12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
13index 4f777059d8..de46e78902 100644 13index c6738960bb2..3899352b1d5 100644
14--- a/bfd/bfd-in2.h 14--- a/bfd/bfd-in2.h
15+++ b/bfd/bfd-in2.h 15+++ b/bfd/bfd-in2.h
16@@ -5872,15 +5872,20 @@ done here - only used for relaxing */ 16@@ -5369,15 +5369,20 @@ done here - only used for relaxing */
17 BFD_RELOC_MICROBLAZE_32_NONE, 17 BFD_RELOC_MICROBLAZE_32_NONE,
18 18
19 /* This is a 64 bit reloc that stores the 32 bit pc relative 19 /* 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 20-value in two words (with an imm instruction). No relocation is
21+ * +value in two words (with an imml instruction). No relocation is 21+value in two words (with an imml instruction). No relocation is
22 * +done here - only used for relaxing */ 22 done here - only used for relaxing */
23- BFD_RELOC_MICROBLAZE_64_NONE, 23- BFD_RELOC_MICROBLAZE_64_NONE,
24+ BFD_RELOC_MICROBLAZE_64_PCREL, 24+ BFD_RELOC_MICROBLAZE_64_PCREL,
25 25
26-/* This is a 64 bit reloc that stores the 32 bit pc relative 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 relative 27+/* This is a 64 bit reloc that stores the 32 bit relative
28 * +value in two words (with an imml instruction). No relocation is 28 value in two words (with an imml instruction). No relocation is
29 * +done here - only used for relaxing */ 29 done here - only used for relaxing */
30 BFD_RELOC_MICROBLAZE_64, 30 BFD_RELOC_MICROBLAZE_64,
31 31
32+/* This is a 64 bit reloc that stores the 32 bit pc relative 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 33+value in two words (with an imm instruction). No relocation is
34+ * +done here - only used for relaxing */ 34+done here - only used for relaxing */
35+ BFD_RELOC_MICROBLAZE_64_NONE, 35+ BFD_RELOC_MICROBLAZE_64_NONE,
36+ 36+
37 /* This is a 64 bit reloc that stores the 32 bit pc relative 37 /* 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 38 value in two words (with an imm instruction). The relocation is
39 PC-relative GOT offset */ 39 PC-relative GOT offset */
40diff --git a/bfd/libbfd.h b/bfd/libbfd.h 40diff --git a/bfd/libbfd.h b/bfd/libbfd.h
41index 450653f2d8..d87a183d5e 100644 41index 4e71991273e..46be3891390 100644
42--- a/bfd/libbfd.h 42--- a/bfd/libbfd.h
43+++ b/bfd/libbfd.h 43+++ b/bfd/libbfd.h
44@@ -2903,14 +2903,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 44@@ -2905,14 +2905,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
45 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 45 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
46 "BFD_RELOC_MICROBLAZE_32_NONE", 46 "BFD_RELOC_MICROBLAZE_32_NONE",
47 "BFD_RELOC_MICROBLAZE_64_NONE", 47 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -59,10 +59,10 @@ index 450653f2d8..d87a183d5e 100644
59 "BFD_RELOC_MICROBLAZE_64_TLSGD", 59 "BFD_RELOC_MICROBLAZE_64_TLSGD",
60 "BFD_RELOC_MICROBLAZE_64_TLSLD", 60 "BFD_RELOC_MICROBLAZE_64_TLSLD",
61diff --git a/bfd/reloc.c b/bfd/reloc.c 61diff --git a/bfd/reloc.c b/bfd/reloc.c
62index ccf29f54cf..861f2d48c0 100644 62index 8b3cc604738..98a156f061f 100644
63--- a/bfd/reloc.c 63--- a/bfd/reloc.c
64+++ b/bfd/reloc.c 64+++ b/bfd/reloc.c
65@@ -6803,24 +6803,12 @@ ENUMDOC 65@@ -6814,24 +6814,12 @@ ENUMDOC
66 done here - only used for relaxing 66 done here - only used for relaxing
67 ENUM 67 ENUM
68 BFD_RELOC_MICROBLAZE_64_NONE 68 BFD_RELOC_MICROBLAZE_64_NONE
@@ -87,7 +87,7 @@ index ccf29f54cf..861f2d48c0 100644
87 ENUMDOC 87 ENUMDOC
88 This is a 64 bit reloc that stores the 32 bit pc relative 88 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 89 value in two words (with an imm instruction). The relocation is
90@@ -6906,6 +6894,20 @@ ENUMDOC 90@@ -6917,6 +6905,20 @@ ENUMDOC
91 value in two words (with an imm instruction). The relocation is 91 value in two words (with an imm instruction). The relocation is
92 relative offset from start of TEXT. 92 relative offset from start of TEXT.
93 93
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch
index 4a35a597..fc5c9464 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Fixed-MB-x-relocation-issues.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch
@@ -1,26 +1,27 @@
1From f190b9380c325b48697755328f4193791a758e55 Mon Sep 17 00:00:00 2001 1From 0bb779328b8564b008a6134826f043b4326f4904 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/43] -Fixed MB-x relocation issues -Added imml for required 4Subject: [PATCH 19/40] Update MB-x
5 MB-x instructions
6 5
6-Fixed MB-x relocation issues
7-Added imml for required MB-x instructions
7--- 8---
8 bfd/elf64-microblaze.c | 68 ++++++++++++++--- 9 bfd/elf64-microblaze.c | 68 ++++++++++--
9 3 files changed, 167 insertions(+), 55 deletions(-) 10 3 files changed, 209 insertions(+), 82 deletions(-)
10 11
11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
12index 56a45f2a05..54a2461037 100644 13index d55700fc513..f8f52870639 100644
13--- a/bfd/elf64-microblaze.c 14--- a/bfd/elf64-microblaze.c
14+++ b/bfd/elf64-microblaze.c 15+++ b/bfd/elf64-microblaze.c
15@@ -1476,8 +1476,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, 16@@ -1478,8 +1478,17 @@ microblaze_elf_relocate_section (bfd *output_bfd,
16 relocation -= (input_section->output_section->vma 17 relocation -= (input_section->output_section->vma
17 + input_section->output_offset 18 + input_section->output_offset
18 + offset + INST_WORD_SIZE); 19 + offset + INST_WORD_SIZE);
19- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 20- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
20+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 21+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
21+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 22+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
22+ { 23+ {
23+ insn &= ~0x00ffffff; 24+ insn &= ~0x00ffffff;
24+ insn |= (relocation >> 16) & 0xffffff; 25+ insn |= (relocation >> 16) & 0xffffff;
25+ bfd_put_32 (input_bfd, insn, 26+ bfd_put_32 (input_bfd, insn,
26 contents + offset + endian); 27 contents + offset + endian);
@@ -31,7 +32,7 @@ index 56a45f2a05..54a2461037 100644
31 bfd_put_16 (input_bfd, relocation & 0xffff, 32 bfd_put_16 (input_bfd, relocation & 0xffff,
32 contents + offset + endian + INST_WORD_SIZE); 33 contents + offset + endian + INST_WORD_SIZE);
33 } 34 }
34@@ -1567,11 +1576,28 @@ microblaze_elf_relocate_section (bfd *output_bfd, 35@@ -1569,11 +1578,28 @@ microblaze_elf_relocate_section (bfd *output_bfd,
35 else 36 else
36 { 37 {
37 if (r_type == R_MICROBLAZE_64_PCREL) 38 if (r_type == R_MICROBLAZE_64_PCREL)
@@ -41,7 +42,7 @@ index 56a45f2a05..54a2461037 100644
41- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 42- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
42+ { 43+ {
43+ if (!input_section->output_section->vma && 44+ if (!input_section->output_section->vma &&
44+ !input_section->output_offset && !offset) 45+ !input_section->output_offset && !offset)
45+ relocation -= (input_section->output_section->vma 46+ relocation -= (input_section->output_section->vma
46+ + input_section->output_offset 47+ + input_section->output_offset
47+ + offset); 48+ + offset);
@@ -51,9 +52,9 @@ index 56a45f2a05..54a2461037 100644
51+ + offset + INST_WORD_SIZE); 52+ + offset + INST_WORD_SIZE);
52+ } 53+ }
53+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 54+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
54+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 55+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
55+ { 56+ {
56+ insn &= ~0x00ffffff; 57+ insn &= ~0x00ffffff;
57+ insn |= (relocation >> 16) & 0xffffff; 58+ insn |= (relocation >> 16) & 0xffffff;
58+ bfd_put_32 (input_bfd, insn, 59+ bfd_put_32 (input_bfd, insn,
59 contents + offset + endian); 60 contents + offset + endian);
@@ -64,7 +65,7 @@ index 56a45f2a05..54a2461037 100644
64 bfd_put_16 (input_bfd, relocation & 0xffff, 65 bfd_put_16 (input_bfd, relocation & 0xffff,
65 contents + offset + endian + INST_WORD_SIZE); 66 contents + offset + endian + INST_WORD_SIZE);
66 } 67 }
67@@ -1690,9 +1716,19 @@ static void 68@@ -1677,9 +1703,19 @@ static void
68 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 69 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
69 { 70 {
70 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 71 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
@@ -87,7 +88,7 @@ index 56a45f2a05..54a2461037 100644
87 } 88 }
88 89
89 /* Read-modify-write into the bfd, an immediate value into appropriate fields of 90 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
90@@ -1704,10 +1740,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 91@@ -1691,10 +1727,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
91 unsigned long instr_lo; 92 unsigned long instr_lo;
92 93
93 instr_hi = bfd_get_32 (abfd, bfd_addr); 94 instr_hi = bfd_get_32 (abfd, bfd_addr);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixing-the-branch-related-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixing-the-branch-related-issues.patch
deleted file mode 100644
index 2e790dc1..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0020-Fixing-the-branch-related-issues.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 534688ca48be148ade9bb1daf77c41c4b221ac0e Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 17:06:58 +0530
4Subject: [PATCH 20/43] Fixing the branch related issues
5
6---
7 bfd/elf64-microblaze.c | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
11index 54a2461037..e9b3cf3a86 100644
12--- a/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c
14@@ -2532,7 +2532,7 @@ microblaze_elf_check_relocs (bfd * abfd,
15
16 /* PR15323, ref flags aren't set for references in the same
17 object. */
18- h->root.non_ir_ref = 1;
19+ h->root.non_ir_ref_regular = 1;
20 }
21
22 switch (r_type)
23--
242.17.1
25
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Various-fixes.patch
index dffdbd3a..eb0bc982 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Fixed-address-computation-issues-with-64bit-address.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0020-Various-fixes.patch
@@ -1,9 +1,10 @@
1From a19471b62a23803a062693a61c783efc05e2cd33 Mon Sep 17 00:00:00 2001 1From 188a60b441711f663f07dc3c3902c8c5d590eb6c 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 21/43] - Fixed address computation issues with 64bit address - 4Subject: [PATCH 20/40] Various fixes
5 Fixed imml dissassamble issue
6 5
6- Fixed address computation issues with 64bit address
7- Fixed imml dissassamble issue
7--- 8---
8 bfd/bfd-in2.h | 5 +++ 9 bfd/bfd-in2.h | 5 +++
9 bfd/elf64-microblaze.c | 14 ++++---- 10 bfd/elf64-microblaze.c | 14 ++++----
@@ -11,23 +12,23 @@ Subject: [PATCH 21/43] - Fixed address computation issues with 64bit address -
11 4 files changed, 79 insertions(+), 16 deletions(-) 12 4 files changed, 79 insertions(+), 16 deletions(-)
12 13
13diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
14index de46e78902..33c9cb62d9 100644 15index 3899352b1d5..91761bf6964 100644
15--- a/bfd/bfd-in2.h 16--- a/bfd/bfd-in2.h
16+++ b/bfd/bfd-in2.h 17+++ b/bfd/bfd-in2.h
17@@ -5881,6 +5881,11 @@ done here - only used for relaxing */ 18@@ -5378,6 +5378,11 @@ value in two words (with an imml instruction). No relocation is
18 * +done here - only used for relaxing */ 19 done here - only used for relaxing */
19 BFD_RELOC_MICROBLAZE_64, 20 BFD_RELOC_MICROBLAZE_64,
20 21
21+/* This is a 64 bit reloc that stores the 32 bit relative 22+/* This is a 64 bit reloc that stores the 32 bit relative
22+ * +value in two words (with an imml instruction). No relocation is 23+value in two words (with an imml instruction). No relocation is
23+ * +done here - only used for relaxing */ 24+done here - only used for relaxing */
24+ BFD_RELOC_MICROBLAZE_EA64, 25+ BFD_RELOC_MICROBLAZE_EA64,
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 * +value in two words (with an imm instruction). No relocation is 28 value in two words (with an imm instruction). No relocation is
28 * +done here - only used for relaxing */ 29 done here - only used for relaxing */
29diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 30diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
30index e9b3cf3a86..40f10aac6d 100644 31index f8f52870639..17e58748a0b 100644
31--- a/bfd/elf64-microblaze.c 32--- a/bfd/elf64-microblaze.c
32+++ b/bfd/elf64-microblaze.c 33+++ b/bfd/elf64-microblaze.c
33@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 34@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -70,7 +71,7 @@ index e9b3cf3a86..40f10aac6d 100644
70 microblaze_reloc = R_MICROBLAZE_IMML_64; 71 microblaze_reloc = R_MICROBLAZE_IMML_64;
71 break; 72 break;
72 case BFD_RELOC_MICROBLAZE_64_GOTPC: 73 case BFD_RELOC_MICROBLAZE_64_GOTPC:
73@@ -1969,7 +1969,7 @@ microblaze_elf_relax_section (bfd *abfd, 74@@ -1956,7 +1956,7 @@ microblaze_elf_relax_section (bfd *abfd,
74 efix = calc_fixup (target_address, 0, sec); 75 efix = calc_fixup (target_address, 0, sec);
75 76
76 /* Validate the in-band val. */ 77 /* Validate the in-band val. */
@@ -80,16 +81,16 @@ index e9b3cf3a86..40f10aac6d 100644
80 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); 81 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
81 } 82 }
82diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 83diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
83index 20ea6a885a..f679a43606 100644 84index 437f536e96a..24ede714858 100644
84--- a/opcodes/microblaze-dis.c 85--- a/opcodes/microblaze-dis.c
85+++ b/opcodes/microblaze-dis.c 86+++ b/opcodes/microblaze-dis.c
86@@ -61,7 +61,7 @@ get_field_imml (long instr) 87@@ -78,7 +78,7 @@ get_field_imml (struct string_buf *buf, long instr)
87 { 88 {
88 char tmpstr[25]; 89 char *p = strbuf (buf);
89 90
90- sprintf (tmpstr, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 91- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
91+ sprintf (tmpstr, "%d", (int)((instr & IMML_MASK) >> IMM_LOW)); 92+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
92 return (strdup (tmpstr)); 93 return p;
93 } 94 }
94 95
95-- 96--
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0022-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 e79b6626..0d212ccc 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0022-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,17 @@
1From 2aa455f838644cd804ec93aeea0d30bb265e91df Mon Sep 17 00:00:00 2001 1From a485fdf959afb6cd079f482eeea9d3186e6393f8 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 22/43] Adding new relocation to support 64bit rodata 4Subject: [PATCH 21/40] Adding new relocation to support 64bit rodata
5 5
6--- 6---
7 bfd/elf64-microblaze.c | 11 +++++++-- 7 bfd/elf64-microblaze.c | 11 +++++++--
8 2 files changed, 54 insertions(+), 6 deletions(-) 8 2 files changed, 54 insertions(+), 6 deletions(-)
9 9
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
11index 40f10aac6d..4d9b90647f 100644 11index 17e58748a0b..b62c47e8514 100644
12--- a/bfd/elf64-microblaze.c 12--- a/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c 13+++ b/bfd/elf64-microblaze.c
14@@ -1461,6 +1461,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 14@@ -1463,6 +1463,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
15 case (int) R_MICROBLAZE_64_PCREL : 15 case (int) R_MICROBLAZE_64_PCREL :
16 case (int) R_MICROBLAZE_64: 16 case (int) R_MICROBLAZE_64:
17 case (int) R_MICROBLAZE_32: 17 case (int) R_MICROBLAZE_32:
@@ -19,16 +19,16 @@ index 40f10aac6d..4d9b90647f 100644
19 { 19 {
20 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols 20 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
21 from removed linkonce sections, or sections discarded by 21 from removed linkonce sections, or sections discarded by
22@@ -1470,6 +1471,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 22@@ -1472,6 +1473,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
23 relocation += addend; 23 relocation += addend;
24 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) 24 if (r_type == R_MICROBLAZE_32)
25 bfd_put_32 (input_bfd, relocation, contents + offset); 25 bfd_put_32 (input_bfd, relocation, contents + offset);
26+ else if (r_type == R_MICROBLAZE_IMML_64) 26+ else if (r_type == R_MICROBLAZE_IMML_64)
27+ bfd_put_64 (input_bfd, relocation, contents + offset); 27+ bfd_put_64 (input_bfd, relocation, contents + offset);
28 else 28 else
29 { 29 {
30 if (r_type == R_MICROBLAZE_64_PCREL) 30 if (r_type == R_MICROBLAZE_64_PCREL)
31@@ -1547,7 +1550,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 31@@ -1549,7 +1552,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
32 } 32 }
33 else 33 else
34 { 34 {
@@ -37,7 +37,7 @@ index 40f10aac6d..4d9b90647f 100644
37 { 37 {
38 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); 38 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
39 outrel.r_addend = relocation + addend; 39 outrel.r_addend = relocation + addend;
40@@ -1573,6 +1576,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 40@@ -1575,6 +1578,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
41 relocation += addend; 41 relocation += addend;
42 if (r_type == R_MICROBLAZE_32) 42 if (r_type == R_MICROBLAZE_32)
43 bfd_put_32 (input_bfd, relocation, contents + offset); 43 bfd_put_32 (input_bfd, relocation, contents + offset);
@@ -46,7 +46,7 @@ index 40f10aac6d..4d9b90647f 100644
46 else 46 else
47 { 47 {
48 if (r_type == R_MICROBLAZE_64_PCREL) 48 if (r_type == R_MICROBLAZE_64_PCREL)
49@@ -2085,7 +2090,8 @@ microblaze_elf_relax_section (bfd *abfd, 49@@ -2072,7 +2077,8 @@ microblaze_elf_relax_section (bfd *abfd,
50 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 50 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
51 irelscan->r_addend); 51 irelscan->r_addend);
52 } 52 }
@@ -56,7 +56,7 @@ index 40f10aac6d..4d9b90647f 100644
56 { 56 {
57 isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 57 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
58 58
59@@ -2591,6 +2597,7 @@ microblaze_elf_check_relocs (bfd * abfd, 59@@ -2568,6 +2574,7 @@ microblaze_elf_check_relocs (bfd * abfd,
60 case R_MICROBLAZE_64: 60 case R_MICROBLAZE_64:
61 case R_MICROBLAZE_64_PCREL: 61 case R_MICROBLAZE_64_PCREL:
62 case R_MICROBLAZE_32: 62 case R_MICROBLAZE_32:
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0023-fixing-the-.bss-relocation-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0022-fixing-the-.bss-relocation-issue.patch
index 2458df6c..aa512b87 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0023-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 3240839197b1c42b3cd6e77c5b3b47aa7a1378a4 Mon Sep 17 00:00:00 2001 1From 24f96f4e86895b41aae21f775599a857939d002f 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 23/43] fixing the .bss relocation issue 4Subject: [PATCH 22/40] 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 10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
11index 4d9b90647f..184b7d560d 100644 11index b62c47e8514..cb3b40b574c 100644
12--- a/bfd/elf64-microblaze.c 12--- a/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c 13+++ b/bfd/elf64-microblaze.c
14@@ -1480,7 +1480,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 14@@ -1482,7 +1482,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
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@@ -1593,7 +1593,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1595,7 +1595,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
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@@ -1722,7 +1722,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 32@@ -1709,7 +1709,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
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 4d9b90647f..184b7d560d 100644
38 { 38 {
39 instr &= ~0x00ffffff; 39 instr &= ~0x00ffffff;
40 instr |= (val & 0xffffff); 40 instr |= (val & 0xffffff);
41@@ -1745,7 +1745,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 41@@ -1732,7 +1732,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
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 4d9b90647f..184b7d560d 100644
47 { 47 {
48 instr_hi &= ~0x00ffffff; 48 instr_hi &= ~0x00ffffff;
49 instr_hi |= (val >> 16) & 0xffffff; 49 instr_hi |= (val >> 16) & 0xffffff;
50@@ -2238,7 +2238,10 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2225,7 +2225,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 4d9b90647f..184b7d560d 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@@ -2282,7 +2285,10 @@ microblaze_elf_relax_section (bfd *abfd, 62@@ -2269,7 +2272,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);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0024-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 d0ca677c..c645781e 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0024-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 50bd636604305329b302b9fbbb692795d26f5fa5 Mon Sep 17 00:00:00 2001 1From cd5868dca5b4a728e6418459d871f5c9ca68253e 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 24/43] Fixed the bug in the R_MICROBLAZE_64_NONE relocation. 4Subject: [PATCH 23/40] 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---
@@ -10,10 +10,10 @@ Subject: [PATCH 24/43] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
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 12diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
13index 035e71f311..2d8c062a42 100644 13index a31b407cfbf..04816a4a187 100644
14--- a/bfd/elf32-microblaze.c 14--- a/bfd/elf32-microblaze.c
15+++ b/bfd/elf32-microblaze.c 15+++ b/bfd/elf32-microblaze.c
16@@ -2022,8 +2022,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);
19 irel->r_addend -= (efix - sfix); 19 irel->r_addend -= (efix - sfix);
@@ -25,10 +25,10 @@ index 035e71f311..2d8c062a42 100644
25 break; 25 break;
26 } 26 }
27diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 27diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
28index 184b7d560d..ef6a87062b 100644 28index cb3b40b574c..b002b414d64 100644
29--- a/bfd/elf64-microblaze.c 29--- a/bfd/elf64-microblaze.c
30+++ b/bfd/elf64-microblaze.c 30+++ b/bfd/elf64-microblaze.c
31@@ -2017,8 +2017,8 @@ microblaze_elf_relax_section (bfd *abfd, 31@@ -2004,8 +2004,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);
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch
deleted file mode 100644
index fba32c08..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From b8c4b1fa22137d18d4ada7e350948035705f402f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 2 Dec 2018 14:49:14 +0530
4Subject: [PATCH 25/43] [Patch,MicroBlaze]: fixed Build issue which are due to
5 conflicts in patches.
6
7---
8 bfd/elf32-microblaze.c | 1 +
9 bfd/elf64-microblaze.c | 12 ++++++------
10 3 files changed, 9 insertions(+), 8 deletions(-)
11
12diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
13index 2d8c062a42..6a795c5069 100644
14--- a/bfd/elf32-microblaze.c
15+++ b/bfd/elf32-microblaze.c
16@@ -1996,6 +1996,7 @@ microblaze_elf_relax_section (bfd *abfd,
17 /* This was a PC-relative instruction that was
18 completely resolved. */
19 int sfix, efix;
20+ unsigned int val;
21 bfd_vma target_address;
22 target_address = irel->r_addend + irel->r_offset;
23 sfix = calc_fixup (irel->r_offset, 0, sec);
24diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
25index ef6a87062b..bed534e7dd 100644
26--- a/bfd/elf64-microblaze.c
27+++ b/bfd/elf64-microblaze.c
28@@ -2854,14 +2854,14 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
29 /* If this is a weak symbol, and there is a real definition, the
30 processor independent code will have arranged for us to see the
31 real definition first, and we can just use the same value. */
32- if (h->u.weakdef != NULL)
33+ if (h->is_weakalias)
34 {
35- BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
36- || h->u.weakdef->root.type == bfd_link_hash_defweak);
37- h->root.u.def.section = h->u.weakdef->root.u.def.section;
38- h->root.u.def.value = h->u.weakdef->root.u.def.value;
39+ struct elf_link_hash_entry *def = weakdef (h);
40+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
41+ h->root.u.def.section = def->root.u.def.section;
42+ h->root.u.def.value = def->root.u.def.value;
43 return TRUE;
44- }
45+ }
46
47 /* This is a reference to a symbol defined by a dynamic object which
48 is not a function. */
49--
502.17.1
51
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
index 664675b9..f5bf917a 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
@@ -1,26 +1,27 @@
1From 7fdfff333f4982d7eb32a564aacfd2d8822c0004 Mon Sep 17 00:00:00 2001 1From 25a67af22ad040f87b3c14185c338828d4e26908 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 11 Mar 2019 14:23:58 +0530 3Date: Mon, 11 Mar 2019 14:23:58 +0530
4Subject: [PATCH 28/43] [Patch,Microblaze] : Binutils security check is causing 4Subject: [PATCH 25/40] [Patch,Microblaze] : Binutils security check is causing
5 build error for windows builds.commenting for now. 5 build error for windows builds.commenting for now.
6 6
7--- 7---
8 bfd/elf-attrs.c | 2 ++ 8 bfd/elf-attrs.c | 3 +++
9 1 file changed, 2 insertions(+) 9 1 file changed, 3 insertions(+)
10 10
11diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c 11diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
12index bfe135e7fb..feb5cb37f5 100644 12index bfe135e7fbb..abf267ad42e 100644
13--- a/bfd/elf-attrs.c 13--- a/bfd/elf-attrs.c
14+++ b/bfd/elf-attrs.c 14+++ b/bfd/elf-attrs.c
15@@ -440,6 +440,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) 15@@ -440,6 +440,8 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
16 /* PR 17512: file: 2844a11d. */ 16 /* PR 17512: file: 2844a11d. */
17 if (hdr->sh_size == 0) 17 if (hdr->sh_size == 0)
18 return; 18 return;
19+
19+ #if 0 20+ #if 0
20 if (hdr->sh_size > bfd_get_file_size (abfd)) 21 if (hdr->sh_size > bfd_get_file_size (abfd))
21 { 22 {
22 /* xgettext:c-format */ 23 /* xgettext:c-format */
23@@ -448,6 +449,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) 24@@ -448,6 +450,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
24 bfd_set_error (bfd_error_invalid_operation); 25 bfd_set_error (bfd_error_invalid_operation);
25 return; 26 return;
26 } 27 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch
deleted file mode 100644
index 38245cbd..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 212c40ed034096069f3ab0dac74ccfb79063b84c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 26 Feb 2019 17:31:41 +0530
4Subject: [PATCH 26/43] [Patch,Microblaze] : changes of "PR22458, failure to
5 choose a matching ELF target" is causing "Multiple Prevailing definition
6 errors",added check for best_match elf.
7
8---
9 bfd/format.c | 5 +++++
10 1 file changed, 5 insertions(+)
11
12diff --git a/bfd/format.c b/bfd/format.c
13index 97a92291a8..3a74cc49d2 100644
14--- a/bfd/format.c
15+++ b/bfd/format.c
16@@ -292,7 +292,12 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
17
18 /* Don't check the default target twice. */
19 if (*target == &binary_vec
20+#if !BFD_SUPPORTS_PLUGINS
21 || (!abfd->target_defaulted && *target == save_targ))
22+#else
23+ || (!abfd->target_defaulted && *target == save_targ)
24+ || (*target)->match_priority > best_match)
25+#endif
26 continue;
27
28 /* If we already tried a match, the bfd is modified and may
29--
302.17.1
31
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch
index 0da9e7b4..f5ddce41 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -1,14 +1,14 @@
1From fcb9c923a78a6a6141626f4c2a82579cfc4e43d6 Mon Sep 17 00:00:00 2001 1From b9e89f0698fd0e3b0e965986681f9fd90d3dc313 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 29/43] fixing the long & long long mingw toolchain issue 4Subject: [PATCH 26/40] fixing the long & long long mingw toolchain issue
5 5
6--- 6---
7 opcodes/microblaze-opc.h | 4 ++-- 7 opcodes/microblaze-opc.h | 4 ++--
8 2 files changed, 7 insertions(+), 7 deletions(-) 8 2 files changed, 7 insertions(+), 7 deletions(-)
9 9
10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
11index 824afc0ab0..d59ee0a95f 100644 11index f4ee8f43372..c8c2addc351 100644
12--- a/opcodes/microblaze-opc.h 12--- a/opcodes/microblaze-opc.h
13+++ b/opcodes/microblaze-opc.h 13+++ b/opcodes/microblaze-opc.h
14@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr"; 14@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr";
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0030-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0027-Added-support-to-new-arithmetic-single-register-inst.patch
index 79d7f4fe..bf05816d 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0030-Added-support-to-new-arithmetic-single-register-inst.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0027-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -1,47 +1,55 @@
1From f36d3bdd09f5c9987199f08ea3dd98bf45a9e18e Mon Sep 17 00:00:00 2001 1From efc3fd518cdb7e8bf82ac27b98b946001f83a2bf 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 30/43] Added support to new arithmetic single register 4Subject: [PATCH 27/40] Added support to new arithmetic single register
5 instructions 5 instructions
6 6
7--- 7---
8 opcodes/microblaze-dis.c | 12 +++ 8 opcodes/microblaze-dis.c | 13 +++-
9 opcodes/microblaze-opc.h | 43 ++++++++++- 9 opcodes/microblaze-opc.h | 45 +++++++++++-
10 opcodes/microblaze-opcm.h | 5 +- 10 opcodes/microblaze-opcm.h | 5 +-
11 4 files changed, 201 insertions(+), 6 deletions(-) 11 4 files changed, 201 insertions(+), 7 deletions(-)
12 12
13diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 13diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
14index f679a43606..e5e880cb1c 100644 14index 24ede714858..e93d9b890ba 100644
15--- a/opcodes/microblaze-dis.c 15--- a/opcodes/microblaze-dis.c
16+++ b/opcodes/microblaze-dis.c 16+++ b/opcodes/microblaze-dis.c
17@@ -114,6 +114,15 @@ get_field_imm15 (long instr) 17@@ -131,6 +131,15 @@ get_field_imm15 (struct string_buf *buf, long instr)
18 return (strdup (tmpstr)); 18 return p;
19 } 19 }
20 20
21+static char * 21+static char *
22+get_field_imm16 (long instr) 22+get_field_imm16 (struct string_buf *buf, long instr)
23+{ 23+{
24+ char tmpstr[25]; 24+ char *p = strbuf (buf);
25+ 25+
26+ sprintf (tmpstr, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW)); 26+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
27+ return (strdup (tmpstr)); 27+ return p;
28+} 28+}
29+ 29+
30 static char * 30 static char *
31 get_field_special (long instr, struct op_code_struct * op) 31 get_field_special (struct string_buf *buf, long instr,
32 { 32 struct op_code_struct *op)
33@@ -419,6 +428,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 33@@ -448,6 +457,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
34 case INST_TYPE_RD_IMM15: 34 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
35 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst)); 35 get_field_imm15 (&buf, inst));
36 break; 36 break;
37+ case INST_TYPE_RD_IMML: 37+ case INST_TYPE_RD_IMML:
38+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm16 (inst)); 38+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
39+ break; 39+ break;
40 /* For mbar insn. */ 40 /* For mbar insn. */
41 case INST_TYPE_IMM5: 41 case INST_TYPE_IMM5:
42 print_func (stream, "\t%s", get_field_imm5_mbar (inst)); 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. */
45 case INST_TYPE_NONE:
46 break;
47- /* For tuqula instruction */
48 /* For bit field insns. */
49 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),
43diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 51diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
44index d59ee0a95f..0774f70e08 100644 52index c8c2addc351..eaf4a1bd9f9 100644
45--- a/opcodes/microblaze-opc.h 53--- a/opcodes/microblaze-opc.h
46+++ b/opcodes/microblaze-opc.h 54+++ b/opcodes/microblaze-opc.h
47@@ -69,6 +69,7 @@ 55@@ -69,6 +69,7 @@
@@ -94,7 +102,7 @@ index d59ee0a95f..0774f70e08 100644
94 /* New Mask for msrset, msrclr insns. */ 102 /* New Mask for msrset, msrclr insns. */
95 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ 103 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
96 /* Mask for mbar insn. */ 104 /* Mask for mbar insn. */
97@@ -114,7 +143,7 @@ 105@@ -114,13 +143,13 @@
98 #define DELAY_SLOT 1 106 #define DELAY_SLOT 1
99 #define NO_DELAY_SLOT 0 107 #define NO_DELAY_SLOT 0
100 108
@@ -103,6 +111,13 @@ index d59ee0a95f..0774f70e08 100644
103 111
104 struct op_code_struct 112 struct op_code_struct
105 { 113 {
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
106@@ -444,13 +473,21 @@ struct op_code_struct 121@@ -444,13 +473,21 @@ struct op_code_struct
107 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst }, 122 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
108 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, 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 },
@@ -140,7 +155,7 @@ index d59ee0a95f..0774f70e08 100644
140 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst }, 155 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
141 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst }, 156 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
142diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 157diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
143index 5f2e190d23..4d2ee2dd0d 100644 158index ee01cdb7d9b..31726c9b01a 100644
144--- a/opcodes/microblaze-opcm.h 159--- a/opcodes/microblaze-opcm.h
145+++ b/opcodes/microblaze-opcm.h 160+++ b/opcodes/microblaze-opcm.h
146@@ -61,7 +61,9 @@ enum microblaze_instr 161@@ -61,7 +61,9 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
index 0be07120..01d615da 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
@@ -1,15 +1,15 @@
1From a15e73a33b3f395f2096e252b655775ed8424c14 Mon Sep 17 00:00:00 2001 1From 953a4eb8152c0aca3e36ccc22a8950c9e68965b5 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 31/43] [Patch,MicroBlaze] : double imml generation for 64 bit 4Subject: [PATCH 28/40] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values. 5 values.
6 6
7--- 7---
8 opcodes/microblaze-opc.h | 4 +- 8 opcodes/microblaze-opc.h | 4 +-
9 2 files changed, 263 insertions(+), 63 deletions(-) 9 2 files changed, 264 insertions(+), 64 deletions(-)
10 10
11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
12index 0774f70e08..bd9d91cd57 100644 12index eaf4a1bd9f9..79c3cf0d1a1 100644
13--- a/opcodes/microblaze-opc.h 13--- a/opcodes/microblaze-opc.h
14+++ b/opcodes/microblaze-opc.h 14+++ b/opcodes/microblaze-opc.h
15@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; 15@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
@@ -18,7 +18,7 @@ index 0774f70e08..bd9d91cd57 100644
18 18
19-#define MIN_IMML ((long long) 0xffffff8000000000L) 19-#define MIN_IMML ((long long) 0xffffff8000000000L)
20-#define MAX_IMML ((long long) 0x0000007fffffffffL) 20-#define MAX_IMML ((long long) 0x0000007fffffffffL)
21+#define MIN_IMML ((long long) -9223372036854775808) 21+#define MIN_IMML ((long long) -9223372036854775807)
22+#define MAX_IMML ((long long) 9223372036854775807) 22+#define MAX_IMML ((long long) 9223372036854775807)
23 23
24 #endif /* MICROBLAZE_OPC */ 24 #endif /* MICROBLAZE_OPC */
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
new file mode 100644
index 00000000..4172595b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0033-Fix-various-compile-warnings.patch
@@ -0,0 +1,60 @@
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/0032-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0034-Add-initial-port-of-linux-gdbserver.patch
index 88c137f5..ff1c606c 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0032-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0034-Add-initial-port-of-linux-gdbserver.patch
@@ -1,7 +1,7 @@
1From 5c7fa77256c704cc493a6bd42425fcec814710e8 Mon Sep 17 00:00:00 2001 1From c5eee33cd39dbb9c44bdad2025a5c848139c55f2 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 32/43] Add initial port of linux gdbserver add 4Subject: [PATCH 34/40] 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,17 +21,21 @@ 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 ++
24 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++ 27 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++
25 gdb/microblaze-linux-tdep.c | 29 +++- 28 gdb/microblaze-linux-tdep.c | 29 +++-
26 gdb/microblaze-tdep.c | 35 ++++- 29 gdb/microblaze-tdep.c | 35 ++++-
27 gdb/microblaze-tdep.h | 4 +- 30 gdb/microblaze-tdep.h | 4 +-
28 gdb/regformats/reg-microblaze.dat | 41 ++++++ 31 gdb/regformats/reg-microblaze.dat | 41 ++++++
29 6 files changed, 298 insertions(+), 3 deletions(-) 32 9 files changed, 322 insertions(+), 3 deletions(-)
33 create mode 100644 gdb/features/microblaze-linux.xml
30 create mode 100644 gdb/gdbserver/linux-microblaze-low.c 34 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
31 create mode 100644 gdb/regformats/reg-microblaze.dat 35 create mode 100644 gdb/regformats/reg-microblaze.dat
32 36
33diff --git a/gdb/configure.host b/gdb/configure.host 37diff --git a/gdb/configure.host b/gdb/configure.host
34index c87f997abc..de8d6b00f3 100644 38index ce528237291..cf1a08e8b28 100644
35--- a/gdb/configure.host 39--- a/gdb/configure.host
36+++ b/gdb/configure.host 40+++ b/gdb/configure.host
37@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;; 41@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;;
@@ -51,9 +55,75 @@ index c87f997abc..de8d6b00f3 100644
51 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) 55 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
52 gdb_host=aix ;; 56 gdb_host=aix ;;
53 powerpc*-*-freebsd*) gdb_host=fbsd ;; 57 powerpc*-*-freebsd*) gdb_host=fbsd ;;
58diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
59new file mode 100644
60index 00000000000..8983e66eb3d
61--- /dev/null
62+++ b/gdb/features/microblaze-linux.xml
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"
54diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 124diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
55new file mode 100644 125new file mode 100644
56index 0000000000..cba5d6fc58 126index 00000000000..cba5d6fc585
57--- /dev/null 127--- /dev/null
58+++ b/gdb/gdbserver/linux-microblaze-low.c 128+++ b/gdb/gdbserver/linux-microblaze-low.c
59@@ -0,0 +1,189 @@ 129@@ -0,0 +1,189 @@
@@ -247,7 +317,7 @@ index 0000000000..cba5d6fc58
247+ microblaze_supply_ptrace_register, 317+ microblaze_supply_ptrace_register,
248+}; 318+};
249diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 319diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
250index 4e5f60cd4e..7ab650a1cc 100644 320index 3bb9b5682ac..42c219d32f3 100644
251--- a/gdb/microblaze-linux-tdep.c 321--- a/gdb/microblaze-linux-tdep.c
252+++ b/gdb/microblaze-linux-tdep.c 322+++ b/gdb/microblaze-linux-tdep.c
253@@ -37,6 +37,22 @@ 323@@ -37,6 +37,22 @@
@@ -273,17 +343,14 @@ index 4e5f60cd4e..7ab650a1cc 100644
273 static int 343 static int
274 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 344 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
275 struct bp_target_info *bp_tgt) 345 struct bp_target_info *bp_tgt)
276@@ -46,18 +62,25 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 346@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
277 int val;
278 int bplen;
279 gdb_byte old_contents[BREAKPOINT_MAX];
280+ struct cleanup *cleanup;
281
282 /* Determine appropriate breakpoint contents and size for this address. */ 347 /* Determine appropriate breakpoint contents and size for this address. */
283 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 348 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
284 349
285+ /* Make sure we see the memory breakpoints. */ 350+ /* Make sure we see the memory breakpoints. */
286+ cleanup = make_show_memory_breakpoints_cleanup (1); 351+ scoped_restore restore_memory
352+ = make_scoped_restore_show_memory_breakpoints (1);
353+
287 val = target_read_memory (addr, old_contents, bplen); 354 val = target_read_memory (addr, old_contents, bplen);
288 355
289 /* If our breakpoint is no longer at the address, this means that the 356 /* If our breakpoint is no longer at the address, this means that the
@@ -296,10 +363,8 @@ index 4e5f60cd4e..7ab650a1cc 100644
296+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 363+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
297+ } 364+ }
298 365
299+ do_cleanups (cleanup);
300 return val; 366 return val;
301 } 367 }
302
303@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info, 368@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
304 /* Trampolines. */ 369 /* Trampolines. */
305 tramp_frame_prepend_unwinder (gdbarch, 370 tramp_frame_prepend_unwinder (gdbarch,
@@ -312,7 +377,7 @@ index 4e5f60cd4e..7ab650a1cc 100644
312 377
313 void 378 void
314diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 379diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
315index 1248acbdc9..730a2b281f 100644 380index 17871229c80..0168e4881ed 100644
316--- a/gdb/microblaze-tdep.c 381--- a/gdb/microblaze-tdep.c
317+++ b/gdb/microblaze-tdep.c 382+++ b/gdb/microblaze-tdep.c
318@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) 383@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
@@ -329,7 +394,6 @@ index 1248acbdc9..730a2b281f 100644
329+ int val; 394+ int val;
330+ int bplen; 395+ int bplen;
331+ gdb_byte old_contents[BREAKPOINT_MAX]; 396+ gdb_byte old_contents[BREAKPOINT_MAX];
332+ struct cleanup *cleanup;
333+ 397+
334+ /* Determine appropriate breakpoint contents and size for this address. */ 398+ /* Determine appropriate breakpoint contents and size for this address. */
335+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 399+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
@@ -337,7 +401,9 @@ index 1248acbdc9..730a2b281f 100644
337+ error (_("Software breakpoints not implemented for this target.")); 401+ error (_("Software breakpoints not implemented for this target."));
338+ 402+
339+ /* Make sure we see the memory breakpoints. */ 403+ /* Make sure we see the memory breakpoints. */
340+ cleanup = make_show_memory_breakpoints_cleanup (1); 404+ scoped_restore restore_memory
405+ = make_scoped_restore_show_memory_breakpoints (1);
406+
341+ val = target_read_memory (addr, old_contents, bplen); 407+ val = target_read_memory (addr, old_contents, bplen);
342+ 408+
343+ /* If our breakpoint is no longer at the address, this means that the 409+ /* If our breakpoint is no longer at the address, this means that the
@@ -349,7 +415,6 @@ index 1248acbdc9..730a2b281f 100644
349+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 415+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
350+ } 416+ }
351+ 417+
352+ do_cleanups (cleanup);
353+ return val; 418+ return val;
354+} 419+}
355 420
@@ -370,7 +435,7 @@ index 1248acbdc9..730a2b281f 100644
370+ 435+
371 } 436 }
372diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 437diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
373index a0048148e4..63aab84ef6 100644 438index 4fbdf9933f0..db0772643dc 100644
374--- a/gdb/microblaze-tdep.h 439--- a/gdb/microblaze-tdep.h
375+++ b/gdb/microblaze-tdep.h 440+++ b/gdb/microblaze-tdep.h
376@@ -117,6 +117,8 @@ struct microblaze_frame_cache 441@@ -117,6 +117,8 @@ struct microblaze_frame_cache
@@ -385,7 +450,7 @@ index a0048148e4..63aab84ef6 100644
385 #endif /* microblaze-tdep.h */ 450 #endif /* microblaze-tdep.h */
386diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat 451diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
387new file mode 100644 452new file mode 100644
388index 0000000000..bd8a438442 453index 00000000000..bd8a4384424
389--- /dev/null 454--- /dev/null
390+++ b/gdb/regformats/reg-microblaze.dat 455+++ b/gdb/regformats/reg-microblaze.dat
391@@ -0,0 +1,41 @@ 456@@ -0,0 +1,41 @@
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Initial-port-of-core-reading-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch
index e60893ef..171a0bf4 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0033-Initial-port-of-core-reading-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0035-Initial-port-of-core-reading-support.patch
@@ -1,22 +1,22 @@
1From a9d58bc9edc348ed15d62598f2a0d0862aaf4e61 Mon Sep 17 00:00:00 2001 1From f8cbcd1ef78f6ce9ae8d3382bf2bb0d1e770d201 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 33/43] Initial port of core reading support Added support for 4Subject: [PATCH 35/40] Initial port of core reading support Added support for
5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO 5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 information for rebuilding ".reg" sections of core dumps at run time. 6 information for rebuilding ".reg" sections of core dumps at run time.
7 7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10--- 10---
11 bfd/elf32-microblaze.c | 84 ++++++++++++++++++++++++++++++++++ 11 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
12 gdb/configure.tgt | 2 +- 12 gdb/configure.tgt | 2 +-
13 gdb/microblaze-linux-tdep.c | 57 +++++++++++++++++++++++ 13 gdb/microblaze-linux-tdep.c | 17 +++++++-
14 gdb/microblaze-tdep.c | 90 +++++++++++++++++++++++++++++++++++++ 14 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++
15 gdb/microblaze-tdep.h | 27 +++++++++++ 15 gdb/microblaze-tdep.h | 27 ++++++++++++
16 5 files changed, 259 insertions(+), 1 deletion(-) 16 5 files changed, 176 insertions(+), 2 deletions(-)
17 17
18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
19index 6a795c5069..c280431df6 100644 19index 04816a4a187..cb7a98d307e 100644
20--- a/bfd/elf32-microblaze.c 20--- a/bfd/elf32-microblaze.c
21+++ b/bfd/elf32-microblaze.c 21+++ b/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 *abfd, const char *name)
@@ -107,7 +107,7 @@ index 6a795c5069..c280431df6 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@@ -3672,4 +3753,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 110@@ -3673,4 +3754,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
111 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 111 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
112 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 112 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
113 113
@@ -116,10 +116,10 @@ index 6a795c5069..c280431df6 100644
116+ 116+
117 #include "elf32-target.h" 117 #include "elf32-target.h"
118diff --git a/gdb/configure.tgt b/gdb/configure.tgt 118diff --git a/gdb/configure.tgt b/gdb/configure.tgt
119index 27f122ad04..622bd486b3 100644 119index caa42be1c01..f0386568460 100644
120--- a/gdb/configure.tgt 120--- a/gdb/configure.tgt
121+++ b/gdb/configure.tgt 121+++ b/gdb/configure.tgt
122@@ -397,7 +397,7 @@ mep-*-*) 122@@ -400,7 +400,7 @@ mep-*-*)
123 123
124 microblaze*-linux-*|microblaze*-*-linux*) 124 microblaze*-linux-*|microblaze*-*-linux*)
125 # Target: Xilinx MicroBlaze running Linux 125 # Target: Xilinx MicroBlaze running Linux
@@ -129,65 +129,34 @@ index 27f122ad04..622bd486b3 100644
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 131diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
132index 7ab650a1cc..e2225d778a 100644 132index 42c219d32f3..0afb6efeba3 100644
133--- a/gdb/microblaze-linux-tdep.c 133--- a/gdb/microblaze-linux-tdep.c
134+++ b/gdb/microblaze-linux-tdep.c 134+++ b/gdb/microblaze-linux-tdep.c
135@@ -135,11 +135,54 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame = 135@@ -36,6 +36,7 @@
136 #include "frame-unwind.h"
137 #include "tramp-frame.h"
138 #include "linux-tdep.h"
139+#include "glibc-tdep.h"
140
141 static int microblaze_debug_flag = 0;
142
143@@ -135,11 +136,14 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
136 microblaze_linux_sighandler_cache_init 144 microblaze_linux_sighandler_cache_init
137 }; 145 };
138 146
139+const struct microblaze_gregset microblaze_linux_core_gregset; 147-
140+
141+static void
142+microblaze_linux_supply_core_gregset (const struct regset *regset,
143+ struct regcache *regcache,
144+ int regnum, const void *gregs, size_t len)
145+{
146+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
147+ regnum, gregs);
148+}
149+
150+static void
151+microblaze_linux_collect_core_gregset (const struct regset *regset,
152+ const struct regcache *regcache,
153+ int regnum, void *gregs, size_t len)
154+{
155+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
156+ regnum, gregs);
157+}
158+
159+static void
160+microblaze_linux_supply_core_fpregset (const struct regset *regset,
161+ struct regcache *regcache,
162+ int regnum, const void *fpregs, size_t len)
163+{
164+ /* FIXME. */
165+ microblaze_supply_fpregset (regcache, regnum, fpregs);
166+}
167+
168+static void
169+microblaze_linux_collect_core_fpregset (const struct regset *regset,
170+ const struct regcache *regcache,
171+ int regnum, void *fpregs, size_t len)
172+{
173+ /* FIXME. */
174+ microblaze_collect_fpregset (regcache, regnum, fpregs);
175+}
176
177 static void 148 static void
178 microblaze_linux_init_abi (struct gdbarch_info info, 149 microblaze_linux_init_abi (struct gdbarch_info info,
179 struct gdbarch *gdbarch) 150 struct gdbarch *gdbarch)
180 { 151 {
181+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 152+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
182+ 153+
183+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
184+ microblaze_linux_collect_core_gregset);
185+ tdep->sizeof_gregset = 200; 154+ tdep->sizeof_gregset = 200;
186+ 155+
187 linux_init_abi (info, gdbarch); 156 linux_init_abi (info, gdbarch);
188 157
189 set_gdbarch_memory_remove_breakpoint (gdbarch, 158 set_gdbarch_memory_remove_breakpoint (gdbarch,
190@@ -153,6 +196,20 @@ microblaze_linux_init_abi (struct gdbarch_info info, 159@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
191 tramp_frame_prepend_unwinder (gdbarch, 160 tramp_frame_prepend_unwinder (gdbarch,
192 &microblaze_linux_sighandler_tramp_frame); 161 &microblaze_linux_sighandler_tramp_frame);
193 162
@@ -202,109 +171,50 @@ index 7ab650a1cc..e2225d778a 100644
202+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 171+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
203+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); 172+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
204+ 173+
205+ set_gdbarch_regset_from_core_section (gdbarch,
206+ microblaze_regset_from_core_section);
207+
208 /* Enable TLS support. */ 174 /* Enable TLS support. */
209 set_gdbarch_fetch_tls_load_module_address (gdbarch, 175 set_gdbarch_fetch_tls_load_module_address (gdbarch,
210 svr4_fetch_objfile_link_map); 176 svr4_fetch_objfile_link_map);
211diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 177diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
212index 730a2b281f..49713ea9b1 100644 178index 0168e4881ed..98944f38d2a 100644
213--- a/gdb/microblaze-tdep.c 179--- a/gdb/microblaze-tdep.c
214+++ b/gdb/microblaze-tdep.c 180+++ b/gdb/microblaze-tdep.c
215@@ -137,6 +137,14 @@ microblaze_fetch_instruction (CORE_ADDR pc) 181@@ -677,6 +677,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
216 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
217
218 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
219+static CORE_ADDR
220+microblaze_store_arguments (struct regcache *regcache, int nargs,
221+ struct value **args, CORE_ADDR sp,
222+ int struct_return, CORE_ADDR struct_addr)
223+{
224+ error (_("store_arguments not implemented"));
225+ return sp;
226+}
227 static int
228 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
229 struct bp_target_info *bp_tgt)
230@@ -541,6 +549,12 @@ microblaze_frame_base_address (struct frame_info *next_frame,
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 (struct gdbarch *gdbarch)
244 tdesc_microblaze_with_stack_protect); 182 tdesc_microblaze_with_stack_protect);
245 } 183 }
246 184
247+void 185+void
248+microblaze_supply_gregset (const struct microblaze_gregset *gregset, 186+microblaze_supply_gregset (const struct regset *regset,
249+ struct regcache *regcache, 187+ struct regcache *regcache,
250+ int regnum, const void *gregs) 188+ int regnum, const void *gregs)
251+{ 189+{
252+ unsigned int *regs = gregs; 190+ const unsigned int *regs = (const unsigned int *)gregs;
253+ if (regnum >= 0) 191+ if (regnum >= 0)
254+ regcache_raw_supply (regcache, regnum, regs + regnum); 192+ regcache->raw_supply (regnum, regs + regnum);
255+ 193+
256+ if (regnum == -1) { 194+ if (regnum == -1) {
257+ int i; 195+ int i;
258+ 196+
259+ for (i = 0; i < 50; i++) { 197+ for (i = 0; i < 50; i++) {
260+ regcache_raw_supply (regcache, i, regs + i); 198+ regcache->raw_supply (i, regs + i);
261+ } 199+ }
262+ } 200+ }
263+} 201+}
264+ 202+
265+ 203+
266+void
267+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
268+ const struct regcache *regcache,
269+ int regnum, void *gregs)
270+{
271+ /* FIXME. */
272+}
273+
274+void
275+microblaze_supply_fpregset (struct regcache *regcache,
276+ int regnum, const void *fpregs)
277+{
278+ /* FIXME. */
279+}
280+
281+void
282+microblaze_collect_fpregset (const struct regcache *regcache,
283+ int regnum, void *fpregs)
284+{
285+ /* FIXME. */
286+}
287+
288+
289+/* Return the appropriate register set for the core section identified 204+/* Return the appropriate register set for the core section identified
290+ by SECT_NAME and SECT_SIZE. */ 205+ by SECT_NAME and SECT_SIZE. */
291+ 206+
292+const struct regset * 207+static void
293+microblaze_regset_from_core_section (struct gdbarch *gdbarch, 208+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
294+ const char *sect_name, size_t sect_size) 209+ iterate_over_regset_sections_cb *cb,
210+ void *cb_data,
211+ const struct regcache *regcache)
295+{ 212+{
296+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 213+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
297+ 214+
298+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name); 215+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
299+
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+ 216+
306+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n"); 217+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
307+ return NULL;
308+} 218+}
309+ 219+
310+ 220+
@@ -312,7 +222,7 @@ index 730a2b281f..49713ea9b1 100644
312 static struct gdbarch * 222 static struct gdbarch *
313 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 223 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
314 { 224 {
315@@ -733,6 +812,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 225@@ -733,6 +770,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
316 tdep = XCNEW (struct gdbarch_tdep); 226 tdep = XCNEW (struct gdbarch_tdep);
317 gdbarch = gdbarch_alloc (&info, tdep); 227 gdbarch = gdbarch_alloc (&info, tdep);
318 228
@@ -323,7 +233,7 @@ index 730a2b281f..49713ea9b1 100644
323 set_gdbarch_long_double_bit (gdbarch, 128); 233 set_gdbarch_long_double_bit (gdbarch, 128);
324 234
325 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 235 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
326@@ -781,6 +864,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 236@@ -781,6 +822,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
327 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 237 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
328 if (tdesc_data != NULL) 238 if (tdesc_data != NULL)
329 tdesc_use_registers (gdbarch, tdesc, tdesc_data); 239 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
@@ -331,14 +241,14 @@ index 730a2b281f..49713ea9b1 100644
331+ 241+
332+ /* If we have register sets, enable the generic core file support. */ 242+ /* If we have register sets, enable the generic core file support. */
333+ if (tdep->gregset) { 243+ if (tdep->gregset) {
334+ set_gdbarch_regset_from_core_section (gdbarch, 244+ set_gdbarch_iterate_over_regset_sections (gdbarch,
335+ microblaze_regset_from_core_section); 245+ microblaze_iterate_over_regset_sections);
336+ } 246+ }
337 247
338 return gdbarch; 248 return gdbarch;
339 } 249 }
340diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 250diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
341index 63aab84ef6..02650f61d9 100644 251index db0772643dc..8f41ba19351 100644
342--- a/gdb/microblaze-tdep.h 252--- a/gdb/microblaze-tdep.h
343+++ b/gdb/microblaze-tdep.h 253+++ b/gdb/microblaze-tdep.h
344@@ -22,8 +22,22 @@ 254@@ -22,8 +22,22 @@
@@ -368,10 +278,10 @@ index 63aab84ef6..02650f61d9 100644
368 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} 278 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
369 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} 279 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
370 280
371+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, 281+extern void microblaze_supply_gregset (const struct regset *regset,
372+ struct regcache *regcache, 282+ struct regcache *regcache,
373+ int regnum, const void *gregs); 283+ int regnum, const void *gregs);
374+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset, 284+extern void microblaze_collect_gregset (const struct regset *regset,
375+ const struct regcache *regcache, 285+ const struct regcache *regcache,
376+ int regnum, void *gregs); 286+ int regnum, void *gregs);
377+extern void microblaze_supply_fpregset (struct regcache *regcache, 287+extern void microblaze_supply_fpregset (struct regcache *regcache,
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0035-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0035-revert-master-rebase-changes-to-gdbserver.patch
deleted file mode 100644
index 0fe5c082..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0035-revert-master-rebase-changes-to-gdbserver.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 6f2d2fd5a214126e2c81dfb0dada3001ba353419 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 35/43] 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
11diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
12index bec72e2b19..153dcb4c71 100644
13--- a/gdb/gdbserver/configure.srv
14+++ b/gdb/gdbserver/configure.srv
15@@ -210,6 +210,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-cell32l.o"
29--
302.17.1
31
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0034-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch
index f0ec43b1..f0c182d3 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0034-Fix-debug-message-when-register-is-unavailable.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Fix-debug-message-when-register-is-unavailable.patch
@@ -1,7 +1,7 @@
1From 9e42c672613131b25da90e58aefd2d39e497c3f6 Mon Sep 17 00:00:00 2001 1From 41fd9d3645d610ff65171e9a44427711232cb4b8 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 34/43] Fix debug message when register is unavailable 4Subject: [PATCH 36/40] 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---
@@ -9,10 +9,10 @@ Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
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 11diff --git a/gdb/frame.c b/gdb/frame.c
12index d8b5f819f1..49706dc97c 100644 12index c746a6a231e..571722c7351 100644
13--- a/gdb/frame.c 13--- a/gdb/frame.c
14+++ b/gdb/frame.c 14+++ b/gdb/frame.c
15@@ -1227,12 +1227,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) 15@@ -1255,12 +1255,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
16 else 16 else
17 { 17 {
18 int i; 18 int i;
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch
deleted file mode 100644
index 111d8059..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From a21f56098eb41e20ba2e6995e6dc72acdea045a0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 30 Apr 2018 17:09:55 +0530
4Subject: [PATCH 36/43] 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
11diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
12index f5fc55034e..73ca5fd7c5 100644
13--- a/gdb/gdbserver/Makefile.in
14+++ b/gdb/gdbserver/Makefile.in
15@@ -169,6 +169,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@@ -226,6 +227,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
31--
322.17.1
33
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/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index 16b891bd..1e0bffbe 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/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 62bda7ae7bf0880201c4872c54e5b530b2fec27b Mon Sep 17 00:00:00 2001 1From 7b22823ae82445f52384e6c0bd85431294868eb7 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/43] microblaze: Add build_gdbserver=yes to top level 4Subject: [PATCH 37/40] 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
@@ -16,10 +16,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
16 1 file changed, 1 insertion(+) 16 1 file changed, 1 insertion(+)
17 17
18diff --git a/gdb/configure.tgt b/gdb/configure.tgt 18diff --git a/gdb/configure.tgt b/gdb/configure.tgt
19index 622bd486b3..989523735b 100644 19index f0386568460..ae238c17cd5 100644
20--- a/gdb/configure.tgt 20--- a/gdb/configure.tgt
21+++ b/gdb/configure.tgt 21+++ b/gdb/configure.tgt
22@@ -405,6 +405,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"
25 gdb_sim=../sim/microblaze/libsim.a 25 gdb_sim=../sim/microblaze/libsim.a
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch
index ca37355c..afde3ce8 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0038-Initial-support-for-native-gdb.patch
@@ -1,62 +1,43 @@
1From fef2dfc9c55d19be25262175a4fa4921167a30b7 Mon Sep 17 00:00:00 2001 1From a06b9c4860af1f8f18ccb7c0653c76c623636034 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/43] Initial support for native gdb 4Subject: [PATCH 38/40] Initial support for native gdb
5 5
6microblaze: Follow PPC method of getting setting registers 6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE 7using PTRACE PEEK/POKE
8 8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10
11Conflicts:
12 gdb/Makefile.in
13--- 10---
14 gdb/Makefile.in | 4 +- 11 gdb/Makefile.in | 2 +
15 gdb/config/microblaze/linux.mh | 9 + 12 gdb/config/microblaze/linux.mh | 9 +
16 gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++ 13 gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++
17 3 files changed, 443 insertions(+), 1 deletion(-) 14 3 files changed, 442 insertions(+)
18 create mode 100644 gdb/config/microblaze/linux.mh 15 create mode 100644 gdb/config/microblaze/linux.mh
19 create mode 100644 gdb/microblaze-linux-nat.c 16 create mode 100644 gdb/microblaze-linux-nat.c
20 17
21diff --git a/gdb/Makefile.in b/gdb/Makefile.in 18diff --git a/gdb/Makefile.in b/gdb/Makefile.in
22index 5614cc3386..d620580498 100644 19index c3e074b21fe..cbcd8f43326 100644
23--- a/gdb/Makefile.in 20--- a/gdb/Makefile.in
24+++ b/gdb/Makefile.in 21+++ b/gdb/Makefile.in
25@@ -1316,6 +1316,7 @@ HFILES_NO_SRCDIR = \ 22@@ -1337,6 +1337,7 @@ HFILES_NO_SRCDIR = \
26 memory-map.h \ 23 memory-map.h \
27 memrange.h \ 24 memrange.h \
28 microblaze-tdep.h \ 25 microblaze-tdep.h \
29+ microblaze-linux-tdep.h \ 26+ microblaze-linux-tdep.h \
30 mips-linux-tdep.h \ 27 mips-linux-tdep.h \
31 mips-nbsd-tdep.h \ 28 mips-nbsd-tdep.h \
32 mips-tdep.h \ 29 mips-tdep.h \
33@@ -1349,6 +1350,7 @@ HFILES_NO_SRCDIR = \ 30@@ -2261,6 +2262,7 @@ ALLDEPFILES = \
34 prologue-value.h \
35 psympriv.h \
36 psymtab.h \
37+ ia64-hpux-tdep.h \
38 ravenscar-thread.h \
39 record.h \
40 record-full.h \
41@@ -2263,6 +2265,7 @@ ALLDEPFILES = \
42 m68k-tdep.c \ 31 m68k-tdep.c \
43 microblaze-linux-tdep.c \ 32 microblaze-linux-tdep.c \
44 microblaze-tdep.c \ 33 microblaze-tdep.c \
45+ microblaze-linux-nat.c \ 34+ microblaze-linux-nat.c \
46 mingw-hdep.c \ 35 mingw-hdep.c \
47 mips-fbsd-nat.c \ 36 mips-fbsd-nat.c \
48 mips-fbsd-tdep.c \ 37 mips-fbsd-tdep.c \
49@@ -2365,7 +2368,6 @@ ALLDEPFILES = \
50 xtensa-linux-tdep.c \
51 xtensa-tdep.c \
52 xtensa-xtregs.c \
53- common/mingw-strerror.c \
54 common/posix-strerror.c
55
56 # Some files need explicit build rules (due to -Werror problems) or due
57diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 38diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
58new file mode 100644 39new file mode 100644
59index 0000000000..a4eaf540e1 40index 00000000000..a4eaf540e1d
60--- /dev/null 41--- /dev/null
61+++ b/gdb/config/microblaze/linux.mh 42+++ b/gdb/config/microblaze/linux.mh
62@@ -0,0 +1,9 @@ 43@@ -0,0 +1,9 @@
@@ -71,7 +52,7 @@ index 0000000000..a4eaf540e1
71+LOADLIBES = -ldl $(RDYNAMIC) 52+LOADLIBES = -ldl $(RDYNAMIC)
72diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 53diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
73new file mode 100644 54new file mode 100644
74index 0000000000..e9b8c9c522 55index 00000000000..e9b8c9c5221
75--- /dev/null 56--- /dev/null
76+++ b/gdb/microblaze-linux-nat.c 57+++ b/gdb/microblaze-linux-nat.c
77@@ -0,0 +1,431 @@ 58@@ -0,0 +1,431 @@
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/0039-Fixing-the-issues-related-to-GDB-7.12.patch
index b8fb68bc..fb4b35e5 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/0039-Fixing-the-issues-related-to-GDB-7.12.patch
@@ -1,20 +1,19 @@
1From e3e7d58035fb75b6cf33689352c6e22309c6dbde Mon Sep 17 00:00:00 2001 1From f13ffe15c10e5d4b5c87761ae9735144d4c8da17 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/43] Fixing the issues related to GDB-7.12 added all the 4Subject: [PATCH 39/40] Fixing the issues related to GDB-7.12
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
7 5
6added all the required function which are new in 7.12 and removed
7few deprecated functions from 7.6
8--- 8---
9 gdb/config/microblaze/linux.mh | 4 +- 9 gdb/config/microblaze/linux.mh | 4 +-
10 gdb/gdbserver/configure.srv | 3 +- 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 +++++++++++++++++--
13 gdb/microblaze-tdep.h | 1 + 12 gdb/microblaze-tdep.h | 1 +
14 5 files changed, 153 insertions(+), 20 deletions(-) 13 4 files changed, 89 insertions(+), 16 deletions(-)
15 14
16diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 15diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
17index a4eaf540e1..74a53b854a 100644 16index a4eaf540e1d..74a53b854a4 100644
18--- a/gdb/config/microblaze/linux.mh 17--- a/gdb/config/microblaze/linux.mh
19+++ b/gdb/config/microblaze/linux.mh 18+++ b/gdb/config/microblaze/linux.mh
20@@ -1,9 +1,11 @@ 19@@ -1,9 +1,11 @@
@@ -31,21 +30,21 @@ index a4eaf540e1..74a53b854a 100644
31 30
32 LOADLIBES = -ldl $(RDYNAMIC) 31 LOADLIBES = -ldl $(RDYNAMIC)
33diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv 32diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
34index 153dcb4c71..201b7ae190 100644 33index e0d2b2fe04a..26db2dd2461 100644
35--- a/gdb/gdbserver/configure.srv 34--- a/gdb/gdbserver/configure.srv
36+++ b/gdb/gdbserver/configure.srv 35+++ b/gdb/gdbserver/configure.srv
37@@ -211,8 +211,7 @@ case "${target}" in 36@@ -185,8 +185,7 @@ case "${target}" in
38 srv_linux_thread_db=yes 37 srv_linux_thread_db=yes
39 ;; 38 ;;
40 microblaze*-*-linux*) srv_regobj=microblaze-linux.o 39 microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
41- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o " 40- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
42- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o" 41- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
43+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o " 42+ 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
46 srv_linux_thread_db=yes
47diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 46diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
48index cba5d6fc58..a2733f3c21 100644 47index cba5d6fc585..a2733f3c21c 100644
49--- a/gdb/gdbserver/linux-microblaze-low.c 48--- a/gdb/gdbserver/linux-microblaze-low.c
50+++ b/gdb/gdbserver/linux-microblaze-low.c 49+++ b/gdb/gdbserver/linux-microblaze-low.c
51@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 50@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
@@ -200,100 +199,8 @@ index cba5d6fc58..a2733f3c21 100644
200+{ 199+{
201+ init_registers_microblaze (); 200+ init_registers_microblaze ();
202+} 201+}
203diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
204index e2225d778a..011e513941 100644
205--- a/gdb/microblaze-linux-tdep.c
206+++ b/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 gdbarch_info info,
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);
295diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 202diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
296index 02650f61d9..3777cbb6a8 100644 203index 8f41ba19351..d2112dc07e1 100644
297--- a/gdb/microblaze-tdep.h 204--- a/gdb/microblaze-tdep.h
298+++ b/gdb/microblaze-tdep.h 205+++ b/gdb/microblaze-tdep.h
299@@ -24,6 +24,7 @@ 206@@ -24,6 +24,7 @@
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/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
index e89d4049..7ac8f07f 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
@@ -1,35 +1,31 @@
1From ecaa548038df1ebf653ef3c3429e49c207461b19 Mon Sep 17 00:00:00 2001 1From 4e5a4e94cb1dd61646230100f883bd27a39cd896 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/43] [Patch, microblaze]: Adding 64 bit MB support Added new 4Subject: [PATCH 40/40] [Patch, microblaze]: Adding 64 bit MB support
5 architecture to Microblaze 64-bit support to GDB Signed-off-by :Nagaraju
6 Mekala <nmekala@xilix.com>
7 5
8Merged on top of binutils work. 6Added new architecture to Microblaze 64-bit support to GDB
9 7
10Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> 8Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11--- 9---
12 bfd/archures.c | 2 + 10 bfd/archures.c | 2 +
13 bfd/bfd-in2.h | 2 + 11 bfd/bfd-in2.h | 2 +
14 bfd/cpu-microblaze.c | 12 +- 12 bfd/cpu-microblaze.c | 16 +-
15 bfd/elf32-microblaze.c | 93 +------- 13 bfd/elf32-microblaze.c | 9 +
16 gdb/Makefile.in | 2 +-
17 gdb/features/Makefile | 3 + 14 gdb/features/Makefile | 3 +
18 gdb/features/microblaze-core.xml | 6 +- 15 gdb/features/microblaze-core.xml | 6 +-
19 gdb/features/microblaze-stack-protect.xml | 4 +- 16 gdb/features/microblaze-with-stack-protect.c | 4 +-
20 gdb/features/microblaze-with-stack-protect.c | 8 +-
21 gdb/features/microblaze.c | 6 +- 17 gdb/features/microblaze.c | 6 +-
22 gdb/features/microblaze64-core.xml | 69 ++++++ 18 gdb/features/microblaze64-core.xml | 69 +++++++
23 gdb/features/microblaze64-stack-protect.xml | 12 + 19 gdb/features/microblaze64-stack-protect.xml | 12 ++
24 .../microblaze64-with-stack-protect.c | 79 +++++++ 20 .../microblaze64-with-stack-protect.c | 79 ++++++++
25 .../microblaze64-with-stack-protect.xml | 12 + 21 .../microblaze64-with-stack-protect.xml | 12 ++
26 gdb/features/microblaze64.c | 77 +++++++ 22 gdb/features/microblaze64.c | 77 ++++++++
27 gdb/features/microblaze64.xml | 11 + 23 gdb/features/microblaze64.xml | 11 ++
28 gdb/microblaze-tdep.c | 207 ++++++++++++++++-- 24 gdb/microblaze-linux-tdep.c | 29 ++-
29 gdb/microblaze-tdep.h | 8 +- 25 gdb/microblaze-tdep.c | 176 ++++++++++++++++--
26 gdb/microblaze-tdep.h | 9 +-
30 .../microblaze-with-stack-protect.dat | 4 +- 27 .../microblaze-with-stack-protect.dat | 4 +-
31 opcodes/microblaze-opc.h | 1 - 28 20 files changed, 504 insertions(+), 40 deletions(-)
32 22 files changed, 504 insertions(+), 134 deletions(-)
33 create mode 100644 gdb/features/microblaze64-core.xml 29 create mode 100644 gdb/features/microblaze64-core.xml
34 create mode 100644 gdb/features/microblaze64-stack-protect.xml 30 create mode 100644 gdb/features/microblaze64-stack-protect.xml
35 create mode 100644 gdb/features/microblaze64-with-stack-protect.c 31 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
@@ -38,10 +34,10 @@ Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
38 create mode 100644 gdb/features/microblaze64.xml 34 create mode 100644 gdb/features/microblaze64.xml
39 35
40diff --git a/bfd/archures.c b/bfd/archures.c 36diff --git a/bfd/archures.c b/bfd/archures.c
41index 647cf0d8d4..3fdf7c3c0e 100644 37index 7866c6095b5..abc1541afe6 100644
42--- a/bfd/archures.c 38--- a/bfd/archures.c
43+++ b/bfd/archures.c 39+++ b/bfd/archures.c
44@@ -512,6 +512,8 @@ DESCRIPTION 40@@ -513,6 +513,8 @@ DESCRIPTION
45 . bfd_arch_lm32, {* Lattice Mico32. *} 41 . bfd_arch_lm32, {* Lattice Mico32. *}
46 .#define bfd_mach_lm32 1 42 .#define bfd_mach_lm32 1
47 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *} 43 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
@@ -51,10 +47,10 @@ index 647cf0d8d4..3fdf7c3c0e 100644
51 . bfd_arch_tilegx, {* Tilera TILE-Gx. *} 47 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
52 .#define bfd_mach_tilepro 1 48 .#define bfd_mach_tilepro 1
53diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 49diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
54index 33c9cb62d9..db624c62b9 100644 50index 91761bf6964..cc34ce0d8c3 100644
55--- a/bfd/bfd-in2.h 51--- a/bfd/bfd-in2.h
56+++ b/bfd/bfd-in2.h 52+++ b/bfd/bfd-in2.h
57@@ -2411,6 +2411,8 @@ enum bfd_architecture 53@@ -1896,6 +1896,8 @@ enum bfd_architecture
58 bfd_arch_lm32, /* Lattice Mico32. */ 54 bfd_arch_lm32, /* Lattice Mico32. */
59 #define bfd_mach_lm32 1 55 #define bfd_mach_lm32 1
60 bfd_arch_microblaze,/* Xilinx MicroBlaze. */ 56 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
@@ -64,7 +60,7 @@ index 33c9cb62d9..db624c62b9 100644
64 bfd_arch_tilegx, /* Tilera TILE-Gx. */ 60 bfd_arch_tilegx, /* Tilera TILE-Gx. */
65 #define bfd_mach_tilepro 1 61 #define bfd_mach_tilepro 1
66diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 62diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
67index c91ba46f75..8e7bcead28 100644 63index 4b48b310c6a..a32c4a33d75 100644
68--- a/bfd/cpu-microblaze.c 64--- a/bfd/cpu-microblaze.c
69+++ b/bfd/cpu-microblaze.c 65+++ b/bfd/cpu-microblaze.c
70@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 66@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
@@ -78,16 +74,23 @@ index c91ba46f75..8e7bcead28 100644
78 "microblaze", /* Architecture name. */ 74 "microblaze", /* Architecture name. */
79 "MicroBlaze", /* Printable name. */ 75 "MicroBlaze", /* Printable name. */
80 3, /* Section align power. */ 76 3, /* Section align power. */
81@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 77@@ -43,11 +43,11 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
82 32, /* 32 bits in an address. */ 78 0 /* Maximum offset of a reloc from the start of an insn. */
83 8, /* 8 bits in a byte. */ 79 },
84 bfd_arch_microblaze, /* Architecture. */ 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. */
85- 0, /* Machine number - 0 for now. */ 88- 0, /* Machine number - 0 for now. */
86+ bfd_mach_microblaze, /* 32 bit Machine */ 89+ bfd_mach_microblaze, /* 32 bit Machine */
87 "microblaze", /* Architecture name. */ 90 "microblaze", /* Architecture name. */
88 "MicroBlaze", /* Printable name. */ 91 "MicroBlaze", /* Printable name. */
89 3, /* Section align power. */ 92 3, /* Section align power. */
90@@ -62,7 +62,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 93@@ -64,7 +64,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
91 32, /* 32 bits in an address. */ 94 32, /* 32 bits in an address. */
92 8, /* 8 bits in a byte. */ 95 8, /* 8 bits in a byte. */
93 bfd_arch_microblaze, /* Architecture. */ 96 bfd_arch_microblaze, /* Architecture. */
@@ -96,110 +99,20 @@ index c91ba46f75..8e7bcead28 100644
96 "microblaze", /* Architecture name. */ 99 "microblaze", /* Architecture name. */
97 "MicroBlaze", /* Printable name. */ 100 "MicroBlaze", /* Printable name. */
98 3, /* Section align power. */ 101 3, /* Section align power. */
99@@ -76,8 +76,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 102@@ -80,7 +80,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
100 64, /* 32 bits in a word. */
101 64, /* 32 bits in an address. */ 103 64, /* 32 bits in an address. */
102 8, /* 8 bits in a byte. */ 104 8, /* 8 bits in a byte. */
103- bfd_arch_microblaze, /* Architecture. */ 105 bfd_arch_microblaze, /* Architecture. */
104- 0, /* Machine number - 0 for now. */ 106- 0, /* Machine number - 0 for now. */
105+ bfd_arch_microblaze, /* Architecture. */
106+ bfd_mach_microblaze64, /* 64 bit Machine */ 107+ bfd_mach_microblaze64, /* 64 bit Machine */
107 "microblaze", /* Architecture name. */ 108 "microblaze", /* Architecture name. */
108 "MicroBlaze", /* Printable name. */ 109 "MicroBlaze", /* Printable name. */
109 3, /* Section align power. */ 110 3, /* Section align power. */
110diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 111diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
111index c280431df6..f9996eae12 100644 112index cb7a98d307e..e4a70150190 100644
112--- a/bfd/elf32-microblaze.c 113--- a/bfd/elf32-microblaze.c
113+++ b/bfd/elf32-microblaze.c 114+++ b/bfd/elf32-microblaze.c
114@@ -767,87 +767,6 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 115@@ -3684,6 +3684,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
115 return _bfd_elf_is_local_label_name (abfd, name);
116 }
117
118-/* Support for core dump NOTE sections. */
119-static bfd_boolean
120-microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
121-{
122- int offset;
123- unsigned int size;
124-
125- switch (note->descsz)
126- {
127- default:
128- return FALSE;
129-
130- case 228: /* Linux/MicroBlaze */
131- /* pr_cursig */
132- elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
133-
134- /* pr_pid */
135- elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
136-
137- /* pr_reg */
138- offset = 72;
139- size = 50 * 4;
140-
141- break;
142- }
143-
144- /* Make a ".reg/999" section. */
145- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
146- size, note->descpos + offset);
147-}
148-
149-static bfd_boolean
150-microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
151-{
152- switch (note->descsz)
153- {
154- default:
155- return FALSE;
156-
157- case 128: /* Linux/MicroBlaze elf_prpsinfo */
158- elf_tdata (abfd)->core->program
159- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
160- elf_tdata (abfd)->core->command
161- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
162- }
163-
164- /* Note that for some reason, a spurious space is tacked
165- onto the end of the args in some (at least one anyway)
166- implementations, so strip it off if it exists. */
167-
168- {
169- char *command = elf_tdata (abfd)->core->command;
170- int n = strlen (command);
171-
172- if (0 < n && command[n - 1] == ' ')
173- command[n - 1] = '\0';
174- }
175-
176- return TRUE;
177-}
178-
179-/* The microblaze linker (like many others) needs to keep track of
180- the number of relocs that it decides to copy as dynamic relocs in
181- check_relocs for each symbol. This is so that it can later discard
182- them if they are found to be unnecessary. We store the information
183- in a field extending the regular ELF linker hash table. */
184-
185-struct elf32_mb_dyn_relocs
186-{
187- struct elf32_mb_dyn_relocs *next;
188-
189- /* The input section of the reloc. */
190- asection *sec;
191-
192- /* Total number of relocs copied for the input section. */
193- bfd_size_type count;
194-
195- /* Number of pc-relative relocs copied for the input section. */
196- bfd_size_type pc_count;
197-};
198-
199 /* ELF linker hash entry. */
200
201 struct elf32_mb_link_hash_entry
202@@ -3683,6 +3602,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
203 return TRUE; 116 return TRUE;
204 } 117 }
205 118
@@ -214,44 +127,28 @@ index c280431df6..f9996eae12 100644
214 /* Hook called by the linker routine which adds symbols from an object 127 /* Hook called by the linker routine which adds symbols from an object
215 file. We use it to put .comm items in .sbss, and not .bss. */ 128 file. We use it to put .comm items in .sbss, and not .bss. */
216 129
217@@ -3752,8 +3679,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 130@@ -3756,5 +3764,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
218 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol 131
219 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 132 #define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
220 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 133 #define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
221-
222-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
223-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
224+#define elf_backend_object_p elf_microblaze_object_p 134+#define elf_backend_object_p elf_microblaze_object_p
225 135
226 #include "elf32-target.h" 136 #include "elf32-target.h"
227diff --git a/gdb/Makefile.in b/gdb/Makefile.in
228index d620580498..69b003f8cb 100644
229--- a/gdb/Makefile.in
230+++ b/gdb/Makefile.in
231@@ -2265,7 +2265,7 @@ ALLDEPFILES = \
232 m68k-tdep.c \
233 microblaze-linux-tdep.c \
234 microblaze-tdep.c \
235- microblaze-linux-nat.c \
236+ microblaze-linux-nat.c \
237 mingw-hdep.c \
238 mips-fbsd-nat.c \
239 mips-fbsd-tdep.c \
240diff --git a/gdb/features/Makefile b/gdb/features/Makefile 137diff --git a/gdb/features/Makefile b/gdb/features/Makefile
241index 3d84ca09a1..fdeec19753 100644 138index 9a98b0542c4..438e0c5a3fe 100644
242--- a/gdb/features/Makefile 139--- a/gdb/features/Makefile
243+++ b/gdb/features/Makefile 140+++ b/gdb/features/Makefile
244@@ -64,6 +64,7 @@ WHICH = aarch64 \ 141@@ -48,6 +48,7 @@ WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
245 i386/x32-avx-avx512-linux \ 142 arm/arm-with-neon \
246 mips-linux mips-dsp-linux \ 143 mips-linux mips-dsp-linux \
247 microblaze-with-stack-protect \ 144 microblaze-with-stack-protect \
248+ microblaze64-with-stack-protect \ 145+ microblaze64-with-stack-protect \
249 mips64-linux mips64-dsp-linux \ 146 mips64-linux mips64-dsp-linux \
250 nios2-linux \ 147 nios2-linux \
251 rs6000/powerpc-32 \ 148 rs6000/powerpc-32 \
252@@ -135,7 +136,9 @@ XMLTOC = \ 149@@ -111,7 +112,9 @@ XMLTOC = \
253 arm/arm-with-vfpv2.xml \ 150 arc-v2.xml \
254 arm/arm-with-vfpv3.xml \ 151 arc-arcompact.xml \
255 microblaze-with-stack-protect.xml \ 152 microblaze-with-stack-protect.xml \
256+ microblaze64-with-stack-protect.xml \ 153+ microblaze64-with-stack-protect.xml \
257 microblaze.xml \ 154 microblaze.xml \
@@ -260,7 +157,7 @@ index 3d84ca09a1..fdeec19753 100644
260 mips-linux.xml \ 157 mips-linux.xml \
261 mips64-dsp-linux.xml \ 158 mips64-dsp-linux.xml \
262diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml 159diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
263index 88c93e5d66..5bc3e49f84 100644 160index f272650a41b..d1f2282fd1e 100644
264--- a/gdb/features/microblaze-core.xml 161--- a/gdb/features/microblaze-core.xml
265+++ b/gdb/features/microblaze-core.xml 162+++ b/gdb/features/microblaze-core.xml
266@@ -8,7 +8,7 @@ 163@@ -8,7 +8,7 @@
@@ -285,24 +182,11 @@ index 88c93e5d66..5bc3e49f84 100644
285 <reg name="rtlbsx" bitsize="32"/> 182 <reg name="rtlbsx" bitsize="32"/>
286 <reg name="rtlblo" bitsize="32"/> 183 <reg name="rtlblo" bitsize="32"/>
287 <reg name="rtlbhi" bitsize="32"/> 184 <reg name="rtlbhi" bitsize="32"/>
288+ <reg name="slr" bitsize="32"/> 185+ <reg name="rslr" bitsize="32"/>
289+ <reg name="shr" bitsize="32"/> 186+ <reg name="rshr" bitsize="32"/>
290 </feature>
291diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
292index 870c148bb0..a7f27b903c 100644
293--- a/gdb/features/microblaze-stack-protect.xml
294+++ b/gdb/features/microblaze-stack-protect.xml
295@@ -7,6 +7,6 @@
296
297 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
298 <feature name="org.gnu.gdb.microblaze.stack-protect">
299- <reg name="rslr" bitsize="32"/>
300- <reg name="rshr" bitsize="32"/>
301+ <reg name="slr" bitsize="32"/>
302+ <reg name="shr" bitsize="32"/>
303 </feature> 187 </feature>
304diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c 188diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
305index b39aa19887..609934e2b4 100644 189index b39aa198874..ab162fd2588 100644
306--- a/gdb/features/microblaze-with-stack-protect.c 190--- a/gdb/features/microblaze-with-stack-protect.c
307+++ b/gdb/features/microblaze-with-stack-protect.c 191+++ b/gdb/features/microblaze-with-stack-protect.c
308@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) 192@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
@@ -323,19 +207,8 @@ index b39aa19887..609934e2b4 100644
323 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); 207 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
324 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); 208 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
325 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); 209 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
326@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
327 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
328
329 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
330- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
331- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
332+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
333+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
334
335 tdesc_microblaze_with_stack_protect = result;
336 }
337diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c 210diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
338index 6c86fc0770..ceb98ca8b8 100644 211index 6c86fc07700..7919ac96e62 100644
339--- a/gdb/features/microblaze.c 212--- a/gdb/features/microblaze.c
340+++ b/gdb/features/microblaze.c 213+++ b/gdb/features/microblaze.c
341@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void) 214@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
@@ -360,14 +233,14 @@ index 6c86fc0770..ceb98ca8b8 100644
360 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 233 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
361 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 234 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
362 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 235 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
363+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 236+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
364+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 237+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
365 238
366 tdesc_microblaze = result; 239 tdesc_microblaze = result;
367 } 240 }
368diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml 241diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
369new file mode 100644 242new file mode 100644
370index 0000000000..96e99e2fb2 243index 00000000000..b9adadfade6
371--- /dev/null 244--- /dev/null
372+++ b/gdb/features/microblaze64-core.xml 245+++ b/gdb/features/microblaze64-core.xml
373@@ -0,0 +1,69 @@ 246@@ -0,0 +1,69 @@
@@ -437,12 +310,12 @@ index 0000000000..96e99e2fb2
437+ <reg name="rtlbsx" bitsize="32"/> 310+ <reg name="rtlbsx" bitsize="32"/>
438+ <reg name="rtlblo" bitsize="32"/> 311+ <reg name="rtlblo" bitsize="32"/>
439+ <reg name="rtlbhi" bitsize="32"/> 312+ <reg name="rtlbhi" bitsize="32"/>
440+ <reg name="slr" bitsize="64"/> 313+ <reg name="rslr" bitsize="64"/>
441+ <reg name="shr" bitsize="64"/> 314+ <reg name="rshr" bitsize="64"/>
442+</feature> 315+</feature>
443diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml 316diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
444new file mode 100644 317new file mode 100644
445index 0000000000..1bbf5fc3ce 318index 00000000000..9d7ea8b9fd7
446--- /dev/null 319--- /dev/null
447+++ b/gdb/features/microblaze64-stack-protect.xml 320+++ b/gdb/features/microblaze64-stack-protect.xml
448@@ -0,0 +1,12 @@ 321@@ -0,0 +1,12 @@
@@ -455,12 +328,12 @@ index 0000000000..1bbf5fc3ce
455+ 328+
456+<!DOCTYPE feature SYSTEM "gdb-target.dtd"> 329+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
457+<feature name="org.gnu.gdb.microblaze64.stack-protect"> 330+<feature name="org.gnu.gdb.microblaze64.stack-protect">
458+ <reg name="slr" bitsize="64"/> 331+ <reg name="rslr" bitsize="64"/>
459+ <reg name="shr" bitsize="64"/> 332+ <reg name="rshr" bitsize="64"/>
460+</feature> 333+</feature>
461diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c 334diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
462new file mode 100644 335new file mode 100644
463index 0000000000..f448c9a749 336index 00000000000..249cb534daa
464--- /dev/null 337--- /dev/null
465+++ b/gdb/features/microblaze64-with-stack-protect.c 338+++ b/gdb/features/microblaze64-with-stack-protect.c
466@@ -0,0 +1,79 @@ 339@@ -0,0 +1,79 @@
@@ -538,14 +411,14 @@ index 0000000000..f448c9a749
538+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 411+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
539+ 412+
540+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect"); 413+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
541+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 414+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
542+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 415+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
543+ 416+
544+ tdesc_microblaze64_with_stack_protect = result; 417+ tdesc_microblaze64_with_stack_protect = result;
545+} 418+}
546diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml 419diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
547new file mode 100644 420new file mode 100644
548index 0000000000..0e9f01611f 421index 00000000000..0e9f01611f3
549--- /dev/null 422--- /dev/null
550+++ b/gdb/features/microblaze64-with-stack-protect.xml 423+++ b/gdb/features/microblaze64-with-stack-protect.xml
551@@ -0,0 +1,12 @@ 424@@ -0,0 +1,12 @@
@@ -563,7 +436,7 @@ index 0000000000..0e9f01611f
563+</target> 436+</target>
564diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c 437diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
565new file mode 100644 438new file mode 100644
566index 0000000000..1aa37c4512 439index 00000000000..5d3e2c8cd91
567--- /dev/null 440--- /dev/null
568+++ b/gdb/features/microblaze64.c 441+++ b/gdb/features/microblaze64.c
569@@ -0,0 +1,77 @@ 442@@ -0,0 +1,77 @@
@@ -639,14 +512,14 @@ index 0000000000..1aa37c4512
639+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 512+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
640+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 513+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
641+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 514+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
642+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 515+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
643+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 516+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
644+ 517+
645+ tdesc_microblaze64 = result; 518+ tdesc_microblaze64 = result;
646+} 519+}
647diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml 520diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
648new file mode 100644 521new file mode 100644
649index 0000000000..515d18e65c 522index 00000000000..515d18e65cf
650--- /dev/null 523--- /dev/null
651+++ b/gdb/features/microblaze64.xml 524+++ b/gdb/features/microblaze64.xml
652@@ -0,0 +1,11 @@ 525@@ -0,0 +1,11 @@
@@ -661,8 +534,55 @@ index 0000000000..515d18e65c
661+<target> 534+<target>
662+ <xi:include href="microblaze64-core.xml"/> 535+ <xi:include href="microblaze64-core.xml"/>
663+</target> 536+</target>
537diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
538index 0afb6efeba3..48459a76991 100644
539--- a/gdb/microblaze-linux-tdep.c
540+++ b/gdb/microblaze-linux-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 }
664diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 584diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
665index 49713ea9b1..0605283c9e 100644 585index 98944f38d2a..5c0d6dd48ae 100644
666--- a/gdb/microblaze-tdep.c 586--- a/gdb/microblaze-tdep.c
667+++ b/gdb/microblaze-tdep.c 587+++ b/gdb/microblaze-tdep.c
668@@ -40,7 +40,9 @@ 588@@ -40,7 +40,9 @@
@@ -675,57 +595,34 @@ index 49713ea9b1..0605283c9e 100644
675 595
676 /* Instruction macros used for analyzing the prologue. */ 596 /* Instruction macros used for analyzing the prologue. */
677 /* This set of instruction macros need to be changed whenever the 597 /* This set of instruction macros need to be changed whenever the
678@@ -75,12 +77,13 @@ static const char *microblaze_register_names[] = 598@@ -79,8 +81,9 @@ static const char *microblaze_register_names[] =
679 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
680 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
681 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
682- "rslr", "rshr"
683+ "slr", "shr"
684 }; 599 };
685 600
686 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) 601 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
687 602-
603+
688 static unsigned int microblaze_debug_flag = 0; 604 static unsigned int microblaze_debug_flag = 0;
689+int reg_size = 4; 605+int MICROBLAZE_REGISTER_SIZE = 4;
690 606
691 static void ATTRIBUTE_PRINTF (1, 2) 607 static void ATTRIBUTE_PRINTF (1, 2)
692 microblaze_debug (const char *fmt, ...) 608 microblaze_debug (const char *fmt, ...)
693@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regcache *regcache, int nargs, 609@@ -137,6 +140,7 @@ microblaze_fetch_instruction (CORE_ADDR pc)
694 error (_("store_arguments not implemented")); 610 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
695 return sp; 611
696 } 612 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
697+#if 0 613+#if 0
698 static int 614 static int
699 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 615 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
700 struct bp_target_info *bp_tgt) 616 struct bp_target_info *bp_tgt)
701@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 617@@ -169,6 +173,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
702 int val;
703 int bplen;
704 gdb_byte old_contents[BREAKPOINT_MAX];
705- struct cleanup *cleanup;
706+ //struct cleanup *cleanup;
707 618
708 /* Determine appropriate breakpoint contents and size for this address. */
709 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
710@@ -162,7 +166,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
711 error (_("Software breakpoints not implemented for this target."));
712
713 /* Make sure we see the memory breakpoints. */
714- cleanup = make_show_memory_breakpoints_cleanup (1);
715+ scoped_restore
716+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
717 val = target_read_memory (addr, old_contents, bplen);
718
719 /* If our breakpoint is no longer at the address, this means that the
720@@ -178,6 +183,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
721 return val; 619 return val;
722 } 620 }
723
724+#endif 621+#endif
622
725 /* Allocate and initialize a frame cache. */ 623 /* Allocate and initialize a frame cache. */
726 624
727 static struct microblaze_frame_cache * 625@@ -556,7 +561,6 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
728@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
729 gdb_byte *valbuf) 626 gdb_byte *valbuf)
730 { 627 {
731 gdb_byte buf[8]; 628 gdb_byte buf[8];
@@ -733,19 +630,7 @@ index 49713ea9b1..0605283c9e 100644
733 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ 630 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
734 switch (TYPE_LENGTH (type)) 631 switch (TYPE_LENGTH (type))
735 { 632 {
736 case 1: /* return last byte in the register. */ 633@@ -633,7 +637,113 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
737 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
738- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
739+ memcpy(valbuf, buf + reg_size - 1, 1);
740 return;
741 case 2: /* return last 2 bytes in register. */
742 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
743- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
744+ memcpy(valbuf, buf + reg_size - 2, 2);
745 return;
746 case 4: /* for sizes 4 or 8, copy the required length. */
747 case 8:
748@@ -647,7 +652,119 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
749 return (TYPE_LENGTH (type) == 16); 634 return (TYPE_LENGTH (type) == 16);
750 } 635 }
751 636
@@ -857,16 +742,14 @@ index 49713ea9b1..0605283c9e 100644
857+} 742+}
858+#endif 743+#endif
859+ 744+
860+static void
861+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
862+{
863+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
864+}
865+
866 static int dwarf2_to_reg_map[78] = 745 static int dwarf2_to_reg_map[78] =
867 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 746 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
868 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 747 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
869@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) 748@@ -665,24 +775,27 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
749 return -1;
750 }
751
752+#if 0
870 static void 753 static void
871 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 754 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
872 { 755 {
@@ -882,46 +765,27 @@ index 49713ea9b1..0605283c9e 100644
882- tdesc_microblaze_with_stack_protect); 765- tdesc_microblaze_with_stack_protect);
883+ tdesc_microblaze64_with_stack_protect); 766+ tdesc_microblaze64_with_stack_protect);
884 } 767 }
768+#endif
885 769
886 void 770 void
887@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct microblaze_gregset *gregset, 771 microblaze_supply_gregset (const struct regset *regset,
888 struct regcache *regcache, 772 struct regcache *regcache,
889 int regnum, const void *gregs) 773 int regnum, const void *gregs)
890 { 774 {
891- unsigned int *regs = gregs; 775- const unsigned int *regs = (const unsigned int *)gregs;
892+ const gdb_byte *regs = (const gdb_byte *) gregs; 776+ const gdb_byte *regs = (const gdb_byte *) gregs;
893 if (regnum >= 0) 777 if (regnum >= 0)
894- regcache_raw_supply (regcache, regnum, regs + regnum); 778 regcache->raw_supply (regnum, regs + regnum);
895+ regcache->raw_supply (regnum, regs + regnum);
896
897 if (regnum == -1) {
898 int i;
899 779
900 for (i = 0; i < 50; i++) { 780@@ -713,7 +826,6 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
901- regcache_raw_supply (regcache, i, regs + i);
902+ regcache->raw_supply (regnum, regs + i);
903 }
904 }
905 } 781 }
906@@ -755,6 +873,17 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
907 }
908
909 782
910+static void
911+make_regs (struct gdbarch *arch)
912+{
913+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
914+ int mach = gdbarch_bfd_arch_info (arch)->mach;
915+
916+ if (mach == bfd_mach_microblaze64)
917+ {
918+ set_gdbarch_ptr_bit (arch, 64);
919+ }
920+}
921 783
784-
922 static struct gdbarch * 785 static struct gdbarch *
923 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 786 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
924@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 787 {
788@@ -727,8 +839,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
925 if (arches != NULL) 789 if (arches != NULL)
926 return arches->gdbarch; 790 return arches->gdbarch;
927 if (tdesc == NULL) 791 if (tdesc == NULL)
@@ -931,7 +795,7 @@ index 49713ea9b1..0605283c9e 100644
931+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 795+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
932+ { 796+ {
933+ tdesc = tdesc_microblaze64; 797+ tdesc = tdesc_microblaze64;
934+ reg_size = 8; 798+ MICROBLAZE_REGISTER_SIZE = 8;
935+ } 799+ }
936+ else 800+ else
937+ tdesc = tdesc_microblaze; 801+ tdesc = tdesc_microblaze;
@@ -939,7 +803,7 @@ index 49713ea9b1..0605283c9e 100644
939 /* Check any target description for validity. */ 803 /* Check any target description for validity. */
940 if (tdesc_has_registers (tdesc)) 804 if (tdesc_has_registers (tdesc))
941 { 805 {
942@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 806@@ -736,27 +855,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
943 int valid_p; 807 int valid_p;
944 int i; 808 int i;
945 809
@@ -980,7 +844,7 @@ index 49713ea9b1..0605283c9e 100644
980 } 844 }
981 845
982 if (!valid_p) 846 if (!valid_p)
983@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 847@@ -764,6 +891,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
984 tdesc_data_cleanup (tdesc_data); 848 tdesc_data_cleanup (tdesc_data);
985 return NULL; 849 return NULL;
986 } 850 }
@@ -988,7 +852,7 @@ index 49713ea9b1..0605283c9e 100644
988 } 852 }
989 853
990 /* Allocate space for the new architecture. */ 854 /* Allocate space for the new architecture. */
991@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 855@@ -783,7 +911,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
992 /* Register numbers of various important registers. */ 856 /* Register numbers of various important registers. */
993 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM); 857 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
994 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM); 858 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
@@ -1006,7 +870,7 @@ index 49713ea9b1..0605283c9e 100644
1006 /* Map Dwarf2 registers to GDB registers. */ 870 /* Map Dwarf2 registers to GDB registers. */
1007 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 871 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
1008 872
1009@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 873@@ -803,13 +941,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1010 microblaze_breakpoint::kind_from_pc); 874 microblaze_breakpoint::kind_from_pc);
1011 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 875 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1012 microblaze_breakpoint::bp_from_kind); 876 microblaze_breakpoint::bp_from_kind);
@@ -1024,21 +888,7 @@ index 49713ea9b1..0605283c9e 100644
1024 888
1025 frame_base_set_default (gdbarch, &microblaze_frame_base); 889 frame_base_set_default (gdbarch, &microblaze_frame_base);
1026 890
1027@@ -866,11 +1023,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 891@@ -840,6 +980,8 @@ _initialize_microblaze_tdep (void)
1028 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
1029 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
1030
1031- /* If we have register sets, enable the generic core file support. */
1032+ /* If we have register sets, enable the generic core file support.
1033 if (tdep->gregset) {
1034 set_gdbarch_regset_from_core_section (gdbarch,
1035 microblaze_regset_from_core_section);
1036- }
1037+ }*/
1038
1039 return gdbarch;
1040 }
1041@@ -882,6 +1039,8 @@ _initialize_microblaze_tdep (void)
1042 892
1043 initialize_tdesc_microblaze_with_stack_protect (); 893 initialize_tdesc_microblaze_with_stack_protect ();
1044 initialize_tdesc_microblaze (); 894 initialize_tdesc_microblaze ();
@@ -1048,7 +898,7 @@ index 49713ea9b1..0605283c9e 100644
1048 add_setshow_zuinteger_cmd ("microblaze", class_maintenance, 898 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
1049 &microblaze_debug_flag, _("\ 899 &microblaze_debug_flag, _("\
1050diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 900diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1051index 3777cbb6a8..55f5dd1962 100644 901index d2112dc07e1..bd03e969b9b 100644
1052--- a/gdb/microblaze-tdep.h 902--- a/gdb/microblaze-tdep.h
1053+++ b/gdb/microblaze-tdep.h 903+++ b/gdb/microblaze-tdep.h
1054@@ -27,7 +27,7 @@ struct microblaze_gregset 904@@ -27,7 +27,7 @@ struct microblaze_gregset
@@ -1072,17 +922,18 @@ index 3777cbb6a8..55f5dd1962 100644
1072 }; 922 };
1073 923
1074 struct microblaze_frame_cache 924 struct microblaze_frame_cache
1075@@ -128,7 +128,7 @@ struct microblaze_frame_cache 925@@ -128,7 +128,8 @@ struct microblaze_frame_cache
1076 struct trad_frame_saved_reg *saved_regs; 926 struct trad_frame_saved_reg *saved_regs;
1077 }; 927 };
1078 /* All registers are 32 bits. */ 928 /* All registers are 32 bits. */
1079-#define MICROBLAZE_REGISTER_SIZE 4 929-#define MICROBLAZE_REGISTER_SIZE 4
1080+//#define MICROBLAZE_REGISTER_SIZE 8 930+extern int microblaze_reg_size;
931+#define MICROBLAZE_REGISTER_SIZE microblaze_reg_size
1081 932
1082 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 933 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1083 Only used for native debugging. */ 934 Only used for native debugging. */
1084diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat 935diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat
1085index 8040a7b3fd..450e321d49 100644 936index 8040a7b3fd0..450e321d49e 100644
1086--- a/gdb/regformats/microblaze-with-stack-protect.dat 937--- a/gdb/regformats/microblaze-with-stack-protect.dat
1087+++ b/gdb/regformats/microblaze-with-stack-protect.dat 938+++ b/gdb/regformats/microblaze-with-stack-protect.dat
1088@@ -60,5 +60,5 @@ expedite:r1,rpc 939@@ -60,5 +60,5 @@ expedite:r1,rpc
@@ -1093,18 +944,6 @@ index 8040a7b3fd..450e321d49 100644
1093-32:rshr 944-32:rshr
1094+32:slr 945+32:slr
1095+32:shr 946+32:shr
1096diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
1097index bd9d91cd57..12d4456bc2 100644
1098--- a/opcodes/microblaze-opc.h
1099+++ b/opcodes/microblaze-opc.h
1100@@ -134,7 +134,6 @@
1101 #define ORLI_MASK 0xA0000000
1102 #define XORLI_MASK 0xA8000000
1103
1104-
1105 /* New Mask for msrset, msrclr insns. */
1106 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
1107 /* Mask for mbar insn. */
1108-- 947--
11092.17.1 9482.17.1
1110 949
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0041-patch-MicroBlaze-porting-GDB-for-linux.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0041-patch-MicroBlaze-porting-GDB-for-linux.patch
deleted file mode 100644
index 7d63e63e..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0041-patch-MicroBlaze-porting-GDB-for-linux.patch
+++ /dev/null
@@ -1,155 +0,0 @@
1From 3f830717572e074a21840549b48265ec00d67bd1 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Dec 2019 14:56:17 +0530
4Subject: [PATCH 41/43] [patch,MicroBlaze] : 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
14diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
15new file mode 100644
16index 0000000000..8983e66eb3
17--- /dev/null
18+++ b/gdb/features/microblaze-linux.xml
19@@ -0,0 +1,12 @@
20+<?xml version="1.0"?>
21+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
22+
23+ Copying and distribution of this file, with or without modification,
24+ are permitted in any medium without royalty provided the copyright
25+ notice and this notice are preserved. -->
26+
27+<!DOCTYPE target SYSTEM "gdb-target.dtd">
28+<target>
29+ <osabi>GNU/Linux</osabi>
30+ <xi:include href="microblaze-core.xml"/>
31+</target>
32diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
33index 73ca5fd7c5..f5d8663ec8 100644
34--- a/gdb/gdbserver/Makefile.in
35+++ b/gdb/gdbserver/Makefile.in
36@@ -639,6 +639,8 @@ common/%.o: ../common/%.c
37
38 %-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
39 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
40+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
41+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
42
43 #
44 # Dependency tracking.
45diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
46index 201b7ae190..e5ed6498a8 100644
47--- a/gdb/gdbserver/configure.srv
48+++ b/gdb/gdbserver/configure.srv
49@@ -210,8 +210,9 @@ case "${target}" in
50 srv_linux_usrregs=yes
51 srv_linux_thread_db=yes
52 ;;
53- microblaze*-*-linux*) srv_regobj=microblaze-linux.o
54+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
55 srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
56+ srv_xmlfiles="microblaze-linux.xml"
57 srv_linux_regsets=yes
58 srv_linux_usrregs=yes
59 srv_linux_thread_db=yes
60diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
61index 011e513941..e3d2a7508d 100644
62--- a/gdb/microblaze-linux-tdep.c
63+++ b/gdb/microblaze-linux-tdep.c
64@@ -41,7 +41,7 @@
65
66 #ifndef REGSET_H
67 #define REGSET_H 1
68-
69+int MICROBLAZE_REGISTER_SIZE=4;
70 struct gdbarch;
71 struct regcache;
72
73@@ -115,7 +115,7 @@ microblaze_debug (const char *fmt, ...)
74 va_end (args);
75 }
76 }
77-
78+#if 0
79 static int
80 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
81 struct bp_target_info *bp_tgt)
82@@ -131,7 +131,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
83 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
84
85 /* Make sure we see the memory breakpoints. */
86- cleanup = make_show_memory_breakpoints_cleanup (1);
87+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
88 val = target_read_memory (addr, old_contents, bplen);
89
90 /* If our breakpoint is no longer at the address, this means that the
91@@ -146,6 +146,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
92 do_cleanups (cleanup);
93 return val;
94 }
95+#endif
96
97 static void
98 microblaze_linux_sigtramp_cache (struct frame_info *next_frame,
99@@ -248,8 +249,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
100
101 linux_init_abi (info, gdbarch);
102
103- set_gdbarch_memory_remove_breakpoint (gdbarch,
104- microblaze_linux_memory_remove_breakpoint);
105+// set_gdbarch_memory_remove_breakpoint (gdbarch,
106+// microblaze_linux_memory_remove_breakpoint);
107
108 /* Shared library handling. */
109 set_solib_svr4_fetch_link_map_offsets (gdbarch,
110@@ -261,10 +262,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
111
112 /* BFD target for core files. */
113 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
114- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
115+ {
116+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
117+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
118+ MICROBLAZE_REGISTER_SIZE=8;
119+ }
120+ else
121+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
122+ }
123 else
124- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
125+ {
126+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
127+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
128+ MICROBLAZE_REGISTER_SIZE=8;
129+ }
130+ else
131+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
132+ }
133
134+ switch (info.bfd_arch_info->mach)
135+ {
136+ case bfd_mach_microblaze64:
137+ set_gdbarch_ptr_bit (gdbarch, 64);
138+ break;
139+ }
140
141 /* Shared library handling. */
142 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
143@@ -278,6 +299,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
144 void
145 _initialize_microblaze_linux_tdep (void)
146 {
147- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
148+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
149+ microblaze_linux_init_abi);
150+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
151 microblaze_linux_init_abi);
152 }
153--
1542.17.1
155
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
deleted file mode 100644
index 06e63f3c..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
+++ /dev/null
@@ -1,146 +0,0 @@
1From 746453e0f35fd669cfacabfe223b8e7007a99797 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 19 Dec 2019 12:22:04 +0530
4Subject: [PATCH 42/43] 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
19diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
20index 5bc3e49f84..6f73f4eb84 100644
21--- a/gdb/features/microblaze-core.xml
22+++ b/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>
32diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
33index a7f27b903c..870c148bb0 100644
34--- a/gdb/features/microblaze-stack-protect.xml
35+++ b/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>
45diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
46index 609934e2b4..ab162fd258 100644
47--- a/gdb/features/microblaze-with-stack-protect.c
48+++ b/gdb/features/microblaze-with-stack-protect.c
49@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
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 }
60diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
61index ceb98ca8b8..7919ac96e6 100644
62--- a/gdb/features/microblaze.c
63+++ b/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 }
75diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
76index 96e99e2fb2..b9adadfade 100644
77--- a/gdb/features/microblaze64-core.xml
78+++ b/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>
88diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
89index 1bbf5fc3ce..9d7ea8b9fd 100644
90--- a/gdb/features/microblaze64-stack-protect.xml
91+++ b/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>
101diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
102index f448c9a749..249cb534da 100644
103--- a/gdb/features/microblaze64-with-stack-protect.c
104+++ b/gdb/features/microblaze64-with-stack-protect.c
105@@ -72,8 +72,8 @@ initialize_tdesc_microblaze64_with_stack_protect (void)
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 }
116diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
117index 1aa37c4512..5d3e2c8cd9 100644
118--- a/gdb/features/microblaze64.c
119+++ b/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 }
131diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
132index 0605283c9e..7a0c2527f4 100644
133--- a/gdb/microblaze-tdep.c
134+++ b/gdb/microblaze-tdep.c
135@@ -77,7 +77,7 @@ static const char *microblaze_register_names[] =
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)
144--
1452.17.1
146
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
deleted file mode 100644
index 0b6cae62..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From 8cb6a265c2108ff7117c07e106604b46238c6ae7 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 17 Jan 2020 15:45:48 +0530
4Subject: [PATCH 43/43] 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
10diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
11index e3d2a7508d..5ef937219c 100644
12--- a/gdb/microblaze-linux-tdep.c
13+++ b/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
22--
232.17.1
24
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
deleted file mode 100644
index ace6aabd..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
+++ /dev/null
@@ -1,363 +0,0 @@
1From 8d75e232d3513a184180d797ef20bf53d3543fa7 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Mon, 20 Jan 2020 12:48:13 -0800
4Subject: [PATCH] gdb/microblaze-linux-nat.c: Fix target compilation of gdb
5
6Add the nat to the configure file
7
8Remove gdb_assert.h and gdb_string.h.
9
10Adjust include for opcodes as well.
11
12Update to match latest style of components, similar to ppc-linux-nat.c
13
14Update:
15 get_regcache_arch(regcache) to regcache->arch()
16 regcache_raw_supply(regcache, ...) to regcache->raw_supply(...)
17 regcache_raw_collect(regcache, ...) to regcache->raw_collect(...)
18
19Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
20---
21 gdb/configure.nat | 4 +
22 gdb/microblaze-linux-nat.c | 149 +++++++++++++------------------------
23 gdb/microblaze-tdep.c | 3 +-
24 3 files changed, 57 insertions(+), 99 deletions(-)
25
26diff --git a/gdb/configure.nat b/gdb/configure.nat
27index 64ee101d83..f0f6c2f5bc 100644
28--- a/gdb/configure.nat
29+++ b/gdb/configure.nat
30@@ -261,6 +261,10 @@ case ${gdb_host} in
31 # Host: Motorola m68k running GNU/Linux.
32 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
33 ;;
34+ microblaze*)
35+ # Host: Microblaze, running Linux
36+ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o"
37+ ;;
38 mips)
39 # Host: Linux/MIPS
40 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
41diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
42index e9b8c9c522..e09a86bb3f 100644
43--- a/gdb/microblaze-linux-nat.c
44+++ b/gdb/microblaze-linux-nat.c
45@@ -36,11 +36,9 @@
46 #include "dwarf2-frame.h"
47 #include "osabi.h"
48
49-#include "gdb_assert.h"
50-#include "gdb_string.h"
51 #include "target-descriptions.h"
52-#include "opcodes/microblaze-opcm.h"
53-#include "opcodes/microblaze-dis.h"
54+#include "../opcodes/microblaze-opcm.h"
55+#include "../opcodes/microblaze-dis.h"
56
57 #include "linux-nat.h"
58 #include "target-descriptions.h"
59@@ -61,34 +59,27 @@
60 /* Defines ps_err_e, struct ps_prochandle. */
61 #include "gdb_proc_service.h"
62
63-/* On GNU/Linux, threads are implemented as pseudo-processes, in which
64- case we may be tracing more than one process at a time. In that
65- case, inferior_ptid will contain the main process ID and the
66- individual thread (process) ID. get_thread_id () is used to get
67- the thread id if it's available, and the process id otherwise. */
68-
69-int
70-get_thread_id (ptid_t ptid)
71-{
72- int tid = TIDGET (ptid);
73- if (0 == tid)
74- tid = PIDGET (ptid);
75- return tid;
76-}
77-
78-#define GET_THREAD_ID(PTID) get_thread_id (PTID)
79-
80 /* Non-zero if our kernel may support the PTRACE_GETREGS and
81 PTRACE_SETREGS requests, for reading and writing the
82 general-purpose registers. Zero if we've tried one of
83 them and gotten an error. */
84 int have_ptrace_getsetregs = 1;
85
86+struct microblaze_linux_nat_target final : public linux_nat_target
87+{
88+ /* Add our register access methods. */
89+ void fetch_registers (struct regcache *, int) override;
90+ void store_registers (struct regcache *, int) override;
91+
92+ const struct target_desc *read_description () override;
93+};
94+
95+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
96+
97 static int
98 microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
99 {
100 int u_addr = -1;
101- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
102 /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
103 interface, and not the wordsize of the program's ABI. */
104 int wordsize = sizeof (long);
105@@ -105,18 +96,16 @@ microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
106 static void
107 fetch_register (struct regcache *regcache, int tid, int regno)
108 {
109- struct gdbarch *gdbarch = get_regcache_arch (regcache);
110- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
111+ struct gdbarch *gdbarch = regcache->arch();
112 /* This isn't really an address. But ptrace thinks of it as one. */
113 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
114 int bytes_transferred;
115- unsigned int offset; /* Offset of registers within the u area. */
116- char buf[MAX_REGISTER_SIZE];
117+ char buf[sizeof(long)];
118
119 if (regaddr == -1)
120 {
121 memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
122- regcache_raw_supply (regcache, regno, buf);
123+ regcache->raw_supply (regno, buf);
124 return;
125 }
126
127@@ -149,14 +138,14 @@ fetch_register (struct regcache *regcache, int tid, int regno)
128 {
129 /* Little-endian values are always found at the left end of the
130 bytes transferred. */
131- regcache_raw_supply (regcache, regno, buf);
132+ regcache->raw_supply (regno, buf);
133 }
134 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
135 {
136 /* Big-endian values are found at the right end of the bytes
137 transferred. */
138 size_t padding = (bytes_transferred - register_size (gdbarch, regno));
139- regcache_raw_supply (regcache, regno, buf + padding);
140+ regcache->raw_supply (regno, buf + padding);
141 }
142 else
143 internal_error (__FILE__, __LINE__,
144@@ -175,8 +164,6 @@ fetch_register (struct regcache *regcache, int tid, int regno)
145 static int
146 fetch_all_gp_regs (struct regcache *regcache, int tid)
147 {
148- struct gdbarch *gdbarch = get_regcache_arch (regcache);
149- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
150 gdb_gregset_t gregset;
151
152 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
153@@ -204,8 +191,6 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
154 static void
155 fetch_gp_regs (struct regcache *regcache, int tid)
156 {
157- struct gdbarch *gdbarch = get_regcache_arch (regcache);
158- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
159 int i;
160
161 if (have_ptrace_getsetregs)
162@@ -219,17 +204,29 @@ fetch_gp_regs (struct regcache *regcache, int tid)
163 fetch_register (regcache, tid, i);
164 }
165
166+/* Fetch registers from the child process. Fetch all registers if
167+ regno == -1, otherwise fetch all general registers or all floating
168+ point registers depending upon the value of regno. */
169+void
170+microblaze_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
171+{
172+ pid_t tid = get_ptrace_pid (regcache->ptid ());
173+
174+ if (regno == -1)
175+ fetch_gp_regs (regcache, tid);
176+ else
177+ fetch_register (regcache, tid, regno);
178+}
179
180 static void
181 store_register (const struct regcache *regcache, int tid, int regno)
182 {
183- struct gdbarch *gdbarch = get_regcache_arch (regcache);
184- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
185+ struct gdbarch *gdbarch = regcache->arch();
186 /* This isn't really an address. But ptrace thinks of it as one. */
187 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
188 int i;
189 size_t bytes_to_transfer;
190- char buf[MAX_REGISTER_SIZE];
191+ char buf[sizeof(long)];
192
193 if (regaddr == -1)
194 return;
195@@ -242,13 +239,13 @@ store_register (const struct regcache *regcache, int tid, int regno)
196 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
197 {
198 /* Little-endian values always sit at the left end of the buffer. */
199- regcache_raw_collect (regcache, regno, buf);
200+ regcache->raw_collect (regno, buf);
201 }
202 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
203 {
204 /* Big-endian values sit at the right end of the buffer. */
205 size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
206- regcache_raw_collect (regcache, regno, buf + padding);
207+ regcache->raw_collect (regno, buf + padding);
208 }
209
210 for (i = 0; i < bytes_to_transfer; i += sizeof (long))
211@@ -281,8 +278,6 @@ store_register (const struct regcache *regcache, int tid, int regno)
212 static int
213 store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
214 {
215- struct gdbarch *gdbarch = get_regcache_arch (regcache);
216- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
217 gdb_gregset_t gregset;
218
219 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
220@@ -319,8 +314,6 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
221 static void
222 store_gp_regs (const struct regcache *regcache, int tid, int regno)
223 {
224- struct gdbarch *gdbarch = get_regcache_arch (regcache);
225- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
226 int i;
227
228 if (have_ptrace_getsetregs)
229@@ -335,33 +328,10 @@ store_gp_regs (const struct regcache *regcache, int tid, int regno)
230 }
231
232
233-/* Fetch registers from the child process. Fetch all registers if
234- regno == -1, otherwise fetch all general registers or all floating
235- point registers depending upon the value of regno. */
236-
237-static void
238-microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
239- struct regcache *regcache, int regno)
240-{
241- /* Get the thread id for the ptrace call. */
242- int tid = GET_THREAD_ID (inferior_ptid);
243-
244- if (regno == -1)
245- fetch_gp_regs (regcache, tid);
246- else
247- fetch_register (regcache, tid, regno);
248-}
249-
250-/* Store registers back into the inferior. Store all registers if
251- regno == -1, otherwise store all general registers or all floating
252- point registers depending upon the value of regno. */
253-
254-static void
255-microblaze_linux_store_inferior_registers (struct target_ops *ops,
256- struct regcache *regcache, int regno)
257+void
258+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
259 {
260- /* Get the thread id for the ptrace call. */
261- int tid = GET_THREAD_ID (inferior_ptid);
262+ pid_t tid = get_ptrace_pid (regcache->ptid ());
263
264 if (regno >= 0)
265 store_register (regcache, tid, regno);
266@@ -373,59 +343,44 @@ microblaze_linux_store_inferior_registers (struct target_ops *ops,
267 thread debugging. */
268
269 void
270-fill_gregset (const struct regcache *regcache,
271- gdb_gregset_t *gregsetp, int regno)
272+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
273 {
274- microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
275+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
276 }
277
278 void
279-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
280+fill_gregset (const struct regcache *regcache,
281+ gdb_gregset_t *gregsetp, int regno)
282 {
283- microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
284+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
285 }
286
287 void
288-fill_fpregset (const struct regcache *regcache,
289- gdb_fpregset_t *fpregsetp, int regno)
290+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
291 {
292 /* FIXME. */
293+ return;
294 }
295
296 void
297-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
298+fill_fpregset (const struct regcache *regcache,
299+ gdb_fpregset_t *fpregsetp, int regno)
300 {
301 /* FIXME. */
302+ return;
303 }
304
305-static const struct target_desc *
306-microblaze_linux_read_description (struct target_ops *ops)
307+const struct target_desc *
308+microblaze_linux_nat_target::read_description ()
309 {
310- CORE_ADDR microblaze_hwcap = 0;
311-
312- if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
313- return NULL;
314-
315 return NULL;
316 }
317
318-
319-void _initialize_microblaze_linux_nat (void);
320-
321 void
322 _initialize_microblaze_linux_nat (void)
323 {
324- struct target_ops *t;
325-
326- /* Fill in the generic GNU/Linux methods. */
327- t = linux_target ();
328-
329- /* Add our register access methods. */
330- t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
331- t->to_store_registers = microblaze_linux_store_inferior_registers;
332-
333- t->to_read_description = microblaze_linux_read_description;
334+ linux_target = &the_microblaze_linux_nat_target;
335
336 /* Register the target. */
337- linux_nat_add_target (t);
338+ add_inf_child_target (linux_target);
339 }
340diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
341index 7a0c2527f4..23deb24d26 100644
342--- a/gdb/microblaze-tdep.c
343+++ b/gdb/microblaze-tdep.c
344@@ -657,7 +657,7 @@ static std::vector<CORE_ADDR>
345 microblaze_software_single_step (struct regcache *regcache)
346 {
347 // struct gdbarch *arch = get_frame_arch(frame);
348- struct gdbarch *arch = get_regcache_arch (regcache);
349+ struct gdbarch *arch = regcache->arch();
350 struct address_space *aspace = get_regcache_aspace (regcache);
351 // struct address_space *aspace = get_frame_address_space (frame);
352 struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
353@@ -876,7 +876,6 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
354 static void
355 make_regs (struct gdbarch *arch)
356 {
357- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
358 int mach = gdbarch_bfd_arch_info (arch)->mach;
359
360 if (mach == bfd_mach_microblaze64)
361--
3622.17.1
363