summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch40
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0003-Add-mlittle-endian-and-mbig-endian-flags.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch)23
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch)127
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0007-Fix-bug-in-TLSTPREL-Relocation.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-Address-extension-instructions.patch)24
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-fixing-the-MAX_OPCODES-to-correct-value.patch25
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch51
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch458
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch202
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch9
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch152
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-MB-x-relocation-issues.patch)175
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixing-the-branch-related-issues.patch25
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0021-Fixed-address-computation-issues-with-64bit-address.patch)59
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0022-Adding-new-relocation-to-support-64bit-rodata.patch)36
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0023-fixing-the-.bss-relocation-issue.patch)26
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state.patch)18
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch68
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch)16
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch31
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0027-Added-support-to-new-arithmetic-single-register-inst.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0030-Added-support-to-new-arithmetic-single-register-inst.patch)87
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch)101
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch47
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch38
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch83
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Fix-various-compile-warnings.patch105
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0032-Add-initial-port-of-linux-gdbserver.patch)111
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-Initial-port-of-core-reading-support.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0033-Initial-port-of-core-reading-support.patch)176
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-revert-master-rebase-changes-to-gdbserver.patch31
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0034-Fix-debug-message-when-register-is-unavailable.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch33
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch41
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch139
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch494
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0041-patch-MicroBlaze-porting-GDB-for-linux.patch155
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch146
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch24
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch364
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0046-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch38
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0047-Patch-MicroBlaze-commit-for-triggering-build-to-remo.patch25
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0048-Patch-MicroBlaze-Adding-more-description-to-the-imml.patch27
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0049-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch39
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0050-Fix-i386-md_pseudo_table.patch28
55 files changed, 1489 insertions, 2540 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch
new file mode 100644
index 00000000..9671968a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch
@@ -0,0 +1,40 @@
1From 501b60af6b36fc69987e1610645742f5593a6da2 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/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
index e0de79fd..039bfc96 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
@@ -1,7 +1,7 @@
1From 247ead894f7079a4ededf2b48a65ffa6e78e2222 Mon Sep 17 00:00:00 2001 1From b8e39d2a6b83d0f0a14d4bfeafd47a37d746f159 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 27d8684df04..b6c5016e4d2 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 aa53dfe6bb5..795c57b5ff6 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/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Add-mlittle-endian-and-mbig-endian-flags.patch
index 98e40c0e..2d4d65e4 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Add-mlittle-endian-and-mbig-endian-flags.patch
@@ -1,7 +1,7 @@
1From 7163824e07ade3ad2dc24e888265d27e0bc87869 Mon Sep 17 00:00:00 2001 1From d2a03159f8643b1c6a2db5d95c478540cc6ca6c4 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com> 2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 19 Mar 2013 17:18:23 +0530 3Date: Tue, 19 Mar 2013 17:18:23 +0530
4Subject: [PATCH 02/43] Add mlittle-endian and mbig-endian flags 4Subject: [PATCH 03/40] Add mlittle-endian and mbig-endian flags
5 5
6Added support in gas for mlittle-endian and mbig-endian flags 6Added support in gas for mlittle-endian and mbig-endian flags
7as options. 7as options.
@@ -16,7 +16,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
16 1 file changed, 9 insertions(+) 16 1 file changed, 9 insertions(+)
17 17
18diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 18diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
19index ab90c6b20f..c92e9ce563 100644 19index ae5d36dc9c3..34eeb972357 100644
20--- a/gas/config/tc-microblaze.c 20--- a/gas/config/tc-microblaze.c
21+++ b/gas/config/tc-microblaze.c 21+++ b/gas/config/tc-microblaze.c
22@@ -37,6 +37,8 @@ 22@@ -37,6 +37,8 @@
@@ -28,7 +28,7 @@ index ab90c6b20f..c92e9ce563 100644
28 28
29 void microblaze_generate_symbol (char *sym); 29 void microblaze_generate_symbol (char *sym);
30 static bfd_boolean check_spl_reg (unsigned *); 30 static bfd_boolean check_spl_reg (unsigned *);
31@@ -1845,6 +1847,8 @@ struct option md_longopts[] = 31@@ -1842,6 +1844,8 @@ struct option md_longopts[] =
32 { 32 {
33 {"EB", no_argument, NULL, OPTION_EB}, 33 {"EB", no_argument, NULL, OPTION_EB},
34 {"EL", no_argument, NULL, OPTION_EL}, 34 {"EL", no_argument, NULL, OPTION_EL},
@@ -37,7 +37,7 @@ index ab90c6b20f..c92e9ce563 100644
37 { NULL, no_argument, NULL, 0} 37 { NULL, no_argument, NULL, 0}
38 }; 38 };
39 39
40@@ -2498,9 +2502,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 40@@ -2494,9 +2498,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
41 switch (c) 41 switch (c)
42 { 42 {
43 case OPTION_EB: 43 case OPTION_EB:
@@ -49,7 +49,7 @@ index ab90c6b20f..c92e9ce563 100644
49 target_big_endian = 0; 49 target_big_endian = 0;
50 break; 50 break;
51 default: 51 default:
52@@ -2515,6 +2521,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) 52@@ -2511,6 +2517,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
53 /* fprintf(stream, _("\ 53 /* fprintf(stream, _("\
54 MicroBlaze options:\n\ 54 MicroBlaze options:\n\
55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */ 55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch
index 445f5dd8..f7b9c7b0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -1,7 +1,7 @@
1From 2b9eec7fdfae66c5500baef444559976d1b20e0b Mon Sep 17 00:00:00 2001 1From a8d621e5ab335e6e61de0f081036b4705071fb74 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 7a129b00f8d..d5e4a5c062d 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,
@@ -24,8 +24,8 @@ index a13e81ebb8..1824ba6e5b 100644
24 abfd, sec); 24 abfd, sec);
25+} 25+}
26 hdr_info->u.dwarf.table = FALSE; 26 hdr_info->u.dwarf.table = FALSE;
27 if (sec_info) 27 free (sec_info);
28 free (sec_info); 28 success:
29-- 29--
302.17.1 302.17.1
31 31
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch
index d1b754c3..14a4f329 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-relaxation-of-assembler-resolved-references.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch
@@ -1,18 +1,18 @@
1From ababe1df64146c616455eb1af4cf8fd21eb6f42c Mon Sep 17 00:00:00 2001 1From c4ce6cb47613293e02837fc00c2c2ebfcdd596f6 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 gas/config/tc-microblaze.c | 1 + 8 gas/config/tc-microblaze.c | 1 +
9 2 files changed, 39 insertions(+) 9 2 files changed, 42 insertions(+)
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 e3c8027248..359484dd5e 100644 12index 693fc71f730..09dedc46106 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@@ -1973,6 +1973,44 @@ microblaze_elf_relax_section (bfd *abfd, 15@@ -1969,6 +1969,47 @@ microblaze_elf_relax_section (bfd *abfd,
16 irelscanend = irelocs + o->reloc_count; 16 irelscanend = irelocs + o->reloc_count;
17 for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 17 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
18 { 18 {
@@ -45,9 +45,12 @@ index e3c8027248..359484dd5e 100644
45+ elf_section_data (o)->this_hdr.contents = ocontents; 45+ elf_section_data (o)->this_hdr.contents = ocontents;
46+ } 46+ }
47+ } 47+ }
48+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
49+ + isym->st_value, sec);
50+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); 48+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
49+ if (val != irelscan->r_addend) {
50+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
51+ }
52+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
53+ + isym->st_value, 0, sec);
51+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 54+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
52+ irelscan->r_addend); 55+ irelscan->r_addend);
53+ } 56+ }
@@ -58,10 +61,10 @@ index e3c8027248..359484dd5e 100644
58 { 61 {
59 isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 62 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
60diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 63diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
61index c92e9ce563..3e728400b7 100644 64index 34eeb972357..d01653aeef9 100644
62--- a/gas/config/tc-microblaze.c 65--- a/gas/config/tc-microblaze.c
63+++ b/gas/config/tc-microblaze.c 66+++ b/gas/config/tc-microblaze.c
64@@ -2205,6 +2205,7 @@ md_apply_fix (fixS * fixP, 67@@ -2201,6 +2201,7 @@ md_apply_fix (fixS * fixP,
65 else 68 else
66 fixP->fx_r_type = BFD_RELOC_NONE; 69 fixP->fx_r_type = BFD_RELOC_NONE;
67 fixP->fx_addsy = section_symbol (absolute_section); 70 fixP->fx_addsy = section_symbol (absolute_section);
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
index ac13e6e3..308a453e 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0005-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
@@ -1,10 +1,12 @@
1From e9837b5aec42b084c93868095b409f9a6a81b570 Mon Sep 17 00:00:00 2001 1From 77c9dd2085e5a9e116cd8d8b4fbc1387c93d26d8 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,46 +14,39 @@ 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 binutils/readelf.c | 4 +++ 21 binutils/readelf.c | 4 ++++
20 gas/config/tc-microblaze.c | 5 +++- 22 gas/config/tc-microblaze.c | 3 +++
21 include/elf/microblaze.h | 2 ++ 23 include/elf/microblaze.h | 1 +
22 7 files changed, 64 insertions(+), 16 deletions(-) 24 7 files changed, 52 insertions(+), 7 deletions(-)
23 25
24diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 26diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
25index e25da50aaf..721531886a 100644 27index 35ef4d755bb..3fdbf8ed755 100644
26--- a/bfd/bfd-in2.h 28--- a/bfd/bfd-in2.h
27+++ b/bfd/bfd-in2.h 29+++ b/bfd/bfd-in2.h
28@@ -5866,10 +5866,15 @@ value relative to the read-write small data area anchor */ 30@@ -5428,6 +5428,11 @@ value relative to the read-write small data area anchor */
29 expressions of the form "Symbol Op Symbol" */ 31 expressions of the form "Symbol Op Symbol" */
30 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, 32 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
31 33
32-/* This is a 64 bit reloc that stores the 32 bit pc relative
33+/* This is a 32 bit reloc that stores the 32 bit pc relative 34+/* This is a 32 bit reloc that stores the 32 bit pc relative
34 value in two words (with an imm instruction). No relocation is 35+value in two words (with an imm instruction). No relocation is
35 done here - only used for relaxing */ 36+done here - only used for relaxing */
36- BFD_RELOC_MICROBLAZE_64_NONE,
37+ BFD_RELOC_MICROBLAZE_32_NONE, 37+ BFD_RELOC_MICROBLAZE_32_NONE,
38+ 38+
39+/* This is a 64 bit reloc that stores the 32 bit pc relative
40+ * +value in two words (with an imm instruction). No relocation is
41+ * +done here - only used for relaxing */
42+ BFD_RELOC_MICROBLAZE_64_NONE,
43
44 /* This is a 64 bit reloc that stores the 32 bit pc relative 39 /* This is a 64 bit reloc that stores the 32 bit pc relative
45 value in two words (with an imm instruction). The relocation is 40 value in two words (with an imm instruction). No relocation is
41 done here - only used for relaxing */
46diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 42diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
47index 359484dd5e..1c69c269c7 100644 43index 09dedc46106..1be1ead2f41 100644
48--- a/bfd/elf32-microblaze.c 44--- a/bfd/elf32-microblaze.c
49+++ b/bfd/elf32-microblaze.c 45+++ b/bfd/elf32-microblaze.c
50@@ -176,7 +176,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 46@@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
51 0x0000ffff, /* Dest Mask. */ 47 0x0000ffff, /* Dest Mask. */
52 FALSE), /* PC relative offset? */ 48 FALSE), /* PC relative offset? */
53 49
54- /* This reloc does nothing. Used for relaxation. */
55+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ 50+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
56+ 0, /* Rightshift. */ 51+ 0, /* Rightshift. */
57+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 52+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
@@ -66,10 +61,9 @@ index 359484dd5e..1c69c269c7 100644
66+ 0, /* Dest Mask. */ 61+ 0, /* Dest Mask. */
67+ FALSE), /* PC relative offset? */ 62+ FALSE), /* PC relative offset? */
68+ 63+
69+ /* This reloc does nothing. Used for relaxation. */ 64 /* This reloc does nothing. Used for relaxation. */
70 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ 65 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
71 0, /* Rightshift. */ 66 0, /* Rightshift. */
72 3, /* Size (0 = byte, 1 = short, 2 = long). */
73@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 67@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
74 case BFD_RELOC_NONE: 68 case BFD_RELOC_NONE:
75 microblaze_reloc = R_MICROBLAZE_NONE; 69 microblaze_reloc = R_MICROBLAZE_NONE;
@@ -80,7 +74,7 @@ index 359484dd5e..1c69c269c7 100644
80 case BFD_RELOC_MICROBLAZE_64_NONE: 74 case BFD_RELOC_MICROBLAZE_64_NONE:
81 microblaze_reloc = R_MICROBLAZE_64_NONE; 75 microblaze_reloc = R_MICROBLAZE_64_NONE;
82 break; 76 break;
83@@ -1918,6 +1935,7 @@ microblaze_elf_relax_section (bfd *abfd, 77@@ -1914,14 +1931,22 @@ microblaze_elf_relax_section (bfd *abfd,
84 } 78 }
85 break; 79 break;
86 case R_MICROBLAZE_NONE: 80 case R_MICROBLAZE_NONE:
@@ -88,7 +82,9 @@ index 359484dd5e..1c69c269c7 100644
88 { 82 {
89 /* This was a PC-relative instruction that was 83 /* This was a PC-relative instruction that was
90 completely resolved. */ 84 completely resolved. */
91@@ -1926,12 +1944,18 @@ microblaze_elf_relax_section (bfd *abfd, 85 int sfix, efix;
86+ unsigned int val;
87 bfd_vma target_address;
92 target_address = irel->r_addend + irel->r_offset; 88 target_address = irel->r_addend + irel->r_offset;
93 sfix = calc_fixup (irel->r_offset, 0, sec); 89 sfix = calc_fixup (irel->r_offset, 0, sec);
94 efix = calc_fixup (target_address, 0, sec); 90 efix = calc_fixup (target_address, 0, sec);
@@ -101,20 +97,12 @@ index 359484dd5e..1c69c269c7 100644
101 irel->r_addend -= (efix - sfix); 97 irel->r_addend -= (efix - sfix);
102 /* Should use HOWTO. */ 98 /* Should use HOWTO. */
103 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, 99 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
104 irel->r_addend); 100@@ -1969,12 +1994,16 @@ microblaze_elf_relax_section (bfd *abfd,
105- }
106- break;
107+ }
108+ break;
109 case R_MICROBLAZE_64_NONE:
110 {
111 /* This was a PC-relative 64-bit instruction that was
112@@ -1973,12 +1997,16 @@ microblaze_elf_relax_section (bfd *abfd,
113 irelscanend = irelocs + o->reloc_count; 101 irelscanend = irelocs + o->reloc_count;
114 for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 102 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
115 { 103 {
116- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) 104- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
117+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 105+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
118 { 106 {
119 unsigned int val; 107 unsigned int val;
120 108
@@ -127,22 +115,12 @@ index 359484dd5e..1c69c269c7 100644
127 /* This was a PC-relative instruction that was completely resolved. */ 115 /* This was a PC-relative instruction that was completely resolved. */
128 if (ocontents == NULL) 116 if (ocontents == NULL)
129 { 117 {
130@@ -1999,18 +2027,17 @@ microblaze_elf_relax_section (bfd *abfd, 118@@ -2002,14 +2031,10 @@ microblaze_elf_relax_section (bfd *abfd,
131 (file_ptr) 0, 119 if (val != irelscan->r_addend) {
132 o->rawsize)) 120 fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
133 goto error_return; 121 }
134- elf_section_data (o)->this_hdr.contents = ocontents; 122- irelscan->r_addend -= calc_fixup (irelscan->r_addend
135- } 123- + isym->st_value, 0, sec);
136- }
137- irelscan->r_addend -= calc_fixup (irelscan->r_addend
138- + isym->st_value, sec);
139+ elf_section_data (o)->this_hdr.contents = ocontents;
140+ }
141+ }
142 val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
143+ if (val != irelscan->r_addend) {
144+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
145+ }
146+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec); 124+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
147 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 125 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
148 irelscan->r_addend); 126 irelscan->r_addend);
@@ -153,20 +131,20 @@ index 359484dd5e..1c69c269c7 100644
153 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 131 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
154 { 132 {
155 isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 133 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
156@@ -2070,7 +2097,7 @@ microblaze_elf_relax_section (bfd *abfd, 134@@ -2069,7 +2094,7 @@ microblaze_elf_relax_section (bfd *abfd,
157 elf_section_data (o)->this_hdr.contents = ocontents; 135 elf_section_data (o)->this_hdr.contents = ocontents;
158 } 136 }
159 } 137 }
160- irelscan->r_addend -= calc_fixup (irel->r_addend 138- irelscan->r_addend -= calc_fixup (irel->r_addend
161+ irelscan->r_addend -= calc_fixup (irelscan->r_addend 139+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
162 + isym->st_value, 140 + isym->st_value,
163 0, 141 0,
164 sec); 142 sec);
165diff --git a/bfd/libbfd.h b/bfd/libbfd.h 143diff --git a/bfd/libbfd.h b/bfd/libbfd.h
166index 36284d71a9..feb9fada1e 100644 144index b97534fc9fe..c1551b92405 100644
167--- a/bfd/libbfd.h 145--- a/bfd/libbfd.h
168+++ b/bfd/libbfd.h 146+++ b/bfd/libbfd.h
169@@ -2901,6 +2901,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 147@@ -2967,6 +2967,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
170 "BFD_RELOC_MICROBLAZE_32_ROSDA", 148 "BFD_RELOC_MICROBLAZE_32_ROSDA",
171 "BFD_RELOC_MICROBLAZE_32_RWSDA", 149 "BFD_RELOC_MICROBLAZE_32_RWSDA",
172 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 150 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
@@ -175,10 +153,10 @@ index 36284d71a9..feb9fada1e 100644
175 "BFD_RELOC_MICROBLAZE_64_GOTPC", 153 "BFD_RELOC_MICROBLAZE_64_GOTPC",
176 "BFD_RELOC_MICROBLAZE_64_GOT", 154 "BFD_RELOC_MICROBLAZE_64_GOT",
177diff --git a/bfd/reloc.c b/bfd/reloc.c 155diff --git a/bfd/reloc.c b/bfd/reloc.c
178index e6446a7809..87753ae4f0 100644 156index 9aba84ca81e..9b39b419415 100644
179--- a/bfd/reloc.c 157--- a/bfd/reloc.c
180+++ b/bfd/reloc.c 158+++ b/bfd/reloc.c
181@@ -6795,6 +6795,12 @@ ENUM 159@@ -6858,6 +6858,12 @@ ENUM
182 ENUMDOC 160 ENUMDOC
183 This is a 32 bit reloc for the microblaze to handle 161 This is a 32 bit reloc for the microblaze to handle
184 expressions of the form "Symbol Op Symbol" 162 expressions of the form "Symbol Op Symbol"
@@ -192,10 +170,10 @@ index e6446a7809..87753ae4f0 100644
192 BFD_RELOC_MICROBLAZE_64_NONE 170 BFD_RELOC_MICROBLAZE_64_NONE
193 ENUMDOC 171 ENUMDOC
194diff --git a/binutils/readelf.c b/binutils/readelf.c 172diff --git a/binutils/readelf.c b/binutils/readelf.c
195index b13eb6a43b..da6252c128 100644 173index 6057515a89b..04704d22fef 100644
196--- a/binutils/readelf.c 174--- a/binutils/readelf.c
197+++ b/binutils/readelf.c 175+++ b/binutils/readelf.c
198@@ -13019,6 +13019,10 @@ is_none_reloc (Filedata * filedata, unsigned int reloc_type) 176@@ -13406,6 +13406,10 @@ is_none_reloc (Filedata * filedata, unsigned int reloc_type)
199 || reloc_type == 32 /* R_AVR_DIFF32. */); 177 || reloc_type == 32 /* R_AVR_DIFF32. */);
200 case EM_METAG: 178 case EM_METAG:
201 return reloc_type == 3; /* R_METAG_NONE. */ 179 return reloc_type == 3; /* R_METAG_NONE. */
@@ -207,38 +185,35 @@ index b13eb6a43b..da6252c128 100644
207 return (reloc_type == 0 /* R_XTENSA_NONE. */ 185 return (reloc_type == 0 /* R_XTENSA_NONE. */
208 || reloc_type == 204 /* R_NDS32_DIFF8. */ 186 || reloc_type == 204 /* R_NDS32_DIFF8. */
209diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 187diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
210index 3e728400b7..fa665b4e25 100644 188index d01653aeef9..74a63abeb0c 100644
211--- a/gas/config/tc-microblaze.c 189--- a/gas/config/tc-microblaze.c
212+++ b/gas/config/tc-microblaze.c 190+++ b/gas/config/tc-microblaze.c
213@@ -2201,7 +2201,9 @@ md_apply_fix (fixS * fixP, 191@@ -2198,6 +2198,8 @@ md_apply_fix (fixS * fixP,
214 /* This fixup has been resolved. Create a reloc in case the linker
215 moves code around due to relaxing. */ 192 moves code around due to relaxing. */
216 if (fixP->fx_r_type == BFD_RELOC_64_PCREL) 193 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
217- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 194 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
218+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
219+ else if (fixP->fx_r_type == BFD_RELOC_32) 195+ else if (fixP->fx_r_type == BFD_RELOC_32)
220+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 196+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
221 else 197 else
222 fixP->fx_r_type = BFD_RELOC_NONE; 198 fixP->fx_r_type = BFD_RELOC_NONE;
223 fixP->fx_addsy = section_symbol (absolute_section); 199 fixP->fx_addsy = section_symbol (absolute_section);
224@@ -2426,6 +2428,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 200@@ -2422,6 +2424,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
225 switch (fixp->fx_r_type) 201 switch (fixp->fx_r_type)
226 { 202 {
227 case BFD_RELOC_NONE: 203 case BFD_RELOC_NONE:
228+ case BFD_RELOC_MICROBLAZE_32_NONE: 204+ case BFD_RELOC_MICROBLAZE_32_NONE:
229 case BFD_RELOC_MICROBLAZE_64_NONE: 205 case BFD_RELOC_MICROBLAZE_64_NONE:
230 case BFD_RELOC_32: 206 case BFD_RELOC_32:
231 case BFD_RELOC_MICROBLAZE_32_LO: 207 case BFD_RELOC_MICROBLAZE_32_LO:
232diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 208diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
233index 830b5ad446..6ee0966444 100644 209index 2fec296967b..55f34f72b0d 100644
234--- a/include/elf/microblaze.h 210--- a/include/elf/microblaze.h
235+++ b/include/elf/microblaze.h 211+++ b/include/elf/microblaze.h
236@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 212@@ -61,6 +61,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
237 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */ 213 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
238 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ 214 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
239 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ 215 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
240+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 216+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
241+
242 END_RELOC_NUMBERS (R_MICROBLAZE_max) 217 END_RELOC_NUMBERS (R_MICROBLAZE_max)
243 218
244 /* Global base address names. */ 219 /* Global base address names. */
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch
index 97d692c7..4319f1d7 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0006-upstream-change-to-garbage-collection-sweep-causes-m.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -1,7 +1,7 @@
1From 403d6e82742452be4e3f3010c8d9989f0a490c0b Mon Sep 17 00:00:00 2001 1From 3f743710f53d86ed5e53d97b3b1b06d7a8cbcdc1 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 998b72f2281..2daf8fdf6a8 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@@ -6372,7 +6372,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/binutils/binutils/0007-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch
index 49534b4e..4ab7681e 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0007-Fix-bug-in-TLSTPREL-Relocation.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch
@@ -1,7 +1,7 @@
1From 072a8968c50b2ebd93e225a6b959916f9d60b493 Mon Sep 17 00:00:00 2001 1From 481dd44f36e7df691037201d9865482debbb397d 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,10 +13,10 @@ 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 1be1ead2f41..ec1944c6faf 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@@ -1447,9 +1447,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
20 relocation += addend; 20 relocation += addend;
21 relocation -= dtprel_base(info); 21 relocation -= dtprel_base(info);
22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch
index 51fcee90..c5bd3b2d 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-Address-extension-instructions.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch
@@ -1,7 +1,7 @@
1From 4674056da6bafa8168c0a680498b958f3a39be94 Mon Sep 17 00:00:00 2001 1From fa85df88dc229f7f8f0bc09cd0995d05f49c03b7 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 | 13 ++++++++++++-
20 opcodes/microblaze-opcm.h | 10 +++++----- 21 opcodes/microblaze-opcm.h | 10 +++++-----
21 2 files changed, 16 insertions(+), 5 deletions(-) 22 2 files changed, 17 insertions(+), 6 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 b6c5016e4d2..c7a506b845a 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 },
@@ -71,7 +81,7 @@ 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 }, 81 {"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}, 82 {"", 0, 0, 0, 0, 0, 0, 0, 0},
73diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 83diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
74index 42f3dd3be5..1c39dbf50b 100644 84index 795c57b5ff6..b05e319862e 100644
75--- a/opcodes/microblaze-opcm.h 85--- a/opcodes/microblaze-opcm.h
76+++ b/opcodes/microblaze-opcm.h 86+++ b/opcodes/microblaze-opcm.h
77@@ -33,13 +33,13 @@ enum microblaze_instr 87@@ -33,13 +33,13 @@ enum microblaze_instr
@@ -90,7 +100,7 @@ index 42f3dd3be5..1c39dbf50b 100644
90- shr, sw, swr, swx, lbui, lhui, lwi, 100- shr, sw, swr, swx, lbui, lhui, lwi,
91+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, 101+ 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, 102+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
93 sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 103 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, 104 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
95 fint, fsqrt, 105 fint, fsqrt,
96-- 106--
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0009-fixing-the-MAX_OPCODES-to-correct-value.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0009-fixing-the-MAX_OPCODES-to-correct-value.patch
deleted file mode 100644
index d93ccd20..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0009-fixing-the-MAX_OPCODES-to-correct-value.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 7651a2f7ab486e26981cb5e032bf578d0951ff4a 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/binutils/binutils/0010-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch
index 901c53e6..1612c11c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch
@@ -1,7 +1,7 @@
1From 7e9e123337f2d441b213ea9d0be07e9049241f64 Mon Sep 17 00:00:00 2001 1From 0034d6b5231a0a72c5f9fc47ba4c8eba0c35ff39 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
@@ -14,13 +14,13 @@ The rest of the bits in the destination register shall be unchanged
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15--- 15---
16 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++- 16 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
17 opcodes/microblaze-dis.c | 16 +++++++++ 17 opcodes/microblaze-dis.c | 17 +++++++++
18 opcodes/microblaze-opc.h | 12 ++++++- 18 opcodes/microblaze-opc.h | 12 ++++++-
19 opcodes/microblaze-opcm.h | 6 +++- 19 opcodes/microblaze-opcm.h | 6 +++-
20 4 files changed, 102 insertions(+), 3 deletions(-) 20 4 files changed, 103 insertions(+), 3 deletions(-)
21 21
22diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 22diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
23index fa665b4e25..71bb888ab8 100644 23index 74a63abeb0c..765abfb3885 100644
24--- a/gas/config/tc-microblaze.c 24--- a/gas/config/tc-microblaze.c
25+++ b/gas/config/tc-microblaze.c 25+++ b/gas/config/tc-microblaze.c
26@@ -917,7 +917,7 @@ md_assemble (char * str) 26@@ -917,7 +917,7 @@ md_assemble (char * str)
@@ -110,41 +110,42 @@ index fa665b4e25..71bb888ab8 100644
110 if (strcmp (op_end, "")) 110 if (strcmp (op_end, ""))
111 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 111 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
112diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 112diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
113index f691740dfd..f8aaf27873 100644 113index be1534c257c..52c9068805f 100644
114--- a/opcodes/microblaze-dis.c 114--- a/opcodes/microblaze-dis.c
115+++ b/opcodes/microblaze-dis.c 115+++ b/opcodes/microblaze-dis.c
116@@ -73,6 +73,18 @@ get_field_imm5_mbar (long instr) 116@@ -90,6 +90,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
117 return(strdup(tmpstr)); 117 return p;
118 } 118 }
119 119
120+static char * 120+static char *
121+get_field_imm5width (long instr) 121+get_field_imm5width (struct string_buf *buf, long instr)
122+{ 122+{
123+ char tmpstr[25]; 123+ char *p = strbuf (buf);
124+ 124+
125+ if (instr & 0x00004000) 125+ if (instr & 0x00004000)
126+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 126+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
127+ else 127+ else
128+ sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */ 128+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
129+ return (strdup (tmpstr)); 129+ return p;
130+} 130+}
131+ 131+
132 static char * 132 static char *
133 get_field_rfsl (long instr) 133 get_field_rfsl (struct string_buf *buf, long instr)
134 { 134 {
135@@ -396,6 +408,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 135@@ -428,6 +440,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
136 /* For mbar 16 or sleep insn. */ 136 case INST_TYPE_NONE:
137 case INST_TYPE_NONE: 137 break;
138 break; 138 /* For tuqula instruction */
139+ /* For bit field insns. */ 139+ /* For bit field insns. */
140+ case INST_TYPE_RD_R1_IMM5_IMM5: 140+ case INST_TYPE_RD_R1_IMM5_IMM5:
141+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst),get_field_r1(inst),get_field_imm5width (inst), get_field_imm5 (inst)); 141+ 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));
142+ break; 142+ break;
143 /* For tuqula instruction */ 143+ /* For tuqula instruction */
144 case INST_TYPE_RD: 144 case INST_TYPE_RD:
145 print_func (stream, "\t%s", get_field_rd (inst)); 145 print_func (stream, "\t%s", get_field_rd (&buf, inst));
146 break;
146diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 147diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
147index 2a6b841232..ce8ac351b5 100644 148index c7a506b845a..f61f4ef66d9 100644
148--- a/opcodes/microblaze-opc.h 149--- a/opcodes/microblaze-opc.h
149+++ b/opcodes/microblaze-opc.h 150+++ b/opcodes/microblaze-opc.h
150@@ -59,6 +59,9 @@ 151@@ -59,6 +59,9 @@
@@ -195,7 +196,7 @@ index 2a6b841232..ce8ac351b5 100644
195 #endif /* MICROBLAZE_OPC */ 196 #endif /* MICROBLAZE_OPC */
196 197
197diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 198diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
198index 1c39dbf50b..28662694cd 100644 199index b05e319862e..fa921c90c98 100644
199--- a/opcodes/microblaze-opcm.h 200--- a/opcodes/microblaze-opcm.h
200+++ b/opcodes/microblaze-opcm.h 201+++ b/opcodes/microblaze-opcm.h
201@@ -29,7 +29,7 @@ enum microblaze_instr 202@@ -29,7 +29,7 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch
index 4c1b0c25..fcb9c8ae 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch
@@ -1,18 +1,18 @@
1From 8b2e8fe916066bb1caa99abc67f8cde3ebd41c70 Mon Sep 17 00:00:00 2001 1From 75e55d8ebf3cd780fe69c066163ab2da7ac204f2 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 ec1944c6faf..cf4a7fdba33 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@@ -1865,8 +1865,7 @@ microblaze_elf_relax_section (bfd *abfd,
16 else 16 else
17 symval += irel->r_addend; 17 symval += irel->r_addend;
18 18
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
index ad4db430..02cc1259 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
@@ -1,7 +1,7 @@
1From 2a7b66bbc0473c6cbe6653a48818962b5b411ef2 Mon Sep 17 00:00:00 2001 1From 5432f81ba9d7c17b20ff576c7c09ae78f4fe6e9c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Fri, 29 Sep 2017 18:00:23 +0530 3Date: Fri, 29 Sep 2017 18:00:23 +0530
4Subject: [PATCH 12/43] [Patch,Microblaze]: fixed bug in GCC so that It will 4Subject: [PATCH 12/40] [Patch,Microblaze]: fixed bug in GCC so that It will
5 support .long 0U and .long 0u 5 support .long 0U and .long 0u
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 12/43] [Patch,Microblaze]: fixed bug in GCC so that It will
9 1 file changed, 9 insertions(+) 9 1 file changed, 9 insertions(+)
10 10
11diff --git a/gas/expr.c b/gas/expr.c 11diff --git a/gas/expr.c b/gas/expr.c
12index ee85bda1cc..b502418b71 100644 12index 6f8ccb82303..0e34ca53d9b 100644
13--- a/gas/expr.c 13--- a/gas/expr.c
14+++ b/gas/expr.c 14+++ b/gas/expr.c
15@@ -810,6 +810,15 @@ operand (expressionS *expressionP, enum expr_mode mode) 15@@ -803,6 +803,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
16 break; 16 break;
17 } 17 }
18 } 18 }
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch
index 323b7bde..accff214 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch
@@ -1,15 +1,15 @@
1From 59a9a1a913b7dfa424792c907001413c1ddd320c Mon Sep 17 00:00:00 2001 1From 6337e24a220dca86b71efcc10c5ffed6bf11bc22 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 16 Oct 2017 15:44:23 +0530 3Date: Mon, 16 Oct 2017 15:44:23 +0530
4Subject: [PATCH 13/43] fixing the constant range check issue sample error: not 4Subject: [PATCH 13/40] fixing the constant range check issue
5 in range ffffffff80000000..7fffffff, not ffffffff70000000
6 5
6sample error: not in range ffffffff80000000..7fffffff, not ffffffff70000000
7--- 7---
8 gas/config/tc-microblaze.c | 2 +- 8 gas/config/tc-microblaze.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-) 9 1 file changed, 1 insertion(+), 1 deletion(-)
10 10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 71bb888ab8..16b10d00a9 100644 12index 765abfb3885..5810a74a5fc 100644
13--- a/gas/config/tc-microblaze.c 13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c 14+++ b/gas/config/tc-microblaze.c
15@@ -757,7 +757,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) 15@@ -757,7 +757,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
index 1a3e0130..cdbe65a6 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
@@ -1,7 +1,7 @@
1From 00b7561a868b08dab952b9b9f4a01118195aeb29 Mon Sep 17 00:00:00 2001 1From e7e06edfb6c24a993603c9100f8ab8c29999ef90 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 21 Feb 2018 12:32:02 +0530 3Date: Wed, 21 Feb 2018 12:32:02 +0530
4Subject: [PATCH 14/43] [Patch,Microblaze]: Compiler will give error messages 4Subject: [PATCH 14/40] [Patch,Microblaze]: Compiler will give error messages
5 in more detail for mxl-gp-opt flag.. 5 in more detail for mxl-gp-opt flag..
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 14/43] [Patch,Microblaze]: Compiler will give error messages
9 1 file changed, 12 insertions(+) 9 1 file changed, 12 insertions(+)
10 10
11diff --git a/ld/ldmain.c b/ld/ldmain.c 11diff --git a/ld/ldmain.c b/ld/ldmain.c
12index 77cdbd0dd2..517d85baef 100644 12index 08be9030cb5..613d748fefd 100644
13--- a/ld/ldmain.c 13--- a/ld/ldmain.c
14+++ b/ld/ldmain.c 14+++ b/ld/ldmain.c
15@@ -1446,6 +1446,18 @@ reloc_overflow (struct bfd_link_info *info, 15@@ -1515,6 +1515,18 @@ reloc_overflow (struct bfd_link_info *info,
16 break; 16 break;
17 case bfd_link_hash_defined: 17 case bfd_link_hash_defined:
18 case bfd_link_hash_defweak: 18 case bfd_link_hash_defweak:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch
index d0f96eca..9f228015 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch
@@ -1,7 +1,7 @@
1From 9aeae734291f8aaeb449c1403561b71de1ea3bea Mon Sep 17 00:00:00 2001 1From a7626e576d867c6c9c8321f00cf5e17dc31c52b8 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,78 +9,79 @@ 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 gas/config/tc-microblaze.c | 274 ++- 16 gas/config/tc-microblaze.c | 274 ++-
16 gas/config/tc-microblaze.h | 4 +- 17 gas/config/tc-microblaze.h | 4 +-
17 include/elf/common.h | 1 + 18 include/elf/common.h | 1 +
18 ld/Makefile.am | 8 + 19 ld/Makefile.am | 4 +
19 ld/Makefile.in | 10 + 20 ld/Makefile.in | 7 +
20 ld/configure.tgt | 3 + 21 ld/configure.tgt | 3 +
21 ld/emulparams/elf64microblaze.sh | 23 + 22 ld/emulparams/elf64microblaze.sh | 23 +
22 ld/emulparams/elf64microblazeel.sh | 23 + 23 ld/emulparams/elf64microblazeel.sh | 23 +
23 opcodes/microblaze-dis.c | 39 +- 24 opcodes/microblaze-dis.c | 43 +-
24 opcodes/microblaze-opc.h | 162 +- 25 opcodes/microblaze-opc.h | 162 +-
25 opcodes/microblaze-opcm.h | 20 +- 26 opcodes/microblaze-opcm.h | 20 +-
26 19 files changed, 4181 insertions(+), 41 deletions(-) 27 20 files changed, 4156 insertions(+), 43 deletions(-)
27 create mode 100644 bfd/elf64-microblaze.c 28 create mode 100644 bfd/elf64-microblaze.c
28 create mode 100644 ld/emulparams/elf64microblaze.sh 29 create mode 100644 ld/emulparams/elf64microblaze.sh
29 create mode 100644 ld/emulparams/elf64microblazeel.sh 30 create mode 100644 ld/emulparams/elf64microblazeel.sh
30 31
31diff --git a/bfd/Makefile.am b/bfd/Makefile.am 32diff --git a/bfd/Makefile.am b/bfd/Makefile.am
32index a9191555ad..c5fd250812 100644 33index c88c4480001..9e12b34038c 100644
33--- a/bfd/Makefile.am 34--- a/bfd/Makefile.am
34+++ b/bfd/Makefile.am 35+++ b/bfd/Makefile.am
35@@ -570,6 +570,7 @@ BFD64_BACKENDS = \ 36@@ -552,6 +552,7 @@ BFD64_BACKENDS = \
36 elf64-riscv.lo \ 37 elf64-ia64.lo \
37 elfxx-riscv.lo \ 38 elf64-ia64-vms.lo \
38 elf64-s390.lo \ 39 elfxx-ia64.lo \
39+ elf64-microblaze.lo \ 40+ elf64-microblaze.lo \
40 elf64-sparc.lo \ 41 elfn32-mips.lo \
41 elf64-tilegx.lo \ 42 elf64-mips.lo \
42 elf64-x86-64.lo \ 43 elfxx-mips.lo \
43@@ -603,6 +604,7 @@ BFD64_BACKENDS_CFILES = \ 44@@ -591,6 +592,7 @@ BFD64_BACKENDS_CFILES = \
44 elf64-nfp.c \ 45 elf64-gen.c \
45 elf64-ppc.c \ 46 elf64-hppa.c \
46 elf64-s390.c \ 47 elf64-ia64-vms.c \
47+ elf64-microblaze.c \ 48+ elf64-microblaze.c \
48 elf64-sparc.c \ 49 elf64-mips.c \
49 elf64-tilegx.c \ 50 elf64-mmix.c \
50 elf64-x86-64.c \ 51 elf64-nfp.c \
51diff --git a/bfd/Makefile.in b/bfd/Makefile.in 52diff --git a/bfd/Makefile.in b/bfd/Makefile.in
52index 896df52042..fd457cba1e 100644 53index d0d14c6ab32..5c12b706616 100644
53--- a/bfd/Makefile.in 54--- a/bfd/Makefile.in
54+++ b/bfd/Makefile.in 55+++ b/bfd/Makefile.in
55@@ -995,6 +995,7 @@ BFD64_BACKENDS = \ 56@@ -978,6 +978,7 @@ BFD64_BACKENDS = \
56 elf64-riscv.lo \ 57 elf64-ia64.lo \
57 elfxx-riscv.lo \ 58 elf64-ia64-vms.lo \
58 elf64-s390.lo \ 59 elfxx-ia64.lo \
59+ elf64-microblaze.lo \ 60+ elf64-microblaze.lo \
60 elf64-sparc.lo \ 61 elfn32-mips.lo \
61 elf64-tilegx.lo \ 62 elf64-mips.lo \
62 elf64-x86-64.lo \ 63 elfxx-mips.lo \
63@@ -1028,6 +1029,7 @@ BFD64_BACKENDS_CFILES = \ 64@@ -1017,6 +1018,7 @@ BFD64_BACKENDS_CFILES = \
64 elf64-nfp.c \ 65 elf64-gen.c \
65 elf64-ppc.c \ 66 elf64-hppa.c \
66 elf64-s390.c \ 67 elf64-ia64-vms.c \
67+ elf64-microblaze.c \ 68+ elf64-microblaze.c \
68 elf64-sparc.c \ 69 elf64-mips.c \
69 elf64-tilegx.c \ 70 elf64-mmix.c \
70 elf64-x86-64.c \ 71 elf64-nfp.c \
71@@ -1494,6 +1496,7 @@ distclean-compile: 72@@ -1495,6 +1497,7 @@ distclean-compile:
72 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@ 73 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
73 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@ 74 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@
74 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@ 75 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64.Plo@am__quote@
75+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@ 76+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
76 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@ 77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@
77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@ 78 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@
78 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@ 79 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-nfp.Plo@am__quote@
79diff --git a/bfd/config.bfd b/bfd/config.bfd 80diff --git a/bfd/config.bfd b/bfd/config.bfd
80index 0e1ddb659c..93d210643d 100644 81index 14523caf0c5..437c03bb9d9 100644
81--- a/bfd/config.bfd 82--- a/bfd/config.bfd
82+++ b/bfd/config.bfd 83+++ b/bfd/config.bfd
83@@ -850,11 +850,15 @@ case "${targ}" in 84@@ -825,11 +825,15 @@ case "${targ}" in
84 microblazeel*-*) 85 microblazeel*-*)
85 targ_defvec=microblaze_elf32_le_vec 86 targ_defvec=microblaze_elf32_le_vec
86 targ_selvecs=microblaze_elf32_vec 87 targ_selvecs=microblaze_elf32_vec
@@ -97,36 +98,36 @@ index 0e1ddb659c..93d210643d 100644
97 98
98 #ifdef BFD64 99 #ifdef BFD64
99diff --git a/bfd/configure b/bfd/configure 100diff --git a/bfd/configure b/bfd/configure
100index 04786696dc..d455abe7c5 100755 101index 5ab3e856bc2..982ecd254a8 100755
101--- a/bfd/configure 102--- a/bfd/configure
102+++ b/bfd/configure 103+++ b/bfd/configure
103@@ -14847,6 +14847,8 @@ do 104@@ -14828,6 +14828,8 @@ do
104 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;; 105 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;;
105 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; 106 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
106 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 107 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
107+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 108+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
108+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 109+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
109 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 110 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
110 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 111 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
111 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; 112 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
112diff --git a/bfd/configure.ac b/bfd/configure.ac 113diff --git a/bfd/configure.ac b/bfd/configure.ac
113index eda38ea086..f01c3362fe 100644 114index 8e86f8399ce..38e80148171 100644
114--- a/bfd/configure.ac 115--- a/bfd/configure.ac
115+++ b/bfd/configure.ac 116+++ b/bfd/configure.ac
116@@ -615,6 +615,8 @@ do 117@@ -564,6 +564,8 @@ do
117 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;; 118 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;;
118 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; 119 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
119 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 120 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;;
120+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 121+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
121+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 122+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
122 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 123 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
123 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;; 124 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
124 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;; 125 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;;
125diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 126diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
126index 9bc2eb3de9..c91ba46f75 100644 127index 05a3f767e22..f94dc2c177b 100644
127--- a/bfd/cpu-microblaze.c 128--- a/bfd/cpu-microblaze.c
128+++ b/bfd/cpu-microblaze.c 129+++ b/bfd/cpu-microblaze.c
129@@ -23,7 +23,24 @@ 130@@ -23,7 +23,25 @@
130 #include "bfd.h" 131 #include "bfd.h"
131 #include "libbfd.h" 132 #include "libbfd.h"
132 133
@@ -147,15 +148,16 @@ index 9bc2eb3de9..c91ba46f75 100644
147+ bfd_default_compatible, /* Architecture comparison function. */ 148+ bfd_default_compatible, /* Architecture comparison function. */
148+ bfd_default_scan, /* String to architecture conversion. */ 149+ bfd_default_scan, /* String to architecture conversion. */
149+ bfd_arch_default_fill, /* Default fill. */ 150+ bfd_arch_default_fill, /* Default fill. */
150+ &bfd_microblaze_arch[1] /* Next in list. */ 151+ &bfd_microblaze_arch[1], /* Next in list. */
152+ 0 /* Maximum offset of a reloc from the start of an insn. */
151+}, 153+},
152 { 154 {
153 32, /* 32 bits in a word. */ 155 32, /* Bits in a word. */
154 32, /* 32 bits in an address. */ 156 32, /* Bits in an address. */
155@@ -38,4 +55,37 @@ const bfd_arch_info_type bfd_microblaze_arch = 157@@ -39,4 +57,39 @@ const bfd_arch_info_type bfd_microblaze_arch =
156 bfd_default_scan, /* String to architecture conversion. */
157 bfd_arch_default_fill, /* Default fill. */ 158 bfd_arch_default_fill, /* Default fill. */
158 NULL /* Next in list. */ 159 NULL, /* Next in list. */
160 0 /* Maximum offset of a reloc from the start of an insn. */
159+} 161+}
160+#else 162+#else
161+{ 163+{
@@ -171,7 +173,8 @@ index 9bc2eb3de9..c91ba46f75 100644
171+ bfd_default_compatible, /* Architecture comparison function. */ 173+ bfd_default_compatible, /* Architecture comparison function. */
172+ bfd_default_scan, /* String to architecture conversion. */ 174+ bfd_default_scan, /* String to architecture conversion. */
173+ bfd_arch_default_fill, /* Default fill. */ 175+ bfd_arch_default_fill, /* Default fill. */
174+ &bfd_microblaze_arch[1] /* Next in list. */ 176+ &bfd_microblaze_arch[1], /* Next in list. */
177+ 0 /* Maximum offset of a reloc from the start of an insn. */
175+}, 178+},
176+{ 179+{
177+ 64, /* 32 bits in a word. */ 180+ 64, /* 32 bits in a word. */
@@ -186,16 +189,29 @@ index 9bc2eb3de9..c91ba46f75 100644
186+ bfd_default_compatible, /* Architecture comparison function. */ 189+ bfd_default_compatible, /* Architecture comparison function. */
187+ bfd_default_scan, /* String to architecture conversion. */ 190+ bfd_default_scan, /* String to architecture conversion. */
188+ bfd_arch_default_fill, /* Default fill. */ 191+ bfd_arch_default_fill, /* Default fill. */
189+ NULL /* Next in list. */ 192+ NULL, /* Next in list. */
193+ 0 /* Maximum offset of a reloc from the start of an insn. */
190+} 194+}
191+#endif 195+#endif
192 }; 196 };
197diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
198index 2c1ddd45b8d..a976b24d0bf 100644
199--- a/bfd/doc/Makefile.in
200+++ b/bfd/doc/Makefile.in
201@@ -375,6 +375,7 @@ pdfdir = @pdfdir@
202 prefix = @prefix@
203 program_transform_name = @program_transform_name@
204 psdir = @psdir@
205+runstatedir = @runstatedir@
206 sbindir = @sbindir@
207 sharedstatedir = @sharedstatedir@
208 srcdir = @srcdir@
193diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 209diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
194new file mode 100644 210new file mode 100644
195index 0000000000..0f43ae6ea8 211index 00000000000..fa4b95e47e0
196--- /dev/null 212--- /dev/null
197+++ b/bfd/elf64-microblaze.c 213+++ b/bfd/elf64-microblaze.c
198@@ -0,0 +1,3584 @@ 214@@ -0,0 +1,3560 @@
199+/* Xilinx MicroBlaze-specific support for 32-bit ELF 215+/* Xilinx MicroBlaze-specific support for 32-bit ELF
200+ 216+
201+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 217+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -853,7 +869,7 @@ index 0000000000..0f43ae6ea8
853+ 869+
854+/* Set the howto pointer for a RCE ELF reloc. */ 870+/* Set the howto pointer for a RCE ELF reloc. */
855+ 871+
856+static void 872+static bfd_boolean
857+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, 873+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
858+ arelent * cache_ptr, 874+ arelent * cache_ptr,
859+ Elf_Internal_Rela * dst) 875+ Elf_Internal_Rela * dst)
@@ -867,13 +883,14 @@ index 0000000000..0f43ae6ea8
867+ r_type = ELF64_R_TYPE (dst->r_info); 883+ r_type = ELF64_R_TYPE (dst->r_info);
868+ if (r_type >= R_MICROBLAZE_max) 884+ if (r_type >= R_MICROBLAZE_max)
869+ { 885+ {
870+ (*_bfd_error_handler) (_("%B: unrecognised MicroBlaze reloc number: %d"), 886+ (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"),
871+ abfd, r_type); 887+ abfd, r_type);
872+ bfd_set_error (bfd_error_bad_value); 888+ bfd_set_error (bfd_error_bad_value);
873+ r_type = R_MICROBLAZE_NONE; 889+ return FALSE;
874+ } 890+ }
875+ 891+
876+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 892+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
893+ return TRUE;
877+} 894+}
878+ 895+
879+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 896+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
@@ -1272,7 +1289,7 @@ index 0000000000..0f43ae6ea8
1272+ /* Only relocate if the symbol is defined. */ 1289+ /* Only relocate if the symbol is defined. */
1273+ if (sec) 1290+ if (sec)
1274+ { 1291+ {
1275+ name = bfd_get_section_name (sec->owner, sec); 1292+ name = bfd_section_name (sec);
1276+ 1293+
1277+ if (strcmp (name, ".sdata2") == 0 1294+ if (strcmp (name, ".sdata2") == 0
1278+ || strcmp (name, ".sbss2") == 0) 1295+ || strcmp (name, ".sbss2") == 0)
@@ -1301,7 +1318,7 @@ index 0000000000..0f43ae6ea8
1301+ bfd_get_filename (input_bfd), 1318+ bfd_get_filename (input_bfd),
1302+ sym_name, 1319+ sym_name,
1303+ microblaze_elf_howto_table[(int) r_type]->name, 1320+ microblaze_elf_howto_table[(int) r_type]->name,
1304+ bfd_get_section_name (sec->owner, sec)); 1321+ bfd_section_name (sec));
1305+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1322+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1306+ ret = FALSE; 1323+ ret = FALSE;
1307+ continue; 1324+ continue;
@@ -1317,7 +1334,7 @@ index 0000000000..0f43ae6ea8
1317+ /* Only relocate if the symbol is defined. */ 1334+ /* Only relocate if the symbol is defined. */
1318+ if (sec) 1335+ if (sec)
1319+ { 1336+ {
1320+ name = bfd_get_section_name (sec->owner, sec); 1337+ name = bfd_section_name (sec);
1321+ 1338+
1322+ if (strcmp (name, ".sdata") == 0 1339+ if (strcmp (name, ".sdata") == 0
1323+ || strcmp (name, ".sbss") == 0) 1340+ || strcmp (name, ".sbss") == 0)
@@ -1346,7 +1363,7 @@ index 0000000000..0f43ae6ea8
1346+ bfd_get_filename (input_bfd), 1363+ bfd_get_filename (input_bfd),
1347+ sym_name, 1364+ sym_name,
1348+ microblaze_elf_howto_table[(int) r_type]->name, 1365+ microblaze_elf_howto_table[(int) r_type]->name,
1349+ bfd_get_section_name (sec->owner, sec)); 1366+ bfd_section_name (sec));
1350+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1367+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1351+ ret = FALSE; 1368+ ret = FALSE;
1352+ continue; 1369+ continue;
@@ -1408,6 +1425,7 @@ index 0000000000..0f43ae6ea8
1408+ goto dogot; 1425+ goto dogot;
1409+ case (int) R_MICROBLAZE_TLSLD: 1426+ case (int) R_MICROBLAZE_TLSLD:
1410+ tls_type = (TLS_TLS | TLS_LD); 1427+ tls_type = (TLS_TLS | TLS_LD);
1428+ /* Fall through. */
1411+ dogot: 1429+ dogot:
1412+ case (int) R_MICROBLAZE_GOT_64: 1430+ case (int) R_MICROBLAZE_GOT_64:
1413+ { 1431+ {
@@ -1708,7 +1726,7 @@ index 0000000000..0f43ae6ea8
1708+ { 1726+ {
1709+ BFD_FAIL (); 1727+ BFD_FAIL ();
1710+ (*_bfd_error_handler) 1728+ (*_bfd_error_handler)
1711+ (_("%B: probably compiled without -fPIC?"), 1729+ (_("%pB: probably compiled without -fPIC?"),
1712+ input_bfd); 1730+ input_bfd);
1713+ bfd_set_error (bfd_error_bad_value); 1731+ bfd_set_error (bfd_error_bad_value);
1714+ return FALSE; 1732+ return FALSE;
@@ -1762,7 +1780,7 @@ index 0000000000..0f43ae6ea8
1762+ name = (bfd_elf_string_from_elf_section 1780+ name = (bfd_elf_string_from_elf_section
1763+ (input_bfd, symtab_hdr->sh_link, sym->st_name)); 1781+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
1764+ if (name == NULL || *name == '\0') 1782+ if (name == NULL || *name == '\0')
1765+ name = bfd_section_name (input_bfd, sec); 1783+ name = bfd_section_name (sec);
1766+ } 1784+ }
1767+ 1785+
1768+ if (errmsg != NULL) 1786+ if (errmsg != NULL)
@@ -1807,21 +1825,6 @@ index 0000000000..0f43ae6ea8
1807+ return ret; 1825+ return ret;
1808+} 1826+}
1809+ 1827+
1810+/* Merge backend specific data from an object file to the output
1811+ object file when linking.
1812+
1813+ Note: We only use this hook to catch endian mismatches. */
1814+static bfd_boolean
1815+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
1816+{
1817+ /* Check if we have the same endianess. */
1818+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
1819+ return FALSE;
1820+
1821+ return TRUE;
1822+}
1823+
1824+
1825+/* Calculate fixup value for reference. */ 1828+/* Calculate fixup value for reference. */
1826+ 1829+
1827+static int 1830+static int
@@ -2138,7 +2141,7 @@ index 0000000000..0f43ae6ea8
2138+ irelscanend = irelocs + o->reloc_count; 2141+ irelscanend = irelocs + o->reloc_count;
2139+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 2142+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2140+ { 2143+ {
2141+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 2144+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2142+ { 2145+ {
2143+ unsigned int val; 2146+ unsigned int val;
2144+ 2147+
@@ -2497,17 +2500,6 @@ index 0000000000..0f43ae6ea8
2497+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); 2500+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2498+} 2501+}
2499+ 2502+
2500+/* Update the got entry reference counts for the section being removed. */
2501+
2502+static bfd_boolean
2503+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
2504+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
2505+ asection * sec ATTRIBUTE_UNUSED,
2506+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
2507+{
2508+ return TRUE;
2509+}
2510+
2511+/* PIC support. */ 2503+/* PIC support. */
2512+ 2504+
2513+#define PLT_ENTRY_SIZE 16 2505+#define PLT_ENTRY_SIZE 16
@@ -2540,13 +2532,13 @@ index 0000000000..0f43ae6ea8
2540+ if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL) 2532+ if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL)
2541+ htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got"); 2533+ htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got");
2542+ if (htab->srelgot == NULL 2534+ if (htab->srelgot == NULL
2543+ || ! bfd_set_section_flags (dynobj, htab->srelgot, SEC_ALLOC 2535+ || ! bfd_set_section_flags (htab->srelgot, SEC_ALLOC
2544+ | SEC_LOAD 2536+ | SEC_LOAD
2545+ | SEC_HAS_CONTENTS 2537+ | SEC_HAS_CONTENTS
2546+ | SEC_IN_MEMORY 2538+ | SEC_IN_MEMORY
2547+ | SEC_LINKER_CREATED 2539+ | SEC_LINKER_CREATED
2548+ | SEC_READONLY) 2540+ | SEC_READONLY)
2549+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) 2541+ || ! bfd_set_section_alignment (htab->srelgot, 2))
2550+ return FALSE; 2542+ return FALSE;
2551+ return TRUE; 2543+ return TRUE;
2552+} 2544+}
@@ -2627,7 +2619,7 @@ index 0000000000..0f43ae6ea8
2627+ 2619+
2628+ /* PR15323, ref flags aren't set for references in the same 2620+ /* PR15323, ref flags aren't set for references in the same
2629+ object. */ 2621+ object. */
2630+ h->root.non_ir_ref = 1; 2622+ h->root.non_ir_ref_regular = 1;
2631+ } 2623+ }
2632+ 2624+
2633+ switch (r_type) 2625+ switch (r_type)
@@ -2663,6 +2655,7 @@ index 0000000000..0f43ae6ea8
2663+ tls_type |= (TLS_TLS | TLS_LD); 2655+ tls_type |= (TLS_TLS | TLS_LD);
2664+ dogottls: 2656+ dogottls:
2665+ sec->has_tls_reloc = 1; 2657+ sec->has_tls_reloc = 1;
2658+ /* Fall through. */
2666+ case R_MICROBLAZE_GOT_64: 2659+ case R_MICROBLAZE_GOT_64:
2667+ if (htab->sgot == NULL) 2660+ if (htab->sgot == NULL)
2668+ { 2661+ {
@@ -2936,12 +2929,12 @@ index 0000000000..0f43ae6ea8
2936+ /* If this is a weak symbol, and there is a real definition, the 2929+ /* If this is a weak symbol, and there is a real definition, the
2937+ processor independent code will have arranged for us to see the 2930+ processor independent code will have arranged for us to see the
2938+ real definition first, and we can just use the same value. */ 2931+ real definition first, and we can just use the same value. */
2939+ if (h->u.weakdef != NULL) 2932+ if (h->is_weakalias)
2940+ { 2933+ {
2941+ BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined 2934+ struct elf_link_hash_entry *def = weakdef (h);
2942+ || h->u.weakdef->root.type == bfd_link_hash_defweak); 2935+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
2943+ h->root.u.def.section = h->u.weakdef->root.u.def.section; 2936+ h->root.u.def.section = def->root.u.def.section;
2944+ h->root.u.def.value = h->u.weakdef->root.u.def.value; 2937+ h->root.u.def.value = def->root.u.def.value;
2945+ return TRUE; 2938+ return TRUE;
2946+ } 2939+ }
2947+ 2940+
@@ -3013,9 +3006,9 @@ index 0000000000..0f43ae6ea8
3013+ sdynbss = htab->sdynbss; 3006+ sdynbss = htab->sdynbss;
3014+ /* Apply the required alignment. */ 3007+ /* Apply the required alignment. */
3015+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two)); 3008+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
3016+ if (power_of_two > bfd_get_section_alignment (dynobj, sdynbss)) 3009+ if (power_of_two > bfd_section_alignment (sdynbss))
3017+ { 3010+ {
3018+ if (! bfd_set_section_alignment (dynobj, sdynbss, power_of_two)) 3011+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
3019+ return FALSE; 3012+ return FALSE;
3020+ } 3013+ }
3021+ 3014+
@@ -3362,7 +3355,7 @@ index 0000000000..0f43ae6ea8
3362+ 3355+
3363+ /* It's OK to base decisions on the section name, because none 3356+ /* It's OK to base decisions on the section name, because none
3364+ of the dynobj section names depend upon the input files. */ 3357+ of the dynobj section names depend upon the input files. */
3365+ name = bfd_get_section_name (dynobj, s); 3358+ name = bfd_section_name (s);
3366+ 3359+
3367+ if (strncmp (name, ".rela", 5) == 0) 3360+ if (strncmp (name, ".rela", 5) == 0)
3368+ { 3361+ {
@@ -3730,7 +3723,7 @@ index 0000000000..0f43ae6ea8
3730+ put into .sbss. */ 3723+ put into .sbss. */
3731+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 3724+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3732+ if (*secp == NULL 3725+ if (*secp == NULL
3733+ || ! bfd_set_section_flags (abfd, *secp, SEC_IS_COMMON)) 3726+ || ! bfd_set_section_flags (*secp, SEC_IS_COMMON))
3734+ return FALSE; 3727+ return FALSE;
3735+ 3728+
3736+ *valp = sym->st_size; 3729+ *valp = sym->st_size;
@@ -3757,11 +3750,10 @@ index 0000000000..0f43ae6ea8
3757+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name 3750+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3758+#define elf_backend_relocate_section microblaze_elf_relocate_section 3751+#define elf_backend_relocate_section microblaze_elf_relocate_section
3759+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section 3752+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3760+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data 3753+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
3761+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup 3754+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3762+ 3755+
3763+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook 3756+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3764+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
3765+#define elf_backend_check_relocs microblaze_elf_check_relocs 3757+#define elf_backend_check_relocs microblaze_elf_check_relocs
3766+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol 3758+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3767+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create 3759+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
@@ -3781,10 +3773,10 @@ index 0000000000..0f43ae6ea8
3781+ 3773+
3782+#include "elf64-target.h" 3774+#include "elf64-target.h"
3783diff --git a/bfd/targets.c b/bfd/targets.c 3775diff --git a/bfd/targets.c b/bfd/targets.c
3784index 158168cb3b..ef567a30c8 100644 3776index 0732c5e4292..1ec226b2f47 100644
3785--- a/bfd/targets.c 3777--- a/bfd/targets.c
3786+++ b/bfd/targets.c 3778+++ b/bfd/targets.c
3787@@ -706,6 +706,8 @@ extern const bfd_target mep_elf32_le_vec; 3779@@ -782,6 +782,8 @@ extern const bfd_target mep_elf32_le_vec;
3788 extern const bfd_target metag_elf32_vec; 3780 extern const bfd_target metag_elf32_vec;
3789 extern const bfd_target microblaze_elf32_vec; 3781 extern const bfd_target microblaze_elf32_vec;
3790 extern const bfd_target microblaze_elf32_le_vec; 3782 extern const bfd_target microblaze_elf32_le_vec;
@@ -3793,7 +3785,7 @@ index 158168cb3b..ef567a30c8 100644
3793 extern const bfd_target mips_ecoff_be_vec; 3785 extern const bfd_target mips_ecoff_be_vec;
3794 extern const bfd_target mips_ecoff_le_vec; 3786 extern const bfd_target mips_ecoff_le_vec;
3795 extern const bfd_target mips_ecoff_bele_vec; 3787 extern const bfd_target mips_ecoff_bele_vec;
3796@@ -1073,6 +1075,10 @@ static const bfd_target * const _bfd_target_vector[] = 3788@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_target_vector[] =
3797 3789
3798 &metag_elf32_vec, 3790 &metag_elf32_vec,
3799 3791
@@ -3805,7 +3797,7 @@ index 158168cb3b..ef567a30c8 100644
3805 3797
3806 &mips_ecoff_be_vec, 3798 &mips_ecoff_be_vec,
3807diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 3799diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
3808index 16b10d00a9..c79434785a 100644 3800index 5810a74a5fc..ffbb843d33e 100644
3809--- a/gas/config/tc-microblaze.c 3801--- a/gas/config/tc-microblaze.c
3810+++ b/gas/config/tc-microblaze.c 3802+++ b/gas/config/tc-microblaze.c
3811@@ -35,10 +35,13 @@ 3803@@ -35,10 +35,13 @@
@@ -4153,7 +4145,7 @@ index 16b10d00a9..c79434785a 100644
4153 4145
4154 default: 4146 default:
4155 as_fatal (_("unimplemented opcode \"%s\""), name); 4147 as_fatal (_("unimplemented opcode \"%s\""), name);
4156@@ -1918,6 +2142,7 @@ struct option md_longopts[] = 4148@@ -1915,6 +2139,7 @@ struct option md_longopts[] =
4157 {"EL", no_argument, NULL, OPTION_EL}, 4149 {"EL", no_argument, NULL, OPTION_EL},
4158 {"mlittle-endian", no_argument, NULL, OPTION_LITTLE}, 4150 {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
4159 {"mbig-endian", no_argument, NULL, OPTION_BIG}, 4151 {"mbig-endian", no_argument, NULL, OPTION_BIG},
@@ -4161,7 +4153,7 @@ index 16b10d00a9..c79434785a 100644
4161 { NULL, no_argument, NULL, 0} 4153 { NULL, no_argument, NULL, 0}
4162 }; 4154 };
4163 4155
4164@@ -2569,6 +2794,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 4156@@ -2565,6 +2790,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
4165 return rel; 4157 return rel;
4166 } 4158 }
4167 4159
@@ -4180,7 +4172,7 @@ index 16b10d00a9..c79434785a 100644
4180 int 4172 int
4181 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 4173 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4182 { 4174 {
4183@@ -2582,6 +2819,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 4175@@ -2578,6 +2815,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4184 case OPTION_LITTLE: 4176 case OPTION_LITTLE:
4185 target_big_endian = 0; 4177 target_big_endian = 0;
4186 break; 4178 break;
@@ -4191,7 +4183,7 @@ index 16b10d00a9..c79434785a 100644
4191 default: 4183 default:
4192 return 0; 4184 return 0;
4193 } 4185 }
4194@@ -2597,6 +2838,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) 4186@@ -2593,6 +2834,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
4195 fprintf (stream, _(" MicroBlaze specific assembler options:\n")); 4187 fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
4196 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu")); 4188 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
4197 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu")); 4189 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
@@ -4200,7 +4192,7 @@ index 16b10d00a9..c79434785a 100644
4200 4192
4201 4193
4202diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h 4194diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
4203index ca9dbb861f..9d38d2ced5 100644 4195index 01cb3e894f7..7435a70ef5e 100644
4204--- a/gas/config/tc-microblaze.h 4196--- a/gas/config/tc-microblaze.h
4205+++ b/gas/config/tc-microblaze.h 4197+++ b/gas/config/tc-microblaze.h
4206@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[]; 4198@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[];
@@ -4215,10 +4207,10 @@ index ca9dbb861f..9d38d2ced5 100644
4215 #define ELF_TC_SPECIAL_SECTIONS \ 4207 #define ELF_TC_SPECIAL_SECTIONS \
4216 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ 4208 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
4217diff --git a/include/elf/common.h b/include/elf/common.h 4209diff --git a/include/elf/common.h b/include/elf/common.h
4218index 996acf9703..2f1e5be366 100644 4210index 4d94c4fd5b3..f709a01816c 100644
4219--- a/include/elf/common.h 4211--- a/include/elf/common.h
4220+++ b/include/elf/common.h 4212+++ b/include/elf/common.h
4221@@ -339,6 +339,7 @@ 4213@@ -340,6 +340,7 @@
4222 #define EM_RISCV 243 /* RISC-V */ 4214 #define EM_RISCV 243 /* RISC-V */
4223 #define EM_LANAI 244 /* Lanai 32-bit processor. */ 4215 #define EM_LANAI 244 /* Lanai 32-bit processor. */
4224 #define EM_BPF 247 /* Linux BPF – in-kernel virtual machine. */ 4216 #define EM_BPF 247 /* Linux BPF – in-kernel virtual machine. */
@@ -4227,71 +4219,71 @@ index 996acf9703..2f1e5be366 100644
4227 #define EM_CSKY 252 /* C-SKY processor family. */ 4219 #define EM_CSKY 252 /* C-SKY processor family. */
4228 4220
4229diff --git a/ld/Makefile.am b/ld/Makefile.am 4221diff --git a/ld/Makefile.am b/ld/Makefile.am
4230index c2c798b4fe..b272f537e4 100644 4222index 02c4fc16395..d063e2d32c5 100644
4231--- a/ld/Makefile.am 4223--- a/ld/Makefile.am
4232+++ b/ld/Makefile.am 4224+++ b/ld/Makefile.am
4233@@ -422,6 +422,8 @@ ALL_64_EMULATION_SOURCES = \ 4225@@ -416,6 +416,8 @@ ALL_64_EMULATION_SOURCES = \
4234 eelf32ltsmipn32.c \ 4226 eelf32ltsmipn32.c \
4235 eelf32ltsmipn32_fbsd.c \ 4227 eelf32ltsmipn32_fbsd.c \
4236 eelf32mipswindiss.c \ 4228 eelf32mipswindiss.c \
4237+ eelf64microblazeel.c \ 4229+ eelf64microblazeel.c \
4238+ eelf64microblaze.c \ 4230+ eelf64microblaze.c \
4239 eelf64_aix.c \ 4231 eelf64_aix.c \
4232 eelf64bpf.c \
4240 eelf64_ia64.c \ 4233 eelf64_ia64.c \
4241 eelf64_ia64_fbsd.c \ 4234@@ -898,6 +900,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4242@@ -1702,6 +1704,12 @@ eelf32_x86_64_nacl.c: $(srcdir)/emulparams/elf32_x86_64_nacl.sh \ 4235 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4243 $(srcdir)/emulparams/elf_nacl.sh \ 4236 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4244 $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} 4237 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
4245 4238+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Pc@am__quote@
4246+eelf64microblazeel.c: $(srcdir)/emulparams/elf64microblazeel.sh \ 4239+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Pc@am__quote@
4247+ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} 4240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Pc@am__quote@
4248+ 4241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4249+eelf64microblaze.c: $(srcdir)/emulparams/elf64microblaze.sh \ 4242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4250+ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS}
4251+
4252 eelf64_aix.c: $(srcdir)/emulparams/elf64_aix.sh \
4253 $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
4254
4255diff --git a/ld/Makefile.in b/ld/Makefile.in 4243diff --git a/ld/Makefile.in b/ld/Makefile.in
4256index fc687fc516..1a530ad729 100644 4244index 2fe12e14f63..01ebb051faa 100644
4257--- a/ld/Makefile.in 4245--- a/ld/Makefile.in
4258+++ b/ld/Makefile.in 4246+++ b/ld/Makefile.in
4259@@ -907,6 +907,8 @@ ALL_64_EMULATION_SOURCES = \ 4247@@ -515,6 +515,7 @@ pdfdir = @pdfdir@
4248 prefix = @prefix@
4249 program_transform_name = @program_transform_name@
4250 psdir = @psdir@
4251+runstatedir = @runstatedir@
4252 sbindir = @sbindir@
4253 sharedstatedir = @sharedstatedir@
4254 srcdir = @srcdir@
4255@@ -898,6 +899,8 @@ ALL_64_EMULATION_SOURCES = \
4260 eelf32ltsmipn32.c \ 4256 eelf32ltsmipn32.c \
4261 eelf32ltsmipn32_fbsd.c \ 4257 eelf32ltsmipn32_fbsd.c \
4262 eelf32mipswindiss.c \ 4258 eelf32mipswindiss.c \
4263+ eelf64microblazeel.c \ 4259+ eelf64microblazeel.c \
4264+ eelf64microblaze.c \ 4260+ eelf64microblaze.c \
4265 eelf64_aix.c \ 4261 eelf64_aix.c \
4262 eelf64bpf.c \
4266 eelf64_ia64.c \ 4263 eelf64_ia64.c \
4267 eelf64_ia64_fbsd.c \ 4264@@ -1360,6 +1363,8 @@ distclean-compile:
4268@@ -1355,6 +1357,8 @@ distclean-compile: 4265 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@
4269 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xc16xs.Po@am__quote@ 4266 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@
4270 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@ 4267 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Po@am__quote@
4271 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@
4272+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Po@am__quote@
4273+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Po@am__quote@ 4268+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Po@am__quote@
4274 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@ 4269+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Po@am__quote@
4275 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@ 4270 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@
4276 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Po@am__quote@ 4271 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc.Po@am__quote@
4277@@ -3306,6 +3310,12 @@ eelf32_x86_64_nacl.c: $(srcdir)/emulparams/elf32_x86_64_nacl.sh \ 4272 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc_fbsd.Po@am__quote@
4278 $(srcdir)/emulparams/elf_nacl.sh \ 4273@@ -2493,6 +2498,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4279 $(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} 4274 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4280 4275 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4281+eelf64microblazeel.c: $(srcdir)/emulparams/elf64microblazeel.sh \ 4276 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
4282+ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} 4277+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Pc@am__quote@
4283+ 4278+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Pc@am__quote@
4284+eelf64microblaze.c: $(srcdir)/emulparams/elf64microblaze.sh \ 4279 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Pc@am__quote@
4285+ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} 4280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4286+ 4281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4287 eelf64_aix.c: $(srcdir)/emulparams/elf64_aix.sh \
4288 $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
4289
4290diff --git a/ld/configure.tgt b/ld/configure.tgt 4282diff --git a/ld/configure.tgt b/ld/configure.tgt
4291index beba17ef51..5109799f2b 100644 4283index 87c7d9a4cad..801d27c9e3f 100644
4292--- a/ld/configure.tgt 4284--- a/ld/configure.tgt
4293+++ b/ld/configure.tgt 4285+++ b/ld/configure.tgt
4294@@ -423,6 +423,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux" 4286@@ -469,6 +469,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux"
4295 microblazeel*) targ_emul=elf32microblazeel 4287 microblazeel*) targ_emul=elf32microblazeel
4296 targ_extra_emuls=elf32microblaze 4288 targ_extra_emuls=elf32microblaze
4297 ;; 4289 ;;
@@ -4303,7 +4295,7 @@ index beba17ef51..5109799f2b 100644
4303 ;; 4295 ;;
4304diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh 4296diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
4305new file mode 100644 4297new file mode 100644
4306index 0000000000..9c7b0eb708 4298index 00000000000..7b4c7c411bd
4307--- /dev/null 4299--- /dev/null
4308+++ b/ld/emulparams/elf64microblaze.sh 4300+++ b/ld/emulparams/elf64microblaze.sh
4309@@ -0,0 +1,23 @@ 4301@@ -0,0 +1,23 @@
@@ -4328,11 +4320,11 @@ index 0000000000..9c7b0eb708
4328+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} 4320+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4329+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);' 4321+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4330+ 4322+
4331+TEMPLATE_NAME=elf32 4323+TEMPLATE_NAME=elf
4332+#GENERATE_SHLIB_SCRIPT=yes 4324+#GENERATE_SHLIB_SCRIPT=yes
4333diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh 4325diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
4334new file mode 100644 4326new file mode 100644
4335index 0000000000..9c7b0eb708 4327index 00000000000..7b4c7c411bd
4336--- /dev/null 4328--- /dev/null
4337+++ b/ld/emulparams/elf64microblazeel.sh 4329+++ b/ld/emulparams/elf64microblazeel.sh
4338@@ -0,0 +1,23 @@ 4330@@ -0,0 +1,23 @@
@@ -4357,104 +4349,108 @@ index 0000000000..9c7b0eb708
4357+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} 4349+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4358+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);' 4350+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4359+ 4351+
4360+TEMPLATE_NAME=elf32 4352+TEMPLATE_NAME=elf
4361+#GENERATE_SHLIB_SCRIPT=yes 4353+#GENERATE_SHLIB_SCRIPT=yes
4362diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 4354diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
4363index f8aaf27873..20ea6a885a 100644 4355index 52c9068805f..a03f5b7a55b 100644
4364--- a/opcodes/microblaze-dis.c 4356--- a/opcodes/microblaze-dis.c
4365+++ b/opcodes/microblaze-dis.c 4357+++ b/opcodes/microblaze-dis.c
4366@@ -33,6 +33,7 @@ 4358@@ -33,6 +33,7 @@
4367 #define get_field_r1(instr) get_field (instr, RA_MASK, RA_LOW) 4359 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
4368 #define get_field_r2(instr) get_field (instr, RB_MASK, RB_LOW) 4360 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
4369 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW) 4361 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
4370+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW) 4362+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
4371 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) 4363 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
4372 4364
4373 4365 #define NUM_STRBUFS 3
4374@@ -56,11 +57,20 @@ get_field_imm (long instr) 4366@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
4375 } 4367 }
4376 4368
4377 static char * 4369 static char *
4378-get_field_imm5 (long instr) 4370-get_field_imm5 (struct string_buf *buf, long instr)
4379+get_field_imml (long instr) 4371+get_field_imml (struct string_buf *buf, long instr)
4380 { 4372 {
4381 char tmpstr[25]; 4373 char *p = strbuf (buf);
4382 4374
4383- sprintf (tmpstr, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW)); 4375- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
4384+ sprintf (tmpstr, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 4376+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
4385+ return (strdup (tmpstr)); 4377+ return p;
4386+} 4378+}
4387+ 4379+
4388+static char * 4380+static char *
4389+get_field_imms (long instr) 4381+get_field_imms (struct string_buf *buf, long instr)
4390+{ 4382+{
4391+ char tmpstr[25]; 4383+ char *p = strbuf (buf);
4392+ 4384+
4393+ sprintf (tmpstr, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW)); 4385+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
4394 return (strdup (tmpstr)); 4386 return p;
4395 } 4387 }
4396 4388
4397@@ -74,14 +84,14 @@ get_field_imm5_mbar (long instr) 4389@@ -91,14 +101,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
4398 } 4390 }
4399 4391
4400 static char * 4392 static char *
4401-get_field_imm5width (long instr) 4393-get_field_imm5width (struct string_buf *buf, long instr)
4402+get_field_immw (long instr) 4394+get_field_immw (struct string_buf *buf, long instr)
4403 { 4395 {
4404 char tmpstr[25]; 4396 char *p = strbuf (buf);
4405 4397
4406 if (instr & 0x00004000) 4398 if (instr & 0x00004000)
4407- sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 4399- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
4408+ sprintf (tmpstr, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */ 4400+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
4409 else 4401 else
4410- sprintf (tmpstr, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */ 4402- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
4411+ sprintf (tmpstr, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */ 4403+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
4412 return (strdup (tmpstr)); 4404 return p;
4413 } 4405 }
4414 4406
4415@@ -286,9 +296,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 4407@@ -308,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4416 } 4408 }
4417 } 4409 }
4418 break; 4410 break;
4419- case INST_TYPE_RD_R1_IMM5: 4411- case INST_TYPE_RD_R1_IMM5:
4420+ case INST_TYPE_RD_R1_IMML: 4412+ case INST_TYPE_RD_R1_IMML:
4421+ print_func (stream, "\t%s, %s, %s", get_field_rd (inst), 4413 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4422+ get_field_r1(inst), get_field_imm (inst)); 4414- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
4415+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
4423+ /* TODO: Also print symbol */ 4416+ /* TODO: Also print symbol */
4417+ break;
4424+ case INST_TYPE_RD_R1_IMMS: 4418+ case INST_TYPE_RD_R1_IMMS:
4425 print_func (stream, "\t%s, %s, %s", get_field_rd (inst), 4419+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4426- get_field_r1(inst), get_field_imm5 (inst)); 4420+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
4427+ get_field_r1(inst), get_field_imms (inst));
4428 break; 4421 break;
4429 case INST_TYPE_RD_RFSL: 4422 case INST_TYPE_RD_RFSL:
4430 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_rfsl (inst)); 4423 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4431@@ -386,6 +400,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 4424@@ -414,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4432 } 4425 }
4433 } 4426 }
4434 break; 4427 break;
4428- case INST_TYPE_RD_R2:
4429- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4430- get_field_r2 (&buf, inst));
4435+ case INST_TYPE_IMML: 4431+ case INST_TYPE_IMML:
4436+ print_func (stream, "\t%s", get_field_imml (inst)); 4432+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
4437+ /* TODO: Also print symbol */ 4433+ /* TODO: Also print symbol */
4438+ break; 4434+ break;
4439 case INST_TYPE_RD_R2: 4435+ case INST_TYPE_RD_R2:
4440 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_r2 (inst)); 4436+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
4437 break;
4438 case INST_TYPE_R2:
4439 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
4440@@ -441,8 +459,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4441 break; 4441 break;
4442@@ -409,9 +427,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 4442 /* For tuqula instruction */
4443 case INST_TYPE_NONE:
4444 break;
4445 /* For bit field insns. */ 4443 /* For bit field insns. */
4446- case INST_TYPE_RD_R1_IMM5_IMM5: 4444- case INST_TYPE_RD_R1_IMM5_IMM5:
4447- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst),get_field_r1(inst),get_field_imm5width (inst), get_field_imm5 (inst)); 4445- 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));
4448- break;
4449+ case INST_TYPE_RD_R1_IMMW_IMMS: 4446+ case INST_TYPE_RD_R1_IMMW_IMMS:
4450+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (inst), get_field_r1(inst), 4447+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
4451+ get_field_immw (inst), get_field_imms (inst)); 4448+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
4452+ break; 4449 break;
4453 /* For tuqula instruction */ 4450 /* For tuqula instruction */
4454 case INST_TYPE_RD: 4451 case INST_TYPE_RD:
4455 print_func (stream, "\t%s", get_field_rd (inst));
4456diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 4452diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
4457index ce8ac351b5..985834b8df 100644 4453index f61f4ef66d9..61eaa39b3eb 100644
4458--- a/opcodes/microblaze-opc.h 4454--- a/opcodes/microblaze-opc.h
4459+++ b/opcodes/microblaze-opc.h 4455+++ b/opcodes/microblaze-opc.h
4460@@ -40,7 +40,7 @@ 4456@@ -40,7 +40,7 @@
@@ -4682,7 +4678,7 @@ index ce8ac351b5..985834b8df 100644
4682 #endif /* MICROBLAZE_OPC */ 4678 #endif /* MICROBLAZE_OPC */
4683 4679
4684diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 4680diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
4685index 28662694cd..076dbcd0b3 100644 4681index fa921c90c98..1dcd3dca3d1 100644
4686--- a/opcodes/microblaze-opcm.h 4682--- a/opcodes/microblaze-opcm.h
4687+++ b/opcodes/microblaze-opcm.h 4683+++ b/opcodes/microblaze-opcm.h
4688@@ -25,6 +25,7 @@ 4684@@ -25,6 +25,7 @@
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch
index 0c3da95a..06a8f70a 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch
@@ -1,32 +1,32 @@
1From bcd4263219c9756b9c1c1df64c6fef1311057fac Mon Sep 17 00:00:00 2001 1From 49a85544705ec3057f0a1f32807b7b986127cec1 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 gas/config/tc-microblaze.c | 152 ++++++++++++++++++++++++++++++------- 12 gas/config/tc-microblaze.c | 127 +++++++++++++++++++++++++++----------
13 include/elf/microblaze.h | 2 + 13 include/elf/microblaze.h | 2 +
14 opcodes/microblaze-opc.h | 4 +- 14 opcodes/microblaze-opc.h | 4 +-
15 opcodes/microblaze-opcm.h | 4 +- 15 opcodes/microblaze-opcm.h | 4 +-
16 9 files changed, 277 insertions(+), 35 deletions(-) 16 9 files changed, 243 insertions(+), 40 deletions(-)
17 17
18diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 18diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
19index 721531886a..4f777059d8 100644 19index 3fdbf8ed755..c55092c9ec7 100644
20--- a/bfd/bfd-in2.h 20--- a/bfd/bfd-in2.h
21+++ b/bfd/bfd-in2.h 21+++ b/bfd/bfd-in2.h
22@@ -5876,11 +5876,21 @@ done here - only used for relaxing */ 22@@ -5438,11 +5438,21 @@ value in two words (with an imm instruction). No relocation is
23 * +done here - only used for relaxing */ 23 done here - only used for relaxing */
24 BFD_RELOC_MICROBLAZE_64_NONE, 24 BFD_RELOC_MICROBLAZE_64_NONE,
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+ * +value in two words (with an imml instruction). No relocation is 27+value in two words (with an imml instruction). No relocation is
28+ * +done here - only used for relaxing */ 28+done here - only used for relaxing */
29+ BFD_RELOC_MICROBLAZE_64, 29+ BFD_RELOC_MICROBLAZE_64,
30+ 30+
31 /* This is a 64 bit reloc that stores the 32 bit pc relative 31 /* This is a 64 bit reloc that stores the 32 bit pc relative
32 value in two words (with an imm instruction). The relocation is 32 value in two words (with an imm instruction). The relocation is
@@ -42,7 +42,7 @@ index 721531886a..4f777059d8 100644
42 value in two words (with an imm instruction). The relocation is 42 value in two words (with an imm instruction). The relocation is
43 GOT offset */ 43 GOT offset */
44diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 44diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
45index d001437b3f..035e71f311 100644 45index cf4a7fdba33..e1a66f57e79 100644
46--- a/bfd/elf32-microblaze.c 46--- a/bfd/elf32-microblaze.c
47+++ b/bfd/elf32-microblaze.c 47+++ b/bfd/elf32-microblaze.c
48@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 48@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -68,7 +68,7 @@ index d001437b3f..035e71f311 100644
68 0, /* Rightshift. */ 68 0, /* Rightshift. */
69@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 69@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
70 0x0000ffff, /* Dest Mask. */ 70 0x0000ffff, /* Dest Mask. */
71 TRUE), /* PC relative offset? */ 71 TRUE), /* PC relative offset? */
72 72
73+ /* A 64 bit GOTPC relocation. Table-entry not really used. */ 73+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
74+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ 74+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
@@ -104,23 +104,14 @@ index d001437b3f..035e71f311 100644
104 case BFD_RELOC_MICROBLAZE_64_GOT: 104 case BFD_RELOC_MICROBLAZE_64_GOT:
105 microblaze_reloc = R_MICROBLAZE_GOT_64; 105 microblaze_reloc = R_MICROBLAZE_GOT_64;
106 break; 106 break;
107@@ -1467,7 +1502,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 107@@ -1929,6 +1964,28 @@ microblaze_elf_relax_section (bfd *abfd,
108 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
109 {
110 relocation += addend;
111- if (r_type == R_MICROBLAZE_32)
112+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
113 bfd_put_32 (input_bfd, relocation, contents + offset);
114 else
115 {
116@@ -1933,6 +1968,28 @@ microblaze_elf_relax_section (bfd *abfd,
117 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 108 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
118 } 109 }
119 break; 110 break;
120+ case R_MICROBLAZE_IMML_64: 111+ case R_MICROBLAZE_IMML_64:
121+ { 112+ {
122+ /* This was a PC-relative instruction that was 113+ /* This was a PC-relative instruction that was
123+ completely resolved. */ 114+ completely resolved. */
124+ int sfix, efix; 115+ int sfix, efix;
125+ unsigned int val; 116+ unsigned int val;
126+ bfd_vma target_address; 117+ bfd_vma target_address;
@@ -142,21 +133,21 @@ index d001437b3f..035e71f311 100644
142 case R_MICROBLAZE_NONE: 133 case R_MICROBLAZE_NONE:
143 case R_MICROBLAZE_32_NONE: 134 case R_MICROBLAZE_32_NONE:
144 { 135 {
145@@ -2037,9 +2094,9 @@ microblaze_elf_relax_section (bfd *abfd, 136@@ -2034,9 +2091,9 @@ microblaze_elf_relax_section (bfd *abfd,
146 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 137 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
147 irelscan->r_addend); 138 irelscan->r_addend);
148 } 139 }
149- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) 140- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
150- { 141- {
151- isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 142- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
152+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64) 143+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
153+ { 144+ {
154+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info); 145+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
155 146
156 /* Look at the reloc only if the value has been resolved. */ 147 /* Look at the reloc only if the value has been resolved. */
157 if (isym->st_shndx == shndx 148 if (isym->st_shndx == shndx
158diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 149diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
159index 0f43ae6ea8..56a45f2a05 100644 150index fa4b95e47e0..d55700fc513 100644
160--- a/bfd/elf64-microblaze.c 151--- a/bfd/elf64-microblaze.c
161+++ b/bfd/elf64-microblaze.c 152+++ b/bfd/elf64-microblaze.c
162@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 153@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -219,7 +210,7 @@ index 0f43ae6ea8..56a45f2a05 100644
219 case BFD_RELOC_MICROBLAZE_64_GOT: 210 case BFD_RELOC_MICROBLAZE_64_GOT:
220 microblaze_reloc = R_MICROBLAZE_GOT_64; 211 microblaze_reloc = R_MICROBLAZE_GOT_64;
221 break; 212 break;
222@@ -1161,6 +1197,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 213@@ -1162,6 +1198,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
223 break; /* Do nothing. */ 214 break; /* Do nothing. */
224 215
225 case (int) R_MICROBLAZE_GOTPC_64: 216 case (int) R_MICROBLAZE_GOTPC_64:
@@ -227,23 +218,14 @@ index 0f43ae6ea8..56a45f2a05 100644
227 relocation = htab->sgotplt->output_section->vma 218 relocation = htab->sgotplt->output_section->vma
228 + htab->sgotplt->output_offset; 219 + htab->sgotplt->output_offset;
229 relocation -= (input_section->output_section->vma 220 relocation -= (input_section->output_section->vma
230@@ -1431,7 +1468,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 221@@ -1863,6 +1900,28 @@ microblaze_elf_relax_section (bfd *abfd,
231 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
232 {
233 relocation += addend;
234- if (r_type == R_MICROBLAZE_32)
235+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
236 bfd_put_32 (input_bfd, relocation, contents + offset);
237 else
238 {
239@@ -1876,6 +1913,28 @@ microblaze_elf_relax_section (bfd *abfd,
240 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 222 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
241 } 223 }
242 break; 224 break;
243+ case R_MICROBLAZE_IMML_64: 225+ case R_MICROBLAZE_IMML_64:
244+ { 226+ {
245+ /* This was a PC-relative instruction that was 227+ /* This was a PC-relative instruction that was
246+ completely resolved. */ 228+ completely resolved. */
247+ int sfix, efix; 229+ int sfix, efix;
248+ unsigned int val; 230+ unsigned int val;
249+ bfd_vma target_address; 231+ bfd_vma target_address;
@@ -266,10 +248,10 @@ index 0f43ae6ea8..56a45f2a05 100644
266 case R_MICROBLAZE_32_NONE: 248 case R_MICROBLAZE_32_NONE:
267 { 249 {
268diff --git a/bfd/libbfd.h b/bfd/libbfd.h 250diff --git a/bfd/libbfd.h b/bfd/libbfd.h
269index feb9fada1e..450653f2d8 100644 251index c1551b92405..b4aace6a70d 100644
270--- a/bfd/libbfd.h 252--- a/bfd/libbfd.h
271+++ b/bfd/libbfd.h 253+++ b/bfd/libbfd.h
272@@ -2903,7 +2903,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 254@@ -2969,7 +2969,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
273 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 255 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
274 "BFD_RELOC_MICROBLAZE_32_NONE", 256 "BFD_RELOC_MICROBLAZE_32_NONE",
275 "BFD_RELOC_MICROBLAZE_64_NONE", 257 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -280,10 +262,10 @@ index feb9fada1e..450653f2d8 100644
280 "BFD_RELOC_MICROBLAZE_64_PLT", 262 "BFD_RELOC_MICROBLAZE_64_PLT",
281 "BFD_RELOC_MICROBLAZE_64_GOTOFF", 263 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
282diff --git a/bfd/reloc.c b/bfd/reloc.c 264diff --git a/bfd/reloc.c b/bfd/reloc.c
283index 87753ae4f0..ccf29f54cf 100644 265index 9b39b419415..0e8a24e9cb0 100644
284--- a/bfd/reloc.c 266--- a/bfd/reloc.c
285+++ b/bfd/reloc.c 267+++ b/bfd/reloc.c
286@@ -6803,12 +6803,24 @@ ENUMDOC 268@@ -6866,12 +6866,24 @@ ENUMDOC
287 done here - only used for relaxing 269 done here - only used for relaxing
288 ENUM 270 ENUM
289 BFD_RELOC_MICROBLAZE_64_NONE 271 BFD_RELOC_MICROBLAZE_64_NONE
@@ -309,7 +291,7 @@ index 87753ae4f0..ccf29f54cf 100644
309 This is a 64 bit reloc that stores the 32 bit pc relative 291 This is a 64 bit reloc that stores the 32 bit pc relative
310 value in two words (with an imm instruction). The relocation is 292 value in two words (with an imm instruction). The relocation is
311diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 293diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
312index c79434785a..3f90b7c892 100644 294index ffbb843d33e..b8250e4cded 100644
313--- a/gas/config/tc-microblaze.c 295--- a/gas/config/tc-microblaze.c
314+++ b/gas/config/tc-microblaze.c 296+++ b/gas/config/tc-microblaze.c
315@@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; 297@@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
@@ -320,16 +302,17 @@ index c79434785a..3f90b7c892 100644
320 302
321 /* Initialize the relax table. */ 303 /* Initialize the relax table. */
322 const relax_typeS md_relax_table[] = 304 const relax_typeS md_relax_table[] =
323@@ -117,6 +118,8 @@ const relax_typeS md_relax_table[] = 305@@ -116,7 +117,8 @@ const relax_typeS md_relax_table[] =
306 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
324 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */ 307 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
325 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ 308 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
326 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */ 309- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
327+// { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */ 310+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
328+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */ 311+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */
329 }; 312 };
330 313
331 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ 314 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
332@@ -396,7 +399,8 @@ const pseudo_typeS md_pseudo_table[] = 315@@ -396,7 +398,8 @@ const pseudo_typeS md_pseudo_table[] =
333 {"data32", cons, 4}, /* Same as word. */ 316 {"data32", cons, 4}, /* Same as word. */
334 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 317 {"ent", s_func, 0}, /* Treat ent as function entry point. */
335 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 318 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
@@ -339,7 +322,7 @@ index c79434785a..3f90b7c892 100644
339 {"weakext", microblaze_s_weakext, 0}, 322 {"weakext", microblaze_s_weakext, 0},
340 {"rodata", microblaze_s_rdata, 0}, 323 {"rodata", microblaze_s_rdata, 0},
341 {"sdata2", microblaze_s_rdata, 1}, 324 {"sdata2", microblaze_s_rdata, 1},
342@@ -405,6 +409,7 @@ const pseudo_typeS md_pseudo_table[] = 325@@ -405,6 +408,7 @@ const pseudo_typeS md_pseudo_table[] =
343 {"sbss", microblaze_s_bss, 1}, 326 {"sbss", microblaze_s_bss, 1},
344 {"text", microblaze_s_text, 0}, 327 {"text", microblaze_s_text, 0},
345 {"word", cons, 4}, 328 {"word", cons, 4},
@@ -347,7 +330,7 @@ index c79434785a..3f90b7c892 100644
347 {"frame", s_ignore, 0}, 330 {"frame", s_ignore, 0},
348 {"mask", s_ignore, 0}, /* Emitted by gcc. */ 331 {"mask", s_ignore, 0}, /* Emitted by gcc. */
349 {NULL, NULL, 0} 332 {NULL, NULL, 0}
350@@ -898,7 +903,7 @@ check_got (int * got_type, int * got_len) 333@@ -898,7 +902,7 @@ check_got (int * got_type, int * got_len)
351 extern bfd_reloc_code_real_type 334 extern bfd_reloc_code_real_type
352 parse_cons_expression_microblaze (expressionS *exp, int size) 335 parse_cons_expression_microblaze (expressionS *exp, int size)
353 { 336 {
@@ -356,7 +339,7 @@ index c79434785a..3f90b7c892 100644
356 { 339 {
357 /* Handle @GOTOFF et.al. */ 340 /* Handle @GOTOFF et.al. */
358 char *save, *gotfree_copy; 341 char *save, *gotfree_copy;
359@@ -930,6 +935,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size) 342@@ -930,6 +934,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
360 343
361 static const char * str_microblaze_ro_anchor = "RO"; 344 static const char * str_microblaze_ro_anchor = "RO";
362 static const char * str_microblaze_rw_anchor = "RW"; 345 static const char * str_microblaze_rw_anchor = "RW";
@@ -364,41 +347,7 @@ index c79434785a..3f90b7c892 100644
364 347
365 static bfd_boolean 348 static bfd_boolean
366 check_spl_reg (unsigned * reg) 349 check_spl_reg (unsigned * reg)
367@@ -1174,6 +1180,33 @@ md_assemble (char * str) 350@@ -1926,6 +1931,7 @@ md_assemble (char * str)
368 inst |= (immed << IMM_LOW) & IMM_MASK;
369 }
370 }
371+#if 0 //revisit
372+ else if (streq (name, "lli") || streq (name, "sli"))
373+ {
374+ temp = immed & 0xFFFFFFFFFFFF8000;
375+ if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
376+ {
377+ /* Needs an immediate inst. */
378+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
379+ if (opcode1 == NULL)
380+ {
381+ as_bad (_("unknown opcode \"%s\""), "imml");
382+ return;
383+ }
384+
385+ inst1 = opcode1->bit_sequence;
386+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
387+ output[0] = INST_BYTE0 (inst1);
388+ output[1] = INST_BYTE1 (inst1);
389+ output[2] = INST_BYTE2 (inst1);
390+ output[3] = INST_BYTE3 (inst1);
391+ output = frag_more (isize);
392+ }
393+ inst |= (reg1 << RD_LOW) & RD_MASK;
394+ inst |= (reg2 << RA_LOW) & RA_MASK;
395+ inst |= (immed << IMM_LOW) & IMM_MASK;
396+ }
397+#endif
398 else
399 {
400 temp = immed & 0xFFFF8000;
401@@ -1926,6 +1959,7 @@ md_assemble (char * str)
402 if (exp.X_op != O_constant) 351 if (exp.X_op != O_constant)
403 { 352 {
404 char *opc = NULL; 353 char *opc = NULL;
@@ -406,7 +355,7 @@ index c79434785a..3f90b7c892 100644
406 relax_substateT subtype; 355 relax_substateT subtype;
407 356
408 if (exp.X_md != 0) 357 if (exp.X_md != 0)
409@@ -1939,7 +1973,7 @@ md_assemble (char * str) 358@@ -1939,7 +1945,7 @@ md_assemble (char * str)
410 subtype, /* PC-relative or not. */ 359 subtype, /* PC-relative or not. */
411 exp.X_add_symbol, 360 exp.X_add_symbol,
412 exp.X_add_number, 361 exp.X_add_number,
@@ -415,7 +364,7 @@ index c79434785a..3f90b7c892 100644
415 immedl = 0L; 364 immedl = 0L;
416 } 365 }
417 else 366 else
418@@ -1977,7 +2011,7 @@ md_assemble (char * str) 367@@ -1977,7 +1983,7 @@ md_assemble (char * str)
419 reg1 = 0; 368 reg1 = 0;
420 } 369 }
421 if (strcmp (op_end, "")) 370 if (strcmp (op_end, ""))
@@ -424,17 +373,17 @@ index c79434785a..3f90b7c892 100644
424 else 373 else
425 as_fatal (_("Error in statement syntax")); 374 as_fatal (_("Error in statement syntax"));
426 375
427@@ -1987,7 +2021,8 @@ md_assemble (char * str) 376@@ -1987,7 +1993,8 @@ md_assemble (char * str)
428 377
429 if (exp.X_op != O_constant) 378 if (exp.X_op != O_constant)
430 { 379 {
431- char *opc = NULL; 380- char *opc = NULL;
432+ //char *opc = NULL; 381+ //char *opc = NULL;
433+ char *opc = str_microblaze_64; 382+ char *opc = strdup(str_microblaze_64);
434 relax_substateT subtype; 383 relax_substateT subtype;
435 384
436 if (exp.X_md != 0) 385 if (exp.X_md != 0)
437@@ -2001,14 +2036,13 @@ md_assemble (char * str) 386@@ -2001,14 +2008,13 @@ md_assemble (char * str)
438 subtype, /* PC-relative or not. */ 387 subtype, /* PC-relative or not. */
439 exp.X_add_symbol, 388 exp.X_add_symbol,
440 exp.X_add_number, 389 exp.X_add_number,
@@ -450,7 +399,7 @@ index c79434785a..3f90b7c892 100644
450 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 399 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
451 if (opcode1 == NULL) 400 if (opcode1 == NULL)
452 { 401 {
453@@ -2187,13 +2221,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 402@@ -2184,13 +2190,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
454 fragP->fr_fix += INST_WORD_SIZE * 2; 403 fragP->fr_fix += INST_WORD_SIZE * 2;
455 fragP->fr_var = 0; 404 fragP->fr_var = 0;
456 break; 405 break;
@@ -475,7 +424,7 @@ index c79434785a..3f90b7c892 100644
475 fragP->fr_fix += INST_WORD_SIZE * 2; 424 fragP->fr_fix += INST_WORD_SIZE * 2;
476 fragP->fr_var = 0; 425 fragP->fr_var = 0;
477 break; 426 break;
478@@ -2416,22 +2460,38 @@ md_apply_fix (fixS * fixP, 427@@ -2412,22 +2428,38 @@ md_apply_fix (fixS * fixP,
479 case BFD_RELOC_64_PCREL: 428 case BFD_RELOC_64_PCREL:
480 case BFD_RELOC_64: 429 case BFD_RELOC_64:
481 case BFD_RELOC_MICROBLAZE_64_TEXTREL: 430 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
@@ -526,7 +475,7 @@ index c79434785a..3f90b7c892 100644
526 buf[0] = INST_BYTE0 (inst1); 475 buf[0] = INST_BYTE0 (inst1);
527 buf[1] = INST_BYTE1 (inst1); 476 buf[1] = INST_BYTE1 (inst1);
528 buf[2] = INST_BYTE2 (inst1); 477 buf[2] = INST_BYTE2 (inst1);
529@@ -2460,6 +2520,7 @@ md_apply_fix (fixS * fixP, 478@@ -2456,6 +2488,7 @@ md_apply_fix (fixS * fixP,
530 /* Fall through. */ 479 /* Fall through. */
531 480
532 case BFD_RELOC_MICROBLAZE_64_GOTPC: 481 case BFD_RELOC_MICROBLAZE_64_GOTPC:
@@ -534,7 +483,7 @@ index c79434785a..3f90b7c892 100644
534 case BFD_RELOC_MICROBLAZE_64_GOT: 483 case BFD_RELOC_MICROBLAZE_64_GOT:
535 case BFD_RELOC_MICROBLAZE_64_PLT: 484 case BFD_RELOC_MICROBLAZE_64_PLT:
536 case BFD_RELOC_MICROBLAZE_64_GOTOFF: 485 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
537@@ -2467,12 +2528,16 @@ md_apply_fix (fixS * fixP, 486@@ -2463,12 +2496,16 @@ md_apply_fix (fixS * fixP,
538 /* Add an imm instruction. First save the current instruction. */ 487 /* Add an imm instruction. First save the current instruction. */
539 for (i = 0; i < INST_WORD_SIZE; i++) 488 for (i = 0; i < INST_WORD_SIZE; i++)
540 buf[i + INST_WORD_SIZE] = buf[i]; 489 buf[i + INST_WORD_SIZE] = buf[i];
@@ -555,22 +504,27 @@ index c79434785a..3f90b7c892 100644
555 return; 504 return;
556 } 505 }
557 506
558@@ -2496,6 +2561,8 @@ md_apply_fix (fixS * fixP, 507@@ -2490,7 +2527,7 @@ md_apply_fix (fixS * fixP,
508 {
509 /* This fixup has been resolved. Create a reloc in case the linker
559 moves code around due to relaxing. */ 510 moves code around due to relaxing. */
560 if (fixP->fx_r_type == BFD_RELOC_64_PCREL) 511- if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
561 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
562+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 512+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
563+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 513 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
564 else if (fixP->fx_r_type == BFD_RELOC_32) 514 else if (fixP->fx_r_type == BFD_RELOC_32)
565 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 515 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
566 else 516@@ -2535,12 +2572,30 @@ md_estimate_size_before_relax (fragS * fragP,
567@@ -2539,6 +2606,32 @@ md_estimate_size_before_relax (fragS * fragP,
568 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error.....")); 517 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
569 abort (); 518 abort ();
570 } 519 }
520- else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
521- !S_IS_WEAK (fragP->fr_symbol))
571+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type 522+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
572+ && !S_IS_WEAK (fragP->fr_symbol)) 523+ && !S_IS_WEAK (fragP->fr_symbol))
573+ { 524 {
525- fragP->fr_subtype = DEFINED_PC_OFFSET;
526- /* Don't know now whether we need an imm instruction. */
527- fragP->fr_var = INST_WORD_SIZE;
574+ if (fragP->fr_opcode != NULL) { 528+ if (fragP->fr_opcode != NULL) {
575+ if(streq (fragP->fr_opcode, str_microblaze_64)) 529+ if(streq (fragP->fr_opcode, str_microblaze_64))
576+ { 530+ {
@@ -592,20 +546,10 @@ index c79434785a..3f90b7c892 100644
592+ /* Don't know now whether we need an imm instruction. */ 546+ /* Don't know now whether we need an imm instruction. */
593+ fragP->fr_var = INST_WORD_SIZE; 547+ fragP->fr_var = INST_WORD_SIZE;
594+ } 548+ }
595+ }
596+ #if 0
597 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
598 !S_IS_WEAK (fragP->fr_symbol))
599 {
600@@ -2546,6 +2639,7 @@ md_estimate_size_before_relax (fragS * fragP,
601 /* Don't know now whether we need an imm instruction. */
602 fragP->fr_var = INST_WORD_SIZE;
603 } 549 }
604+#endif
605 else if (S_IS_DEFINED (fragP->fr_symbol) 550 else if (S_IS_DEFINED (fragP->fr_symbol)
606 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0)) 551 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
607 { 552@@ -2644,6 +2699,7 @@ md_estimate_size_before_relax (fragS * fragP,
608@@ -2648,6 +2742,7 @@ md_estimate_size_before_relax (fragS * fragP,
609 case TLSLD_OFFSET: 553 case TLSLD_OFFSET:
610 case TLSTPREL_OFFSET: 554 case TLSTPREL_OFFSET:
611 case TLSDTPREL_OFFSET: 555 case TLSDTPREL_OFFSET:
@@ -613,16 +557,16 @@ index c79434785a..3f90b7c892 100644
613 fragP->fr_var = INST_WORD_SIZE*2; 557 fragP->fr_var = INST_WORD_SIZE*2;
614 break; 558 break;
615 case DEFINED_RO_SEGMENT: 559 case DEFINED_RO_SEGMENT:
616@@ -2701,7 +2796,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) 560@@ -2697,7 +2753,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
617 else 561 else
618 { 562 {
619 /* The case where we are going to resolve things... */ 563 /* The case where we are going to resolve things... */
620- if (fixp->fx_r_type == BFD_RELOC_64_PCREL) 564- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
621+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) 565+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
622 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; 566 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
623 else 567 else
624 return fixp->fx_where + fixp->fx_frag->fr_address; 568 return fixp->fx_where + fixp->fx_frag->fr_address;
625@@ -2734,6 +2829,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 569@@ -2730,6 +2786,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
626 case BFD_RELOC_MICROBLAZE_32_RWSDA: 570 case BFD_RELOC_MICROBLAZE_32_RWSDA:
627 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 571 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
628 case BFD_RELOC_MICROBLAZE_64_GOTPC: 572 case BFD_RELOC_MICROBLAZE_64_GOTPC:
@@ -631,7 +575,7 @@ index c79434785a..3f90b7c892 100644
631 case BFD_RELOC_MICROBLAZE_64_GOT: 575 case BFD_RELOC_MICROBLAZE_64_GOT:
632 case BFD_RELOC_MICROBLAZE_64_PLT: 576 case BFD_RELOC_MICROBLAZE_64_PLT:
633 case BFD_RELOC_MICROBLAZE_64_GOTOFF: 577 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
634@@ -2876,7 +2973,10 @@ cons_fix_new_microblaze (fragS * frag, 578@@ -2872,7 +2930,10 @@ cons_fix_new_microblaze (fragS * frag,
635 r = BFD_RELOC_32; 579 r = BFD_RELOC_32;
636 break; 580 break;
637 case 8: 581 case 8:
@@ -644,7 +588,7 @@ index c79434785a..3f90b7c892 100644
644 default: 588 default:
645 as_bad (_("unsupported BFD relocation size %u"), size); 589 as_bad (_("unsupported BFD relocation size %u"), size);
646diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 590diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
647index 6ee0966444..16b2736577 100644 591index 55f34f72b0d..8576e55cb8a 100644
648--- a/include/elf/microblaze.h 592--- a/include/elf/microblaze.h
649+++ b/include/elf/microblaze.h 593+++ b/include/elf/microblaze.h
650@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 594@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
@@ -653,11 +597,11 @@ index 6ee0966444..16b2736577 100644
653 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 597 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
654+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) 598+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
655+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ 599+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
656
657 END_RELOC_NUMBERS (R_MICROBLAZE_max) 600 END_RELOC_NUMBERS (R_MICROBLAZE_max)
658 601
602 /* Global base address names. */
659diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 603diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
660index 985834b8df..9b6264b61c 100644 604index 61eaa39b3eb..f2139a6839b 100644
661--- a/opcodes/microblaze-opc.h 605--- a/opcodes/microblaze-opc.h
662+++ b/opcodes/microblaze-opc.h 606+++ b/opcodes/microblaze-opc.h
663@@ -538,8 +538,8 @@ struct op_code_struct 607@@ -538,8 +538,8 @@ struct op_code_struct
@@ -672,7 +616,7 @@ index 985834b8df..9b6264b61c 100644
672 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 616 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
673 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst }, 617 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
674diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 618diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
675index 076dbcd0b3..5f2e190d23 100644 619index 1dcd3dca3d1..ad8b8ce345b 100644
676--- a/opcodes/microblaze-opcm.h 620--- a/opcodes/microblaze-opcm.h
677+++ b/opcodes/microblaze-opcm.h 621+++ b/opcodes/microblaze-opcm.h
678@@ -40,8 +40,8 @@ enum microblaze_instr 622@@ -40,8 +40,8 @@ enum microblaze_instr
@@ -680,9 +624,9 @@ index 076dbcd0b3..5f2e190d23 100644
680 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, 624 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
681 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, 625 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
682- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, 626- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
683- sbi, shi, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 627- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
684+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, 628+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
685+ sbi, shi, sli, swi, msrset, msrclr, tuqula, fadd, frsub, fmul, fdiv, 629+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
686 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 630 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
687 fint, fsqrt, 631 fint, fsqrt,
688 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, 632 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
index a6428534..067d9266 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
@@ -1,15 +1,16 @@
1From 7f6533a7c442b8966f30bbe7f0e872b1ef6a0d3f Mon Sep 17 00:00:00 2001 1From 48f658aba97d74c702b2fc5f1577d63c800b91f5 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 f2139a6839b..f9709412097 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/binutils/binutils/0018-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch
index 99c5f62a..0ed01b79 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch
@@ -1,48 +1,48 @@
1From 6d241a6865abf8196ba0cfa2aed7e847df087b6e Mon Sep 17 00:00:00 2001 1From 90d732c25cb6b55b33837e1d23d6850e4cbe10f7 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 gas/config/tc-microblaze.c | 90 ++++++++++++++++---------------------- 10 gas/config/tc-microblaze.c | 54 +++++++++++++++++++++++++++-----------
11 4 files changed, 62 insertions(+), 69 deletions(-) 11 4 files changed, 63 insertions(+), 32 deletions(-)
12 12
13diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 13diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
14index 4f777059d8..de46e78902 100644 14index c55092c9ec7..88f89bcdbcd 100644
15--- a/bfd/bfd-in2.h 15--- a/bfd/bfd-in2.h
16+++ b/bfd/bfd-in2.h 16+++ b/bfd/bfd-in2.h
17@@ -5872,15 +5872,20 @@ done here - only used for relaxing */ 17@@ -5434,15 +5434,20 @@ done here - only used for relaxing */
18 BFD_RELOC_MICROBLAZE_32_NONE, 18 BFD_RELOC_MICROBLAZE_32_NONE,
19 19
20 /* This is a 64 bit reloc that stores the 32 bit pc relative 20 /* This is a 64 bit reloc that stores the 32 bit pc relative
21- * +value in two words (with an imm instruction). No relocation is 21-value in two words (with an imm instruction). No relocation is
22+ * +value in two words (with an imml instruction). No relocation is 22+value in two words (with an imml instruction). No relocation is
23 * +done here - only used for relaxing */ 23 done here - only used for relaxing */
24- BFD_RELOC_MICROBLAZE_64_NONE, 24- BFD_RELOC_MICROBLAZE_64_NONE,
25+ BFD_RELOC_MICROBLAZE_64_PCREL, 25+ BFD_RELOC_MICROBLAZE_64_PCREL,
26 26
27-/* This is a 64 bit reloc that stores the 32 bit pc relative 27-/* This is a 64 bit reloc that stores the 32 bit pc relative
28+/* This is a 64 bit reloc that stores the 32 bit relative 28+/* This is a 64 bit reloc that stores the 32 bit relative
29 * +value in two words (with an imml instruction). No relocation is 29 value in two words (with an imml instruction). No relocation is
30 * +done here - only used for relaxing */ 30 done here - only used for relaxing */
31 BFD_RELOC_MICROBLAZE_64, 31 BFD_RELOC_MICROBLAZE_64,
32 32
33+/* This is a 64 bit reloc that stores the 32 bit pc relative 33+/* This is a 64 bit reloc that stores the 32 bit pc relative
34+ * +value in two words (with an imm instruction). No relocation is 34+value in two words (with an imm instruction). No relocation is
35+ * +done here - only used for relaxing */ 35+done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_64_NONE, 36+ BFD_RELOC_MICROBLAZE_64_NONE,
37+ 37+
38 /* This is a 64 bit reloc that stores the 32 bit pc relative 38 /* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). The relocation is 39 value in two words (with an imm instruction). The relocation is
40 PC-relative GOT offset */ 40 PC-relative GOT offset */
41diff --git a/bfd/libbfd.h b/bfd/libbfd.h 41diff --git a/bfd/libbfd.h b/bfd/libbfd.h
42index 450653f2d8..d87a183d5e 100644 42index b4aace6a70d..b4b7ee29a30 100644
43--- a/bfd/libbfd.h 43--- a/bfd/libbfd.h
44+++ b/bfd/libbfd.h 44+++ b/bfd/libbfd.h
45@@ -2903,14 +2903,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 45@@ -2969,14 +2969,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
46 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 46 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
47 "BFD_RELOC_MICROBLAZE_32_NONE", 47 "BFD_RELOC_MICROBLAZE_32_NONE",
48 "BFD_RELOC_MICROBLAZE_64_NONE", 48 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -60,10 +60,10 @@ index 450653f2d8..d87a183d5e 100644
60 "BFD_RELOC_MICROBLAZE_64_TLSGD", 60 "BFD_RELOC_MICROBLAZE_64_TLSGD",
61 "BFD_RELOC_MICROBLAZE_64_TLSLD", 61 "BFD_RELOC_MICROBLAZE_64_TLSLD",
62diff --git a/bfd/reloc.c b/bfd/reloc.c 62diff --git a/bfd/reloc.c b/bfd/reloc.c
63index ccf29f54cf..861f2d48c0 100644 63index 0e8a24e9cb0..b5c97da3ffd 100644
64--- a/bfd/reloc.c 64--- a/bfd/reloc.c
65+++ b/bfd/reloc.c 65+++ b/bfd/reloc.c
66@@ -6803,24 +6803,12 @@ ENUMDOC 66@@ -6866,24 +6866,12 @@ ENUMDOC
67 done here - only used for relaxing 67 done here - only used for relaxing
68 ENUM 68 ENUM
69 BFD_RELOC_MICROBLAZE_64_NONE 69 BFD_RELOC_MICROBLAZE_64_NONE
@@ -88,7 +88,7 @@ index ccf29f54cf..861f2d48c0 100644
88 ENUMDOC 88 ENUMDOC
89 This is a 64 bit reloc that stores the 32 bit pc relative 89 This is a 64 bit reloc that stores the 32 bit pc relative
90 value in two words (with an imm instruction). The relocation is 90 value in two words (with an imm instruction). The relocation is
91@@ -6906,6 +6894,20 @@ ENUMDOC 91@@ -6969,6 +6957,20 @@ ENUMDOC
92 value in two words (with an imm instruction). The relocation is 92 value in two words (with an imm instruction). The relocation is
93 relative offset from start of TEXT. 93 relative offset from start of TEXT.
94 94
@@ -110,7 +110,7 @@ index ccf29f54cf..861f2d48c0 100644
110 BFD_RELOC_AARCH64_RELOC_START 110 BFD_RELOC_AARCH64_RELOC_START
111 ENUMDOC 111 ENUMDOC
112diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 112diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
113index 3f90b7c892..587a4d56ec 100644 113index b8250e4cded..9c8b6284fb1 100644
114--- a/gas/config/tc-microblaze.c 114--- a/gas/config/tc-microblaze.c
115+++ b/gas/config/tc-microblaze.c 115+++ b/gas/config/tc-microblaze.c
116@@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; 116@@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
@@ -121,62 +121,28 @@ index 3f90b7c892..587a4d56ec 100644
121 121
122 /* Initialize the relax table. */ 122 /* Initialize the relax table. */
123 const relax_typeS md_relax_table[] = 123 const relax_typeS md_relax_table[] =
124@@ -119,7 +120,8 @@ const relax_typeS md_relax_table[] = 124@@ -118,7 +119,8 @@ const relax_typeS md_relax_table[] =
125 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
125 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ 126 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
126 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */ 127 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
127 // { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */ 128- { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */
128- { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */ 129+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */
129+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */ 130+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
130+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
131 }; 131 };
132 132
133 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ 133 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
134@@ -1180,33 +1182,6 @@ md_assemble (char * str) 134@@ -1930,8 +1932,8 @@ md_assemble (char * str)
135 inst |= (immed << IMM_LOW) & IMM_MASK;
136 }
137 }
138-#if 0 //revisit
139- else if (streq (name, "lli") || streq (name, "sli"))
140- {
141- temp = immed & 0xFFFFFFFFFFFF8000;
142- if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
143- {
144- /* Needs an immediate inst. */
145- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
146- if (opcode1 == NULL)
147- {
148- as_bad (_("unknown opcode \"%s\""), "imml");
149- return;
150- }
151-
152- inst1 = opcode1->bit_sequence;
153- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
154- output[0] = INST_BYTE0 (inst1);
155- output[1] = INST_BYTE1 (inst1);
156- output[2] = INST_BYTE2 (inst1);
157- output[3] = INST_BYTE3 (inst1);
158- output = frag_more (isize);
159- }
160- inst |= (reg1 << RD_LOW) & RD_MASK;
161- inst |= (reg2 << RA_LOW) & RA_MASK;
162- inst |= (immed << IMM_LOW) & IMM_MASK;
163- }
164-#endif
165 else
166 {
167 temp = immed & 0xFFFF8000;
168@@ -1958,8 +1933,8 @@ md_assemble (char * str)
169 135
170 if (exp.X_op != O_constant) 136 if (exp.X_op != O_constant)
171 { 137 {
172- char *opc = NULL; 138- char *opc = NULL;
173- //char *opc = str_microblaze_64; 139- //char *opc = str_microblaze_64;
174+ //char *opc = NULL; 140+ //char *opc = NULL;
175+ char *opc = str_microblaze_64; 141+ char *opc = strdup(str_microblaze_64);
176 relax_substateT subtype; 142 relax_substateT subtype;
177 143
178 if (exp.X_md != 0) 144 if (exp.X_md != 0)
179@@ -2221,13 +2196,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 145@@ -2190,13 +2192,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
180 fragP->fr_fix += INST_WORD_SIZE * 2; 146 fragP->fr_fix += INST_WORD_SIZE * 2;
181 fragP->fr_var = 0; 147 fragP->fr_var = 0;
182 break; 148 break;
@@ -198,7 +164,7 @@ index 3f90b7c892..587a4d56ec 100644
198 fragP->fr_fix += INST_WORD_SIZE * 2; 164 fragP->fr_fix += INST_WORD_SIZE * 2;
199 fragP->fr_var = 0; 165 fragP->fr_var = 0;
200 break; 166 break;
201@@ -2237,7 +2218,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 167@@ -2206,7 +2214,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
202 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC); 168 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC);
203 else 169 else
204 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, 170 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
@@ -207,7 +173,7 @@ index 3f90b7c892..587a4d56ec 100644
207 fragP->fr_fix += INST_WORD_SIZE * 2; 173 fragP->fr_fix += INST_WORD_SIZE * 2;
208 fragP->fr_var = 0; 174 fragP->fr_var = 0;
209 break; 175 break;
210@@ -2457,14 +2438,17 @@ md_apply_fix (fixS * fixP, 176@@ -2425,14 +2433,17 @@ md_apply_fix (fixS * fixP,
211 } 177 }
212 } 178 }
213 break; 179 break;
@@ -226,7 +192,7 @@ index 3f90b7c892..587a4d56ec 100644
226 { 192 {
227 /* Generate the imm instruction. */ 193 /* Generate the imm instruction. */
228 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 194 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
229@@ -2477,6 +2461,10 @@ md_apply_fix (fixS * fixP, 195@@ -2445,6 +2456,10 @@ md_apply_fix (fixS * fixP,
230 inst1 = opcode1->bit_sequence; 196 inst1 = opcode1->bit_sequence;
231 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 197 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
232 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; 198 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
@@ -237,7 +203,7 @@ index 3f90b7c892..587a4d56ec 100644
237 } 203 }
238 else 204 else
239 { 205 {
240@@ -2487,7 +2475,7 @@ md_apply_fix (fixS * fixP, 206@@ -2455,7 +2470,7 @@ md_apply_fix (fixS * fixP,
241 as_bad (_("unknown opcode \"%s\""), "imm"); 207 as_bad (_("unknown opcode \"%s\""), "imm");
242 return; 208 return;
243 } 209 }
@@ -246,7 +212,7 @@ index 3f90b7c892..587a4d56ec 100644
246 inst1 = opcode1->bit_sequence; 212 inst1 = opcode1->bit_sequence;
247 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 213 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
248 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 214 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
249@@ -2534,7 +2522,7 @@ md_apply_fix (fixS * fixP, 215@@ -2502,7 +2517,7 @@ md_apply_fix (fixS * fixP,
250 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 216 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
251 if (opcode1 == NULL) 217 if (opcode1 == NULL)
252 { 218 {
@@ -255,16 +221,16 @@ index 3f90b7c892..587a4d56ec 100644
255 as_bad (_("unknown opcode \"%s\""), "imml"); 221 as_bad (_("unknown opcode \"%s\""), "imml");
256 else 222 else
257 as_bad (_("unknown opcode \"%s\""), "imm"); 223 as_bad (_("unknown opcode \"%s\""), "imm");
258@@ -2561,8 +2549,6 @@ md_apply_fix (fixS * fixP, 224@@ -2527,7 +2542,7 @@ md_apply_fix (fixS * fixP,
225 {
226 /* This fixup has been resolved. Create a reloc in case the linker
259 moves code around due to relaxing. */ 227 moves code around due to relaxing. */
260 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
261 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
262- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 228- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
263- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 229+ if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
230 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
264 else if (fixP->fx_r_type == BFD_RELOC_32) 231 else if (fixP->fx_r_type == BFD_RELOC_32)
265 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 232 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
266 else 233@@ -2579,21 +2594,21 @@ md_estimate_size_before_relax (fragS * fragP,
267@@ -2613,33 +2599,24 @@ md_estimate_size_before_relax (fragS * fragP,
268 if(streq (fragP->fr_opcode, str_microblaze_64)) 234 if(streq (fragP->fr_opcode, str_microblaze_64))
269 { 235 {
270 /* Used as an absolute value. */ 236 /* Used as an absolute value. */
@@ -290,19 +256,7 @@ index 3f90b7c892..587a4d56ec 100644
290 fragP->fr_var = INST_WORD_SIZE; 256 fragP->fr_var = INST_WORD_SIZE;
291 } 257 }
292 } 258 }
293- #if 0 259@@ -2626,6 +2641,13 @@ md_estimate_size_before_relax (fragS * fragP,
294- else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
295- !S_IS_WEAK (fragP->fr_symbol))
296- {
297- fragP->fr_subtype = DEFINED_PC_OFFSET;
298- /* Don't know now whether we need an imm instruction. */
299- fragP->fr_var = INST_WORD_SIZE;
300- }
301-#endif
302 else if (S_IS_DEFINED (fragP->fr_symbol)
303 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
304 {
305@@ -2669,6 +2646,13 @@ md_estimate_size_before_relax (fragS * fragP,
306 /* Variable part does not change. */ 260 /* Variable part does not change. */
307 fragP->fr_var = INST_WORD_SIZE*2; 261 fragP->fr_var = INST_WORD_SIZE*2;
308 } 262 }
@@ -316,7 +270,7 @@ index 3f90b7c892..587a4d56ec 100644
316 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor)) 270 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
317 { 271 {
318 /* It is accessed using the small data read only anchor. */ 272 /* It is accessed using the small data read only anchor. */
319@@ -2743,6 +2727,7 @@ md_estimate_size_before_relax (fragS * fragP, 273@@ -2700,6 +2722,7 @@ md_estimate_size_before_relax (fragS * fragP,
320 case TLSTPREL_OFFSET: 274 case TLSTPREL_OFFSET:
321 case TLSDTPREL_OFFSET: 275 case TLSDTPREL_OFFSET:
322 case DEFINED_64_OFFSET: 276 case DEFINED_64_OFFSET:
@@ -324,16 +278,16 @@ index 3f90b7c892..587a4d56ec 100644
324 fragP->fr_var = INST_WORD_SIZE*2; 278 fragP->fr_var = INST_WORD_SIZE*2;
325 break; 279 break;
326 case DEFINED_RO_SEGMENT: 280 case DEFINED_RO_SEGMENT:
327@@ -2796,7 +2781,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) 281@@ -2753,7 +2776,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
328 else 282 else
329 { 283 {
330 /* The case where we are going to resolve things... */ 284 /* The case where we are going to resolve things... */
331- if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) 285- if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
332+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 286+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
333 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; 287 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
334 else 288 else
335 return fixp->fx_where + fixp->fx_frag->fr_address; 289 return fixp->fx_where + fixp->fx_frag->fr_address;
336@@ -2831,6 +2816,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 290@@ -2788,6 +2811,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
337 case BFD_RELOC_MICROBLAZE_64_GOTPC: 291 case BFD_RELOC_MICROBLAZE_64_GOTPC:
338 case BFD_RELOC_MICROBLAZE_64_GPC: 292 case BFD_RELOC_MICROBLAZE_64_GPC:
339 case BFD_RELOC_MICROBLAZE_64: 293 case BFD_RELOC_MICROBLAZE_64:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch
index edbfac0c..a621fb05 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-MB-x-relocation-issues.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch
@@ -1,28 +1,29 @@
1From bb6c70cfa1402a685995103ac90e7ceeccdd0991 Mon Sep 17 00:00:00 2001 1From c3e194e231529c1b642f7f1a19a2a7b1ea644bd9 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 gas/config/tc-microblaze.c | 152 +++++++++++++++++++++++++++---------- 10 gas/config/tc-microblaze.c | 221 +++++++++++++++++++++++++------------
10 gas/tc.h | 2 +- 11 gas/tc.h | 2 +-
11 3 files changed, 167 insertions(+), 55 deletions(-) 12 3 files changed, 209 insertions(+), 82 deletions(-)
12 13
13diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 14diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
14index 56a45f2a05..54a2461037 100644 15index d55700fc513..f8f52870639 100644
15--- a/bfd/elf64-microblaze.c 16--- a/bfd/elf64-microblaze.c
16+++ b/bfd/elf64-microblaze.c 17+++ b/bfd/elf64-microblaze.c
17@@ -1476,8 +1476,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, 18@@ -1478,8 +1478,17 @@ microblaze_elf_relocate_section (bfd *output_bfd,
18 relocation -= (input_section->output_section->vma 19 relocation -= (input_section->output_section->vma
19 + input_section->output_offset 20 + input_section->output_offset
20 + offset + INST_WORD_SIZE); 21 + offset + INST_WORD_SIZE);
21- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 22- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
22+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 23+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
23+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 24+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
24+ { 25+ {
25+ insn &= ~0x00ffffff; 26+ insn &= ~0x00ffffff;
26+ insn |= (relocation >> 16) & 0xffffff; 27+ insn |= (relocation >> 16) & 0xffffff;
27+ bfd_put_32 (input_bfd, insn, 28+ bfd_put_32 (input_bfd, insn,
28 contents + offset + endian); 29 contents + offset + endian);
@@ -33,7 +34,7 @@ index 56a45f2a05..54a2461037 100644
33 bfd_put_16 (input_bfd, relocation & 0xffff, 34 bfd_put_16 (input_bfd, relocation & 0xffff,
34 contents + offset + endian + INST_WORD_SIZE); 35 contents + offset + endian + INST_WORD_SIZE);
35 } 36 }
36@@ -1567,11 +1576,28 @@ microblaze_elf_relocate_section (bfd *output_bfd, 37@@ -1569,11 +1578,28 @@ microblaze_elf_relocate_section (bfd *output_bfd,
37 else 38 else
38 { 39 {
39 if (r_type == R_MICROBLAZE_64_PCREL) 40 if (r_type == R_MICROBLAZE_64_PCREL)
@@ -43,7 +44,7 @@ index 56a45f2a05..54a2461037 100644
43- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 44- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
44+ { 45+ {
45+ if (!input_section->output_section->vma && 46+ if (!input_section->output_section->vma &&
46+ !input_section->output_offset && !offset) 47+ !input_section->output_offset && !offset)
47+ relocation -= (input_section->output_section->vma 48+ relocation -= (input_section->output_section->vma
48+ + input_section->output_offset 49+ + input_section->output_offset
49+ + offset); 50+ + offset);
@@ -53,9 +54,9 @@ index 56a45f2a05..54a2461037 100644
53+ + offset + INST_WORD_SIZE); 54+ + offset + INST_WORD_SIZE);
54+ } 55+ }
55+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 56+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
56+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 57+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
57+ { 58+ {
58+ insn &= ~0x00ffffff; 59+ insn &= ~0x00ffffff;
59+ insn |= (relocation >> 16) & 0xffffff; 60+ insn |= (relocation >> 16) & 0xffffff;
60+ bfd_put_32 (input_bfd, insn, 61+ bfd_put_32 (input_bfd, insn,
61 contents + offset + endian); 62 contents + offset + endian);
@@ -66,7 +67,7 @@ index 56a45f2a05..54a2461037 100644
66 bfd_put_16 (input_bfd, relocation & 0xffff, 67 bfd_put_16 (input_bfd, relocation & 0xffff,
67 contents + offset + endian + INST_WORD_SIZE); 68 contents + offset + endian + INST_WORD_SIZE);
68 } 69 }
69@@ -1690,9 +1716,19 @@ static void 70@@ -1677,9 +1703,19 @@ static void
70 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 71 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
71 { 72 {
72 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 73 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
@@ -89,7 +90,7 @@ index 56a45f2a05..54a2461037 100644
89 } 90 }
90 91
91 /* Read-modify-write into the bfd, an immediate value into appropriate fields of 92 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
92@@ -1704,10 +1740,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 93@@ -1691,10 +1727,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
93 unsigned long instr_lo; 94 unsigned long instr_lo;
94 95
95 instr_hi = bfd_get_32 (abfd, bfd_addr); 96 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -113,10 +114,10 @@ index 56a45f2a05..54a2461037 100644
113 instr_lo &= ~0x0000ffff; 114 instr_lo &= ~0x0000ffff;
114 instr_lo |= (val & 0x0000ffff); 115 instr_lo |= (val & 0x0000ffff);
115diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 116diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
116index 587a4d56ec..fa437b6c98 100644 117index 9c8b6284fb1..f61fdf3b90a 100644
117--- a/gas/config/tc-microblaze.c 118--- a/gas/config/tc-microblaze.c
118+++ b/gas/config/tc-microblaze.c 119+++ b/gas/config/tc-microblaze.c
119@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 120@@ -391,7 +391,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
120 Integer arg to pass to the function. */ 121 Integer arg to pass to the function. */
121 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c, 122 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
122 and then in the read.c table. */ 123 and then in the read.c table. */
@@ -125,7 +126,7 @@ index 587a4d56ec..fa437b6c98 100644
125 { 126 {
126 {"lcomm", microblaze_s_lcomm, 1}, 127 {"lcomm", microblaze_s_lcomm, 1},
127 {"data", microblaze_s_data, 0}, 128 {"data", microblaze_s_data, 0},
128@@ -401,7 +401,7 @@ const pseudo_typeS md_pseudo_table[] = 129@@ -400,7 +400,7 @@ const pseudo_typeS md_pseudo_table[] =
129 {"data32", cons, 4}, /* Same as word. */ 130 {"data32", cons, 4}, /* Same as word. */
130 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 131 {"ent", s_func, 0}, /* Treat ent as function entry point. */
131 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 132 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
@@ -134,7 +135,84 @@ index 587a4d56ec..fa437b6c98 100644
134 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */ 135 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
135 {"weakext", microblaze_s_weakext, 0}, 136 {"weakext", microblaze_s_weakext, 0},
136 {"rodata", microblaze_s_rdata, 0}, 137 {"rodata", microblaze_s_rdata, 0},
137@@ -996,7 +996,7 @@ md_assemble (char * str) 138@@ -538,30 +538,6 @@ parse_reg (char * s, unsigned * reg)
139 *reg = REG_SP;
140 return s + 3;
141 }
142- else if (strncasecmp (s, "rfsl", 4) == 0)
143- {
144- if (ISDIGIT (s[4]) && ISDIGIT (s[5]))
145- {
146- tmpreg = (s[4] - '0') * 10 + s[5] - '0';
147- s += 6;
148- }
149- else if (ISDIGIT (s[4]))
150- {
151- tmpreg = s[4] - '0';
152- s += 5;
153- }
154- else
155- as_bad (_("register expected, but saw '%.6s'"), s);
156-
157- if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
158- *reg = tmpreg;
159- else
160- {
161- as_bad (_("Invalid register number at '%.6s'"), s);
162- *reg = 0;
163- }
164- return s;
165- }
166 /* Stack protection registers. */
167 else if (strncasecmp (s, "rshr", 4) == 0)
168 {
169@@ -605,6 +581,45 @@ parse_reg (char * s, unsigned * reg)
170 return s;
171 }
172
173+/* Same as above, but with long(er) register */
174+static char *
175+parse_regl (char * s, unsigned long * reg)
176+{
177+ unsigned long tmpreg = 0;
178+
179+ /* Strip leading whitespace. */
180+ while (ISSPACE (* s))
181+ ++ s;
182+
183+ if (strncasecmp (s, "rfsl", 4) == 0)
184+ {
185+ if (ISDIGIT (s[4]) && ISDIGIT (s[5]))
186+ {
187+ tmpreg = (s[4] - '0') * 10 + s[5] - '0';
188+ s += 6;
189+ }
190+ else if (ISDIGIT (s[4]))
191+ {
192+ tmpreg = s[4] - '0';
193+ s += 5;
194+ }
195+ else
196+ as_bad (_("register expected, but saw '%.6s'"), s);
197+
198+ if ((int) tmpreg >= MIN_REGNUM && tmpreg <= MAX_REGNUM)
199+ *reg = tmpreg;
200+ else
201+ {
202+ as_bad (_("Invalid register number at '%.6s'"), s);
203+ *reg = 0;
204+ }
205+ return s;
206+ }
207+ as_bad (_("register expected, but saw '%.6s'"), s);
208+ *reg = 0;
209+ return s;
210+}
211+
212 static char *
213 parse_exp (char *s, expressionS *e)
214 {
215@@ -995,7 +1010,7 @@ md_assemble (char * str)
138 unsigned reg2; 216 unsigned reg2;
139 unsigned reg3; 217 unsigned reg3;
140 unsigned isize; 218 unsigned isize;
@@ -143,7 +221,7 @@ index 587a4d56ec..fa437b6c98 100644
143 expressionS exp; 221 expressionS exp;
144 char name[20]; 222 char name[20];
145 long immedl; 223 long immedl;
146@@ -1118,8 +1118,9 @@ md_assemble (char * str) 224@@ -1117,8 +1132,9 @@ md_assemble (char * str)
147 as_fatal (_("lmi pseudo instruction should not use a label in imm field")); 225 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
148 else if (streq (name, "smi")) 226 else if (streq (name, "smi"))
149 as_fatal (_("smi pseudo instruction should not use a label in imm field")); 227 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
@@ -155,7 +233,7 @@ index 587a4d56ec..fa437b6c98 100644
155 opc = str_microblaze_ro_anchor; 233 opc = str_microblaze_ro_anchor;
156 else if (reg2 == REG_RWSDP) 234 else if (reg2 == REG_RWSDP)
157 opc = str_microblaze_rw_anchor; 235 opc = str_microblaze_rw_anchor;
158@@ -1182,31 +1183,55 @@ md_assemble (char * str) 236@@ -1181,31 +1197,55 @@ md_assemble (char * str)
159 inst |= (immed << IMM_LOW) & IMM_MASK; 237 inst |= (immed << IMM_LOW) & IMM_MASK;
160 } 238 }
161 } 239 }
@@ -197,7 +275,7 @@ index 587a4d56ec..fa437b6c98 100644
197+ inst |= (reg2 << RA_LOW) & RA_MASK; 275+ inst |= (reg2 << RA_LOW) & RA_MASK;
198+ inst |= (immed << IMM_LOW) & IMM_MASK; 276+ inst |= (immed << IMM_LOW) & IMM_MASK;
199+ } 277+ }
200+ else 278+ else
201+ { 279+ {
202+ temp = immed & 0xFFFF8000; 280+ temp = immed & 0xFFFF8000;
203+ if ((temp != 0) && (temp != 0xFFFF8000)) 281+ if ((temp != 0) && (temp != 0xFFFF8000))
@@ -225,7 +303,34 @@ index 587a4d56ec..fa437b6c98 100644
225 break; 303 break;
226 304
227 case INST_TYPE_RD_R1_IMMS: 305 case INST_TYPE_RD_R1_IMMS:
228@@ -1832,12 +1857,20 @@ md_assemble (char * str) 306@@ -1400,7 +1440,7 @@ md_assemble (char * str)
307 reg1 = 0;
308 }
309 if (strcmp (op_end, ""))
310- op_end = parse_reg (op_end + 1, &immed); /* Get rfslN. */
311+ op_end = parse_regl (op_end + 1, &immed); /* Get rfslN. */
312 else
313 {
314 as_fatal (_("Error in statement syntax"));
315@@ -1454,7 +1494,7 @@ md_assemble (char * str)
316 reg1 = 0;
317 }
318 if (strcmp (op_end, ""))
319- op_end = parse_reg (op_end + 1, &immed); /* Get rfslN. */
320+ op_end = parse_regl (op_end + 1, &immed); /* Get rfslN. */
321 else
322 {
323 as_fatal (_("Error in statement syntax"));
324@@ -1472,7 +1512,7 @@ md_assemble (char * str)
325
326 case INST_TYPE_RFSL:
327 if (strcmp (op_end, ""))
328- op_end = parse_reg (op_end + 1, &immed); /* Get rfslN. */
329+ op_end = parse_regl (op_end + 1, &immed); /* Get rfslN. */
330 else
331 {
332 as_fatal (_("Error in statement syntax"));
333@@ -1831,12 +1871,20 @@ md_assemble (char * str)
229 case INST_TYPE_IMM: 334 case INST_TYPE_IMM:
230 if (streq (name, "imm")) 335 if (streq (name, "imm"))
231 as_fatal (_("An IMM instruction should not be present in the .s file")); 336 as_fatal (_("An IMM instruction should not be present in the .s file"));
@@ -240,21 +345,21 @@ index 587a4d56ec..fa437b6c98 100644
240 { 345 {
241- char *opc = NULL; 346- char *opc = NULL;
242+ char *opc; 347+ char *opc;
243+ if (microblaze_arch_size == 64 && (streq (name, "breai") || 348+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
244+ streq (name, "breaid") || 349+ streq (name, "breaid") ||
245+ streq (name, "brai") || streq (name, "braid"))) 350+ streq (name, "brai") || streq (name, "braid")))
246+ opc = str_microblaze_64; 351+ opc = strdup(str_microblaze_64);
247+ else 352+ else
248+ opc = NULL; 353+ opc = NULL;
249 relax_substateT subtype; 354 relax_substateT subtype;
250 355
251 if (exp.X_md != 0) 356 if (exp.X_md != 0)
252@@ -1860,27 +1893,54 @@ md_assemble (char * str) 357@@ -1859,27 +1907,54 @@ md_assemble (char * str)
253 immed = exp.X_add_number; 358 immed = exp.X_add_number;
254 } 359 }
255 360
256+ if (microblaze_arch_size == 64 && (streq (name, "breai") || 361+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
257+ streq (name, "breaid") || 362+ streq (name, "breaid") ||
258+ streq (name, "brai") || streq (name, "braid"))) 363+ streq (name, "brai") || streq (name, "braid")))
259+ { 364+ {
260+ temp = immed & 0xFFFFFF8000; 365+ temp = immed & 0xFFFFFF8000;
@@ -322,7 +427,7 @@ index 587a4d56ec..fa437b6c98 100644
322 break; 427 break;
323 428
324 case INST_TYPE_NONE: 429 case INST_TYPE_NONE:
325@@ -2460,7 +2520,7 @@ md_apply_fix (fixS * fixP, 430@@ -2455,7 +2530,7 @@ md_apply_fix (fixS * fixP,
326 431
327 inst1 = opcode1->bit_sequence; 432 inst1 = opcode1->bit_sequence;
328 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 433 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
@@ -331,13 +436,13 @@ index 587a4d56ec..fa437b6c98 100644
331 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 436 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
332 fixP->fx_r_type = BFD_RELOC_64; 437 fixP->fx_r_type = BFD_RELOC_64;
333 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 438 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
334@@ -2628,7 +2688,14 @@ md_estimate_size_before_relax (fragS * fragP, 439@@ -2623,7 +2698,14 @@ md_estimate_size_before_relax (fragS * fragP,
335 } 440 }
336 else 441 else
337 { 442 {
338- fragP->fr_subtype = UNDEFINED_PC_OFFSET; 443- fragP->fr_subtype = UNDEFINED_PC_OFFSET;
339+ if (fragP->fr_opcode != NULL) { 444+ if (fragP->fr_opcode != NULL) {
340+ if (streq (fragP->fr_opcode, str_microblaze_64)) 445+ if (streq (fragP->fr_opcode, str_microblaze_64))
341+ fragP->fr_subtype = DEFINED_64_PC_OFFSET; 446+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
342+ else 447+ else
343+ fragP->fr_subtype = UNDEFINED_PC_OFFSET; 448+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
@@ -347,7 +452,7 @@ index 587a4d56ec..fa437b6c98 100644
347 fragP->fr_var = INST_WORD_SIZE*2; 452 fragP->fr_var = INST_WORD_SIZE*2;
348 } 453 }
349 break; 454 break;
350@@ -2905,6 +2972,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 455@@ -2900,6 +2982,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
351 case OPTION_M64: 456 case OPTION_M64:
352 //if (arg != NULL && strcmp (arg, "64") == 0) 457 //if (arg != NULL && strcmp (arg, "64") == 0)
353 microblaze_arch_size = 64; 458 microblaze_arch_size = 64;
@@ -356,7 +461,7 @@ index 587a4d56ec..fa437b6c98 100644
356 default: 461 default:
357 return 0; 462 return 0;
358diff --git a/gas/tc.h b/gas/tc.h 463diff --git a/gas/tc.h b/gas/tc.h
359index 0a50a6985b..529a73b43b 100644 464index da1738d67a8..5bdfe5c3475 100644
360--- a/gas/tc.h 465--- a/gas/tc.h
361+++ b/gas/tc.h 466+++ b/gas/tc.h
362@@ -22,7 +22,7 @@ 467@@ -22,7 +22,7 @@
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixing-the-branch-related-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixing-the-branch-related-issues.patch
deleted file mode 100644
index 528c9279..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixing-the-branch-related-issues.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 8375ef893eb327ae4a5dc9207041ffc0e9bc6e2b 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/binutils/binutils/0021-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch
index d62f0ed2..ad2fd5fe 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0021-Fixed-address-computation-issues-with-64bit-address.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch
@@ -1,9 +1,10 @@
1From 9f13e07180c09f814665676ac6c04cb7a2cd7c11 Mon Sep 17 00:00:00 2001 1From 1594b2f497822ebdb923b4ae55e81a10bfd4817d 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 ++++----
@@ -12,23 +13,23 @@ Subject: [PATCH 21/43] - Fixed address computation issues with 64bit address -
12 4 files changed, 79 insertions(+), 16 deletions(-) 13 4 files changed, 79 insertions(+), 16 deletions(-)
13 14
14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 15diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
15index de46e78902..33c9cb62d9 100644 16index 88f89bcdbcd..8902d9c7939 100644
16--- a/bfd/bfd-in2.h 17--- a/bfd/bfd-in2.h
17+++ b/bfd/bfd-in2.h 18+++ b/bfd/bfd-in2.h
18@@ -5881,6 +5881,11 @@ done here - only used for relaxing */ 19@@ -5443,6 +5443,11 @@ value in two words (with an imml instruction). No relocation is
19 * +done here - only used for relaxing */ 20 done here - only used for relaxing */
20 BFD_RELOC_MICROBLAZE_64, 21 BFD_RELOC_MICROBLAZE_64,
21 22
22+/* This is a 64 bit reloc that stores the 32 bit relative 23+/* This is a 64 bit reloc that stores the 32 bit relative
23+ * +value in two words (with an imml instruction). No relocation is 24+value in two words (with an imml instruction). No relocation is
24+ * +done here - only used for relaxing */ 25+done here - only used for relaxing */
25+ BFD_RELOC_MICROBLAZE_EA64, 26+ BFD_RELOC_MICROBLAZE_EA64,
26+ 27+
27 /* This is a 64 bit reloc that stores the 32 bit pc relative 28 /* This is a 64 bit reloc that stores the 32 bit pc relative
28 * +value in two words (with an imm instruction). No relocation is 29 value in two words (with an imm instruction). No relocation is
29 * +done here - only used for relaxing */ 30 done here - only used for relaxing */
30diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 31diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
31index e9b3cf3a86..40f10aac6d 100644 32index f8f52870639..17e58748a0b 100644
32--- a/bfd/elf64-microblaze.c 33--- a/bfd/elf64-microblaze.c
33+++ b/bfd/elf64-microblaze.c 34+++ b/bfd/elf64-microblaze.c
34@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 35@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -71,7 +72,7 @@ index e9b3cf3a86..40f10aac6d 100644
71 microblaze_reloc = R_MICROBLAZE_IMML_64; 72 microblaze_reloc = R_MICROBLAZE_IMML_64;
72 break; 73 break;
73 case BFD_RELOC_MICROBLAZE_64_GOTPC: 74 case BFD_RELOC_MICROBLAZE_64_GOTPC:
74@@ -1969,7 +1969,7 @@ microblaze_elf_relax_section (bfd *abfd, 75@@ -1956,7 +1956,7 @@ microblaze_elf_relax_section (bfd *abfd,
75 efix = calc_fixup (target_address, 0, sec); 76 efix = calc_fixup (target_address, 0, sec);
76 77
77 /* Validate the in-band val. */ 78 /* Validate the in-band val. */
@@ -81,10 +82,10 @@ index e9b3cf3a86..40f10aac6d 100644
81 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); 82 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
82 } 83 }
83diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 84diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
84index fa437b6c98..46df32e72f 100644 85index f61fdf3b90a..0dfb59ffe8b 100644
85--- a/gas/config/tc-microblaze.c 86--- a/gas/config/tc-microblaze.c
86+++ b/gas/config/tc-microblaze.c 87+++ b/gas/config/tc-microblaze.c
87@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] = 88@@ -401,7 +401,6 @@ pseudo_typeS md_pseudo_table[] =
88 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 89 {"ent", s_func, 0}, /* Treat ent as function entry point. */
89 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 90 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
90 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */ 91 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
@@ -92,7 +93,7 @@ index fa437b6c98..46df32e72f 100644
92 {"weakext", microblaze_s_weakext, 0}, 93 {"weakext", microblaze_s_weakext, 0},
93 {"rodata", microblaze_s_rdata, 0}, 94 {"rodata", microblaze_s_rdata, 0},
94 {"sdata2", microblaze_s_rdata, 1}, 95 {"sdata2", microblaze_s_rdata, 1},
95@@ -2479,18 +2478,74 @@ md_apply_fix (fixS * fixP, 96@@ -2489,18 +2488,74 @@ md_apply_fix (fixS * fixP,
96 case BFD_RELOC_RVA: 97 case BFD_RELOC_RVA:
97 case BFD_RELOC_32_PCREL: 98 case BFD_RELOC_32_PCREL:
98 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 99 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
@@ -142,7 +143,7 @@ index fa437b6c98..46df32e72f 100644
142+ } 143+ }
143+ } 144+ }
144+ break; 145+ break;
145+ 146+
146+ case BFD_RELOC_MICROBLAZE_EA64: 147+ case BFD_RELOC_MICROBLAZE_EA64:
147 /* Don't do anything if the symbol is not defined. */ 148 /* Don't do anything if the symbol is not defined. */
148 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 149 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
@@ -171,16 +172,16 @@ index fa437b6c98..46df32e72f 100644
171 buf[3] |= ((val >> 24) & 0xff); 172 buf[3] |= ((val >> 24) & 0xff);
172 buf[2] |= ((val >> 16) & 0xff); 173 buf[2] |= ((val >> 16) & 0xff);
173 buf[1] |= ((val >> 8) & 0xff); 174 buf[1] |= ((val >> 8) & 0xff);
174@@ -2611,6 +2666,8 @@ md_apply_fix (fixS * fixP, 175@@ -2621,6 +2676,8 @@ md_apply_fix (fixS * fixP,
175 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 176 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
176 else if (fixP->fx_r_type == BFD_RELOC_32) 177 else if (fixP->fx_r_type == BFD_RELOC_32)
177 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 178 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
178+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64) 179+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64)
179+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64; 180+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64;
180 else 181 else
181 fixP->fx_r_type = BFD_RELOC_NONE; 182 fixP->fx_r_type = BFD_RELOC_NONE;
182 fixP->fx_addsy = section_symbol (absolute_section); 183 fixP->fx_addsy = section_symbol (absolute_section);
183@@ -2882,6 +2939,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 184@@ -2892,6 +2949,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
184 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 185 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
185 case BFD_RELOC_MICROBLAZE_64_GOTPC: 186 case BFD_RELOC_MICROBLAZE_64_GOTPC:
186 case BFD_RELOC_MICROBLAZE_64_GPC: 187 case BFD_RELOC_MICROBLAZE_64_GPC:
@@ -188,7 +189,7 @@ index fa437b6c98..46df32e72f 100644
188 case BFD_RELOC_MICROBLAZE_64: 189 case BFD_RELOC_MICROBLAZE_64:
189 case BFD_RELOC_MICROBLAZE_64_PCREL: 190 case BFD_RELOC_MICROBLAZE_64_PCREL:
190 case BFD_RELOC_MICROBLAZE_64_GOT: 191 case BFD_RELOC_MICROBLAZE_64_GOT:
191@@ -3027,10 +3085,10 @@ cons_fix_new_microblaze (fragS * frag, 192@@ -3037,10 +3095,10 @@ cons_fix_new_microblaze (fragS * frag,
192 r = BFD_RELOC_32; 193 r = BFD_RELOC_32;
193 break; 194 break;
194 case 8: 195 case 8:
@@ -203,16 +204,16 @@ index fa437b6c98..46df32e72f 100644
203 default: 204 default:
204 as_bad (_("unsupported BFD relocation size %u"), size); 205 as_bad (_("unsupported BFD relocation size %u"), size);
205diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 206diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
206index 20ea6a885a..f679a43606 100644 207index a03f5b7a55b..fc8e79b19cf 100644
207--- a/opcodes/microblaze-dis.c 208--- a/opcodes/microblaze-dis.c
208+++ b/opcodes/microblaze-dis.c 209+++ b/opcodes/microblaze-dis.c
209@@ -61,7 +61,7 @@ get_field_imml (long instr) 210@@ -78,7 +78,7 @@ get_field_imml (struct string_buf *buf, long instr)
210 { 211 {
211 char tmpstr[25]; 212 char *p = strbuf (buf);
212 213
213- sprintf (tmpstr, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 214- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
214+ sprintf (tmpstr, "%d", (int)((instr & IMML_MASK) >> IMM_LOW)); 215+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
215 return (strdup (tmpstr)); 216 return p;
216 } 217 }
217 218
218-- 219--
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0022-Adding-new-relocation-to-support-64bit-rodata.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch
index ec82926d..99f285f2 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0022-Adding-new-relocation-to-support-64bit-rodata.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch
@@ -1,7 +1,7 @@
1From beeceebb05a4eeaeca697f4ba7e214485b10369a Mon Sep 17 00:00:00 2001 1From b33fdfda4af069859ebe6588a5b9774cb5a2f14d 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 +++++++--
@@ -9,10 +9,10 @@ Subject: [PATCH 22/43] Adding new relocation to support 64bit rodata
9 2 files changed, 54 insertions(+), 6 deletions(-) 9 2 files changed, 54 insertions(+), 6 deletions(-)
10 10
11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
12index 40f10aac6d..4d9b90647f 100644 12index 17e58748a0b..b62c47e8514 100644
13--- a/bfd/elf64-microblaze.c 13--- a/bfd/elf64-microblaze.c
14+++ b/bfd/elf64-microblaze.c 14+++ b/bfd/elf64-microblaze.c
15@@ -1461,6 +1461,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 15@@ -1463,6 +1463,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
16 case (int) R_MICROBLAZE_64_PCREL : 16 case (int) R_MICROBLAZE_64_PCREL :
17 case (int) R_MICROBLAZE_64: 17 case (int) R_MICROBLAZE_64:
18 case (int) R_MICROBLAZE_32: 18 case (int) R_MICROBLAZE_32:
@@ -20,16 +20,16 @@ index 40f10aac6d..4d9b90647f 100644
20 { 20 {
21 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols 21 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
22 from removed linkonce sections, or sections discarded by 22 from removed linkonce sections, or sections discarded by
23@@ -1470,6 +1471,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1472,6 +1473,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
24 relocation += addend; 24 relocation += addend;
25 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) 25 if (r_type == R_MICROBLAZE_32)
26 bfd_put_32 (input_bfd, relocation, contents + offset); 26 bfd_put_32 (input_bfd, relocation, contents + offset);
27+ else if (r_type == R_MICROBLAZE_IMML_64) 27+ else if (r_type == R_MICROBLAZE_IMML_64)
28+ bfd_put_64 (input_bfd, relocation, contents + offset); 28+ bfd_put_64 (input_bfd, relocation, contents + offset);
29 else 29 else
30 { 30 {
31 if (r_type == R_MICROBLAZE_64_PCREL) 31 if (r_type == R_MICROBLAZE_64_PCREL)
32@@ -1547,7 +1550,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 32@@ -1549,7 +1552,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
33 } 33 }
34 else 34 else
35 { 35 {
@@ -38,7 +38,7 @@ index 40f10aac6d..4d9b90647f 100644
38 { 38 {
39 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); 39 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
40 outrel.r_addend = relocation + addend; 40 outrel.r_addend = relocation + addend;
41@@ -1573,6 +1576,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 41@@ -1575,6 +1578,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
42 relocation += addend; 42 relocation += addend;
43 if (r_type == R_MICROBLAZE_32) 43 if (r_type == R_MICROBLAZE_32)
44 bfd_put_32 (input_bfd, relocation, contents + offset); 44 bfd_put_32 (input_bfd, relocation, contents + offset);
@@ -47,7 +47,7 @@ index 40f10aac6d..4d9b90647f 100644
47 else 47 else
48 { 48 {
49 if (r_type == R_MICROBLAZE_64_PCREL) 49 if (r_type == R_MICROBLAZE_64_PCREL)
50@@ -2085,7 +2090,8 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2072,7 +2077,8 @@ microblaze_elf_relax_section (bfd *abfd,
51 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 51 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
52 irelscan->r_addend); 52 irelscan->r_addend);
53 } 53 }
@@ -57,7 +57,7 @@ index 40f10aac6d..4d9b90647f 100644
57 { 57 {
58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
59 59
60@@ -2591,6 +2597,7 @@ microblaze_elf_check_relocs (bfd * abfd, 60@@ -2568,6 +2574,7 @@ microblaze_elf_check_relocs (bfd * abfd,
61 case R_MICROBLAZE_64: 61 case R_MICROBLAZE_64:
62 case R_MICROBLAZE_64_PCREL: 62 case R_MICROBLAZE_64_PCREL:
63 case R_MICROBLAZE_32: 63 case R_MICROBLAZE_32:
@@ -66,10 +66,10 @@ index 40f10aac6d..4d9b90647f 100644
66 if (h != NULL && !bfd_link_pic (info)) 66 if (h != NULL && !bfd_link_pic (info))
67 { 67 {
68diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 68diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
69index 46df32e72f..c6d2e4c82d 100644 69index 0dfb59ffe8b..4bd71557ca2 100644
70--- a/gas/config/tc-microblaze.c 70--- a/gas/config/tc-microblaze.c
71+++ b/gas/config/tc-microblaze.c 71+++ b/gas/config/tc-microblaze.c
72@@ -1119,6 +1119,13 @@ md_assemble (char * str) 72@@ -1133,6 +1133,13 @@ md_assemble (char * str)
73 as_fatal (_("smi pseudo instruction should not use a label in imm field")); 73 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
74 if(streq (name, "lli") || streq (name, "sli")) 74 if(streq (name, "lli") || streq (name, "sli"))
75 opc = str_microblaze_64; 75 opc = str_microblaze_64;
@@ -83,7 +83,7 @@ index 46df32e72f..c6d2e4c82d 100644
83 else if (reg2 == REG_ROSDP) 83 else if (reg2 == REG_ROSDP)
84 opc = str_microblaze_ro_anchor; 84 opc = str_microblaze_ro_anchor;
85 else if (reg2 == REG_RWSDP) 85 else if (reg2 == REG_RWSDP)
86@@ -1182,7 +1189,10 @@ md_assemble (char * str) 86@@ -1196,7 +1203,10 @@ md_assemble (char * str)
87 inst |= (immed << IMM_LOW) & IMM_MASK; 87 inst |= (immed << IMM_LOW) & IMM_MASK;
88 } 88 }
89 } 89 }
@@ -95,19 +95,19 @@ index 46df32e72f..c6d2e4c82d 100644
95 { 95 {
96 temp = immed & 0xFFFFFF8000; 96 temp = immed & 0xFFFFFF8000;
97 if (temp != 0 && temp != 0xFFFFFF8000) 97 if (temp != 0 && temp != 0xFFFFFF8000)
98@@ -1794,6 +1804,11 @@ md_assemble (char * str) 98@@ -1808,6 +1818,11 @@ md_assemble (char * str)
99 99
100 if (exp.X_md != 0) 100 if (exp.X_md != 0)
101 subtype = get_imm_otype(exp.X_md); 101 subtype = get_imm_otype(exp.X_md);
102+ else if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai")) 102+ else if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
103+ { 103+ {
104+ opc = str_microblaze_64; 104+ opc = strdup(str_microblaze_64);
105+ subtype = opcode->inst_offset_type; 105+ subtype = opcode->inst_offset_type;
106+ } 106+ }
107 else 107 else
108 subtype = opcode->inst_offset_type; 108 subtype = opcode->inst_offset_type;
109 109
110@@ -1811,6 +1826,31 @@ md_assemble (char * str) 110@@ -1825,6 +1840,31 @@ md_assemble (char * str)
111 output = frag_more (isize); 111 output = frag_more (isize);
112 immed = exp.X_add_number; 112 immed = exp.X_add_number;
113 } 113 }
@@ -139,7 +139,7 @@ index 46df32e72f..c6d2e4c82d 100644
139 139
140 temp = immed & 0xFFFF8000; 140 temp = immed & 0xFFFF8000;
141 if ((temp != 0) && (temp != 0xFFFF8000)) 141 if ((temp != 0) && (temp != 0xFFFF8000))
142@@ -1834,6 +1874,7 @@ md_assemble (char * str) 142@@ -1848,6 +1888,7 @@ md_assemble (char * str)
143 143
144 inst |= (reg1 << RD_LOW) & RD_MASK; 144 inst |= (reg1 << RD_LOW) & RD_MASK;
145 inst |= (immed << IMM_LOW) & IMM_MASK; 145 inst |= (immed << IMM_LOW) & IMM_MASK;
@@ -147,7 +147,7 @@ index 46df32e72f..c6d2e4c82d 100644
147 break; 147 break;
148 148
149 case INST_TYPE_R2: 149 case INST_TYPE_R2:
150@@ -3085,10 +3126,10 @@ cons_fix_new_microblaze (fragS * frag, 150@@ -3095,10 +3136,10 @@ cons_fix_new_microblaze (fragS * frag,
151 r = BFD_RELOC_32; 151 r = BFD_RELOC_32;
152 break; 152 break;
153 case 8: 153 case 8:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0023-fixing-the-.bss-relocation-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch
index d1ec5dbf..48b89d64 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0023-fixing-the-.bss-relocation-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch
@@ -1,35 +1,35 @@
1From 3f031961082caec9e172ff0224a51c08ab6e19c3 Mon Sep 17 00:00:00 2001 1From 118e1717ef8421bc86bcf56c9186f065bd607efd 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/binutils/binutils/0024-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
index 20752939..c84767fa 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
@@ -1,7 +1,7 @@
1From 843b73643718b0776462bce6aba6b2c6fdb33d85 Mon Sep 17 00:00:00 2001 1From 04d4e164cec91078b1b1155bae6ae4b508758969 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 e1a66f57e79..bf09c68afd9 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@@ -2019,8 +2019,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/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch
index b0fe8231..9a8e799c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch
@@ -1,7 +1,7 @@
1From 69b77a73f4e609883cd7a0946b407becd46bf918 Mon Sep 17 00:00:00 2001 1From 7d26e7f32769e1a324a8dfd3bc3eaa2a5fbfe62a Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 27 Feb 2019 15:12:32 +0530 3Date: Wed, 27 Feb 2019 15:12:32 +0530
4Subject: [PATCH 27/43] Revert "ld: Remove unused expression state" 4Subject: [PATCH 24/40] Revert "ld: Remove unused expression state"
5 5
6This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb. 6This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb.
7 7
@@ -13,10 +13,10 @@ Conflicts:
13 2 files changed, 6 insertions(+), 3 deletions(-) 13 2 files changed, 6 insertions(+), 3 deletions(-)
14 14
15diff --git a/ld/ldexp.c b/ld/ldexp.c 15diff --git a/ld/ldexp.c b/ld/ldexp.c
16index 60b17ef576..dac4b52450 100644 16index b4e7c41209d..dd3b058110a 100644
17--- a/ld/ldexp.c 17--- a/ld/ldexp.c
18+++ b/ld/ldexp.c 18+++ b/ld/ldexp.c
19@@ -1354,6 +1354,7 @@ static etree_type * 19@@ -1360,6 +1360,7 @@ static etree_type *
20 exp_assop (const char *dst, 20 exp_assop (const char *dst,
21 etree_type *src, 21 etree_type *src,
22 enum node_tree_enum class, 22 enum node_tree_enum class,
@@ -24,7 +24,7 @@ index 60b17ef576..dac4b52450 100644
24 bfd_boolean hidden) 24 bfd_boolean hidden)
25 { 25 {
26 etree_type *n; 26 etree_type *n;
27@@ -1365,6 +1366,7 @@ exp_assop (const char *dst, 27@@ -1371,6 +1372,7 @@ exp_assop (const char *dst,
28 n->assign.type.node_class = class; 28 n->assign.type.node_class = class;
29 n->assign.src = src; 29 n->assign.src = src;
30 n->assign.dst = dst; 30 n->assign.dst = dst;
@@ -32,7 +32,7 @@ index 60b17ef576..dac4b52450 100644
32 n->assign.hidden = hidden; 32 n->assign.hidden = hidden;
33 return n; 33 return n;
34 } 34 }
35@@ -1374,7 +1376,7 @@ exp_assop (const char *dst, 35@@ -1380,7 +1382,7 @@ exp_assop (const char *dst,
36 etree_type * 36 etree_type *
37 exp_assign (const char *dst, etree_type *src, bfd_boolean hidden) 37 exp_assign (const char *dst, etree_type *src, bfd_boolean hidden)
38 { 38 {
@@ -41,7 +41,7 @@ index 60b17ef576..dac4b52450 100644
41 } 41 }
42 42
43 /* Handle --defsym command-line option. */ 43 /* Handle --defsym command-line option. */
44@@ -1382,7 +1384,7 @@ exp_assign (const char *dst, etree_type *src, bfd_boolean hidden) 44@@ -1388,7 +1390,7 @@ exp_assign (const char *dst, etree_type *src, bfd_boolean hidden)
45 etree_type * 45 etree_type *
46 exp_defsym (const char *dst, etree_type *src) 46 exp_defsym (const char *dst, etree_type *src)
47 { 47 {
@@ -50,7 +50,7 @@ index 60b17ef576..dac4b52450 100644
50 } 50 }
51 51
52 /* Handle PROVIDE. */ 52 /* Handle PROVIDE. */
53@@ -1390,7 +1392,7 @@ exp_defsym (const char *dst, etree_type *src) 53@@ -1396,7 +1398,7 @@ exp_defsym (const char *dst, etree_type *src)
54 etree_type * 54 etree_type *
55 exp_provide (const char *dst, etree_type *src, bfd_boolean hidden) 55 exp_provide (const char *dst, etree_type *src, bfd_boolean hidden)
56 { 56 {
@@ -60,7 +60,7 @@ index 60b17ef576..dac4b52450 100644
60 60
61 /* Handle ASSERT. */ 61 /* Handle ASSERT. */
62diff --git a/ld/ldexp.h b/ld/ldexp.h 62diff --git a/ld/ldexp.h b/ld/ldexp.h
63index 71395bc6c4..f94b00aedb 100644 63index 717e839bd41..852ac6c5889 100644
64--- a/ld/ldexp.h 64--- a/ld/ldexp.h
65+++ b/ld/ldexp.h 65+++ b/ld/ldexp.h
66@@ -66,6 +66,7 @@ typedef union etree_union { 66@@ -66,6 +66,7 @@ typedef union etree_union {
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch
deleted file mode 100644
index 50179787..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-MicroBlaze-fixed-Build-issue-which-are-due-to-.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From 3a5e6a9c614c3f6abcf8bf853527ef07a5370f80 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 gas/config/tc-microblaze.c | 4 ++--
11 3 files changed, 9 insertions(+), 8 deletions(-)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 2d8c062a42..6a795c5069 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -1996,6 +1996,7 @@ microblaze_elf_relax_section (bfd *abfd,
18 /* This was a PC-relative instruction that was
19 completely resolved. */
20 int sfix, efix;
21+ unsigned int val;
22 bfd_vma target_address;
23 target_address = irel->r_addend + irel->r_offset;
24 sfix = calc_fixup (irel->r_offset, 0, sec);
25diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
26index ef6a87062b..bed534e7dd 100644
27--- a/bfd/elf64-microblaze.c
28+++ b/bfd/elf64-microblaze.c
29@@ -2854,14 +2854,14 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
30 /* If this is a weak symbol, and there is a real definition, the
31 processor independent code will have arranged for us to see the
32 real definition first, and we can just use the same value. */
33- if (h->u.weakdef != NULL)
34+ if (h->is_weakalias)
35 {
36- BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
37- || h->u.weakdef->root.type == bfd_link_hash_defweak);
38- h->root.u.def.section = h->u.weakdef->root.u.def.section;
39- h->root.u.def.value = h->u.weakdef->root.u.def.value;
40+ struct elf_link_hash_entry *def = weakdef (h);
41+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
42+ h->root.u.def.section = def->root.u.def.section;
43+ h->root.u.def.value = def->root.u.def.value;
44 return TRUE;
45- }
46+ }
47
48 /* This is a reference to a symbol defined by a dynamic object which
49 is not a function. */
50diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
51index c6d2e4c82d..b3e49f0cf0 100644
52--- a/gas/config/tc-microblaze.c
53+++ b/gas/config/tc-microblaze.c
54@@ -118,9 +118,9 @@ const relax_typeS md_relax_table[] =
55 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
56 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
57 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
58- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
59+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
60 // { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
61- { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */
62+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */
63 { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
64 };
65
66--
672.17.1
68
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
index 0fd14f6d..97d75650 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-Microblaze-Binutils-security-check-is-causing-.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
@@ -1,7 +1,7 @@
1From 282a60ab92e6705853dac30fd38aaf298d7f02b0 Mon Sep 17 00:00:00 2001 1From 8293b0cf15d4411402a2b0b50e4c532093c5d952 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---
@@ -9,18 +9,18 @@ Subject: [PATCH 28/43] [Patch,Microblaze] : Binutils security check is causing
9 1 file changed, 2 insertions(+) 9 1 file changed, 2 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 070104c2734..8331c8759d5 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@@ -442,6 +442,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
16 /* PR 17512: file: 2844a11d. */
17 if (hdr->sh_size == 0) 16 if (hdr->sh_size == 0)
18 return; 17 return;
18
19+ #if 0 19+ #if 0
20 if (hdr->sh_size > bfd_get_file_size (abfd)) 20 filesize = bfd_get_file_size (abfd);
21 if (filesize != 0 && hdr->sh_size > filesize)
21 { 22 {
22 /* xgettext:c-format */ 23@@ -451,6 +452,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
23@@ -448,6 +449,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
24 bfd_set_error (bfd_error_invalid_operation); 24 bfd_set_error (bfd_error_invalid_operation);
25 return; 25 return;
26 } 26 }
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch
deleted file mode 100644
index aef46b3f..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-Microblaze-changes-of-PR22458-failure-to-choos.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From e7f43c3afe90faa42c09f368671972c26c2b7b38 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/binutils/binutils/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch
index dbafc786..ebd1fa4c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0029-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -1,7 +1,7 @@
1From 26662110955e26c62629f4263a999216dac326ef Mon Sep 17 00:00:00 2001 1From 987bd08638fab099dcfdce412448734182be51e6 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 gas/config/tc-microblaze.c | 10 +++++----- 7 gas/config/tc-microblaze.c | 10 +++++-----
@@ -9,10 +9,10 @@ Subject: [PATCH 29/43] fixing the long & long long mingw toolchain issue
9 2 files changed, 7 insertions(+), 7 deletions(-) 9 2 files changed, 7 insertions(+), 7 deletions(-)
10 10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index b3e49f0cf0..5b506d3348 100644 12index 4bd71557ca2..83e17c60fa0 100644
13--- a/gas/config/tc-microblaze.c 13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c 14+++ b/gas/config/tc-microblaze.c
15@@ -783,7 +783,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) 15@@ -797,7 +797,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
16 } 16 }
17 17
18 static char * 18 static char *
@@ -21,7 +21,7 @@ index b3e49f0cf0..5b506d3348 100644
21 { 21 {
22 char *new_pointer; 22 char *new_pointer;
23 char *atp; 23 char *atp;
24@@ -834,11 +834,11 @@ parse_imml (char * s, expressionS * e, long min, long max) 24@@ -848,11 +848,11 @@ parse_imml (char * s, expressionS * e, long min, long max)
25 ; /* An error message has already been emitted. */ 25 ; /* An error message has already been emitted. */
26 else if ((e->X_op != O_constant && e->X_op != O_symbol) ) 26 else if ((e->X_op != O_constant && e->X_op != O_symbol) )
27 as_fatal (_("operand must be a constant or a label")); 27 as_fatal (_("operand must be a constant or a label"));
@@ -38,7 +38,7 @@ index b3e49f0cf0..5b506d3348 100644
38 38
39 if (atp) 39 if (atp)
40diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 40diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
41index 824afc0ab0..d59ee0a95f 100644 41index f9709412097..77d74c17f3a 100644
42--- a/opcodes/microblaze-opc.h 42--- a/opcodes/microblaze-opc.h
43+++ b/opcodes/microblaze-opc.h 43+++ b/opcodes/microblaze-opc.h
44@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr"; 44@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr";
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0030-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Added-support-to-new-arithmetic-single-register-inst.patch
index 8141095a..12f44a6d 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0030-Added-support-to-new-arithmetic-single-register-inst.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -1,21 +1,21 @@
1From 7b332d61cb3dbcae69021ce706f2c408c85af193 Mon Sep 17 00:00:00 2001 1From dde3395588ca91a7c484cc4a003f72f80848c534 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 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++- 8 gas/config/tc-microblaze.c | 145 ++++++++++++++++++++++++++++++++++++-
9 opcodes/microblaze-dis.c | 12 +++ 9 opcodes/microblaze-dis.c | 13 +++-
10 opcodes/microblaze-opc.h | 43 ++++++++++- 10 opcodes/microblaze-opc.h | 45 +++++++++++-
11 opcodes/microblaze-opcm.h | 5 +- 11 opcodes/microblaze-opcm.h | 5 +-
12 4 files changed, 201 insertions(+), 6 deletions(-) 12 4 files changed, 201 insertions(+), 7 deletions(-)
13 13
14diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 14diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
15index 5b506d3348..12eef24a29 100644 15index 83e17c60fa0..b4330652758 100644
16--- a/gas/config/tc-microblaze.c 16--- a/gas/config/tc-microblaze.c
17+++ b/gas/config/tc-microblaze.c 17+++ b/gas/config/tc-microblaze.c
18@@ -423,12 +423,33 @@ void 18@@ -422,12 +422,33 @@ void
19 md_begin (void) 19 md_begin (void)
20 { 20 {
21 struct op_code_struct * opcode; 21 struct op_code_struct * opcode;
@@ -26,7 +26,7 @@ index 5b506d3348..12eef24a29 100644
26 /* Insert unique names into hash table. */ 26 /* Insert unique names into hash table. */
27- for (opcode = opcodes; opcode->name; opcode ++) 27- for (opcode = opcodes; opcode->name; opcode ++)
28- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); 28- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
29+ for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++) 29+ for (opcode = (struct op_code_struct *)opcodes; opcode->name; opcode ++)
30+ { 30+ {
31+ if (strcmp (prev_name, opcode->name)) 31+ if (strcmp (prev_name, opcode->name))
32+ { 32+ {
@@ -51,7 +51,7 @@ index 5b506d3348..12eef24a29 100644
51 } 51 }
52 52
53 /* Try to parse a reg name. */ 53 /* Try to parse a reg name. */
54@@ -986,6 +1007,7 @@ md_assemble (char * str) 54@@ -1000,6 +1021,7 @@ md_assemble (char * str)
55 { 55 {
56 char * op_start; 56 char * op_start;
57 char * op_end; 57 char * op_end;
@@ -59,19 +59,15 @@ index 5b506d3348..12eef24a29 100644
59 struct op_code_struct * opcode, *opcode1; 59 struct op_code_struct * opcode, *opcode1;
60 char * output = NULL; 60 char * output = NULL;
61 int nlen = 0; 61 int nlen = 0;
62@@ -996,9 +1018,10 @@ md_assemble (char * str) 62@@ -1013,6 +1035,7 @@ md_assemble (char * str)
63 unsigned reg3; 63 expressionS exp;
64 unsigned isize;
65 unsigned long immed, immed2, temp;
66- expressionS exp;
67+ expressionS exp,exp1;
68 char name[20]; 64 char name[20];
69 long immedl; 65 long immedl;
70+ int reg=0; 66+ int reg=0;
71 67
72 /* Drop leading whitespace. */ 68 /* Drop leading whitespace. */
73 while (ISSPACE (* str)) 69 while (ISSPACE (* str))
74@@ -1029,7 +1052,78 @@ md_assemble (char * str) 70@@ -1043,7 +1066,78 @@ md_assemble (char * str)
75 as_bad (_("unknown opcode \"%s\""), name); 71 as_bad (_("unknown opcode \"%s\""), name);
76 return; 72 return;
77 } 73 }
@@ -151,7 +147,7 @@ index 5b506d3348..12eef24a29 100644
151 inst = opcode->bit_sequence; 147 inst = opcode->bit_sequence;
152 isize = 4; 148 isize = 4;
153 149
154@@ -1480,6 +1574,51 @@ md_assemble (char * str) 150@@ -1494,6 +1588,51 @@ md_assemble (char * str)
155 inst |= (immed << IMM_LOW) & IMM15_MASK; 151 inst |= (immed << IMM_LOW) & IMM15_MASK;
156 break; 152 break;
157 153
@@ -204,37 +200,45 @@ index 5b506d3348..12eef24a29 100644
204 if (strcmp (op_end, "")) 200 if (strcmp (op_end, ""))
205 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 201 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
206diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 202diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
207index f679a43606..e5e880cb1c 100644 203index fc8e79b19cf..f5db1189240 100644
208--- a/opcodes/microblaze-dis.c 204--- a/opcodes/microblaze-dis.c
209+++ b/opcodes/microblaze-dis.c 205+++ b/opcodes/microblaze-dis.c
210@@ -114,6 +114,15 @@ get_field_imm15 (long instr) 206@@ -131,6 +131,15 @@ get_field_imm15 (struct string_buf *buf, long instr)
211 return (strdup (tmpstr)); 207 return p;
212 } 208 }
213 209
214+static char * 210+static char *
215+get_field_imm16 (long instr) 211+get_field_imm16 (struct string_buf *buf, long instr)
216+{ 212+{
217+ char tmpstr[25]; 213+ char *p = strbuf (buf);
218+ 214+
219+ sprintf (tmpstr, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW)); 215+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
220+ return (strdup (tmpstr)); 216+ return p;
221+} 217+}
222+ 218+
223 static char * 219 static char *
224 get_field_special (long instr, struct op_code_struct * op) 220 get_field_special (struct string_buf *buf, long instr,
225 { 221 struct op_code_struct *op)
226@@ -419,6 +428,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 222@@ -450,6 +459,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
227 case INST_TYPE_RD_IMM15: 223 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
228 print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm15 (inst)); 224 get_field_imm15 (&buf, inst));
229 break; 225 break;
230+ case INST_TYPE_RD_IMML: 226+ case INST_TYPE_RD_IMML:
231+ print_func (stream, "\t%s, %s", get_field_rd (inst), get_field_imm16 (inst)); 227+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
232+ break; 228+ break;
233 /* For mbar insn. */ 229 /* For mbar insn. */
234 case INST_TYPE_IMM5: 230 case INST_TYPE_IMM5:
235 print_func (stream, "\t%s", get_field_imm5_mbar (inst)); 231 print_func (stream, "\t%s", get_field_imm5_mbar (&buf, inst));
232@@ -457,7 +469,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
233 /* For mbar 16 or sleep insn. */
234 case INST_TYPE_NONE:
235 break;
236- /* For tuqula instruction */
237 /* For bit field insns. */
238 case INST_TYPE_RD_R1_IMMW_IMMS:
239 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
236diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 240diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
237index d59ee0a95f..0774f70e08 100644 241index 77d74c17f3a..bd1cc90bff6 100644
238--- a/opcodes/microblaze-opc.h 242--- a/opcodes/microblaze-opc.h
239+++ b/opcodes/microblaze-opc.h 243+++ b/opcodes/microblaze-opc.h
240@@ -69,6 +69,7 @@ 244@@ -69,6 +69,7 @@
@@ -287,7 +291,7 @@ index d59ee0a95f..0774f70e08 100644
287 /* New Mask for msrset, msrclr insns. */ 291 /* New Mask for msrset, msrclr insns. */
288 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ 292 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
289 /* Mask for mbar insn. */ 293 /* Mask for mbar insn. */
290@@ -114,7 +143,7 @@ 294@@ -114,13 +143,13 @@
291 #define DELAY_SLOT 1 295 #define DELAY_SLOT 1
292 #define NO_DELAY_SLOT 0 296 #define NO_DELAY_SLOT 0
293 297
@@ -296,6 +300,13 @@ index d59ee0a95f..0774f70e08 100644
296 300
297 struct op_code_struct 301 struct op_code_struct
298 { 302 {
303 const char * name;
304 short inst_type; /* Registers and immediate values involved. */
305- short inst_offset_type; /* Immediate vals offset from PC? (= 1 for branches). */
306+ int inst_offset_type; /* Immediate vals offset from PC? (= 1 for branches). */
307 short delay_slots; /* Info about delay slots needed after this instr. */
308 short immval_mask;
309 unsigned long bit_sequence; /* All the fixed bits for the op are set and
299@@ -444,13 +473,21 @@ struct op_code_struct 310@@ -444,13 +473,21 @@ struct op_code_struct
300 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst }, 311 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
301 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst }, 312 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
@@ -333,7 +344,7 @@ index d59ee0a95f..0774f70e08 100644
333 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst }, 344 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
334 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst }, 345 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
335diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 346diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
336index 5f2e190d23..4d2ee2dd0d 100644 347index ad8b8ce345b..86cdb3b0715 100644
337--- a/opcodes/microblaze-opcm.h 348--- a/opcodes/microblaze-opcm.h
338+++ b/opcodes/microblaze-opcm.h 349+++ b/opcodes/microblaze-opcm.h
339@@ -61,7 +61,9 @@ enum microblaze_instr 350@@ -61,7 +61,9 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
index f9f0fc55..a8d5a385 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
@@ -1,19 +1,19 @@
1From 213df2cac38d404619614939de0c9d3dcbf7557d Mon Sep 17 00:00:00 2001 1From 623f4e7ea6c18bec0e141c7471c7bd609bd9a6d7 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 gas/config/tc-microblaze.c | 322 ++++++++++++++++++++++++++++++------- 8 gas/config/tc-microblaze.c | 324 ++++++++++++++++++++++++++++++-------
9 opcodes/microblaze-opc.h | 4 +- 9 opcodes/microblaze-opc.h | 4 +-
10 2 files changed, 263 insertions(+), 63 deletions(-) 10 2 files changed, 264 insertions(+), 64 deletions(-)
11 11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index 12eef24a29..3ff6a14baf 100644 13index b4330652758..f5cc1e05f7e 100644
14--- a/gas/config/tc-microblaze.c 14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c 15+++ b/gas/config/tc-microblaze.c
16@@ -1008,7 +1008,7 @@ md_assemble (char * str) 16@@ -1022,7 +1022,7 @@ md_assemble (char * str)
17 char * op_start; 17 char * op_start;
18 char * op_end; 18 char * op_end;
19 char * temp_op_end; 19 char * temp_op_end;
@@ -22,20 +22,21 @@ index 12eef24a29..3ff6a14baf 100644
22 char * output = NULL; 22 char * output = NULL;
23 int nlen = 0; 23 int nlen = 0;
24 int i; 24 int i;
25@@ -1192,7 +1192,12 @@ md_assemble (char * str) 25@@ -1206,7 +1206,12 @@ md_assemble (char * str)
26 reg2 = 0; 26 reg2 = 0;
27 } 27 }
28 if (strcmp (op_end, "")) 28 if (strcmp (op_end, ""))
29- op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
29+ { 30+ {
30+ if(microblaze_arch_size == 64) 31+ if (microblaze_arch_size == 64)
31+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML); 32+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
32+ else 33+ else
33 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM); 34+ op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
34+ } 35+ }
35 else 36 else
36 as_fatal (_("Error in statement syntax")); 37 as_fatal (_("Error in statement syntax"));
37 38
38@@ -1288,24 +1293,51 @@ md_assemble (char * str) 39@@ -1302,24 +1307,51 @@ md_assemble (char * str)
39 || streq (name, "lwi") || streq (name, "sbi") 40 || streq (name, "lwi") || streq (name, "sbi")
40 || streq (name, "shi") || streq (name, "swi")))) 41 || streq (name, "shi") || streq (name, "swi"))))
41 { 42 {
@@ -51,27 +52,28 @@ index 12eef24a29..3ff6a14baf 100644
51+ { 52+ {
52+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 53+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
53+ if (opcode1 == NULL) 54+ if (opcode1 == NULL)
54+ { 55 {
55+ as_bad (_("unknown opcode \"%s\""), "imml"); 56 as_bad (_("unknown opcode \"%s\""), "imml");
56+ return; 57 return;
57+ } 58 }
58+ inst1 = opcode1->bit_sequence; 59 inst1 = opcode1->bit_sequence;
60- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
59+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 61+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
60+ output[0] = INST_BYTE0 (inst1); 62 output[0] = INST_BYTE0 (inst1);
61+ output[1] = INST_BYTE1 (inst1); 63 output[1] = INST_BYTE1 (inst1);
62+ output[2] = INST_BYTE2 (inst1); 64 output[2] = INST_BYTE2 (inst1);
63+ output[3] = INST_BYTE3 (inst1); 65 output[3] = INST_BYTE3 (inst1);
64+ output = frag_more (isize); 66 output = frag_more (isize);
65+ } 67 }
66+ else 68+ else
67+ { 69+ {
68+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 70+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
69+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 71+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
70+ if (opcode1 == NULL || opcode2 == NULL) 72+ if (opcode1 == NULL || opcode2 == NULL)
71 { 73+ {
72 as_bad (_("unknown opcode \"%s\""), "imml"); 74+ as_bad (_("unknown opcode \"%s\""), "imml");
73 return; 75+ return;
74 } 76+ }
75+ inst1 = opcode2->bit_sequence; 77+ inst1 = opcode2->bit_sequence;
76+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; 78+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
77+ output[0] = INST_BYTE0 (inst1); 79+ output[0] = INST_BYTE0 (inst1);
@@ -79,20 +81,19 @@ index 12eef24a29..3ff6a14baf 100644
79+ output[2] = INST_BYTE2 (inst1); 81+ output[2] = INST_BYTE2 (inst1);
80+ output[3] = INST_BYTE3 (inst1); 82+ output[3] = INST_BYTE3 (inst1);
81+ output = frag_more (isize); 83+ output = frag_more (isize);
82 inst1 = opcode1->bit_sequence; 84+ inst1 = opcode1->bit_sequence;
83- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
84+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 85+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
85 output[0] = INST_BYTE0 (inst1); 86+ output[0] = INST_BYTE0 (inst1);
86 output[1] = INST_BYTE1 (inst1); 87+ output[1] = INST_BYTE1 (inst1);
87 output[2] = INST_BYTE2 (inst1); 88+ output[2] = INST_BYTE2 (inst1);
88 output[3] = INST_BYTE3 (inst1); 89+ output[3] = INST_BYTE3 (inst1);
89 output = frag_more (isize); 90+ output = frag_more (isize);
90 } 91+ }
91+ } 92+ }
92 inst |= (reg1 << RD_LOW) & RD_MASK; 93 inst |= (reg1 << RD_LOW) & RD_MASK;
93 inst |= (reg2 << RA_LOW) & RA_MASK; 94 inst |= (reg2 << RA_LOW) & RA_MASK;
94 inst |= (immed << IMM_LOW) & IMM_MASK; 95 inst |= (immed << IMM_LOW) & IMM_MASK;
95@@ -1316,14 +1348,13 @@ md_assemble (char * str) 96@@ -1330,14 +1362,13 @@ md_assemble (char * str)
96 if ((temp != 0) && (temp != 0xFFFF8000)) 97 if ((temp != 0) && (temp != 0xFFFF8000))
97 { 98 {
98 /* Needs an immediate inst. */ 99 /* Needs an immediate inst. */
@@ -109,7 +110,7 @@ index 12eef24a29..3ff6a14baf 100644
109 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK; 110 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
110 output[0] = INST_BYTE0 (inst1); 111 output[0] = INST_BYTE0 (inst1);
111 output[1] = INST_BYTE1 (inst1); 112 output[1] = INST_BYTE1 (inst1);
112@@ -1564,7 +1595,7 @@ md_assemble (char * str) 113@@ -1578,7 +1609,7 @@ md_assemble (char * str)
113 as_fatal (_("Cannot use special register with this instruction")); 114 as_fatal (_("Cannot use special register with this instruction"));
114 115
115 if (exp.X_op != O_constant) 116 if (exp.X_op != O_constant)
@@ -118,7 +119,7 @@ index 12eef24a29..3ff6a14baf 100644
118 else 119 else
119 { 120 {
120 output = frag_more (isize); 121 output = frag_more (isize);
121@@ -1898,8 +1929,9 @@ md_assemble (char * str) 122@@ -1912,8 +1943,9 @@ md_assemble (char * str)
122 temp = immed & 0xFFFF8000; 123 temp = immed & 0xFFFF8000;
123 if ((temp != 0) && (temp != 0xFFFF8000)) 124 if ((temp != 0) && (temp != 0xFFFF8000))
124 { 125 {
@@ -129,7 +130,7 @@ index 12eef24a29..3ff6a14baf 100644
129 if (opcode1 == NULL) 130 if (opcode1 == NULL)
130 { 131 {
131 as_bad (_("unknown opcode \"%s\""), "imm"); 132 as_bad (_("unknown opcode \"%s\""), "imm");
132@@ -1928,7 +1960,12 @@ md_assemble (char * str) 133@@ -1942,7 +1974,12 @@ md_assemble (char * str)
133 reg1 = 0; 134 reg1 = 0;
134 } 135 }
135 if (strcmp (op_end, "")) 136 if (strcmp (op_end, ""))
@@ -142,7 +143,7 @@ index 12eef24a29..3ff6a14baf 100644
142 else 143 else
143 as_fatal (_("Error in statement syntax")); 144 as_fatal (_("Error in statement syntax"));
144 145
145@@ -1967,30 +2004,55 @@ md_assemble (char * str) 146@@ -1981,30 +2018,55 @@ md_assemble (char * str)
146 } 147 }
147 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai")) 148 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
148 { 149 {
@@ -203,8 +204,8 @@ index 12eef24a29..3ff6a14baf 100644
203 temp = immed & 0xFFFF8000; 204 temp = immed & 0xFFFF8000;
204 if ((temp != 0) && (temp != 0xFFFF8000)) 205 if ((temp != 0) && (temp != 0xFFFF8000))
205 { 206 {
206@@ -2076,25 +2138,50 @@ md_assemble (char * str) 207@@ -2090,25 +2152,50 @@ md_assemble (char * str)
207 streq (name, "breaid") || 208 streq (name, "breaid") ||
208 streq (name, "brai") || streq (name, "braid"))) 209 streq (name, "brai") || streq (name, "braid")))
209 { 210 {
210- temp = immed & 0xFFFFFF8000; 211- temp = immed & 0xFFFFFF8000;
@@ -258,7 +259,7 @@ index 12eef24a29..3ff6a14baf 100644
258 inst |= (immed << IMM_LOW) & IMM_MASK; 259 inst |= (immed << IMM_LOW) & IMM_MASK;
259 } 260 }
260 else 261 else
261@@ -2194,21 +2281,45 @@ md_assemble (char * str) 262@@ -2208,21 +2295,45 @@ md_assemble (char * str)
262 { 263 {
263 output = frag_more (isize); 264 output = frag_more (isize);
264 immedl = exp.X_add_number; 265 immedl = exp.X_add_number;
@@ -319,7 +320,7 @@ index 12eef24a29..3ff6a14baf 100644
319 } 320 }
320 321
321 inst |= (reg1 << RD_LOW) & RD_MASK; 322 inst |= (reg1 << RD_LOW) & RD_MASK;
322@@ -2257,21 +2368,46 @@ md_assemble (char * str) 323@@ -2271,21 +2382,46 @@ md_assemble (char * str)
323 { 324 {
324 output = frag_more (isize); 325 output = frag_more (isize);
325 immedl = exp.X_add_number; 326 immedl = exp.X_add_number;
@@ -374,7 +375,7 @@ index 12eef24a29..3ff6a14baf 100644
374 375
375 inst |= (reg1 << RA_LOW) & RA_MASK; 376 inst |= (reg1 << RA_LOW) & RA_MASK;
376 inst |= (immedl << IMM_LOW) & IMM_MASK; 377 inst |= (immedl << IMM_LOW) & IMM_MASK;
377@@ -2554,8 +2690,8 @@ md_apply_fix (fixS * fixP, 378@@ -2565,8 +2701,8 @@ md_apply_fix (fixS * fixP,
378 /* Note: use offsetT because it is signed, valueT is unsigned. */ 379 /* Note: use offsetT because it is signed, valueT is unsigned. */
379 offsetT val = (offsetT) * valp; 380 offsetT val = (offsetT) * valp;
380 int i; 381 int i;
@@ -385,7 +386,7 @@ index 12eef24a29..3ff6a14baf 100644
385 386
386 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>"); 387 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
387 388
388@@ -2739,30 +2875,75 @@ md_apply_fix (fixS * fixP, 389@@ -2749,30 +2885,75 @@ md_apply_fix (fixS * fixP,
389 case BFD_RELOC_MICROBLAZE_64_TEXTREL: 390 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
390 case BFD_RELOC_MICROBLAZE_64: 391 case BFD_RELOC_MICROBLAZE_64:
391 case BFD_RELOC_MICROBLAZE_64_PCREL: 392 case BFD_RELOC_MICROBLAZE_64_PCREL:
@@ -471,7 +472,7 @@ index 12eef24a29..3ff6a14baf 100644
471 /* Generate the imm instruction. */ 472 /* Generate the imm instruction. */
472 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 473 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
473 if (opcode1 == NULL) 474 if (opcode1 == NULL)
474@@ -2774,12 +2955,11 @@ md_apply_fix (fixS * fixP, 475@@ -2784,12 +2965,11 @@ md_apply_fix (fixS * fixP,
475 inst1 = opcode1->bit_sequence; 476 inst1 = opcode1->bit_sequence;
476 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 477 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
477 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 478 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
@@ -485,7 +486,7 @@ index 12eef24a29..3ff6a14baf 100644
485 /* Add the value only if the symbol is defined. */ 486 /* Add the value only if the symbol is defined. */
486 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 487 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
487 { 488 {
488@@ -2811,21 +2991,41 @@ md_apply_fix (fixS * fixP, 489@@ -2821,21 +3001,41 @@ md_apply_fix (fixS * fixP,
489 /* Add an imm instruction. First save the current instruction. */ 490 /* Add an imm instruction. First save the current instruction. */
490 for (i = 0; i < INST_WORD_SIZE; i++) 491 for (i = 0; i < INST_WORD_SIZE; i++)
491 buf[i + INST_WORD_SIZE] = buf[i]; 492 buf[i + INST_WORD_SIZE] = buf[i];
@@ -532,7 +533,7 @@ index 12eef24a29..3ff6a14baf 100644
532 within the same section only. */ 533 within the same section only. */
533 buf[0] = INST_BYTE0 (inst1); 534 buf[0] = INST_BYTE0 (inst1);
534diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 535diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
535index 0774f70e08..bd9d91cd57 100644 536index bd1cc90bff6..cf5b5920921 100644
536--- a/opcodes/microblaze-opc.h 537--- a/opcodes/microblaze-opc.h
537+++ b/opcodes/microblaze-opc.h 538+++ b/opcodes/microblaze-opc.h
538@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; 539@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
@@ -541,7 +542,7 @@ index 0774f70e08..bd9d91cd57 100644
541 542
542-#define MIN_IMML ((long long) 0xffffff8000000000L) 543-#define MIN_IMML ((long long) 0xffffff8000000000L)
543-#define MAX_IMML ((long long) 0x0000007fffffffffL) 544-#define MAX_IMML ((long long) 0x0000007fffffffffL)
544+#define MIN_IMML ((long long) -9223372036854775808) 545+#define MIN_IMML ((long long) -9223372036854775807)
545+#define MAX_IMML ((long long) 9223372036854775807) 546+#define MAX_IMML ((long long) 9223372036854775807)
546 547
547 #endif /* MICROBLAZE_OPC */ 548 #endif /* MICROBLAZE_OPC */
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
index 118c5629..3720f2dc 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0045-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
@@ -1,7 +1,7 @@
1From d64ce07a2b9206ce1e53d8958b28de02cc7cca2b Mon Sep 17 00:00:00 2001 1From b7b5caa314177cfe8aeb0fb6d748f6e52fe51a83 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Wed, 22 Jan 2020 16:31:12 +0530 3Date: Wed, 22 Jan 2020 16:31:12 +0530
4Subject: [PATCH 45/45] Fixed bug in generation of IMML instruction for the new 4Subject: [PATCH 29/40] Fixed bug in generation of IMML instruction for the new
5 MB-64 instructions with single register. 5 MB-64 instructions with single register.
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 45/45] Fixed bug in generation of IMML instruction for the new
9 1 file changed, 47 insertions(+), 3 deletions(-) 9 1 file changed, 47 insertions(+), 3 deletions(-)
10 10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 95a1e69729..dc79328df6 100644 12index f5cc1e05f7e..efd1a42769e 100644
13--- a/gas/config/tc-microblaze.c 13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c 14+++ b/gas/config/tc-microblaze.c
15@@ -1642,12 +1642,56 @@ md_assemble (char * str) 15@@ -1653,12 +1653,56 @@ md_assemble (char * str)
16 exp.X_add_symbol, 16 exp.X_add_symbol,
17 exp.X_add_number, 17 exp.X_add_number,
18 (char *) opc); 18 (char *) opc);
@@ -70,8 +70,8 @@ index 95a1e69729..dc79328df6 100644
70 } 70 }
71 inst |= (reg1 << RD_LOW) & RD_MASK; 71 inst |= (reg1 << RD_LOW) & RD_MASK;
72 inst |= (immed << IMM_LOW) & IMM16_MASK; 72 inst |= (immed << IMM_LOW) & IMM16_MASK;
73@@ -2141,8 +2185,8 @@ md_assemble (char * str) 73@@ -2152,8 +2196,8 @@ md_assemble (char * str)
74 streq (name, "breaid") || 74 streq (name, "breaid") ||
75 streq (name, "brai") || streq (name, "braid"))) 75 streq (name, "brai") || streq (name, "braid")))
76 { 76 {
77- temp = immed & 0xFFFFFFFFFFFF8000; 77- temp = immed & 0xFFFFFFFFFFFF8000;
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch
new file mode 100644
index 00000000..8cd3563b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch
@@ -0,0 +1,47 @@
1From 0afa4ba2af8d63cb70771f1c7e235af920603533 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH 30/40] [Patch,MicroBlaze m64]: Update imml instructions for
5 Type A branch EA
6
7This patch will remove imml 0 and imml -1 instructions when the offset is less than 16 bit for Type A branch EA instructions.
8---
9 gas/config/tc-microblaze.c | 14 +++++++-------
10 1 file changed, 7 insertions(+), 7 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index efd1a42769e..1d838abfefa 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -2164,13 +2164,13 @@ md_assemble (char * str)
17 if (exp.X_op != O_constant)
18 {
19 char *opc;
20- if (microblaze_arch_size == 64 && (streq (name, "breai") ||
21- streq (name, "breaid") ||
22- streq (name, "brai") || streq (name, "braid")))
23- opc = strdup(str_microblaze_64);
24+ /* removal of imml 0 and imml -1 for bea type A insns.
25+ if offset is 16 bit then imml instructions are redundant */
26+ if (microblaze_arch_size == 64 && (streq (name, "brai") || streq (name, "braid")))
27+ opc = strdup(str_microblaze_64);
28 else
29- opc = NULL;
30- relax_substateT subtype;
31+ opc = NULL;
32+ relax_substateT subtype;
33
34 if (exp.X_md != 0)
35 subtype = get_imm_otype(exp.X_md);
36@@ -2930,7 +2930,7 @@ md_apply_fix (fixS * fixP,
37 case BFD_RELOC_MICROBLAZE_64:
38 case BFD_RELOC_MICROBLAZE_64_PCREL:
39 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
40- || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
41+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL || (fixP->fx_r_type == BFD_RELOC_64_PCREL && microblaze_arch_size == 64))
42 {
43 /* Generate the imm instruction. */
44 if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
45--
462.17.1
47
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch
new file mode 100644
index 00000000..fda23a1a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch
@@ -0,0 +1,38 @@
1From 23f0f6e8281b5cd481ef7636739c07b446828f7e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Jun 2020 21:20:26 +0530
4Subject: [PATCH 31/40] ldlang.c: Workaround for improper address mapping
5 causing runtime loops
6
7[Patch,MicroBlaze] : improper address mapping of PROVIDE directive
8symbols[DTOR_END] are causing runtime loops and we don't need to override
9PROVIDE symbols if symbols are defined in libraries and linker so I am
10disabling override for PROVIDE symbols.
11---
12 ld/ldlang.c | 8 +++++++-
13 1 file changed, 7 insertions(+), 1 deletion(-)
14
15diff --git a/ld/ldlang.c b/ld/ldlang.c
16index 9977195074a..9e2c1da066e 100644
17--- a/ld/ldlang.c
18+++ b/ld/ldlang.c
19@@ -3657,9 +3657,15 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
20 plugin_insert = NULL;
21 #endif
22 break;
23+ /* This is from a --defsym on the command line. */
24 case lang_assignment_statement_enum:
25 if (s->assignment_statement.exp->type.node_class != etree_assert)
26- exp_fold_tree_no_dot (s->assignment_statement.exp);
27+ {
28+ if(!(s->assignment_statement.exp->assign.defsym) && (s->assignment_statement.exp->type.node_class == etree_provide))
29+ ;
30+ else
31+ exp_fold_tree_no_dot (s->assignment_statement.exp);
32+ }
33 break;
34 default:
35 break;
36--
372.17.1
38
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch
new file mode 100644
index 00000000..0e813f96
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch
@@ -0,0 +1,83 @@
1From 4d0c68ffb688c23f984de8c0a22af824c3902d83 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 16 Jul 2020 12:38:11 -0500
4Subject: [PATCH 32/40] gas: revert moving of md_pseudo_table from const
5
6The base system expect md_pseudo_table to be constant, Changing the
7definition will break other architectures when compiled with a
8unified source code.
9
10Patch reverts the change away from const, and implements a newer
11dynamic handler that passes the correct argument value based on word
12size.
13
14Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
15---
16 gas/config/tc-microblaze.c | 16 +++++++++++++---
17 gas/tc.h | 2 +-
18 2 files changed, 14 insertions(+), 4 deletions(-)
19
20diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
21index 1d838abfefa..da99d4ef482 100644
22--- a/gas/config/tc-microblaze.c
23+++ b/gas/config/tc-microblaze.c
24@@ -384,6 +384,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
25 demand_empty_rest_of_line ();
26 }
27
28+/* Handle the .gpword pseudo-op, Pass to s_rva */
29+
30+static void
31+microblaze_s_gpword (int ignore ATTRIBUTE_UNUSED)
32+{
33+ int size = 4;
34+ if (microblaze_arch_size == 64)
35+ size = 8;
36+ s_rva(size);
37+}
38+
39 /* This table describes all the machine specific pseudo-ops the assembler
40 has to support. The fields are:
41 Pseudo-op name without dot
42@@ -391,7 +402,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
43 Integer arg to pass to the function. */
44 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
45 and then in the read.c table. */
46-pseudo_typeS md_pseudo_table[] =
47+const pseudo_typeS md_pseudo_table[] =
48 {
49 {"lcomm", microblaze_s_lcomm, 1},
50 {"data", microblaze_s_data, 0},
51@@ -400,7 +411,7 @@ pseudo_typeS md_pseudo_table[] =
52 {"data32", cons, 4}, /* Same as word. */
53 {"ent", s_func, 0}, /* Treat ent as function entry point. */
54 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
55- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
56+ {"gpword", microblaze_s_gpword, 0}, /* gpword label => store resolved label address in data section. */
57 {"weakext", microblaze_s_weakext, 0},
58 {"rodata", microblaze_s_rdata, 0},
59 {"sdata2", microblaze_s_rdata, 1},
60@@ -3464,7 +3475,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
61 case OPTION_M64:
62 //if (arg != NULL && strcmp (arg, "64") == 0)
63 microblaze_arch_size = 64;
64- md_pseudo_table[7].poc_val = 8;
65 break;
66 default:
67 return 0;
68diff --git a/gas/tc.h b/gas/tc.h
69index 5bdfe5c3475..da1738d67a8 100644
70--- a/gas/tc.h
71+++ b/gas/tc.h
72@@ -22,7 +22,7 @@
73 /* In theory (mine, at least!) the machine dependent part of the assembler
74 should only have to include one file. This one. -- JF */
75
76-extern pseudo_typeS md_pseudo_table[];
77+extern const pseudo_typeS md_pseudo_table[];
78
79 const char * md_atof (int, char *, int *);
80 int md_parse_option (int, const char *);
81--
822.17.1
83
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Fix-various-compile-warnings.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Fix-various-compile-warnings.patch
new file mode 100644
index 00000000..7339995e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Fix-various-compile-warnings.patch
@@ -0,0 +1,105 @@
1From d9114e764eb42ae1daaf6af7c2a5e48fc764109d 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 gas/config/tc-microblaze.c | 11 +++++------
10 2 files changed, 10 insertions(+), 10 deletions(-)
11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index b002b414d64..8308f1ebd09 100644
14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c
16@@ -692,7 +692,7 @@ microblaze_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
17 /* Set the howto pointer for a RCE ELF reloc. */
18
19 static bfd_boolean
20-microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
21+microblaze_elf_info_to_howto (bfd * abfd,
22 arelent * cache_ptr,
23 Elf_Internal_Rela * dst)
24 {
25@@ -705,14 +705,14 @@ microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
26 r_type = ELF64_R_TYPE (dst->r_info);
27 if (r_type >= R_MICROBLAZE_max)
28 {
29- (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"),
30+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
31 abfd, r_type);
32 bfd_set_error (bfd_error_bad_value);
33 return FALSE;
34 }
35
36 cache_ptr->howto = microblaze_elf_howto_table [r_type];
37- return TRUE;
38+ return TRUE;
39 }
40
41 /* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
42@@ -1560,7 +1560,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
43 else
44 {
45 BFD_FAIL ();
46- (*_bfd_error_handler)
47+ _bfd_error_handler
48 (_("%pB: probably compiled without -fPIC?"),
49 input_bfd);
50 bfd_set_error (bfd_error_bad_value);
51@@ -2554,6 +2554,7 @@ microblaze_elf_check_relocs (bfd * abfd,
52 goto dogottls;
53 case R_MICROBLAZE_TLSLD:
54 tls_type |= (TLS_TLS | TLS_LD);
55+ /* Fall through. */
56 dogottls:
57 sec->has_tls_reloc = 1;
58 /* Fall through. */
59diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
60index da99d4ef482..62daa56b47a 100644
61--- a/gas/config/tc-microblaze.c
62+++ b/gas/config/tc-microblaze.c
63@@ -1091,7 +1091,6 @@ md_assemble (char * str)
64 reg = is_reg (temp_op_end + 1);
65 if (reg)
66 {
67-
68 opcode->inst_type=INST_TYPE_RD_R1_IMML;
69 opcode->inst_offset_type = OPCODE_MASK_H;
70 if (streq (name, "addli"))
71@@ -1242,18 +1241,18 @@ md_assemble (char * str)
72 else if (streq (name, "smi"))
73 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
74 if(streq (name, "lli") || streq (name, "sli"))
75- opc = str_microblaze_64;
76+ opc = strdup(str_microblaze_64);
77 else if ((microblaze_arch_size == 64) && ((streq (name, "lbui")
78 || streq (name, "lhui") || streq (name, "lwi") || streq (name, "sbi")
79 || streq (name, "shi") || streq (name, "swi"))))
80 {
81- opc = str_microblaze_64;
82+ opc = strdup(str_microblaze_64);
83 subtype = opcode->inst_offset_type;
84 }
85 else if (reg2 == REG_ROSDP)
86- opc = str_microblaze_ro_anchor;
87+ opc = strdup(str_microblaze_ro_anchor);
88 else if (reg2 == REG_RWSDP)
89- opc = str_microblaze_rw_anchor;
90+ opc = strdup(str_microblaze_rw_anchor);
91 else
92 opc = NULL;
93 if (exp.X_md != 0)
94@@ -1718,7 +1717,7 @@ md_assemble (char * str)
95 inst |= (reg1 << RD_LOW) & RD_MASK;
96 inst |= (immed << IMM_LOW) & IMM16_MASK;
97 break;
98-
99+
100 case INST_TYPE_R1_RFSL:
101 if (strcmp (op_end, ""))
102 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
103--
1042.17.1
105
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0032-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch
index 7ac89d2d..00e5410c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0032-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch
@@ -1,7 +1,7 @@
1From c347f9727cc86bb0174dc001446c0670e7306692 Mon Sep 17 00:00:00 2001 1From c466a54f6ac8fae44f3e79e33bb782086dc08a2b 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 ++
24 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++ 25 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++
25 gdb/microblaze-linux-tdep.c | 29 +++- 26 gdb/microblaze-linux-tdep.c | 29 +++-
26 gdb/microblaze-tdep.c | 35 ++++- 27 gdb/microblaze-tdep.c | 35 ++++-
27 gdb/microblaze-tdep.h | 4 +- 28 gdb/microblaze-tdep.h | 4 +-
28 gdb/regformats/reg-microblaze.dat | 41 ++++++ 29 gdb/regformats/reg-microblaze.dat | 41 ++++++
29 6 files changed, 298 insertions(+), 3 deletions(-) 30 gdbserver/Makefile.in | 4 +
31 gdbserver/configure.srv | 8 ++
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,27 @@ 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>
54diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 76diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
55new file mode 100644 77new file mode 100644
56index 0000000000..cba5d6fc58 78index 00000000000..cba5d6fc585
57--- /dev/null 79--- /dev/null
58+++ b/gdb/gdbserver/linux-microblaze-low.c 80+++ b/gdb/gdbserver/linux-microblaze-low.c
59@@ -0,0 +1,189 @@ 81@@ -0,0 +1,189 @@
@@ -247,7 +269,7 @@ index 0000000000..cba5d6fc58
247+ microblaze_supply_ptrace_register, 269+ microblaze_supply_ptrace_register,
248+}; 270+};
249diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 271diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
250index 4e5f60cd4e..7ab650a1cc 100644 272index be710bedb64..d15b24d619e 100644
251--- a/gdb/microblaze-linux-tdep.c 273--- a/gdb/microblaze-linux-tdep.c
252+++ b/gdb/microblaze-linux-tdep.c 274+++ b/gdb/microblaze-linux-tdep.c
253@@ -37,6 +37,22 @@ 275@@ -37,6 +37,22 @@
@@ -273,17 +295,14 @@ index 4e5f60cd4e..7ab650a1cc 100644
273 static int 295 static int
274 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 296 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
275 struct bp_target_info *bp_tgt) 297 struct bp_target_info *bp_tgt)
276@@ -46,18 +62,25 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 298@@ -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. */ 299 /* Determine appropriate breakpoint contents and size for this address. */
283 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 300 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
284 301
285+ /* Make sure we see the memory breakpoints. */ 302+ /* Make sure we see the memory breakpoints. */
286+ cleanup = make_show_memory_breakpoints_cleanup (1); 303+ scoped_restore restore_memory
304+ = make_scoped_restore_show_memory_breakpoints (1);
305+
287 val = target_read_memory (addr, old_contents, bplen); 306 val = target_read_memory (addr, old_contents, bplen);
288 307
289 /* If our breakpoint is no longer at the address, this means that the 308 /* If our breakpoint is no longer at the address, this means that the
@@ -296,10 +315,8 @@ index 4e5f60cd4e..7ab650a1cc 100644
296+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 315+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
297+ } 316+ }
298 317
299+ do_cleanups (cleanup);
300 return val; 318 return val;
301 } 319 }
302
303@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info, 320@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
304 /* Trampolines. */ 321 /* Trampolines. */
305 tramp_frame_prepend_unwinder (gdbarch, 322 tramp_frame_prepend_unwinder (gdbarch,
@@ -310,9 +327,9 @@ index 4e5f60cd4e..7ab650a1cc 100644
310+ svr4_fetch_objfile_link_map); 327+ svr4_fetch_objfile_link_map);
311 } 328 }
312 329
313 void 330 void _initialize_microblaze_linux_tdep ();
314diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 331diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
315index 1248acbdc9..730a2b281f 100644 332index 5c804133040..5972a69eb5f 100644
316--- a/gdb/microblaze-tdep.c 333--- a/gdb/microblaze-tdep.c
317+++ b/gdb/microblaze-tdep.c 334+++ b/gdb/microblaze-tdep.c
318@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) 335@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
@@ -329,7 +346,6 @@ index 1248acbdc9..730a2b281f 100644
329+ int val; 346+ int val;
330+ int bplen; 347+ int bplen;
331+ gdb_byte old_contents[BREAKPOINT_MAX]; 348+ gdb_byte old_contents[BREAKPOINT_MAX];
332+ struct cleanup *cleanup;
333+ 349+
334+ /* Determine appropriate breakpoint contents and size for this address. */ 350+ /* Determine appropriate breakpoint contents and size for this address. */
335+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); 351+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
@@ -337,7 +353,9 @@ index 1248acbdc9..730a2b281f 100644
337+ error (_("Software breakpoints not implemented for this target.")); 353+ error (_("Software breakpoints not implemented for this target."));
338+ 354+
339+ /* Make sure we see the memory breakpoints. */ 355+ /* Make sure we see the memory breakpoints. */
340+ cleanup = make_show_memory_breakpoints_cleanup (1); 356+ scoped_restore restore_memory
357+ = make_scoped_restore_show_memory_breakpoints (1);
358+
341+ val = target_read_memory (addr, old_contents, bplen); 359+ val = target_read_memory (addr, old_contents, bplen);
342+ 360+
343+ /* If our breakpoint is no longer at the address, this means that the 361+ /* If our breakpoint is no longer at the address, this means that the
@@ -349,7 +367,6 @@ index 1248acbdc9..730a2b281f 100644
349+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr); 367+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
350+ } 368+ }
351+ 369+
352+ do_cleanups (cleanup);
353+ return val; 370+ return val;
354+} 371+}
355 372
@@ -363,14 +380,14 @@ index 1248acbdc9..730a2b281f 100644
363 380
364 set_gdbarch_frame_args_skip (gdbarch, 8); 381 set_gdbarch_frame_args_skip (gdbarch, 8);
365 382
366@@ -770,4 +802,5 @@ When non-zero, microblaze specific debugging is enabled."), 383@@ -771,4 +803,5 @@ When non-zero, microblaze specific debugging is enabled."),
367 NULL, 384 NULL,
368 &setdebuglist, &showdebuglist); 385 &setdebuglist, &showdebuglist);
369 386
370+ 387+
371 } 388 }
372diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 389diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
373index a0048148e4..63aab84ef6 100644 390index 4fbdf9933f0..db0772643dc 100644
374--- a/gdb/microblaze-tdep.h 391--- a/gdb/microblaze-tdep.h
375+++ b/gdb/microblaze-tdep.h 392+++ b/gdb/microblaze-tdep.h
376@@ -117,6 +117,8 @@ struct microblaze_frame_cache 393@@ -117,6 +117,8 @@ struct microblaze_frame_cache
@@ -385,7 +402,7 @@ index a0048148e4..63aab84ef6 100644
385 #endif /* microblaze-tdep.h */ 402 #endif /* microblaze-tdep.h */
386diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat 403diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
387new file mode 100644 404new file mode 100644
388index 0000000000..bd8a438442 405index 00000000000..bd8a4384424
389--- /dev/null 406--- /dev/null
390+++ b/gdb/regformats/reg-microblaze.dat 407+++ b/gdb/regformats/reg-microblaze.dat
391@@ -0,0 +1,41 @@ 408@@ -0,0 +1,41 @@
@@ -430,6 +447,54 @@ index 0000000000..bd8a438442
430+32:fsr 447+32:fsr
431+32:slr 448+32:slr
432+32:shr 449+32:shr
450diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
451index 9d7687be534..8195ccb8ad2 100644
452--- a/gdbserver/Makefile.in
453+++ b/gdbserver/Makefile.in
454@@ -183,6 +183,7 @@ SFILES = \
455 $(srcdir)/linux-ia64-low.cc \
456 $(srcdir)/linux-low.cc \
457 $(srcdir)/linux-m68k-low.cc \
458+ $(srcdir)/linux-microblaze-low.c \
459 $(srcdir)/linux-mips-low.cc \
460 $(srcdir)/linux-nios2-low.cc \
461 $(srcdir)/linux-ppc-low.cc \
462@@ -216,6 +217,7 @@ SFILES = \
463 $(srcdir)/../gdb/nat/linux-namespaces.c \
464 $(srcdir)/../gdb/nat/linux-osdata.c \
465 $(srcdir)/../gdb/nat/linux-personality.c \
466+ $(srcdir)/../gdb/nat/microblaze-linux.c \
467 $(srcdir)/../gdb/nat/mips-linux-watch.c \
468 $(srcdir)/../gdb/nat/ppc-linux.c \
469 $(srcdir)/../gdb/nat/riscv-linux-tdesc.c \
470@@ -557,6 +559,8 @@ target/%.o: ../gdb/target/%.c
471
472 %-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
473 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
474+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
475+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
476
477 #
478 # Dependency tracking.
479diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
480index 5e33bd9c54d..13d5c6aff87 100644
481--- a/gdbserver/configure.srv
482+++ b/gdbserver/configure.srv
483@@ -155,6 +155,14 @@ case "${gdbserver_host}" in
484 srv_linux_usrregs=yes
485 srv_linux_thread_db=yes
486 ;;
487+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
488+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
489+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
490+ srv_xmlfiles="microblaze-linux.xml"
491+ srv_linux_regsets=yes
492+ srv_linux_usrregs=yes
493+ srv_linux_thread_db=yes
494+ ;;
495 powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
496 srv_regobj="${srv_regobj} powerpc-altivec32l.o"
497 srv_regobj="${srv_regobj} powerpc-vsx32l.o"
433-- 498--
4342.17.1 4992.17.1
435 500
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Initial-port-of-core-reading-support.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0035-Initial-port-of-core-reading-support.patch
index e6bbf2b7..4eeeb7da 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Initial-port-of-core-reading-support.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0035-Initial-port-of-core-reading-support.patch
@@ -1,22 +1,22 @@
1From 0fd864ff792d7bcbbcbed5ee0ae9f429f1fd2353 Mon Sep 17 00:00:00 2001 1From b6c01467951b83f9cca621ffeb89151eba1d73a1 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 bf09c68afd9..a4b15882d77 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@@ -3574,4 +3655,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 d66f01bb9f7..2938fddfe82 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@@ -389,7 +389,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 d15b24d619e..0d5c08d24f6 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 5972a69eb5f..7462a1f7ce6 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/binutils/binutils/0035-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0035-revert-master-rebase-changes-to-gdbserver.patch
deleted file mode 100644
index ddb53a07..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0035-revert-master-rebase-changes-to-gdbserver.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 1c5dbbd272854e6e7912e2602bdfd78b64399319 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 d19d22b3a3..7a0be5b072 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/binutils/binutils/0034-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch
index df5b3db3..79d08da9 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Fix-debug-message-when-register-is-unavailable.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch
@@ -1,7 +1,7 @@
1From e44a27432ce56bb48eb9785ffaae14bc3a12bd27 Mon Sep 17 00:00:00 2001 1From dc76254a84fa1086983aefe9db4d8f94b42efb9b 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 ff27b9f00e9..bf931b370c9 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@@ -1263,12 +1263,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/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch
deleted file mode 100644
index f2e5e951..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver-previous-c.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From bd55e11af18006afb87a8b0fbd93bb0920354e0e 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 4ae13692a2..45d95e6cab 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/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index e2b601b6..80b70fcc 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 988a9a41ac91ce3293af8708c1c88c51c48a2a72 Mon Sep 17 00:00:00 2001 1From 23376adc47cf72e46a1edf99e7fbc40164d39cd6 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 2938fddfe82..ac2d35a9917 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@@ -397,6 +397,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/binutils/binutils/0038-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch
index 1a50f0a6..9360bc5a 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch
@@ -1,62 +1,43 @@
1From aa9cb6db79c663dc944cb67928d16e63f2a69f74 Mon Sep 17 00:00:00 2001 1From f34017e4cec8ad571accfd964187ab1f2db8de7f 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 215ef7933c..8c9a3c07c0 100644 19index 9ae9fe2d1e1..a44464b9830 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@@ -1328,6 +1328,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@@ -2207,6 +2208,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/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch
index 0b1475a7..136291f2 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch
@@ -1,20 +1,19 @@
1From 0b5b76d6c9757ebb1c9677772c24272957190345 Mon Sep 17 00:00:00 2001 1From 1a493a6fc3bebb50d9679a4d11709676f933ab04 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 +-
11 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++---- 10 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
12 gdb/microblaze-linux-tdep.c | 68 +++++++++++++++++--
13 gdb/microblaze-tdep.h | 1 + 11 gdb/microblaze-tdep.h | 1 +
14 5 files changed, 153 insertions(+), 20 deletions(-) 12 gdbserver/configure.srv | 3 +-
13 4 files changed, 89 insertions(+), 16 deletions(-)
15 14
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 @@
@@ -30,22 +29,8 @@ index a4eaf540e1..74a53b854a 100644
30 NAT_CDEPS = $(srcdir)/proc-service.list 29 NAT_CDEPS = $(srcdir)/proc-service.list
31 30
32 LOADLIBES = -ldl $(RDYNAMIC) 31 LOADLIBES = -ldl $(RDYNAMIC)
33diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
34index 7a0be5b072..c421790bd0 100644
35--- a/gdb/gdbserver/configure.srv
36+++ b/gdb/gdbserver/configure.srv
37@@ -211,8 +211,7 @@ case "${target}" in
38 srv_linux_thread_db=yes
39 ;;
40 microblaze*-*-linux*) srv_regobj=microblaze-linux.o
41- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
42- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
43+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
44 srv_linux_regsets=yes
45 srv_linux_usrregs=yes
46 srv_linux_thread_db=yes
47diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 32diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
48index cba5d6fc58..a2733f3c21 100644 33index cba5d6fc585..a2733f3c21c 100644
49--- a/gdb/gdbserver/linux-microblaze-low.c 34--- a/gdb/gdbserver/linux-microblaze-low.c
50+++ b/gdb/gdbserver/linux-microblaze-low.c 35+++ b/gdb/gdbserver/linux-microblaze-low.c
51@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 36@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
@@ -200,100 +185,8 @@ index cba5d6fc58..a2733f3c21 100644
200+{ 185+{
201+ init_registers_microblaze (); 186+ init_registers_microblaze ();
202+} 187+}
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 188diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
296index 02650f61d9..3777cbb6a8 100644 189index 8f41ba19351..d2112dc07e1 100644
297--- a/gdb/microblaze-tdep.h 190--- a/gdb/microblaze-tdep.h
298+++ b/gdb/microblaze-tdep.h 191+++ b/gdb/microblaze-tdep.h
299@@ -24,6 +24,7 @@ 192@@ -24,6 +24,7 @@
@@ -304,6 +197,20 @@ index 02650f61d9..3777cbb6a8 100644
304 unsigned int gregs[32]; 197 unsigned int gregs[32];
305 unsigned int fpregs[32]; 198 unsigned int fpregs[32];
306 unsigned int pregs[16]; 199 unsigned int pregs[16];
200diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
201index 13d5c6aff87..ff9ada71b0d 100644
202--- a/gdbserver/configure.srv
203+++ b/gdbserver/configure.srv
204@@ -156,8 +156,7 @@ case "${gdbserver_host}" in
205 srv_linux_thread_db=yes
206 ;;
207 microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
208- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
209- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
210+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
211 srv_xmlfiles="microblaze-linux.xml"
212 srv_linux_regsets=yes
213 srv_linux_usrregs=yes
307-- 214--
3082.17.1 2152.17.1
309 216
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
index 6582af01..1dc6b695 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
@@ -1,37 +1,33 @@
1From 34e572e123b166122cc54a8d8e66676c36515711 Mon Sep 17 00:00:00 2001 1From 928d8d1f05274ab6029e4da7d659312c769beded 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 gas/config/tc-microblaze.c | 16 +- 14 gas/config/tc-microblaze.c | 14 ++
17 gas/config/tc-microblaze.h | 4 + 15 gas/config/tc-microblaze.h | 4 +
18 gdb/Makefile.in | 2 +-
19 gdb/features/Makefile | 3 + 16 gdb/features/Makefile | 3 +
20 gdb/features/microblaze-core.xml | 6 +- 17 gdb/features/microblaze-core.xml | 6 +-
21 gdb/features/microblaze-stack-protect.xml | 4 +- 18 gdb/features/microblaze-with-stack-protect.c | 4 +-
22 gdb/features/microblaze-with-stack-protect.c | 8 +-
23 gdb/features/microblaze.c | 6 +- 19 gdb/features/microblaze.c | 6 +-
24 gdb/features/microblaze64-core.xml | 69 ++++++ 20 gdb/features/microblaze64-core.xml | 69 +++++++
25 gdb/features/microblaze64-stack-protect.xml | 12 + 21 gdb/features/microblaze64-stack-protect.xml | 12 ++
26 .../microblaze64-with-stack-protect.c | 79 +++++++ 22 .../microblaze64-with-stack-protect.c | 79 ++++++++
27 .../microblaze64-with-stack-protect.xml | 12 + 23 .../microblaze64-with-stack-protect.xml | 12 ++
28 gdb/features/microblaze64.c | 77 +++++++ 24 gdb/features/microblaze64.c | 77 ++++++++
29 gdb/features/microblaze64.xml | 11 + 25 gdb/features/microblaze64.xml | 11 ++
30 gdb/microblaze-tdep.c | 207 ++++++++++++++++-- 26 gdb/microblaze-linux-tdep.c | 29 ++-
31 gdb/microblaze-tdep.h | 8 +- 27 gdb/microblaze-tdep.c | 176 ++++++++++++++++--
28 gdb/microblaze-tdep.h | 9 +-
32 .../microblaze-with-stack-protect.dat | 4 +- 29 .../microblaze-with-stack-protect.dat | 4 +-
33 opcodes/microblaze-opc.h | 1 - 30 20 files changed, 504 insertions(+), 40 deletions(-)
34 22 files changed, 504 insertions(+), 134 deletions(-)
35 create mode 100644 gdb/features/microblaze64-core.xml 31 create mode 100644 gdb/features/microblaze64-core.xml
36 create mode 100644 gdb/features/microblaze64-stack-protect.xml 32 create mode 100644 gdb/features/microblaze64-stack-protect.xml
37 create mode 100644 gdb/features/microblaze64-with-stack-protect.c 33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
@@ -40,10 +36,10 @@ Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
40 create mode 100644 gdb/features/microblaze64.xml 36 create mode 100644 gdb/features/microblaze64.xml
41 37
42diff --git a/bfd/archures.c b/bfd/archures.c 38diff --git a/bfd/archures.c b/bfd/archures.c
43index 647cf0d8d4..3fdf7c3c0e 100644 39index 551ec8732f0..627d81261da 100644
44--- a/bfd/archures.c 40--- a/bfd/archures.c
45+++ b/bfd/archures.c 41+++ b/bfd/archures.c
46@@ -512,6 +512,8 @@ DESCRIPTION 42@@ -522,6 +522,8 @@ DESCRIPTION
47 . bfd_arch_lm32, {* Lattice Mico32. *} 43 . bfd_arch_lm32, {* Lattice Mico32. *}
48 .#define bfd_mach_lm32 1 44 .#define bfd_mach_lm32 1
49 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *} 45 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
@@ -53,10 +49,10 @@ index 647cf0d8d4..3fdf7c3c0e 100644
53 . bfd_arch_tilegx, {* Tilera TILE-Gx. *} 49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
54 .#define bfd_mach_tilepro 1 50 .#define bfd_mach_tilepro 1
55diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 51diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
56index 33c9cb62d9..db624c62b9 100644 52index 8902d9c7939..0e5071c235d 100644
57--- a/bfd/bfd-in2.h 53--- a/bfd/bfd-in2.h
58+++ b/bfd/bfd-in2.h 54+++ b/bfd/bfd-in2.h
59@@ -2411,6 +2411,8 @@ enum bfd_architecture 55@@ -1922,6 +1922,8 @@ enum bfd_architecture
60 bfd_arch_lm32, /* Lattice Mico32. */ 56 bfd_arch_lm32, /* Lattice Mico32. */
61 #define bfd_mach_lm32 1 57 #define bfd_mach_lm32 1
62 bfd_arch_microblaze,/* Xilinx MicroBlaze. */ 58 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
@@ -66,7 +62,7 @@ index 33c9cb62d9..db624c62b9 100644
66 bfd_arch_tilegx, /* Tilera TILE-Gx. */ 62 bfd_arch_tilegx, /* Tilera TILE-Gx. */
67 #define bfd_mach_tilepro 1 63 #define bfd_mach_tilepro 1
68diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 64diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
69index c91ba46f75..8e7bcead28 100644 65index f94dc2c177b..4dbc149155e 100644
70--- a/bfd/cpu-microblaze.c 66--- a/bfd/cpu-microblaze.c
71+++ b/bfd/cpu-microblaze.c 67+++ b/bfd/cpu-microblaze.c
72@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 68@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
@@ -80,16 +76,23 @@ index c91ba46f75..8e7bcead28 100644
80 "microblaze", /* Architecture name. */ 76 "microblaze", /* Architecture name. */
81 "MicroBlaze", /* Printable name. */ 77 "MicroBlaze", /* Printable name. */
82 3, /* Section align power. */ 78 3, /* Section align power. */
83@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 79@@ -43,11 +43,11 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
84 32, /* 32 bits in an address. */ 80 0 /* Maximum offset of a reloc from the start of an insn. */
85 8, /* 8 bits in a byte. */ 81 },
86 bfd_arch_microblaze, /* Architecture. */ 82 {
83- 32, /* Bits in a word. */
84- 32, /* Bits in an address. */
85- 8, /* Bits in a byte. */
86+ 32, /* 32 bits in a word. */
87+ 32, /* 32 bits in an address. */
88+ 8, /* 8 bits in a byte. */
89 bfd_arch_microblaze, /* Architecture number. */
87- 0, /* Machine number - 0 for now. */ 90- 0, /* Machine number - 0 for now. */
88+ bfd_mach_microblaze, /* 32 bit Machine */ 91+ bfd_mach_microblaze, /* 32 bit Machine */
89 "microblaze", /* Architecture name. */ 92 "microblaze", /* Architecture name. */
90 "MicroBlaze", /* Printable name. */ 93 "MicroBlaze", /* Printable name. */
91 3, /* Section align power. */ 94 3, /* Section align power. */
92@@ -62,7 +62,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 95@@ -64,7 +64,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
93 32, /* 32 bits in an address. */ 96 32, /* 32 bits in an address. */
94 8, /* 8 bits in a byte. */ 97 8, /* 8 bits in a byte. */
95 bfd_arch_microblaze, /* Architecture. */ 98 bfd_arch_microblaze, /* Architecture. */
@@ -98,110 +101,20 @@ index c91ba46f75..8e7bcead28 100644
98 "microblaze", /* Architecture name. */ 101 "microblaze", /* Architecture name. */
99 "MicroBlaze", /* Printable name. */ 102 "MicroBlaze", /* Printable name. */
100 3, /* Section align power. */ 103 3, /* Section align power. */
101@@ -76,8 +76,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 104@@ -80,7 +80,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
102 64, /* 32 bits in a word. */
103 64, /* 32 bits in an address. */ 105 64, /* 32 bits in an address. */
104 8, /* 8 bits in a byte. */ 106 8, /* 8 bits in a byte. */
105- bfd_arch_microblaze, /* Architecture. */ 107 bfd_arch_microblaze, /* Architecture. */
106- 0, /* Machine number - 0 for now. */ 108- 0, /* Machine number - 0 for now. */
107+ bfd_arch_microblaze, /* Architecture. */
108+ bfd_mach_microblaze64, /* 64 bit Machine */ 109+ bfd_mach_microblaze64, /* 64 bit Machine */
109 "microblaze", /* Architecture name. */ 110 "microblaze", /* Architecture name. */
110 "MicroBlaze", /* Printable name. */ 111 "MicroBlaze", /* Printable name. */
111 3, /* Section align power. */ 112 3, /* Section align power. */
112diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 113diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
113index c280431df6..f9996eae12 100644 114index a4b15882d77..d33f709b8b3 100644
114--- a/bfd/elf32-microblaze.c 115--- a/bfd/elf32-microblaze.c
115+++ b/bfd/elf32-microblaze.c 116+++ b/bfd/elf32-microblaze.c
116@@ -767,87 +767,6 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 117@@ -3585,6 +3585,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
117 return _bfd_elf_is_local_label_name (abfd, name);
118 }
119
120-/* Support for core dump NOTE sections. */
121-static bfd_boolean
122-microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
123-{
124- int offset;
125- unsigned int size;
126-
127- switch (note->descsz)
128- {
129- default:
130- return FALSE;
131-
132- case 228: /* Linux/MicroBlaze */
133- /* pr_cursig */
134- elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
135-
136- /* pr_pid */
137- elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
138-
139- /* pr_reg */
140- offset = 72;
141- size = 50 * 4;
142-
143- break;
144- }
145-
146- /* Make a ".reg/999" section. */
147- return _bfd_elfcore_make_pseudosection (abfd, ".reg",
148- size, note->descpos + offset);
149-}
150-
151-static bfd_boolean
152-microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
153-{
154- switch (note->descsz)
155- {
156- default:
157- return FALSE;
158-
159- case 128: /* Linux/MicroBlaze elf_prpsinfo */
160- elf_tdata (abfd)->core->program
161- = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
162- elf_tdata (abfd)->core->command
163- = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
164- }
165-
166- /* Note that for some reason, a spurious space is tacked
167- onto the end of the args in some (at least one anyway)
168- implementations, so strip it off if it exists. */
169-
170- {
171- char *command = elf_tdata (abfd)->core->command;
172- int n = strlen (command);
173-
174- if (0 < n && command[n - 1] == ' ')
175- command[n - 1] = '\0';
176- }
177-
178- return TRUE;
179-}
180-
181-/* The microblaze linker (like many others) needs to keep track of
182- the number of relocs that it decides to copy as dynamic relocs in
183- check_relocs for each symbol. This is so that it can later discard
184- them if they are found to be unnecessary. We store the information
185- in a field extending the regular ELF linker hash table. */
186-
187-struct elf32_mb_dyn_relocs
188-{
189- struct elf32_mb_dyn_relocs *next;
190-
191- /* The input section of the reloc. */
192- asection *sec;
193-
194- /* Total number of relocs copied for the input section. */
195- bfd_size_type count;
196-
197- /* Number of pc-relative relocs copied for the input section. */
198- bfd_size_type pc_count;
199-};
200-
201 /* ELF linker hash entry. */
202
203 struct elf32_mb_link_hash_entry
204@@ -3683,6 +3602,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
205 return TRUE; 118 return TRUE;
206 } 119 }
207 120
@@ -216,42 +129,30 @@ index c280431df6..f9996eae12 100644
216 /* Hook called by the linker routine which adds symbols from an object 129 /* Hook called by the linker routine which adds symbols from an object
217 file. We use it to put .comm items in .sbss, and not .bss. */ 130 file. We use it to put .comm items in .sbss, and not .bss. */
218 131
219@@ -3752,8 +3679,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 132@@ -3657,5 +3665,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
220 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol 133
221 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 134 #define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
222 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 135 #define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
223-
224-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
225-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
226+#define elf_backend_object_p elf_microblaze_object_p 136+#define elf_backend_object_p elf_microblaze_object_p
227 137
228 #include "elf32-target.h" 138 #include "elf32-target.h"
229diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 139diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
230index 3ff6a14baf..95a1e69729 100644 140index 62daa56b47a..b22f6de2df6 100644
231--- a/gas/config/tc-microblaze.c 141--- a/gas/config/tc-microblaze.c
232+++ b/gas/config/tc-microblaze.c 142+++ b/gas/config/tc-microblaze.c
233@@ -426,7 +426,10 @@ md_begin (void) 143@@ -437,6 +437,11 @@ md_begin (void)
234 const char *prev_name = "";
235 144
236 opcode_hash_control = hash_new (); 145 opcode_hash_control = hash_new ();
237- 146
238+ if (microblaze_arch_size == 64) 147+ if (microblaze_arch_size == 64)
239+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze64); 148+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze64);
240+ else 149+ else
241+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze); 150+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze);
151+
242 /* Insert unique names into hash table. */ 152 /* Insert unique names into hash table. */
243 for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++) 153 for (opcode = (struct op_code_struct *)opcodes; opcode->name; opcode ++)
244 { 154 {
245@@ -1348,7 +1351,7 @@ md_assemble (char * str) 155@@ -3494,6 +3499,15 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
246 if ((temp != 0) && (temp != 0xFFFF8000))
247 {
248 /* Needs an immediate inst. */
249- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
250+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
251 if (opcode1 == NULL)
252 {
253 as_bad (_("unknown opcode \"%s\""), "imm");
254@@ -3431,6 +3434,15 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
255 } 156 }
256 157
257 158
@@ -268,7 +169,7 @@ index 3ff6a14baf..95a1e69729 100644
268 found a machine specific op in an expression, 169 found a machine specific op in an expression,
269 then we create relocs accordingly. */ 170 then we create relocs accordingly. */
270diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h 171diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
271index 9d38d2ced5..13f58917e7 100644 172index 7435a70ef5e..90c2a4a5558 100644
272--- a/gas/config/tc-microblaze.h 173--- a/gas/config/tc-microblaze.h
273+++ b/gas/config/tc-microblaze.h 174+++ b/gas/config/tc-microblaze.h
274@@ -23,6 +23,10 @@ 175@@ -23,6 +23,10 @@
@@ -282,34 +183,21 @@ index 9d38d2ced5..13f58917e7 100644
282 #ifndef TARGET_BYTES_BIG_ENDIAN 183 #ifndef TARGET_BYTES_BIG_ENDIAN
283 /* Used to initialise target_big_endian. */ 184 /* Used to initialise target_big_endian. */
284 #define TARGET_BYTES_BIG_ENDIAN 1 185 #define TARGET_BYTES_BIG_ENDIAN 1
285diff --git a/gdb/Makefile.in b/gdb/Makefile.in
286index 8c9a3c07c0..15387197c7 100644
287--- a/gdb/Makefile.in
288+++ b/gdb/Makefile.in
289@@ -2265,7 +2265,7 @@ ALLDEPFILES = \
290 m68k-tdep.c \
291 microblaze-linux-tdep.c \
292 microblaze-tdep.c \
293- microblaze-linux-nat.c \
294+ microblaze-linux-nat.c \
295 mingw-hdep.c \
296 mips-fbsd-nat.c \
297 mips-fbsd-tdep.c \
298diff --git a/gdb/features/Makefile b/gdb/features/Makefile 186diff --git a/gdb/features/Makefile b/gdb/features/Makefile
299index 3d84ca09a1..fdeec19753 100644 187index d0af9a47b48..2c3cf91b69f 100644
300--- a/gdb/features/Makefile 188--- a/gdb/features/Makefile
301+++ b/gdb/features/Makefile 189+++ b/gdb/features/Makefile
302@@ -64,6 +64,7 @@ WHICH = aarch64 \ 190@@ -46,6 +46,7 @@
303 i386/x32-avx-avx512-linux \ 191 # List of .dat files to create in ../regformats/
304 mips-linux mips-dsp-linux \ 192 WHICH = mips-linux mips-dsp-linux \
305 microblaze-with-stack-protect \ 193 microblaze-with-stack-protect \
306+ microblaze64-with-stack-protect \ 194+ microblaze64-with-stack-protect \
307 mips64-linux mips64-dsp-linux \ 195 mips64-linux mips64-dsp-linux \
308 nios2-linux \ 196 nios2-linux \
309 rs6000/powerpc-32 \ 197 rs6000/powerpc-32 \
310@@ -135,7 +136,9 @@ XMLTOC = \ 198@@ -107,7 +108,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
311 arm/arm-with-vfpv2.xml \ 199 # to make on the command line.
312 arm/arm-with-vfpv3.xml \ 200 XMLTOC = \
313 microblaze-with-stack-protect.xml \ 201 microblaze-with-stack-protect.xml \
314+ microblaze64-with-stack-protect.xml \ 202+ microblaze64-with-stack-protect.xml \
315 microblaze.xml \ 203 microblaze.xml \
@@ -318,7 +206,7 @@ index 3d84ca09a1..fdeec19753 100644
318 mips-linux.xml \ 206 mips-linux.xml \
319 mips64-dsp-linux.xml \ 207 mips64-dsp-linux.xml \
320diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml 208diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
321index 88c93e5d66..5bc3e49f84 100644 209index f272650a41b..d1f2282fd1e 100644
322--- a/gdb/features/microblaze-core.xml 210--- a/gdb/features/microblaze-core.xml
323+++ b/gdb/features/microblaze-core.xml 211+++ b/gdb/features/microblaze-core.xml
324@@ -8,7 +8,7 @@ 212@@ -8,7 +8,7 @@
@@ -343,24 +231,11 @@ index 88c93e5d66..5bc3e49f84 100644
343 <reg name="rtlbsx" bitsize="32"/> 231 <reg name="rtlbsx" bitsize="32"/>
344 <reg name="rtlblo" bitsize="32"/> 232 <reg name="rtlblo" bitsize="32"/>
345 <reg name="rtlbhi" bitsize="32"/> 233 <reg name="rtlbhi" bitsize="32"/>
346+ <reg name="slr" bitsize="32"/> 234+ <reg name="rslr" bitsize="32"/>
347+ <reg name="shr" bitsize="32"/> 235+ <reg name="rshr" bitsize="32"/>
348 </feature>
349diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
350index 870c148bb0..a7f27b903c 100644
351--- a/gdb/features/microblaze-stack-protect.xml
352+++ b/gdb/features/microblaze-stack-protect.xml
353@@ -7,6 +7,6 @@
354
355 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
356 <feature name="org.gnu.gdb.microblaze.stack-protect">
357- <reg name="rslr" bitsize="32"/>
358- <reg name="rshr" bitsize="32"/>
359+ <reg name="slr" bitsize="32"/>
360+ <reg name="shr" bitsize="32"/>
361 </feature> 236 </feature>
362diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c 237diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
363index b39aa19887..609934e2b4 100644 238index b39aa198874..ab162fd2588 100644
364--- a/gdb/features/microblaze-with-stack-protect.c 239--- a/gdb/features/microblaze-with-stack-protect.c
365+++ b/gdb/features/microblaze-with-stack-protect.c 240+++ b/gdb/features/microblaze-with-stack-protect.c
366@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) 241@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
@@ -381,19 +256,8 @@ index b39aa19887..609934e2b4 100644
381 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); 256 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
382 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); 257 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
383 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); 258 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
384@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
385 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
386
387 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
388- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
389- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
390+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
391+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
392
393 tdesc_microblaze_with_stack_protect = result;
394 }
395diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c 259diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
396index 6c86fc0770..ceb98ca8b8 100644 260index 6c86fc07700..7919ac96e62 100644
397--- a/gdb/features/microblaze.c 261--- a/gdb/features/microblaze.c
398+++ b/gdb/features/microblaze.c 262+++ b/gdb/features/microblaze.c
399@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void) 263@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
@@ -418,14 +282,14 @@ index 6c86fc0770..ceb98ca8b8 100644
418 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 282 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
419 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 283 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
420 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 284 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
421+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 285+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
422+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 286+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
423 287
424 tdesc_microblaze = result; 288 tdesc_microblaze = result;
425 } 289 }
426diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml 290diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
427new file mode 100644 291new file mode 100644
428index 0000000000..96e99e2fb2 292index 00000000000..b9adadfade6
429--- /dev/null 293--- /dev/null
430+++ b/gdb/features/microblaze64-core.xml 294+++ b/gdb/features/microblaze64-core.xml
431@@ -0,0 +1,69 @@ 295@@ -0,0 +1,69 @@
@@ -495,12 +359,12 @@ index 0000000000..96e99e2fb2
495+ <reg name="rtlbsx" bitsize="32"/> 359+ <reg name="rtlbsx" bitsize="32"/>
496+ <reg name="rtlblo" bitsize="32"/> 360+ <reg name="rtlblo" bitsize="32"/>
497+ <reg name="rtlbhi" bitsize="32"/> 361+ <reg name="rtlbhi" bitsize="32"/>
498+ <reg name="slr" bitsize="64"/> 362+ <reg name="rslr" bitsize="64"/>
499+ <reg name="shr" bitsize="64"/> 363+ <reg name="rshr" bitsize="64"/>
500+</feature> 364+</feature>
501diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml 365diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
502new file mode 100644 366new file mode 100644
503index 0000000000..1bbf5fc3ce 367index 00000000000..9d7ea8b9fd7
504--- /dev/null 368--- /dev/null
505+++ b/gdb/features/microblaze64-stack-protect.xml 369+++ b/gdb/features/microblaze64-stack-protect.xml
506@@ -0,0 +1,12 @@ 370@@ -0,0 +1,12 @@
@@ -513,12 +377,12 @@ index 0000000000..1bbf5fc3ce
513+ 377+
514+<!DOCTYPE feature SYSTEM "gdb-target.dtd"> 378+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
515+<feature name="org.gnu.gdb.microblaze64.stack-protect"> 379+<feature name="org.gnu.gdb.microblaze64.stack-protect">
516+ <reg name="slr" bitsize="64"/> 380+ <reg name="rslr" bitsize="64"/>
517+ <reg name="shr" bitsize="64"/> 381+ <reg name="rshr" bitsize="64"/>
518+</feature> 382+</feature>
519diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c 383diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
520new file mode 100644 384new file mode 100644
521index 0000000000..f448c9a749 385index 00000000000..249cb534daa
522--- /dev/null 386--- /dev/null
523+++ b/gdb/features/microblaze64-with-stack-protect.c 387+++ b/gdb/features/microblaze64-with-stack-protect.c
524@@ -0,0 +1,79 @@ 388@@ -0,0 +1,79 @@
@@ -596,14 +460,14 @@ index 0000000000..f448c9a749
596+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 460+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
597+ 461+
598+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect"); 462+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
599+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 463+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
600+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 464+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
601+ 465+
602+ tdesc_microblaze64_with_stack_protect = result; 466+ tdesc_microblaze64_with_stack_protect = result;
603+} 467+}
604diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml 468diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
605new file mode 100644 469new file mode 100644
606index 0000000000..0e9f01611f 470index 00000000000..0e9f01611f3
607--- /dev/null 471--- /dev/null
608+++ b/gdb/features/microblaze64-with-stack-protect.xml 472+++ b/gdb/features/microblaze64-with-stack-protect.xml
609@@ -0,0 +1,12 @@ 473@@ -0,0 +1,12 @@
@@ -621,7 +485,7 @@ index 0000000000..0e9f01611f
621+</target> 485+</target>
622diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c 486diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
623new file mode 100644 487new file mode 100644
624index 0000000000..1aa37c4512 488index 00000000000..5d3e2c8cd91
625--- /dev/null 489--- /dev/null
626+++ b/gdb/features/microblaze64.c 490+++ b/gdb/features/microblaze64.c
627@@ -0,0 +1,77 @@ 491@@ -0,0 +1,77 @@
@@ -697,14 +561,14 @@ index 0000000000..1aa37c4512
697+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 561+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
698+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 562+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
699+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 563+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
700+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64"); 564+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
701+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64"); 565+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
702+ 566+
703+ tdesc_microblaze64 = result; 567+ tdesc_microblaze64 = result;
704+} 568+}
705diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml 569diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
706new file mode 100644 570new file mode 100644
707index 0000000000..515d18e65c 571index 00000000000..515d18e65cf
708--- /dev/null 572--- /dev/null
709+++ b/gdb/features/microblaze64.xml 573+++ b/gdb/features/microblaze64.xml
710@@ -0,0 +1,11 @@ 574@@ -0,0 +1,11 @@
@@ -719,8 +583,55 @@ index 0000000000..515d18e65c
719+<target> 583+<target>
720+ <xi:include href="microblaze64-core.xml"/> 584+ <xi:include href="microblaze64-core.xml"/>
721+</target> 585+</target>
586diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
587index 0d5c08d24f6..a9a0eef3854 100644
588--- a/gdb/microblaze-linux-tdep.c
589+++ b/gdb/microblaze-linux-tdep.c
590@@ -159,9 +159,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
591
592 /* BFD target for core files. */
593 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
594- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
595+ {
596+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
597+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
598+ MICROBLAZE_REGISTER_SIZE=8;
599+ }
600+ else
601+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
602+ }
603 else
604- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
605+ {
606+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
607+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
608+ MICROBLAZE_REGISTER_SIZE=8;
609+ }
610+ else
611+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
612+ }
613+
614+ switch (info.bfd_arch_info->mach)
615+ {
616+ case bfd_mach_microblaze64:
617+ set_gdbarch_ptr_bit (gdbarch, 64);
618+ break;
619+ }
620
621
622 /* Shared library handling. */
623@@ -177,6 +198,8 @@ void _initialize_microblaze_linux_tdep ();
624 void
625 _initialize_microblaze_linux_tdep ()
626 {
627- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
628+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
629+ microblaze_linux_init_abi);
630+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
631 microblaze_linux_init_abi);
632 }
722diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 633diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
723index 49713ea9b1..0605283c9e 100644 634index 7462a1f7ce6..5dd0b3ea532 100644
724--- a/gdb/microblaze-tdep.c 635--- a/gdb/microblaze-tdep.c
725+++ b/gdb/microblaze-tdep.c 636+++ b/gdb/microblaze-tdep.c
726@@ -40,7 +40,9 @@ 637@@ -40,7 +40,9 @@
@@ -733,57 +644,34 @@ index 49713ea9b1..0605283c9e 100644
733 644
734 /* Instruction macros used for analyzing the prologue. */ 645 /* Instruction macros used for analyzing the prologue. */
735 /* This set of instruction macros need to be changed whenever the 646 /* This set of instruction macros need to be changed whenever the
736@@ -75,12 +77,13 @@ static const char *microblaze_register_names[] = 647@@ -79,8 +81,9 @@ static const char *microblaze_register_names[] =
737 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
738 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
739 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
740- "rslr", "rshr"
741+ "slr", "shr"
742 }; 648 };
743 649
744 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) 650 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
745 651-
652+
746 static unsigned int microblaze_debug_flag = 0; 653 static unsigned int microblaze_debug_flag = 0;
747+int reg_size = 4; 654+int MICROBLAZE_REGISTER_SIZE = 4;
748 655
749 static void ATTRIBUTE_PRINTF (1, 2) 656 static void ATTRIBUTE_PRINTF (1, 2)
750 microblaze_debug (const char *fmt, ...) 657 microblaze_debug (const char *fmt, ...)
751@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regcache *regcache, int nargs, 658@@ -137,6 +140,7 @@ microblaze_fetch_instruction (CORE_ADDR pc)
752 error (_("store_arguments not implemented")); 659 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
753 return sp; 660
754 } 661 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
755+#if 0 662+#if 0
756 static int 663 static int
757 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 664 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
758 struct bp_target_info *bp_tgt) 665 struct bp_target_info *bp_tgt)
759@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 666@@ -169,6 +173,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
760 int val;
761 int bplen;
762 gdb_byte old_contents[BREAKPOINT_MAX];
763- struct cleanup *cleanup;
764+ //struct cleanup *cleanup;
765 667
766 /* Determine appropriate breakpoint contents and size for this address. */
767 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
768@@ -162,7 +166,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
769 error (_("Software breakpoints not implemented for this target."));
770
771 /* Make sure we see the memory breakpoints. */
772- cleanup = make_show_memory_breakpoints_cleanup (1);
773+ scoped_restore
774+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
775 val = target_read_memory (addr, old_contents, bplen);
776
777 /* If our breakpoint is no longer at the address, this means that the
778@@ -178,6 +183,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
779 return val; 668 return val;
780 } 669 }
781
782+#endif 670+#endif
671
783 /* Allocate and initialize a frame cache. */ 672 /* Allocate and initialize a frame cache. */
784 673
785 static struct microblaze_frame_cache * 674@@ -556,7 +561,6 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
786@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
787 gdb_byte *valbuf) 675 gdb_byte *valbuf)
788 { 676 {
789 gdb_byte buf[8]; 677 gdb_byte buf[8];
@@ -791,19 +679,7 @@ index 49713ea9b1..0605283c9e 100644
791 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ 679 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
792 switch (TYPE_LENGTH (type)) 680 switch (TYPE_LENGTH (type))
793 { 681 {
794 case 1: /* return last byte in the register. */ 682@@ -633,7 +637,113 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
795 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
796- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
797+ memcpy(valbuf, buf + reg_size - 1, 1);
798 return;
799 case 2: /* return last 2 bytes in register. */
800 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
801- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
802+ memcpy(valbuf, buf + reg_size - 2, 2);
803 return;
804 case 4: /* for sizes 4 or 8, copy the required length. */
805 case 8:
806@@ -647,7 +652,119 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
807 return (TYPE_LENGTH (type) == 16); 683 return (TYPE_LENGTH (type) == 16);
808 } 684 }
809 685
@@ -915,16 +791,14 @@ index 49713ea9b1..0605283c9e 100644
915+} 791+}
916+#endif 792+#endif
917+ 793+
918+static void
919+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
920+{
921+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
922+}
923+
924 static int dwarf2_to_reg_map[78] = 794 static int dwarf2_to_reg_map[78] =
925 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 795 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
926 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 796 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
927@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) 797@@ -665,24 +775,27 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
798 return -1;
799 }
800
801+#if 0
928 static void 802 static void
929 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 803 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
930 { 804 {
@@ -940,46 +814,27 @@ index 49713ea9b1..0605283c9e 100644
940- tdesc_microblaze_with_stack_protect); 814- tdesc_microblaze_with_stack_protect);
941+ tdesc_microblaze64_with_stack_protect); 815+ tdesc_microblaze64_with_stack_protect);
942 } 816 }
817+#endif
943 818
944 void 819 void
945@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct microblaze_gregset *gregset, 820 microblaze_supply_gregset (const struct regset *regset,
946 struct regcache *regcache, 821 struct regcache *regcache,
947 int regnum, const void *gregs) 822 int regnum, const void *gregs)
948 { 823 {
949- unsigned int *regs = gregs; 824- const unsigned int *regs = (const unsigned int *)gregs;
950+ const gdb_byte *regs = (const gdb_byte *) gregs; 825+ const gdb_byte *regs = (const gdb_byte *) gregs;
951 if (regnum >= 0) 826 if (regnum >= 0)
952- regcache_raw_supply (regcache, regnum, regs + regnum); 827 regcache->raw_supply (regnum, regs + regnum);
953+ regcache->raw_supply (regnum, regs + regnum);
954
955 if (regnum == -1) {
956 int i;
957 828
958 for (i = 0; i < 50; i++) { 829@@ -713,7 +826,6 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
959- regcache_raw_supply (regcache, i, regs + i);
960+ regcache->raw_supply (regnum, regs + i);
961 }
962 }
963 } 830 }
964@@ -755,6 +873,17 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
965 }
966
967 831
968+static void
969+make_regs (struct gdbarch *arch)
970+{
971+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
972+ int mach = gdbarch_bfd_arch_info (arch)->mach;
973+
974+ if (mach == bfd_mach_microblaze64)
975+ {
976+ set_gdbarch_ptr_bit (arch, 64);
977+ }
978+}
979 832
833-
980 static struct gdbarch * 834 static struct gdbarch *
981 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 835 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
982@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 836 {
837@@ -727,8 +839,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
983 if (arches != NULL) 838 if (arches != NULL)
984 return arches->gdbarch; 839 return arches->gdbarch;
985 if (tdesc == NULL) 840 if (tdesc == NULL)
@@ -989,7 +844,7 @@ index 49713ea9b1..0605283c9e 100644
989+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 844+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
990+ { 845+ {
991+ tdesc = tdesc_microblaze64; 846+ tdesc = tdesc_microblaze64;
992+ reg_size = 8; 847+ MICROBLAZE_REGISTER_SIZE = 8;
993+ } 848+ }
994+ else 849+ else
995+ tdesc = tdesc_microblaze; 850+ tdesc = tdesc_microblaze;
@@ -997,7 +852,7 @@ index 49713ea9b1..0605283c9e 100644
997 /* Check any target description for validity. */ 852 /* Check any target description for validity. */
998 if (tdesc_has_registers (tdesc)) 853 if (tdesc_has_registers (tdesc))
999 { 854 {
1000@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 855@@ -736,27 +855,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1001 int valid_p; 856 int valid_p;
1002 int i; 857 int i;
1003 858
@@ -1038,7 +893,7 @@ index 49713ea9b1..0605283c9e 100644
1038 } 893 }
1039 894
1040 if (!valid_p) 895 if (!valid_p)
1041@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 896@@ -764,6 +891,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1042 tdesc_data_cleanup (tdesc_data); 897 tdesc_data_cleanup (tdesc_data);
1043 return NULL; 898 return NULL;
1044 } 899 }
@@ -1046,7 +901,7 @@ index 49713ea9b1..0605283c9e 100644
1046 } 901 }
1047 902
1048 /* Allocate space for the new architecture. */ 903 /* Allocate space for the new architecture. */
1049@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 904@@ -783,7 +911,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1050 /* Register numbers of various important registers. */ 905 /* Register numbers of various important registers. */
1051 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM); 906 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
1052 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM); 907 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
@@ -1064,7 +919,7 @@ index 49713ea9b1..0605283c9e 100644
1064 /* Map Dwarf2 registers to GDB registers. */ 919 /* Map Dwarf2 registers to GDB registers. */
1065 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 920 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
1066 921
1067@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 922@@ -803,13 +941,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1068 microblaze_breakpoint::kind_from_pc); 923 microblaze_breakpoint::kind_from_pc);
1069 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 924 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1070 microblaze_breakpoint::bp_from_kind); 925 microblaze_breakpoint::bp_from_kind);
@@ -1082,21 +937,7 @@ index 49713ea9b1..0605283c9e 100644
1082 937
1083 frame_base_set_default (gdbarch, &microblaze_frame_base); 938 frame_base_set_default (gdbarch, &microblaze_frame_base);
1084 939
1085@@ -866,11 +1023,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 940@@ -841,6 +981,8 @@ _initialize_microblaze_tdep ()
1086 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
1087 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
1088
1089- /* If we have register sets, enable the generic core file support. */
1090+ /* If we have register sets, enable the generic core file support.
1091 if (tdep->gregset) {
1092 set_gdbarch_regset_from_core_section (gdbarch,
1093 microblaze_regset_from_core_section);
1094- }
1095+ }*/
1096
1097 return gdbarch;
1098 }
1099@@ -882,6 +1039,8 @@ _initialize_microblaze_tdep (void)
1100 941
1101 initialize_tdesc_microblaze_with_stack_protect (); 942 initialize_tdesc_microblaze_with_stack_protect ();
1102 initialize_tdesc_microblaze (); 943 initialize_tdesc_microblaze ();
@@ -1106,7 +947,7 @@ index 49713ea9b1..0605283c9e 100644
1106 add_setshow_zuinteger_cmd ("microblaze", class_maintenance, 947 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
1107 &microblaze_debug_flag, _("\ 948 &microblaze_debug_flag, _("\
1108diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 949diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1109index 3777cbb6a8..55f5dd1962 100644 950index d2112dc07e1..bd03e969b9b 100644
1110--- a/gdb/microblaze-tdep.h 951--- a/gdb/microblaze-tdep.h
1111+++ b/gdb/microblaze-tdep.h 952+++ b/gdb/microblaze-tdep.h
1112@@ -27,7 +27,7 @@ struct microblaze_gregset 953@@ -27,7 +27,7 @@ struct microblaze_gregset
@@ -1130,17 +971,18 @@ index 3777cbb6a8..55f5dd1962 100644
1130 }; 971 };
1131 972
1132 struct microblaze_frame_cache 973 struct microblaze_frame_cache
1133@@ -128,7 +128,7 @@ struct microblaze_frame_cache 974@@ -128,7 +128,8 @@ struct microblaze_frame_cache
1134 struct trad_frame_saved_reg *saved_regs; 975 struct trad_frame_saved_reg *saved_regs;
1135 }; 976 };
1136 /* All registers are 32 bits. */ 977 /* All registers are 32 bits. */
1137-#define MICROBLAZE_REGISTER_SIZE 4 978-#define MICROBLAZE_REGISTER_SIZE 4
1138+//#define MICROBLAZE_REGISTER_SIZE 8 979+extern int microblaze_reg_size;
980+#define MICROBLAZE_REGISTER_SIZE microblaze_reg_size
1139 981
1140 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 982 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1141 Only used for native debugging. */ 983 Only used for native debugging. */
1142diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat 984diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat
1143index 8040a7b3fd..450e321d49 100644 985index 8040a7b3fd0..450e321d49e 100644
1144--- a/gdb/regformats/microblaze-with-stack-protect.dat 986--- a/gdb/regformats/microblaze-with-stack-protect.dat
1145+++ b/gdb/regformats/microblaze-with-stack-protect.dat 987+++ b/gdb/regformats/microblaze-with-stack-protect.dat
1146@@ -60,5 +60,5 @@ expedite:r1,rpc 988@@ -60,5 +60,5 @@ expedite:r1,rpc
@@ -1151,18 +993,6 @@ index 8040a7b3fd..450e321d49 100644
1151-32:rshr 993-32:rshr
1152+32:slr 994+32:slr
1153+32:shr 995+32:shr
1154diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
1155index bd9d91cd57..12d4456bc2 100644
1156--- a/opcodes/microblaze-opc.h
1157+++ b/opcodes/microblaze-opc.h
1158@@ -134,7 +134,6 @@
1159 #define ORLI_MASK 0xA0000000
1160 #define XORLI_MASK 0xA8000000
1161
1162-
1163 /* New Mask for msrset, msrclr insns. */
1164 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
1165 /* Mask for mbar insn. */
1166-- 996--
11672.17.1 9972.17.1
1168 998
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0041-patch-MicroBlaze-porting-GDB-for-linux.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0041-patch-MicroBlaze-porting-GDB-for-linux.patch
deleted file mode 100644
index 1a0153b8..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0041-patch-MicroBlaze-porting-GDB-for-linux.patch
+++ /dev/null
@@ -1,155 +0,0 @@
1From 07757f455d343beb50ac04815c77b04075bf9534 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 45d95e6cab..7c8fa3c246 100644
34--- a/gdb/gdbserver/Makefile.in
35+++ b/gdb/gdbserver/Makefile.in
36@@ -633,6 +633,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 c421790bd0..6ad0ac9fa6 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/binutils/binutils/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
deleted file mode 100644
index ad8dcb53..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0042-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
+++ /dev/null
@@ -1,146 +0,0 @@
1From c2a4667e87bd610a48a6690fcc9fdc6761398bcf 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/binutils/binutils/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
deleted file mode 100644
index 930e161c..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0043-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From 9562530bc48c76d8f824b8f4901ad90dd2969086 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/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
deleted file mode 100644
index 29e198cd..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0044-gdb-microblaze-linux-nat.c-Fix-target-compilation-of.patch
+++ /dev/null
@@ -1,364 +0,0 @@
1From 4f0e06249d23629e1d56b296e7a040b6968484e9 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 44/45] gdb/microblaze-linux-nat.c: Fix target compilation of
5 gdb
6
7Add the nat to the configure file
8
9Remove gdb_assert.h and gdb_string.h.
10
11Adjust include for opcodes as well.
12
13Update to match latest style of components, similar to ppc-linux-nat.c
14
15Update:
16 get_regcache_arch(regcache) to regcache->arch()
17 regcache_raw_supply(regcache, ...) to regcache->raw_supply(...)
18 regcache_raw_collect(regcache, ...) to regcache->raw_collect(...)
19
20Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
21---
22 gdb/configure.nat | 4 +
23 gdb/microblaze-linux-nat.c | 149 +++++++++++++------------------------
24 gdb/microblaze-tdep.c | 3 +-
25 3 files changed, 57 insertions(+), 99 deletions(-)
26
27diff --git a/gdb/configure.nat b/gdb/configure.nat
28index 3118263ac6..b8dc7398a5 100644
29--- a/gdb/configure.nat
30+++ b/gdb/configure.nat
31@@ -260,6 +260,10 @@ case ${gdb_host} in
32 # Host: Motorola m68k running GNU/Linux.
33 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
34 ;;
35+ microblaze*)
36+ # Host: Microblaze, running Linux
37+ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o"
38+ ;;
39 mips)
40 # Host: Linux/MIPS
41 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
42diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
43index e9b8c9c522..e09a86bb3f 100644
44--- a/gdb/microblaze-linux-nat.c
45+++ b/gdb/microblaze-linux-nat.c
46@@ -36,11 +36,9 @@
47 #include "dwarf2-frame.h"
48 #include "osabi.h"
49
50-#include "gdb_assert.h"
51-#include "gdb_string.h"
52 #include "target-descriptions.h"
53-#include "opcodes/microblaze-opcm.h"
54-#include "opcodes/microblaze-dis.h"
55+#include "../opcodes/microblaze-opcm.h"
56+#include "../opcodes/microblaze-dis.h"
57
58 #include "linux-nat.h"
59 #include "target-descriptions.h"
60@@ -61,34 +59,27 @@
61 /* Defines ps_err_e, struct ps_prochandle. */
62 #include "gdb_proc_service.h"
63
64-/* On GNU/Linux, threads are implemented as pseudo-processes, in which
65- case we may be tracing more than one process at a time. In that
66- case, inferior_ptid will contain the main process ID and the
67- individual thread (process) ID. get_thread_id () is used to get
68- the thread id if it's available, and the process id otherwise. */
69-
70-int
71-get_thread_id (ptid_t ptid)
72-{
73- int tid = TIDGET (ptid);
74- if (0 == tid)
75- tid = PIDGET (ptid);
76- return tid;
77-}
78-
79-#define GET_THREAD_ID(PTID) get_thread_id (PTID)
80-
81 /* Non-zero if our kernel may support the PTRACE_GETREGS and
82 PTRACE_SETREGS requests, for reading and writing the
83 general-purpose registers. Zero if we've tried one of
84 them and gotten an error. */
85 int have_ptrace_getsetregs = 1;
86
87+struct microblaze_linux_nat_target final : public linux_nat_target
88+{
89+ /* Add our register access methods. */
90+ void fetch_registers (struct regcache *, int) override;
91+ void store_registers (struct regcache *, int) override;
92+
93+ const struct target_desc *read_description () override;
94+};
95+
96+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
97+
98 static int
99 microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
100 {
101 int u_addr = -1;
102- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
103 /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
104 interface, and not the wordsize of the program's ABI. */
105 int wordsize = sizeof (long);
106@@ -105,18 +96,16 @@ microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
107 static void
108 fetch_register (struct regcache *regcache, int tid, int regno)
109 {
110- struct gdbarch *gdbarch = get_regcache_arch (regcache);
111- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
112+ struct gdbarch *gdbarch = regcache->arch();
113 /* This isn't really an address. But ptrace thinks of it as one. */
114 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
115 int bytes_transferred;
116- unsigned int offset; /* Offset of registers within the u area. */
117- char buf[MAX_REGISTER_SIZE];
118+ char buf[sizeof(long)];
119
120 if (regaddr == -1)
121 {
122 memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
123- regcache_raw_supply (regcache, regno, buf);
124+ regcache->raw_supply (regno, buf);
125 return;
126 }
127
128@@ -149,14 +138,14 @@ fetch_register (struct regcache *regcache, int tid, int regno)
129 {
130 /* Little-endian values are always found at the left end of the
131 bytes transferred. */
132- regcache_raw_supply (regcache, regno, buf);
133+ regcache->raw_supply (regno, buf);
134 }
135 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
136 {
137 /* Big-endian values are found at the right end of the bytes
138 transferred. */
139 size_t padding = (bytes_transferred - register_size (gdbarch, regno));
140- regcache_raw_supply (regcache, regno, buf + padding);
141+ regcache->raw_supply (regno, buf + padding);
142 }
143 else
144 internal_error (__FILE__, __LINE__,
145@@ -175,8 +164,6 @@ fetch_register (struct regcache *regcache, int tid, int regno)
146 static int
147 fetch_all_gp_regs (struct regcache *regcache, int tid)
148 {
149- struct gdbarch *gdbarch = get_regcache_arch (regcache);
150- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
151 gdb_gregset_t gregset;
152
153 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
154@@ -204,8 +191,6 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
155 static void
156 fetch_gp_regs (struct regcache *regcache, int tid)
157 {
158- struct gdbarch *gdbarch = get_regcache_arch (regcache);
159- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
160 int i;
161
162 if (have_ptrace_getsetregs)
163@@ -219,17 +204,29 @@ fetch_gp_regs (struct regcache *regcache, int tid)
164 fetch_register (regcache, tid, i);
165 }
166
167+/* Fetch registers from the child process. Fetch all registers if
168+ regno == -1, otherwise fetch all general registers or all floating
169+ point registers depending upon the value of regno. */
170+void
171+microblaze_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
172+{
173+ pid_t tid = get_ptrace_pid (regcache->ptid ());
174+
175+ if (regno == -1)
176+ fetch_gp_regs (regcache, tid);
177+ else
178+ fetch_register (regcache, tid, regno);
179+}
180
181 static void
182 store_register (const struct regcache *regcache, int tid, int regno)
183 {
184- struct gdbarch *gdbarch = get_regcache_arch (regcache);
185- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
186+ struct gdbarch *gdbarch = regcache->arch();
187 /* This isn't really an address. But ptrace thinks of it as one. */
188 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
189 int i;
190 size_t bytes_to_transfer;
191- char buf[MAX_REGISTER_SIZE];
192+ char buf[sizeof(long)];
193
194 if (regaddr == -1)
195 return;
196@@ -242,13 +239,13 @@ store_register (const struct regcache *regcache, int tid, int regno)
197 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
198 {
199 /* Little-endian values always sit at the left end of the buffer. */
200- regcache_raw_collect (regcache, regno, buf);
201+ regcache->raw_collect (regno, buf);
202 }
203 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
204 {
205 /* Big-endian values sit at the right end of the buffer. */
206 size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
207- regcache_raw_collect (regcache, regno, buf + padding);
208+ regcache->raw_collect (regno, buf + padding);
209 }
210
211 for (i = 0; i < bytes_to_transfer; i += sizeof (long))
212@@ -281,8 +278,6 @@ store_register (const struct regcache *regcache, int tid, int regno)
213 static int
214 store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
215 {
216- struct gdbarch *gdbarch = get_regcache_arch (regcache);
217- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
218 gdb_gregset_t gregset;
219
220 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
221@@ -319,8 +314,6 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
222 static void
223 store_gp_regs (const struct regcache *regcache, int tid, int regno)
224 {
225- struct gdbarch *gdbarch = get_regcache_arch (regcache);
226- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
227 int i;
228
229 if (have_ptrace_getsetregs)
230@@ -335,33 +328,10 @@ store_gp_regs (const struct regcache *regcache, int tid, int regno)
231 }
232
233
234-/* Fetch registers from the child process. Fetch all registers if
235- regno == -1, otherwise fetch all general registers or all floating
236- point registers depending upon the value of regno. */
237-
238-static void
239-microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
240- struct regcache *regcache, int regno)
241-{
242- /* Get the thread id for the ptrace call. */
243- int tid = GET_THREAD_ID (inferior_ptid);
244-
245- if (regno == -1)
246- fetch_gp_regs (regcache, tid);
247- else
248- fetch_register (regcache, tid, regno);
249-}
250-
251-/* Store registers back into the inferior. Store all registers if
252- regno == -1, otherwise store all general registers or all floating
253- point registers depending upon the value of regno. */
254-
255-static void
256-microblaze_linux_store_inferior_registers (struct target_ops *ops,
257- struct regcache *regcache, int regno)
258+void
259+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
260 {
261- /* Get the thread id for the ptrace call. */
262- int tid = GET_THREAD_ID (inferior_ptid);
263+ pid_t tid = get_ptrace_pid (regcache->ptid ());
264
265 if (regno >= 0)
266 store_register (regcache, tid, regno);
267@@ -373,59 +343,44 @@ microblaze_linux_store_inferior_registers (struct target_ops *ops,
268 thread debugging. */
269
270 void
271-fill_gregset (const struct regcache *regcache,
272- gdb_gregset_t *gregsetp, int regno)
273+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
274 {
275- microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
276+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
277 }
278
279 void
280-supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
281+fill_gregset (const struct regcache *regcache,
282+ gdb_gregset_t *gregsetp, int regno)
283 {
284- microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
285+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
286 }
287
288 void
289-fill_fpregset (const struct regcache *regcache,
290- gdb_fpregset_t *fpregsetp, int regno)
291+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
292 {
293 /* FIXME. */
294+ return;
295 }
296
297 void
298-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
299+fill_fpregset (const struct regcache *regcache,
300+ gdb_fpregset_t *fpregsetp, int regno)
301 {
302 /* FIXME. */
303+ return;
304 }
305
306-static const struct target_desc *
307-microblaze_linux_read_description (struct target_ops *ops)
308+const struct target_desc *
309+microblaze_linux_nat_target::read_description ()
310 {
311- CORE_ADDR microblaze_hwcap = 0;
312-
313- if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
314- return NULL;
315-
316 return NULL;
317 }
318
319-
320-void _initialize_microblaze_linux_nat (void);
321-
322 void
323 _initialize_microblaze_linux_nat (void)
324 {
325- struct target_ops *t;
326-
327- /* Fill in the generic GNU/Linux methods. */
328- t = linux_target ();
329-
330- /* Add our register access methods. */
331- t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
332- t->to_store_registers = microblaze_linux_store_inferior_registers;
333-
334- t->to_read_description = microblaze_linux_read_description;
335+ linux_target = &the_microblaze_linux_nat_target;
336
337 /* Register the target. */
338- linux_nat_add_target (t);
339+ add_inf_child_target (linux_target);
340 }
341diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
342index 7a0c2527f4..23deb24d26 100644
343--- a/gdb/microblaze-tdep.c
344+++ b/gdb/microblaze-tdep.c
345@@ -657,7 +657,7 @@ static std::vector<CORE_ADDR>
346 microblaze_software_single_step (struct regcache *regcache)
347 {
348 // struct gdbarch *arch = get_frame_arch(frame);
349- struct gdbarch *arch = get_regcache_arch (regcache);
350+ struct gdbarch *arch = regcache->arch();
351 struct address_space *aspace = get_regcache_aspace (regcache);
352 // struct address_space *aspace = get_frame_address_space (frame);
353 struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
354@@ -876,7 +876,6 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
355 static void
356 make_regs (struct gdbarch *arch)
357 {
358- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
359 int mach = gdbarch_bfd_arch_info (arch)->mach;
360
361 if (mach == bfd_mach_microblaze64)
362--
3632.17.1
364
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0046-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0046-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
deleted file mode 100644
index 7677ab35..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0046-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 9c8f4f1c11d324f0788da3a077b06c6bc9e6f2b8 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH] [Patch,MicroBlaze m64] : This patch will remove imml 0 and
5 imml -1 instructions when the offset is less than 16 bit for Type A branch EA
6 instructions.
7
8---
9 gas/config/tc-microblaze.c | 6 ++----
10 1 file changed, 2 insertions(+), 4 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index 088eae73a9..12fd145a03 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -2150,9 +2150,7 @@ md_assemble (char * str)
17 if (exp.X_op != O_constant)
18 {
19 char *opc;
20- if (microblaze_arch_size == 64 && (streq (name, "breai") ||
21- streq (name, "breaid") ||
22- streq (name, "brai") || streq (name, "braid")))
23+ if (microblaze_arch_size == 64 && (streq (name, "brai") || streq (name, "braid")))
24 opc = str_microblaze_64;
25 else
26 opc = NULL;
27@@ -2920,7 +2918,7 @@ md_apply_fix (fixS * fixP,
28 case BFD_RELOC_MICROBLAZE_64:
29 case BFD_RELOC_MICROBLAZE_64_PCREL:
30 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
31- || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
32+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL || (fixP->fx_r_type == BFD_RELOC_64_PCREL && microblaze_arch_size == 64))
33 {
34 /* Generate the imm instruction. */
35 if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
36--
372.17.1
38
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0047-Patch-MicroBlaze-commit-for-triggering-build-to-remo.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0047-Patch-MicroBlaze-commit-for-triggering-build-to-remo.patch
deleted file mode 100644
index 93314594..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0047-Patch-MicroBlaze-commit-for-triggering-build-to-remo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 2ab2547493c871b452adb2cb8754691b0adf5f03 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 19 Apr 2020 21:17:03 +0530
4Subject: [PATCH 47/49] [Patch,MicroBlaze] : commit for triggering build to
5 remove imml for Type A BEA insns.
6
7---
8 gas/config/tc-microblaze.c | 1 +
9 1 file changed, 1 insertion(+)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 12fd145a03..7ae0dbc018 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -2150,6 +2150,7 @@ md_assemble (char * str)
16 if (exp.X_op != O_constant)
17 {
18 char *opc;
19+/* removal imml 0 and imml -1 for bea type A insns */
20 if (microblaze_arch_size == 64 && (streq (name, "brai") || streq (name, "braid")))
21 opc = str_microblaze_64;
22 else
23--
242.17.1
25
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0048-Patch-MicroBlaze-Adding-more-description-to-the-imml.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0048-Patch-MicroBlaze-Adding-more-description-to-the-imml.patch
deleted file mode 100644
index 30fbbe7b..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0048-Patch-MicroBlaze-Adding-more-description-to-the-imml.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 9b61edf44e44303f1937e98a02a7d78f750a9b24 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 30 Apr 2020 19:40:16 +0530
4Subject: [PATCH 48/49] [Patch,MicroBlaze] : Adding more description to the
5 imml removal for bea type B insns.
6
7---
8 gas/config/tc-microblaze.c | 3 ++-
9 1 file changed, 2 insertions(+), 1 deletion(-)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 7ae0dbc018..1d37af54bf 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -2150,7 +2150,8 @@ md_assemble (char * str)
16 if (exp.X_op != O_constant)
17 {
18 char *opc;
19-/* removal imml 0 and imml -1 for bea type A insns */
20+/* removal of imml 0 and imml -1 for bea type A insns.
21+if offset is 16 bit then imml instructions are redundant */
22 if (microblaze_arch_size == 64 && (streq (name, "brai") || streq (name, "braid")))
23 opc = str_microblaze_64;
24 else
25--
262.17.1
27
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0049-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0049-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
deleted file mode 100644
index b751f294..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0049-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From ba660177916ffb8a0a9882c27246a201dbc218bd Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Jun 2020 21:20:26 +0530
4Subject: [PATCH 49/49] [Patch,MicroBlaze] : improper address mapping of
5 PROVIDE directive symbols[DTOR_END] are causing runtime loops and we don't
6 need to override PROVIDE symbols if symbols are defined in libraries and
7 linker so I am disabling override for PROVIDE symbols.
8
9---
10 ld/ldlang.c | 12 +++++++++---
11 1 file changed, 9 insertions(+), 3 deletions(-)
12
13diff --git a/ld/ldlang.c b/ld/ldlang.c
14index 33f6bda292..a0b404c04d 100644
15--- a/ld/ldlang.c
16+++ b/ld/ldlang.c
17@@ -3559,10 +3559,16 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
18 plugin_insert = NULL;
19 #endif
20 break;
21+ /* This is from a --defsym on the command line. */
22 case lang_assignment_statement_enum:
23- if (s->assignment_statement.exp->type.node_class != etree_assert)
24- exp_fold_tree_no_dot (s->assignment_statement.exp);
25- break;
26+ if (s->assignment_statement.exp->type.node_class != etree_assert)
27+ {
28+ if(!(s->assignment_statement.exp->assign.defsym) && (s->assignment_statement.exp->type.node_class == etree_provide))
29+ ;
30+ else
31+ exp_fold_tree_no_dot (s->assignment_statement.exp);
32+ }
33+ break;
34 default:
35 break;
36 }
37--
382.17.1
39
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0050-Fix-i386-md_pseudo_table.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0050-Fix-i386-md_pseudo_table.patch
deleted file mode 100644
index 9469732e..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0050-Fix-i386-md_pseudo_table.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1Fix a possible compilation issue on i386 when using microblaze patches
2
3Due to patch 0019, a later item may need to refer to this table.
4
5| ../../gas/config/tc-i386.c:1155:20: error: conflicting types for ‘md_pseudo_table’
6| const pseudo_typeS md_pseudo_table[] =
7| ^~~~~~~~~~~~~~~
8| In file included from ../../gas/as.h:565:0,
9| from ../../gas/config/tc-i386.c:28:
10| ../../gas/tc.h:25:21: note: previous declaration of ‘md_pseudo_table’ was here
11| extern pseudo_typeS md_pseudo_table[];
12| ^~~~~~~~~~~~~~~
13
14Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
15
16Index: git/gas/config/tc-i386.c
17===================================================================
18--- git.orig/gas/config/tc-i386.c
19+++ git/gas/config/tc-i386.c
20@@ -1152,7 +1152,7 @@ pe_lcomm (int needs_align)
21 }
22 #endif
23
24-const pseudo_typeS md_pseudo_table[] =
25+pseudo_typeS md_pseudo_table[] =
26 {
27 #if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
28 {"align", s_align_bytes, 0},