summaryrefslogtreecommitdiffstats
path: root/meta-microblaze
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@xilinx.com>2020-12-03 16:37:29 -0800
committerMark Hatle <mark.hatle@xilinx.com>2020-12-04 16:23:30 -0800
commit64c6e9b11168046c044d87f6fcefea3c86c2e613 (patch)
treefebfcf964c8b9b3b25b88965afb4dd193cbf5abb /meta-microblaze
parent3d886fe006c5cbfaea04beb424408db79ec233f5 (diff)
downloadmeta-xilinx-64c6e9b11168046c044d87f6fcefea3c86c2e613.tar.gz
binutils: update to early gatesgarth version
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc91
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0003-Add-mlittle-endian-and-mbig-endian-flags.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch304
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch77
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch222
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch)25
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0008-fixing-the-MAX_OPCODES-to-correct-value.patch25
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-Add-new-bit-field-instructions.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch)40
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch)580
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch)193
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch)9
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-Added-relocations-for-MB-X.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch)140
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch)175
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch28
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch)52
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch36
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch26
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch33
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-Added-support-to-new-arithmetic-single-register-inst.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0027-Added-support-to-new-arithmetic-single-register-inst.patch)72
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch)101
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch38
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch39
-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-gas-revert-moving-of-md_pseudo_table-from-const.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch)16
-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-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch43
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch)457
-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-Initial-port-of-core-reading-support-Added-support-f.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0035-Initial-port-of-core-reading-support.patch)174
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-debug-message-when-register-is-unavailable.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch31
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch36
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch)13
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0039-Fixing-the-issues-related-to-GDB-7.12.patch)173
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch)372
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0042-porting-GDB-for-linux.patch155
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0043-Binutils-security-check-is-causing-build-error-for-w.patch41
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch146
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch24
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch39
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch87
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch75
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch45
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch37
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch99
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0052-sim-Allow-microblaze-architecture.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch)8
59 files changed, 2805 insertions, 1876 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
index e10c34ff..27ed147d 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
@@ -1,44 +1,63 @@
1FILESEXTRAPATHS_append := ":${THISDIR}/binutils" 1FILESEXTRAPATHS_append := ":${THISDIR}/binutils"
2 2
3SRC_URI_append = " \ 3SRC_URI_append = " \
4 file://0001-sim-Allow-microblaze-architecture.patch \ 4 file://0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \
5 file://0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \ 5 file://0002-Add-mlittle-endian-and-mbig-endian-flags.patch \
6 file://0003-Add-mlittle-endian-and-mbig-endian-flags.patch \ 6 file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \
7 file://0004-Disable-the-warning-message-for-eh_frame_hdr.patch \ 7 file://0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \
8 file://0005-Fix-relaxation-of-assembler-resolved-references.patch \ 8 file://0005-upstream-change-to-garbage-collection-sweep-causes-m.patch \
9 file://0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch \ 9 file://0006-Fix-bug-in-TLSTPREL-Relocation.patch \
10 file://0007-upstream-change-to-garbage-collection-sweep-causes-m.patch \ 10 file://0007-Added-Address-extension-instructions.patch \
11 file://0008-Fix-bug-in-TLSTPREL-Relocation.patch \ 11 file://0008-fixing-the-MAX_OPCODES-to-correct-value.patch \
12 file://0009-Added-Address-extension-instructions.patch \ 12 file://0009-Add-new-bit-field-instructions.patch \
13 file://0010-Add-new-bit-field-instructions.patch \ 13 file://0010-fixing-the-imm-bug.patch \
14 file://0011-fixing-the-imm-bug.patch \ 14 file://0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch \
15 file://0012-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch \ 15 file://0012-fixing-the-constant-range-check-issue.patch \
16 file://0013-fixing-the-constant-range-check-issue.patch \ 16 file://0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch \
17 file://0014-Patch-Microblaze-Compiler-will-give-error-messages-i.patch \ 17 file://0014-intial-commit-of-MB-64-bit.patch \
18 file://0015-intial-commit-of-MB-64-bit.patch \ 18 file://0015-MB-X-initial-commit.patch \
19 file://0016-MB-X-initial-commit.patch \ 19 file://0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
20 file://0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \ 20 file://0017-Added-relocations-for-MB-X.patch \
21 file://0018-Added-relocations-for-MB-X.patch \ 21 file://0018-Fixed-MB-x-relocation-issues.patch \
22 file://0019-Update-MB-x.patch \ 22 file://0019-Fixing-the-branch-related-issues.patch \
23 file://0020-Various-fixes.patch \ 23 file://0020-Fixed-address-computation-issues-with-64bit-address.patch \
24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \ 24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \
25 file://0022-fixing-the-.bss-relocation-issue.patch \ 25 file://0022-fixing-the-.bss-relocation-issue.patch \
26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \ 26 file://0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \
27 file://0024-Revert-ld-Remove-unused-expression-state.patch \ 27 file://0024-Revert-ld-Remove-unused-expression-state.patch \
28 file://0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch \ 28 file://0025-fixing-the-long-long-long-mingw-toolchain-issue.patch \
29 file://0026-fixing-the-long-long-long-mingw-toolchain-issue.patch \ 29 file://0026-Added-support-to-new-arithmetic-single-register-inst.patch \
30 file://0027-Added-support-to-new-arithmetic-single-register-inst.patch \ 30 file://0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
31 file://0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \ 31 file://0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \
32 file://0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \ 32 file://0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch \
33 file://0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch \ 33 file://0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch \
34 file://0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch \ 34 file://0031-gas-revert-moving-of-md_pseudo_table-from-const.patch \
35 file://0032-gas-revert-moving-of-md_pseudo_table-from-const.patch \ 35 file://0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
36 file://0033-Fix-various-compile-warnings.patch \ 36 file://0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
37 file://0034-Add-initial-port-of-linux-gdbserver.patch \ 37 file://0034-Initial-port-of-core-reading-support-Added-support-f.patch \
38 file://0035-Initial-port-of-core-reading-support.patch \ 38 file://0035-Fix-debug-message-when-register-is-unavailable.patch \
39 file://0036-Fix-debug-message-when-register-is-unavailable.patch \ 39 file://0036-revert-master-rebase-changes-to-gdbserver.patch \
40 file://0037-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \ 40 file://0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch \
41 file://0038-Initial-support-for-native-gdb.patch \ 41 file://0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
42 file://0039-Fixing-the-issues-related-to-GDB-7.12.patch \ 42 file://0039-Initial-support-for-native-gdb.patch \
43 file://0040-Patch-microblaze-Adding-64-bit-MB-support.patch \ 43 file://0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch \
44 file://0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch \
45 file://0042-porting-GDB-for-linux.patch \
46 file://0043-Binutils-security-check-is-causing-build-error-for-w.patch \
47 file://0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch \
48 file://0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch \
49 file://0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch \
50 file://0047-bfd-elf64-microblaze.c-Fix-build-failures.patch \
51 file://0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch \
52 file://0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch \
53 file://0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch \
54 file://0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch \
55 file://0052-sim-Allow-microblaze-architecture.patch \
44 " 56 "
57
58#
59## file://0048-bfd-gas-Use-standard-method-to-set-the-machine-arch.patch \
60## file://0052-opcodes-microblaze-opc.h-Expand-the-size-to-int-to-d.patch \
61## file://0053-opcodes-microblaze-opc.h-MIN_IMML-is-too-large.patch \
62## file://0054-gas-config-tc-microblaze.c-Resolve-numerous-compiler.patch \
63#
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
index 039bfc96..fe3f2bff 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
@@ -1,7 +1,7 @@
1From b8e39d2a6b83d0f0a14d4bfeafd47a37d746f159 Mon Sep 17 00:00:00 2001 1From 212bd1115f13cc0904fb5556751585c775bc51a6 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000 3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 02/40] Add wdc.ext.clear and wdc.ext.flush insns 4Subject: [PATCH 01/52] Add wdc.ext.clear and wdc.ext.flush insns
5 5
6Added two new instructions, wdc.ext.clear and wdc.ext.flush, 6Added two new instructions, wdc.ext.clear and wdc.ext.flush,
7to enable MicroBlaze to flush an external cache, which is 7to enable MicroBlaze to flush an external cache, which is
@@ -15,7 +15,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15 2 files changed, 6 insertions(+), 3 deletions(-) 15 2 files changed, 6 insertions(+), 3 deletions(-)
16 16
17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
18index 27d8684df04..b6c5016e4d2 100644 18index 27d8684df0..b6c5016e4d 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 27d8684df04..b6c5016e4d2 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 aa53dfe6bb5..795c57b5ff6 100644 49index aa53dfe6bb..795c57b5ff 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/0003-Add-mlittle-endian-and-mbig-endian-flags.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
index 2d4d65e4..78f4be14 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Add-mlittle-endian-and-mbig-endian-flags.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
@@ -1,7 +1,7 @@
1From d2a03159f8643b1c6a2db5d95c478540cc6ca6c4 Mon Sep 17 00:00:00 2001 1From 23ed5e7ab73a2b5dc1ca09362d4815a643a2d187 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 03/40] Add mlittle-endian and mbig-endian flags 4Subject: [PATCH 02/52] 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 ae5d36dc9c3..34eeb972357 100644 19index ae5d36dc9c..34eeb97235 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 @@
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
index f7b9c7b0..96ddefa0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0004-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -1,7 +1,7 @@
1From a8d621e5ab335e6e61de0f081036b4705071fb74 Mon Sep 17 00:00:00 2001 1From f74d7754befd636c6139261e6c6b23ed49aa0fa9 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> 2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200 3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 04/40] Disable the warning message for eh_frame_hdr 4Subject: [PATCH 03/52] Disable the warning message for eh_frame_hdr
5 5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7--- 7---
@@ -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 7a129b00f8d..d5e4a5c062d 100644 12index 7a129b00f8..d5e4a5c062 100644
13--- a/bfd/elf-eh-frame.c 13--- a/bfd/elf-eh-frame.c
14+++ b/bfd/elf-eh-frame.c 14+++ b/bfd/elf-eh-frame.c
15@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, 15@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
new file mode 100644
index 00000000..a63ad020
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
@@ -0,0 +1,304 @@
1From 6aadc146948741df27125cc2253ba9a50efa5cfc Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 8 Nov 2016 11:54:08 +0530
4Subject: [PATCH 04/52] [LOCAL]: Fix relaxation of assembler resolved
5 references,Fixup debug_loc sections after linker relaxation Adds a new
6 reloctype R_MICROBLAZE_32_NONE, used for passing reloc info from the
7 assembler to the linker when the linker manages to fully resolve a local
8 symbol reference.
9
10This is a workaround for design flaws in the assembler to
11linker interface with regards to linker relaxation.
12
13Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15
16Conflicts:
17 bfd/elf32-microblaze.c
18 binutils/readelf.c
19 include/elf/microblaze.h
20---
21 bfd/bfd-in2.h | 5 ++
22 bfd/elf32-microblaze.c | 126 ++++++++++++++++++++++++++++---------
23 bfd/libbfd.h | 1 +
24 bfd/reloc.c | 6 ++
25 binutils/readelf.c | 4 ++
26 gas/config/tc-microblaze.c | 4 ++
27 include/elf/microblaze.h | 2 +
28 7 files changed, 119 insertions(+), 29 deletions(-)
29
30diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
31index 35ef4d755b..1bd19a2b63 100644
32--- a/bfd/bfd-in2.h
33+++ b/bfd/bfd-in2.h
34@@ -5428,6 +5428,11 @@ value relative to the read-write small data area anchor */
35 expressions of the form "Symbol Op Symbol" */
36 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
37
38+/* This is a 32 bit reloc that stores the 32 bit pc relative
39+value in two words (with an imm instruction).No relocation is
40+done here - only used for relaxing */
41+ BFD_RELOC_MICROBLAZE_32_NONE,
42+
43 /* This is a 64 bit reloc that stores the 32 bit pc relative
44 value in two words (with an imm instruction). No relocation is
45 done here - only used for relaxing */
46diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
47index 693fc71f73..e9715eae6a 100644
48--- a/bfd/elf32-microblaze.c
49+++ b/bfd/elf32-microblaze.c
50@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
51 FALSE), /* PC relative offset? */
52
53 /* This reloc does nothing. Used for relaxation. */
54+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
55+ 0, /* Rightshift. */
56+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
57+ 32, /* Bitsize. */
58+ TRUE, /* PC_relative. */
59+ 0, /* Bitpos. */
60+ complain_overflow_bitfield, /* Complain on overflow. */
61+ NULL, /* Special Function. */
62+ "R_MICROBLAZE_32_NONE",/* Name. */
63+ FALSE, /* Partial Inplace. */
64+ 0, /* Source Mask. */
65+ 0, /* Dest Mask. */
66+ FALSE), /* PC relative offset? */
67+
68 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
69 0, /* Rightshift. */
70 3, /* Size (0 = byte, 1 = short, 2 = long). */
71@@ -562,7 +576,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
72 case BFD_RELOC_NONE:
73 microblaze_reloc = R_MICROBLAZE_NONE;
74 break;
75- case BFD_RELOC_MICROBLAZE_64_NONE:
76+ case BFD_RELOC_MICROBLAZE_32_NONE:
77+ microblaze_reloc = R_MICROBLAZE_32_NONE;
78+ break;
79+ case BFD_RELOC_MICROBLAZE_64_NONE:
80 microblaze_reloc = R_MICROBLAZE_64_NONE;
81 break;
82 case BFD_RELOC_32:
83@@ -1914,18 +1931,26 @@ microblaze_elf_relax_section (bfd *abfd,
84 }
85 break;
86 case R_MICROBLAZE_NONE:
87+ case R_MICROBLAZE_32_NONE:
88 {
89 /* This was a PC-relative instruction that was
90 completely resolved. */
91 int sfix, efix;
92+ unsigned int val;
93 bfd_vma target_address;
94 target_address = irel->r_addend + irel->r_offset;
95 sfix = calc_fixup (irel->r_offset, 0, sec);
96 efix = calc_fixup (target_address, 0, sec);
97- irel->r_addend -= (efix - sfix);
98- /* Should use HOWTO. */
99- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
100- irel->r_addend);
101+
102+ /* Validate the in-band val. */
103+ val = bfd_get_32 (abfd, contents + irel->r_offset);
104+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
105+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
106+ }
107+ irel->r_addend -= (efix - sfix);
108+ /* Should use HOWTO. */
109+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
110+ irel->r_addend);
111 }
112 break;
113 case R_MICROBLAZE_64_NONE:
114@@ -1969,30 +1994,73 @@ microblaze_elf_relax_section (bfd *abfd,
115 irelscanend = irelocs + o->reloc_count;
116 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
117 {
118- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
119- {
120- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
121+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
122+ {
123+ unsigned int val;
124+
125+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
126+
127+ /* hax: We only do the following fixup for debug location lists. */
128+ if (strcmp(".debug_loc", o->name))
129+ continue;
130+
131+ /* This was a PC-relative instruction that was completely resolved. */
132+ if (ocontents == NULL)
133+ {
134+ if (elf_section_data (o)->this_hdr.contents != NULL)
135+ ocontents = elf_section_data (o)->this_hdr.contents;
136+ else
137+ {
138+ /* We always cache the section contents.
139+ Perhaps, if info->keep_memory is FALSE, we
140+ should free them, if we are permitted to. */
141+
142+ if (o->rawsize == 0)
143+ o->rawsize = o->size;
144+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
145+ if (ocontents == NULL)
146+ goto error_return;
147+ if (!bfd_get_section_contents (abfd, o, ocontents,
148+ (file_ptr) 0,
149+ o->rawsize))
150+ goto error_return;
151+ elf_section_data (o)->this_hdr.contents = ocontents;
152+ }
153+ }
154
155- /* Look at the reloc only if the value has been resolved. */
156- if (isym->st_shndx == shndx
157- && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
158- {
159- if (ocontents == NULL)
160- {
161- if (elf_section_data (o)->this_hdr.contents != NULL)
162- ocontents = elf_section_data (o)->this_hdr.contents;
163- else
164- {
165- /* We always cache the section contents.
166- Perhaps, if info->keep_memory is FALSE, we
167- should free them, if we are permitted to. */
168- if (o->rawsize == 0)
169- o->rawsize = o->size;
170- ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
171- if (ocontents == NULL)
172- goto error_return;
173- if (!bfd_get_section_contents (abfd, o, ocontents,
174- (file_ptr) 0,
175+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
176+ if (val != irelscan->r_addend) {
177+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
178+ }
179+
180+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
181+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
182+ irelscan->r_addend);
183+ }
184+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
185+ {
186+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
187+
188+ /* Look at the reloc only if the value has been resolved. */
189+ if (isym->st_shndx == shndx
190+ && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
191+ {
192+ if (ocontents == NULL)
193+ {
194+ if (elf_section_data (o)->this_hdr.contents != NULL)
195+ ocontents = elf_section_data (o)->this_hdr.contents;
196+ else
197+ {
198+ /* We always cache the section contents.
199+ Perhaps, if info->keep_memory is FALSE, we
200+ should free them, if we are permitted to. */
201+ if (o->rawsize == 0)
202+ o->rawsize = o->size;
203+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
204+ if (ocontents == NULL)
205+ goto error_return;
206+ if (!bfd_get_section_contents (abfd, o, ocontents,
207+ (file_ptr) 0,
208 o->rawsize))
209 goto error_return;
210 elf_section_data (o)->this_hdr.contents = ocontents;
211@@ -2028,7 +2096,7 @@ microblaze_elf_relax_section (bfd *abfd,
212 elf_section_data (o)->this_hdr.contents = ocontents;
213 }
214 }
215- irelscan->r_addend -= calc_fixup (irel->r_addend
216+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
217 + isym->st_value,
218 0,
219 sec);
220diff --git a/bfd/libbfd.h b/bfd/libbfd.h
221index b97534fc9f..c1551b9240 100644
222--- a/bfd/libbfd.h
223+++ b/bfd/libbfd.h
224@@ -2967,6 +2967,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
225 "BFD_RELOC_MICROBLAZE_32_ROSDA",
226 "BFD_RELOC_MICROBLAZE_32_RWSDA",
227 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
228+ "BFD_RELOC_MICROBLAZE_32_NONE",
229 "BFD_RELOC_MICROBLAZE_64_NONE",
230 "BFD_RELOC_MICROBLAZE_64_GOTPC",
231 "BFD_RELOC_MICROBLAZE_64_GOT",
232diff --git a/bfd/reloc.c b/bfd/reloc.c
233index 9aba84ca81..9b39b41941 100644
234--- a/bfd/reloc.c
235+++ b/bfd/reloc.c
236@@ -6858,6 +6858,12 @@ ENUM
237 ENUMDOC
238 This is a 32 bit reloc for the microblaze to handle
239 expressions of the form "Symbol Op Symbol"
240+ENUM
241+ BFD_RELOC_MICROBLAZE_32_NONE
242+ENUMDOC
243+ This is a 32 bit reloc that stores the 32 bit pc relative
244+ value in two words (with an imm instruction). No relocation is
245+ done here - only used for relaxing
246 ENUM
247 BFD_RELOC_MICROBLAZE_64_NONE
248 ENUMDOC
249diff --git a/binutils/readelf.c b/binutils/readelf.c
250index 6057515a89..2b797ef2db 100644
251--- a/binutils/readelf.c
252+++ b/binutils/readelf.c
253@@ -13187,6 +13187,10 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
254 return reloc_type == 1; /* R_Z80_8. */
255 default:
256 return FALSE;
257+ case EM_MICROBLAZE:
258+ return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */
259+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
260+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
261 }
262 }
263
264diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
265index 34eeb97235..74a63abeb0 100644
266--- a/gas/config/tc-microblaze.c
267+++ b/gas/config/tc-microblaze.c
268@@ -2198,9 +2198,12 @@ md_apply_fix (fixS * fixP,
269 moves code around due to relaxing. */
270 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
271 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
272+ else if (fixP->fx_r_type == BFD_RELOC_32)
273+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
274 else
275 fixP->fx_r_type = BFD_RELOC_NONE;
276 fixP->fx_addsy = section_symbol (absolute_section);
277+ fixP->fx_done = 0;
278 }
279 return;
280 }
281@@ -2421,6 +2424,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
282 switch (fixp->fx_r_type)
283 {
284 case BFD_RELOC_NONE:
285+ case BFD_RELOC_MICROBLAZE_32_NONE:
286 case BFD_RELOC_MICROBLAZE_64_NONE:
287 case BFD_RELOC_32:
288 case BFD_RELOC_MICROBLAZE_32_LO:
289diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
290index 2fec296967..3978a3dc01 100644
291--- a/include/elf/microblaze.h
292+++ b/include/elf/microblaze.h
293@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
294 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
295 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
296 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
297+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
298+
299 END_RELOC_NUMBERS (R_MICROBLAZE_max)
300
301 /* Global base address names. */
302--
3032.17.1
304
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch
deleted file mode 100644
index 14a4f329..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0005-Fix-relaxation-of-assembler-resolved-references.patch
+++ /dev/null
@@ -1,77 +0,0 @@
1From c4ce6cb47613293e02837fc00c2c2ebfcdd596f6 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Tue, 14 Feb 2012 01:00:22 +0100
4Subject: [PATCH 05/40] Fix relaxation of assembler resolved references
5
6---
7 bfd/elf32-microblaze.c | 41 ++++++++++++++++++++++++++++++++++++++
8 gas/config/tc-microblaze.c | 1 +
9 2 files changed, 42 insertions(+)
10
11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
12index 693fc71f730..09dedc46106 100644
13--- a/bfd/elf32-microblaze.c
14+++ b/bfd/elf32-microblaze.c
15@@ -1969,6 +1969,47 @@ microblaze_elf_relax_section (bfd *abfd,
16 irelscanend = irelocs + o->reloc_count;
17 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
18 {
19+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
20+ {
21+ unsigned int val;
22+
23+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
24+
25+ /* This was a PC-relative instruction that was completely resolved. */
26+ if (ocontents == NULL)
27+ {
28+ if (elf_section_data (o)->this_hdr.contents != NULL)
29+ ocontents = elf_section_data (o)->this_hdr.contents;
30+ else
31+ {
32+ /* We always cache the section contents.
33+ Perhaps, if info->keep_memory is FALSE, we
34+ should free them, if we are permitted to. */
35+
36+ if (o->rawsize == 0)
37+ o->rawsize = o->size;
38+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
39+ if (ocontents == NULL)
40+ goto error_return;
41+ if (!bfd_get_section_contents (abfd, o, ocontents,
42+ (file_ptr) 0,
43+ o->rawsize))
44+ goto error_return;
45+ elf_section_data (o)->this_hdr.contents = ocontents;
46+ }
47+ }
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);
54+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
55+ irelscan->r_addend);
56+ }
57+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
58+ fprintf(stderr, "Unhandled NONE 64\n");
59+ }
60 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
61 {
62 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
63diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
64index 34eeb972357..d01653aeef9 100644
65--- a/gas/config/tc-microblaze.c
66+++ b/gas/config/tc-microblaze.c
67@@ -2201,6 +2201,7 @@ md_apply_fix (fixS * fixP,
68 else
69 fixP->fx_r_type = BFD_RELOC_NONE;
70 fixP->fx_addsy = section_symbol (absolute_section);
71+ fixP->fx_done = 0;
72 }
73 return;
74 }
75--
762.17.1
77
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
index 4319f1d7..95e4a363 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0007-upstream-change-to-garbage-collection-sweep-causes-m.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -1,7 +1,7 @@
1From 3f743710f53d86ed5e53d97b3b1b06d7a8cbcdc1 Mon Sep 17 00:00:00 2001 1From 4fc5075cebc9c76053b5ff683ab75c9e8b46ca1a Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000 3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 07/40] upstream change to garbage collection sweep causes mb 4Subject: [PATCH 05/52] upstream change to garbage collection sweep causes mb
5 regression 5 regression
6 6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a 7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
@@ -23,7 +23,7 @@ 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 998b72f2281..2daf8fdf6a8 100644 26index 998b72f228..2daf8fdf6a 100644
27--- a/bfd/elflink.c 27--- a/bfd/elflink.c
28+++ b/bfd/elflink.c 28+++ b/bfd/elflink.c
29@@ -6372,7 +6372,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)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch
index 4ab7681e..fcbd662e 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Fix-bug-in-TLSTPREL-Relocation.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch
@@ -1,7 +1,7 @@
1From 481dd44f36e7df691037201d9865482debbb397d Mon Sep 17 00:00:00 2001 1From 4e8bd012d3025a6f6b2b2794930f1bfbad7932e8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 15 Jun 2015 16:50:30 +0530 3Date: Mon, 15 Jun 2015 16:50:30 +0530
4Subject: [PATCH 08/40] Fix bug in TLSTPREL Relocation 4Subject: [PATCH 06/52] Fix bug in TLSTPREL Relocation
5 5
6Fixed the problem related to the fixup/relocations TLSTPREL. 6Fixed the problem related to the fixup/relocations TLSTPREL.
7When the fixup is applied the addend is not added at the correct offset 7When the fixup is applied the addend is not added at the correct offset
@@ -13,7 +13,7 @@ big & little-endian compilers
13 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
14 14
15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
16index 1be1ead2f41..ec1944c6faf 100644 16index e9715eae6a..9c4f809eaa 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@@ -1447,9 +1447,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, 19@@ -1447,9 +1447,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
deleted file mode 100644
index 308a453e..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0006-microblaze-Fixup-debug_loc-sections-after-linker-rel.patch
+++ /dev/null
@@ -1,222 +0,0 @@
1From 77c9dd2085e5a9e116cd8d8b4fbc1387c93d26d8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 6 Feb 2017 15:53:08 +0530
4Subject: [PATCH 06/40] microblaze: Fixup debug_loc sections after linker
5 relaxation
6
7Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing
8reloc info from the assembler to the linker when the linker
9manages to fully resolve a local symbol reference.
10
11This is a workaround for design flaws in the assembler to
12linker interface with regards to linker relaxation.
13
14Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com>
16---
17 bfd/bfd-in2.h | 5 +++++
18 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++-------
19 bfd/libbfd.h | 1 +
20 bfd/reloc.c | 6 ++++++
21 binutils/readelf.c | 4 ++++
22 gas/config/tc-microblaze.c | 3 +++
23 include/elf/microblaze.h | 1 +
24 7 files changed, 52 insertions(+), 7 deletions(-)
25
26diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
27index 35ef4d755bb..3fdbf8ed755 100644
28--- a/bfd/bfd-in2.h
29+++ b/bfd/bfd-in2.h
30@@ -5428,6 +5428,11 @@ value relative to the read-write small data area anchor */
31 expressions of the form "Symbol Op Symbol" */
32 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
33
34+/* This is a 32 bit reloc that stores the 32 bit pc relative
35+value in two words (with an imm instruction). No relocation is
36+done here - only used for relaxing */
37+ BFD_RELOC_MICROBLAZE_32_NONE,
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 */
42diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
43index 09dedc46106..1be1ead2f41 100644
44--- a/bfd/elf32-microblaze.c
45+++ b/bfd/elf32-microblaze.c
46@@ -176,6 +176,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
47 0x0000ffff, /* Dest Mask. */
48 FALSE), /* PC relative offset? */
49
50+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
51+ 0, /* Rightshift. */
52+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
53+ 32, /* Bitsize. */
54+ TRUE, /* PC_relative. */
55+ 0, /* Bitpos. */
56+ complain_overflow_bitfield, /* Complain on overflow. */
57+ NULL, /* Special Function. */
58+ "R_MICROBLAZE_32_NONE",/* Name. */
59+ FALSE, /* Partial Inplace. */
60+ 0, /* Source Mask. */
61+ 0, /* Dest Mask. */
62+ FALSE), /* PC relative offset? */
63+
64 /* This reloc does nothing. Used for relaxation. */
65 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
66 0, /* Rightshift. */
67@@ -562,6 +576,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
68 case BFD_RELOC_NONE:
69 microblaze_reloc = R_MICROBLAZE_NONE;
70 break;
71+ case BFD_RELOC_MICROBLAZE_32_NONE:
72+ microblaze_reloc = R_MICROBLAZE_32_NONE;
73+ break;
74 case BFD_RELOC_MICROBLAZE_64_NONE:
75 microblaze_reloc = R_MICROBLAZE_64_NONE;
76 break;
77@@ -1914,14 +1931,22 @@ microblaze_elf_relax_section (bfd *abfd,
78 }
79 break;
80 case R_MICROBLAZE_NONE:
81+ case R_MICROBLAZE_32_NONE:
82 {
83 /* This was a PC-relative instruction that was
84 completely resolved. */
85 int sfix, efix;
86+ unsigned int val;
87 bfd_vma target_address;
88 target_address = irel->r_addend + irel->r_offset;
89 sfix = calc_fixup (irel->r_offset, 0, sec);
90 efix = calc_fixup (target_address, 0, sec);
91+
92+ /* Validate the in-band val. */
93+ val = bfd_get_32 (abfd, contents + irel->r_offset);
94+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
95+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
96+ }
97 irel->r_addend -= (efix - sfix);
98 /* Should use HOWTO. */
99 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
100@@ -1969,12 +1994,16 @@ microblaze_elf_relax_section (bfd *abfd,
101 irelscanend = irelocs + o->reloc_count;
102 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
103 {
104- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
105+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
106 {
107 unsigned int val;
108
109 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
110
111+ /* hax: We only do the following fixup for debug location lists. */
112+ if (strcmp(".debug_loc", o->name))
113+ continue;
114+
115 /* This was a PC-relative instruction that was completely resolved. */
116 if (ocontents == NULL)
117 {
118@@ -2002,14 +2031,10 @@ microblaze_elf_relax_section (bfd *abfd,
119 if (val != irelscan->r_addend) {
120 fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
121 }
122- irelscan->r_addend -= calc_fixup (irelscan->r_addend
123- + isym->st_value, 0, sec);
124+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
125 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
126 irelscan->r_addend);
127 }
128- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
129- fprintf(stderr, "Unhandled NONE 64\n");
130- }
131 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
132 {
133 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
134@@ -2069,7 +2094,7 @@ microblaze_elf_relax_section (bfd *abfd,
135 elf_section_data (o)->this_hdr.contents = ocontents;
136 }
137 }
138- irelscan->r_addend -= calc_fixup (irel->r_addend
139+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
140 + isym->st_value,
141 0,
142 sec);
143diff --git a/bfd/libbfd.h b/bfd/libbfd.h
144index b97534fc9fe..c1551b92405 100644
145--- a/bfd/libbfd.h
146+++ b/bfd/libbfd.h
147@@ -2967,6 +2967,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
148 "BFD_RELOC_MICROBLAZE_32_ROSDA",
149 "BFD_RELOC_MICROBLAZE_32_RWSDA",
150 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
151+ "BFD_RELOC_MICROBLAZE_32_NONE",
152 "BFD_RELOC_MICROBLAZE_64_NONE",
153 "BFD_RELOC_MICROBLAZE_64_GOTPC",
154 "BFD_RELOC_MICROBLAZE_64_GOT",
155diff --git a/bfd/reloc.c b/bfd/reloc.c
156index 9aba84ca81e..9b39b419415 100644
157--- a/bfd/reloc.c
158+++ b/bfd/reloc.c
159@@ -6858,6 +6858,12 @@ ENUM
160 ENUMDOC
161 This is a 32 bit reloc for the microblaze to handle
162 expressions of the form "Symbol Op Symbol"
163+ENUM
164+ BFD_RELOC_MICROBLAZE_32_NONE
165+ENUMDOC
166+ This is a 32 bit reloc that stores the 32 bit pc relative
167+ value in two words (with an imm instruction). No relocation is
168+ done here - only used for relaxing
169 ENUM
170 BFD_RELOC_MICROBLAZE_64_NONE
171 ENUMDOC
172diff --git a/binutils/readelf.c b/binutils/readelf.c
173index 6057515a89b..04704d22fef 100644
174--- a/binutils/readelf.c
175+++ b/binutils/readelf.c
176@@ -13406,6 +13406,10 @@ is_none_reloc (Filedata * filedata, unsigned int reloc_type)
177 || reloc_type == 32 /* R_AVR_DIFF32. */);
178 case EM_METAG:
179 return reloc_type == 3; /* R_METAG_NONE. */
180+ case EM_MICROBLAZE:
181+ return reloc_type == 30 /* R_MICROBLAZE_32_NONE. */
182+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
183+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
184 case EM_NDS32:
185 return (reloc_type == 0 /* R_XTENSA_NONE. */
186 || reloc_type == 204 /* R_NDS32_DIFF8. */
187diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
188index d01653aeef9..74a63abeb0c 100644
189--- a/gas/config/tc-microblaze.c
190+++ b/gas/config/tc-microblaze.c
191@@ -2198,6 +2198,8 @@ md_apply_fix (fixS * fixP,
192 moves code around due to relaxing. */
193 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
194 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
195+ else if (fixP->fx_r_type == BFD_RELOC_32)
196+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
197 else
198 fixP->fx_r_type = BFD_RELOC_NONE;
199 fixP->fx_addsy = section_symbol (absolute_section);
200@@ -2422,6 +2424,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
201 switch (fixp->fx_r_type)
202 {
203 case BFD_RELOC_NONE:
204+ case BFD_RELOC_MICROBLAZE_32_NONE:
205 case BFD_RELOC_MICROBLAZE_64_NONE:
206 case BFD_RELOC_32:
207 case BFD_RELOC_MICROBLAZE_32_LO:
208diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
209index 2fec296967b..55f34f72b0d 100644
210--- a/include/elf/microblaze.h
211+++ b/include/elf/microblaze.h
212@@ -61,6 +61,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
213 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
214 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
215 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
216+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
217 END_RELOC_NUMBERS (R_MICROBLAZE_max)
218
219 /* Global base address names. */
220--
2212.17.1
222
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
index c5bd3b2d..fd15e23c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0009-Added-Address-extension-instructions.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
@@ -1,7 +1,7 @@
1From fa85df88dc229f7f8f0bc09cd0995d05f49c03b7 Mon Sep 17 00:00:00 2001 1From 1d1344e5786d435f4f492739d0c477befa4c6906 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jan 2016 12:28:21 +0530 3Date: Mon, 18 Jan 2016 12:28:21 +0530
4Subject: [PATCH 09/40] Added Address extension instructions 4Subject: [PATCH 07/52] Added Address extension instructions
5 5
6This patch adds the support of new instructions which are required 6This patch adds the support of new instructions which are required
7for supporting Address extension feature. 7for supporting Address extension feature.
@@ -13,27 +13,20 @@ ChangeLog:
13 13
14 *microblaze-opc.h (op_code_struct): Update 14 *microblaze-opc.h (op_code_struct): Update
15 Added new instructions 15 Added new instructions
16 Set MAX_OPCODES to matching value
17 *microblaze-opcm.h (microblaze_instr): Update 16 *microblaze-opcm.h (microblaze_instr): Update
18 Added new instructions 17 Added new instructions
18
19Conflicts:
20 opcodes/microblaze-opcm.h
19--- 21---
20 opcodes/microblaze-opc.h | 13 ++++++++++++- 22 opcodes/microblaze-opc.h | 11 +++++++++++
21 opcodes/microblaze-opcm.h | 10 +++++----- 23 opcodes/microblaze-opcm.h | 10 +++++-----
22 2 files changed, 17 insertions(+), 6 deletions(-) 24 2 files changed, 16 insertions(+), 5 deletions(-)
23 25
24diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 26diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
25index b6c5016e4d2..c7a506b845a 100644 27index b6c5016e4d..1f1ade40b2 100644
26--- a/opcodes/microblaze-opc.h 28--- a/opcodes/microblaze-opc.h
27+++ b/opcodes/microblaze-opc.h 29+++ 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 {
37@@ -178,8 +178,11 @@ struct op_code_struct 30@@ -178,8 +178,11 @@ struct op_code_struct
38 {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst }, 31 {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
39 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst }, 32 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
@@ -81,7 +74,7 @@ index b6c5016e4d2..c7a506b845a 100644
81 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst }, 74 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
82 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 75 {"", 0, 0, 0, 0, 0, 0, 0, 0},
83diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 76diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
84index 795c57b5ff6..b05e319862e 100644 77index 795c57b5ff..b05e319862 100644
85--- a/opcodes/microblaze-opcm.h 78--- a/opcodes/microblaze-opcm.h
86+++ b/opcodes/microblaze-opcm.h 79+++ b/opcodes/microblaze-opcm.h
87@@ -33,13 +33,13 @@ enum microblaze_instr 80@@ -33,13 +33,13 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0008-fixing-the-MAX_OPCODES-to-correct-value.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0008-fixing-the-MAX_OPCODES-to-correct-value.patch
new file mode 100644
index 00000000..8564003c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0008-fixing-the-MAX_OPCODES-to-correct-value.patch
@@ -0,0 +1,25 @@
1From b2e494ee992ef0509bd2a4512f62841098631219 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 28 Jan 2016 14:07:34 +0530
4Subject: [PATCH 08/52] fixing the MAX_OPCODES to correct value
5
6---
7 opcodes/microblaze-opc.h | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
11index 1f1ade40b2..c7a506b845 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/0009-Add-new-bit-field-instructions.patch
index 1612c11c..0188629d 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0010-Add-new-bit-field-instructions.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Add-new-bit-field-instructions.patch
@@ -1,7 +1,7 @@
1From 0034d6b5231a0a72c5f9fc47ba4c8eba0c35ff39 Mon Sep 17 00:00:00 2001 1From cea8d524fca305c2878374433d9745b938e4c78f Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530 3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 10/40] Add new bit-field instructions 4Subject: [PATCH 09/52] Add new bit-field instructions
5 5
6This patches adds new bsefi and bsifi instructions. 6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a 7BSEFI- The instruction shall extract a bit field from a
@@ -12,15 +12,18 @@ from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged 12The rest of the bits in the destination register shall be unchanged
13 13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
15--- 18---
16 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++- 19 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
17 opcodes/microblaze-dis.c | 17 +++++++++ 20 opcodes/microblaze-dis.c | 20 +++++++++--
18 opcodes/microblaze-opc.h | 12 ++++++- 21 opcodes/microblaze-opc.h | 12 ++++++-
19 opcodes/microblaze-opcm.h | 6 +++- 22 opcodes/microblaze-opcm.h | 6 +++-
20 4 files changed, 103 insertions(+), 3 deletions(-) 23 4 files changed, 104 insertions(+), 5 deletions(-)
21 24
22diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 25diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
23index 74a63abeb0c..765abfb3885 100644 26index 74a63abeb0..765abfb388 100644
24--- a/gas/config/tc-microblaze.c 27--- a/gas/config/tc-microblaze.c
25+++ b/gas/config/tc-microblaze.c 28+++ b/gas/config/tc-microblaze.c
26@@ -917,7 +917,7 @@ md_assemble (char * str) 29@@ -917,7 +917,7 @@ md_assemble (char * str)
@@ -110,14 +113,14 @@ index 74a63abeb0c..765abfb3885 100644
110 if (strcmp (op_end, "")) 113 if (strcmp (op_end, ""))
111 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 114 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
112diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 115diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
113index be1534c257c..52c9068805f 100644 116index be1534c257..315c6e9350 100644
114--- a/opcodes/microblaze-dis.c 117--- a/opcodes/microblaze-dis.c
115+++ b/opcodes/microblaze-dis.c 118+++ b/opcodes/microblaze-dis.c
116@@ -90,6 +90,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) 119@@ -91,7 +91,19 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
117 return p;
118 } 120 }
119 121
120+static char * 122 static char *
123-get_field_rfsl (struct string_buf *buf, long instr)
121+get_field_imm5width (struct string_buf *buf, long instr) 124+get_field_imm5width (struct string_buf *buf, long instr)
122+{ 125+{
123+ char *p = strbuf (buf); 126+ char *p = strbuf (buf);
@@ -129,23 +132,26 @@ index be1534c257c..52c9068805f 100644
129+ return p; 132+ return p;
130+} 133+}
131+ 134+
132 static char * 135+static char *
133 get_field_rfsl (struct string_buf *buf, long instr) 136+get_field_rfsl (struct string_buf *buf,long instr)
134 { 137 {
135@@ -428,6 +440,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 138 char *p = strbuf (buf);
139
140@@ -427,7 +439,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
141 /* For mbar 16 or sleep insn. */
136 case INST_TYPE_NONE: 142 case INST_TYPE_NONE:
137 break; 143 break;
138 /* For tuqula instruction */ 144- /* For tuqula instruction */
139+ /* For bit field insns. */ 145+ /* For bit field insns. */
140+ case INST_TYPE_RD_R1_IMM5_IMM5: 146+ case INST_TYPE_RD_R1_IMM5_IMM5:
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)); 147+ 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; 148+ break;
143+ /* For tuqula instruction */ 149+ /* For tuqula instruction */
144 case INST_TYPE_RD: 150 case INST_TYPE_RD:
145 print_func (stream, "\t%s", get_field_rd (&buf, inst)); 151 print_func (stream, "\t%s", get_field_rd (&buf, inst));
146 break; 152 break;
147diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 153diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
148index c7a506b845a..f61f4ef66d9 100644 154index c7a506b845..f61f4ef66d 100644
149--- a/opcodes/microblaze-opc.h 155--- a/opcodes/microblaze-opc.h
150+++ b/opcodes/microblaze-opc.h 156+++ b/opcodes/microblaze-opc.h
151@@ -59,6 +59,9 @@ 157@@ -59,6 +59,9 @@
@@ -196,7 +202,7 @@ index c7a506b845a..f61f4ef66d9 100644
196 #endif /* MICROBLAZE_OPC */ 202 #endif /* MICROBLAZE_OPC */
197 203
198diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 204diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
199index b05e319862e..fa921c90c98 100644 205index b05e319862..fa921c90c9 100644
200--- a/opcodes/microblaze-opcm.h 206--- a/opcodes/microblaze-opcm.h
201+++ b/opcodes/microblaze-opcm.h 207+++ b/opcodes/microblaze-opcm.h
202@@ -29,7 +29,7 @@ enum microblaze_instr 208@@ -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/0010-fixing-the-imm-bug.patch
index fcb9c8ae..892205cd 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0011-fixing-the-imm-bug.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch
@@ -1,15 +1,15 @@
1From 75e55d8ebf3cd780fe69c066163ab2da7ac204f2 Mon Sep 17 00:00:00 2001 1From d6ccef90be40de63ee6da4943a601edaf7b1a136 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 10 Jul 2017 16:07:28 +0530 3Date: Mon, 10 Jul 2017 16:07:28 +0530
4Subject: [PATCH 11/40] fixing the imm bug. 4Subject: [PATCH 10/52] fixing the imm bug. with relax option imm -1 is also
5 getting removed this is corrected now.
5 6
6with relax option imm -1 is also getting removed this is corrected now.
7--- 7---
8 bfd/elf32-microblaze.c | 3 +-- 8 bfd/elf32-microblaze.c | 3 +--
9 1 file changed, 1 insertion(+), 2 deletions(-) 9 1 file changed, 1 insertion(+), 2 deletions(-)
10 10
11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 11diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
12index ec1944c6faf..cf4a7fdba33 100644 12index 9c4f809eaa..c22130fd8c 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@@ -1865,8 +1865,7 @@ microblaze_elf_relax_section (bfd *abfd, 15@@ -1865,8 +1865,7 @@ microblaze_elf_relax_section (bfd *abfd,
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/0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
index 02cc1259..db23fe14 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/0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
@@ -1,7 +1,7 @@
1From 5432f81ba9d7c17b20ff576c7c09ae78f4fe6e9c Mon Sep 17 00:00:00 2001 1From 3bb637b058c5f2622950e6984695e36f9cac067a 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/40] [Patch,Microblaze]: fixed bug in GCC so that It will 4Subject: [PATCH 11/52] [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,7 +9,7 @@ Subject: [PATCH 12/40] [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 6f8ccb82303..0e34ca53d9b 100644 12index 6f8ccb8230..0e34ca53d9 100644
13--- a/gas/expr.c 13--- a/gas/expr.c
14+++ b/gas/expr.c 14+++ b/gas/expr.c
15@@ -803,6 +803,15 @@ operand (expressionS *expressionP, enum expr_mode mode) 15@@ -803,6 +803,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch
index accff214..4145b0da 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0013-fixing-the-constant-range-check-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch
@@ -1,15 +1,15 @@
1From 6337e24a220dca86b71efcc10c5ffed6bf11bc22 Mon Sep 17 00:00:00 2001 1From e1cb5c37efd76b44a878574ee3baad4c7a882e3b 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/40] fixing the constant range check issue 4Subject: [PATCH 12/52] fixing the constant range check issue sample error: not
5 in range ffffffff80000000..7fffffff, not ffffffff70000000
5 6
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 765abfb3885..5810a74a5fc 100644 12index 765abfb388..5810a74a5f 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/0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
index cdbe65a6..a74f2b9e 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/0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
@@ -1,7 +1,7 @@
1From e7e06edfb6c24a993603c9100f8ab8c29999ef90 Mon Sep 17 00:00:00 2001 1From 1a3f130008b4ebcd9a6e45cdac7188bde88f2f28 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/40] [Patch,Microblaze]: Compiler will give error messages 4Subject: [PATCH 13/52] [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,7 +9,7 @@ Subject: [PATCH 14/40] [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 08be9030cb5..613d748fefd 100644 12index 08be9030cb..613d748fef 100644
13--- a/ld/ldmain.c 13--- a/ld/ldmain.c
14+++ b/ld/ldmain.c 14+++ b/ld/ldmain.c
15@@ -1515,6 +1515,18 @@ reloc_overflow (struct bfd_link_info *info, 15@@ -1515,6 +1515,18 @@ reloc_overflow (struct bfd_link_info *info,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch
index 9f228015..f0037e1f 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0015-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch
@@ -1,84 +1,90 @@
1From a7626e576d867c6c9c8321f00cf5e17dc31c52b8 Mon Sep 17 00:00:00 2001 1From d25d934f076297615cb0287488449fb32b9c46e8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 16:28:28 +0530 3Date: Sun, 30 Sep 2018 16:28:28 +0530
4Subject: [PATCH 15/40] intial commit of MB 64-bit 4Subject: [PATCH 14/52] intial commit of MB 64-bit
5 5
6Conflicts:
7 bfd/configure
8 bfd/configure.ac
9 bfd/cpu-microblaze.c
10 ld/Makefile.am
11 ld/Makefile.in
12 opcodes/microblaze-dis.c
6--- 13---
7 bfd/Makefile.am | 2 + 14 bfd/Makefile.am | 2 +
8 bfd/Makefile.in | 3 + 15 bfd/Makefile.in | 3 +
9 bfd/config.bfd | 4 + 16 bfd/config.bfd | 4 +
10 bfd/configure | 2 + 17 bfd/configure | 2 +
11 bfd/configure.ac | 2 + 18 bfd/configure.ac | 2 +
12 bfd/cpu-microblaze.c | 55 +- 19 bfd/cpu-microblaze.c | 53 +-
13 bfd/doc/Makefile.in | 1 + 20 bfd/elf64-microblaze.c | 3610 ++++++++++++++++++++++++++++
14 bfd/elf64-microblaze.c | 3560 ++++++++++++++++++++++++++++
15 bfd/targets.c | 6 + 21 bfd/targets.c | 6 +
16 gas/config/tc-microblaze.c | 274 ++- 22 gas/config/tc-microblaze.c | 274 ++-
17 gas/config/tc-microblaze.h | 4 +- 23 gas/config/tc-microblaze.h | 4 +-
18 include/elf/common.h | 1 + 24 include/elf/common.h | 1 +
19 ld/Makefile.am | 4 + 25 ld/Makefile.am | 4 +
20 ld/Makefile.in | 7 + 26 ld/Makefile.in | 6 +
21 ld/configure.tgt | 3 + 27 ld/configure.tgt | 3 +
22 ld/emulparams/elf64microblaze.sh | 23 + 28 ld/emulparams/elf64microblaze.sh | 23 +
23 ld/emulparams/elf64microblazeel.sh | 23 + 29 ld/emulparams/elf64microblazeel.sh | 23 +
24 opcodes/microblaze-dis.c | 43 +- 30 opcodes/microblaze-dis.c | 35 +-
25 opcodes/microblaze-opc.h | 162 +- 31 opcodes/microblaze-opc.h | 162 +-
26 opcodes/microblaze-opcm.h | 20 +- 32 opcodes/microblaze-opcm.h | 20 +-
27 20 files changed, 4156 insertions(+), 43 deletions(-) 33 19 files changed, 4197 insertions(+), 40 deletions(-)
28 create mode 100644 bfd/elf64-microblaze.c 34 create mode 100644 bfd/elf64-microblaze.c
29 create mode 100644 ld/emulparams/elf64microblaze.sh 35 create mode 100644 ld/emulparams/elf64microblaze.sh
30 create mode 100644 ld/emulparams/elf64microblazeel.sh 36 create mode 100644 ld/emulparams/elf64microblazeel.sh
31 37
32diff --git a/bfd/Makefile.am b/bfd/Makefile.am 38diff --git a/bfd/Makefile.am b/bfd/Makefile.am
33index c88c4480001..9e12b34038c 100644 39index c88c448000..d86f1c5697 100644
34--- a/bfd/Makefile.am 40--- a/bfd/Makefile.am
35+++ b/bfd/Makefile.am 41+++ b/bfd/Makefile.am
36@@ -552,6 +552,7 @@ BFD64_BACKENDS = \ 42@@ -562,6 +562,7 @@ BFD64_BACKENDS = \
37 elf64-ia64.lo \ 43 elf64-riscv.lo \
38 elf64-ia64-vms.lo \ 44 elfxx-riscv.lo \
39 elfxx-ia64.lo \ 45 elf64-s390.lo \
40+ elf64-microblaze.lo \ 46+ elf64-microblaze.lo \
41 elfn32-mips.lo \ 47 elf64-sparc.lo \
42 elf64-mips.lo \ 48 elf64-tilegx.lo \
43 elfxx-mips.lo \ 49 elf64-x86-64.lo \
44@@ -591,6 +592,7 @@ BFD64_BACKENDS_CFILES = \ 50@@ -596,6 +597,7 @@ BFD64_BACKENDS_CFILES = \
45 elf64-gen.c \
46 elf64-hppa.c \
47 elf64-ia64-vms.c \
48+ elf64-microblaze.c \
49 elf64-mips.c \
50 elf64-mmix.c \
51 elf64-nfp.c \ 51 elf64-nfp.c \
52 elf64-ppc.c \
53 elf64-s390.c \
54+ elf64-microblaze.c \
55 elf64-sparc.c \
56 elf64-tilegx.c \
57 elf64-x86-64.c \
52diff --git a/bfd/Makefile.in b/bfd/Makefile.in 58diff --git a/bfd/Makefile.in b/bfd/Makefile.in
53index d0d14c6ab32..5c12b706616 100644 59index d0d14c6ab3..a54abeca48 100644
54--- a/bfd/Makefile.in 60--- a/bfd/Makefile.in
55+++ b/bfd/Makefile.in 61+++ b/bfd/Makefile.in
56@@ -978,6 +978,7 @@ BFD64_BACKENDS = \ 62@@ -988,6 +988,7 @@ BFD64_BACKENDS = \
57 elf64-ia64.lo \ 63 elf64-riscv.lo \
58 elf64-ia64-vms.lo \ 64 elfxx-riscv.lo \
59 elfxx-ia64.lo \ 65 elf64-s390.lo \
60+ elf64-microblaze.lo \ 66+ elf64-microblaze.lo \
61 elfn32-mips.lo \ 67 elf64-sparc.lo \
62 elf64-mips.lo \ 68 elf64-tilegx.lo \
63 elfxx-mips.lo \ 69 elf64-x86-64.lo \
64@@ -1017,6 +1018,7 @@ BFD64_BACKENDS_CFILES = \ 70@@ -1022,6 +1023,7 @@ BFD64_BACKENDS_CFILES = \
65 elf64-gen.c \
66 elf64-hppa.c \
67 elf64-ia64-vms.c \
68+ elf64-microblaze.c \
69 elf64-mips.c \
70 elf64-mmix.c \
71 elf64-nfp.c \ 71 elf64-nfp.c \
72@@ -1495,6 +1497,7 @@ distclean-compile: 72 elf64-ppc.c \
73 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@ 73 elf64-s390.c \
74 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@ 74+ elf64-microblaze.c \
75 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64.Plo@am__quote@ 75 elf64-sparc.c \
76 elf64-tilegx.c \
77 elf64-x86-64.c \
78@@ -1501,6 +1503,7 @@ distclean-compile:
79 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
80 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
81 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
76+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@ 82+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
77 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@ 83 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
78 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@ 84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
79 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-nfp.Plo@am__quote@ 85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
80diff --git a/bfd/config.bfd b/bfd/config.bfd 86diff --git a/bfd/config.bfd b/bfd/config.bfd
81index 14523caf0c5..437c03bb9d9 100644 87index 14523caf0c..437c03bb9d 100644
82--- a/bfd/config.bfd 88--- a/bfd/config.bfd
83+++ b/bfd/config.bfd 89+++ b/bfd/config.bfd
84@@ -825,11 +825,15 @@ case "${targ}" in 90@@ -825,11 +825,15 @@ case "${targ}" in
@@ -98,36 +104,36 @@ index 14523caf0c5..437c03bb9d9 100644
98 104
99 #ifdef BFD64 105 #ifdef BFD64
100diff --git a/bfd/configure b/bfd/configure 106diff --git a/bfd/configure b/bfd/configure
101index 5ab3e856bc2..982ecd254a8 100755 107index 0340ed541b..ff5ae4706c 100755
102--- a/bfd/configure 108--- a/bfd/configure
103+++ b/bfd/configure 109+++ b/bfd/configure
104@@ -14828,6 +14828,8 @@ do 110@@ -14903,6 +14903,8 @@ do
105 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;; 111 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
106 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 112 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
107 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 113 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
108+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 114+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
109+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 115+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
110 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 116 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
111 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 117 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
112 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 118 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
113diff --git a/bfd/configure.ac b/bfd/configure.ac 119diff --git a/bfd/configure.ac b/bfd/configure.ac
114index 8e86f8399ce..38e80148171 100644 120index 8e86f8399c..408092d3be 100644
115--- a/bfd/configure.ac 121--- a/bfd/configure.ac
116+++ b/bfd/configure.ac 122+++ b/bfd/configure.ac
117@@ -564,6 +564,8 @@ do 123@@ -639,6 +639,8 @@ do
118 metag_elf32_vec) tb="$tb elf32-metag.lo elf32.lo $elf" ;; 124 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
119 microblaze_elf32_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 125 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
120 microblaze_elf32_le_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; 126 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
121+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 127+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
122+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;; 128+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
123 mips_ecoff_be_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 129 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
124 mips_ecoff_le_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 130 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
125 mips_ecoff_bele_vec) tb="$tb coff-mips.lo ecoff.lo $ecoff" ;; 131 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
126diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 132diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
127index 05a3f767e22..f94dc2c177b 100644 133index 05a3f767e2..194920b20b 100644
128--- a/bfd/cpu-microblaze.c 134--- a/bfd/cpu-microblaze.c
129+++ b/bfd/cpu-microblaze.c 135+++ b/bfd/cpu-microblaze.c
130@@ -23,7 +23,25 @@ 136@@ -23,7 +23,24 @@
131 #include "bfd.h" 137 #include "bfd.h"
132 #include "libbfd.h" 138 #include "libbfd.h"
133 139
@@ -148,13 +154,12 @@ index 05a3f767e22..f94dc2c177b 100644
148+ bfd_default_compatible, /* Architecture comparison function. */ 154+ bfd_default_compatible, /* Architecture comparison function. */
149+ bfd_default_scan, /* String to architecture conversion. */ 155+ bfd_default_scan, /* String to architecture conversion. */
150+ bfd_arch_default_fill, /* Default fill. */ 156+ bfd_arch_default_fill, /* Default fill. */
151+ &bfd_microblaze_arch[1], /* Next in list. */ 157+ &bfd_microblaze_arch[1] /* Next in list. */
152+ 0 /* Maximum offset of a reloc from the start of an insn. */
153+}, 158+},
154 { 159 {
155 32, /* Bits in a word. */ 160 32, /* Bits in a word. */
156 32, /* Bits in an address. */ 161 32, /* Bits in an address. */
157@@ -39,4 +57,39 @@ const bfd_arch_info_type bfd_microblaze_arch = 162@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
158 bfd_arch_default_fill, /* Default fill. */ 163 bfd_arch_default_fill, /* Default fill. */
159 NULL, /* Next in list. */ 164 NULL, /* Next in list. */
160 0 /* Maximum offset of a reloc from the start of an insn. */ 165 0 /* Maximum offset of a reloc from the start of an insn. */
@@ -173,8 +178,7 @@ index 05a3f767e22..f94dc2c177b 100644
173+ bfd_default_compatible, /* Architecture comparison function. */ 178+ bfd_default_compatible, /* Architecture comparison function. */
174+ bfd_default_scan, /* String to architecture conversion. */ 179+ bfd_default_scan, /* String to architecture conversion. */
175+ bfd_arch_default_fill, /* Default fill. */ 180+ bfd_arch_default_fill, /* Default fill. */
176+ &bfd_microblaze_arch[1], /* Next in list. */ 181+ &bfd_microblaze_arch[1] /* Next in list. */
177+ 0 /* Maximum offset of a reloc from the start of an insn. */
178+}, 182+},
179+{ 183+{
180+ 64, /* 32 bits in a word. */ 184+ 64, /* 32 bits in a word. */
@@ -189,29 +193,17 @@ index 05a3f767e22..f94dc2c177b 100644
189+ bfd_default_compatible, /* Architecture comparison function. */ 193+ bfd_default_compatible, /* Architecture comparison function. */
190+ bfd_default_scan, /* String to architecture conversion. */ 194+ bfd_default_scan, /* String to architecture conversion. */
191+ bfd_arch_default_fill, /* Default fill. */ 195+ bfd_arch_default_fill, /* Default fill. */
192+ NULL, /* Next in list. */ 196+ NULL, /* Next in list. */
193+ 0 /* Maximum offset of a reloc from the start of an insn. */ 197+ 0 /* Maximum offset of a reloc from the start of an insn. */
194+} 198+}
195+#endif 199+#endif
196 }; 200 };
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@
209diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 201diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
210new file mode 100644 202new file mode 100644
211index 00000000000..fa4b95e47e0 203index 0000000000..a357388115
212--- /dev/null 204--- /dev/null
213+++ b/bfd/elf64-microblaze.c 205+++ b/bfd/elf64-microblaze.c
214@@ -0,0 +1,3560 @@ 206@@ -0,0 +1,3610 @@
215+/* Xilinx MicroBlaze-specific support for 32-bit ELF 207+/* Xilinx MicroBlaze-specific support for 32-bit ELF
216+ 208+
217+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 209+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
@@ -870,7 +862,7 @@ index 00000000000..fa4b95e47e0
870+/* Set the howto pointer for a RCE ELF reloc. */ 862+/* Set the howto pointer for a RCE ELF reloc. */
871+ 863+
872+static bfd_boolean 864+static bfd_boolean
873+microblaze_elf_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, 865+microblaze_elf_info_to_howto (bfd * abfd,
874+ arelent * cache_ptr, 866+ arelent * cache_ptr,
875+ Elf_Internal_Rela * dst) 867+ Elf_Internal_Rela * dst)
876+{ 868+{
@@ -883,14 +875,15 @@ index 00000000000..fa4b95e47e0
883+ r_type = ELF64_R_TYPE (dst->r_info); 875+ r_type = ELF64_R_TYPE (dst->r_info);
884+ if (r_type >= R_MICROBLAZE_max) 876+ if (r_type >= R_MICROBLAZE_max)
885+ { 877+ {
886+ (*_bfd_error_handler) (_("%pB: unrecognised MicroBlaze reloc number: %d"), 878+ /* xgettext:c-format */
887+ abfd, r_type); 879+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
880+ abfd, r_type);
888+ bfd_set_error (bfd_error_bad_value); 881+ bfd_set_error (bfd_error_bad_value);
889+ return FALSE; 882+ return FALSE;
890+ } 883+ }
891+ 884+
892+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 885+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
893+ return TRUE; 886+ return TRUE;
894+} 887+}
895+ 888+
896+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 889+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
@@ -1013,7 +1006,6 @@ index 00000000000..fa4b95e47e0
1013+ struct elf64_mb_link_hash_entry *eh; 1006+ struct elf64_mb_link_hash_entry *eh;
1014+ 1007+
1015+ eh = (struct elf64_mb_link_hash_entry *) entry; 1008+ eh = (struct elf64_mb_link_hash_entry *) entry;
1016+ eh->dyn_relocs = NULL;
1017+ eh->tls_mask = 0; 1009+ eh->tls_mask = 0;
1018+ } 1010+ }
1019+ 1011+
@@ -1026,7 +1018,7 @@ index 00000000000..fa4b95e47e0
1026+microblaze_elf_link_hash_table_create (bfd *abfd) 1018+microblaze_elf_link_hash_table_create (bfd *abfd)
1027+{ 1019+{
1028+ struct elf64_mb_link_hash_table *ret; 1020+ struct elf64_mb_link_hash_table *ret;
1029+ bfd_size_type amt = sizeof (struct elf64_mb_link_hash_table); 1021+ size_t amt = sizeof (struct elf64_mb_link_hash_table);
1030+ 1022+
1031+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt); 1023+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt);
1032+ if (ret == NULL) 1024+ if (ret == NULL)
@@ -1241,6 +1233,7 @@ index 00000000000..fa4b95e47e0
1241+ else 1233+ else
1242+ { 1234+ {
1243+ bfd_vma relocation; 1235+ bfd_vma relocation;
1236+ bfd_boolean resolved_to_zero;
1244+ 1237+
1245+ /* This is a final link. */ 1238+ /* This is a final link. */
1246+ sym = NULL; 1239+ sym = NULL;
@@ -1280,6 +1273,9 @@ index 00000000000..fa4b95e47e0
1280+ goto check_reloc; 1273+ goto check_reloc;
1281+ } 1274+ }
1282+ 1275+
1276+ resolved_to_zero = (h != NULL
1277+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
1278+
1283+ switch ((int) r_type) 1279+ switch ((int) r_type)
1284+ { 1280+ {
1285+ case (int) R_MICROBLAZE_SRO32 : 1281+ case (int) R_MICROBLAZE_SRO32 :
@@ -1314,11 +1310,14 @@ index 00000000000..fa4b95e47e0
1314+ } 1310+ }
1315+ else 1311+ else
1316+ { 1312+ {
1317+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1313+ _bfd_error_handler
1318+ bfd_get_filename (input_bfd), 1314+ /* xgettext:c-format */
1319+ sym_name, 1315+ (_("%pB: the target (%s) of an %s relocation"
1320+ microblaze_elf_howto_table[(int) r_type]->name, 1316+ " is in the wrong section (%pA)"),
1321+ bfd_section_name (sec)); 1317+ input_bfd,
1318+ sym_name,
1319+ microblaze_elf_howto_table[(int) r_type]->name,
1320+ sec);
1322+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1321+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1323+ ret = FALSE; 1322+ ret = FALSE;
1324+ continue; 1323+ continue;
@@ -1359,11 +1358,14 @@ index 00000000000..fa4b95e47e0
1359+ } 1358+ }
1360+ else 1359+ else
1361+ { 1360+ {
1362+ (*_bfd_error_handler) (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), 1361+ _bfd_error_handler
1363+ bfd_get_filename (input_bfd), 1362+ /* xgettext:c-format */
1364+ sym_name, 1363+ (_("%pB: the target (%s) of an %s relocation"
1365+ microblaze_elf_howto_table[(int) r_type]->name, 1364+ " is in the wrong section (%pA)"),
1366+ bfd_section_name (sec)); 1365+ input_bfd,
1366+ sym_name,
1367+ microblaze_elf_howto_table[(int) r_type]->name,
1368+ sec);
1367+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1369+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1368+ ret = FALSE; 1370+ ret = FALSE;
1369+ continue; 1371+ continue;
@@ -1425,7 +1427,6 @@ index 00000000000..fa4b95e47e0
1425+ goto dogot; 1427+ goto dogot;
1426+ case (int) R_MICROBLAZE_TLSLD: 1428+ case (int) R_MICROBLAZE_TLSLD:
1427+ tls_type = (TLS_TLS | TLS_LD); 1429+ tls_type = (TLS_TLS | TLS_LD);
1428+ /* Fall through. */
1429+ dogot: 1430+ dogot:
1430+ case (int) R_MICROBLAZE_GOT_64: 1431+ case (int) R_MICROBLAZE_GOT_64:
1431+ { 1432+ {
@@ -1489,7 +1490,8 @@ index 00000000000..fa4b95e47e0
1489+ /* Need to generate relocs ? */ 1490+ /* Need to generate relocs ? */
1490+ if ((bfd_link_pic (info) || indx != 0) 1491+ if ((bfd_link_pic (info) || indx != 0)
1491+ && (h == NULL 1492+ && (h == NULL
1492+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1493+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1494+ && !resolved_to_zero)
1493+ || h->root.type != bfd_link_hash_undefweak)) 1495+ || h->root.type != bfd_link_hash_undefweak))
1494+ need_relocs = TRUE; 1496+ need_relocs = TRUE;
1495+ 1497+
@@ -1551,47 +1553,47 @@ index 00000000000..fa4b95e47e0
1551+ } 1553+ }
1552+ else if (IS_TLS_GD(tls_type)) 1554+ else if (IS_TLS_GD(tls_type))
1553+ { 1555+ {
1554+ *offp |= 1; 1556+ *offp |= 1;
1555+ static_value -= dtprel_base(info); 1557+ static_value -= dtprel_base(info);
1556+ if (need_relocs) 1558+ if (need_relocs)
1557+ { 1559+ microblaze_elf_output_dynamic_relocation
1558+ microblaze_elf_output_dynamic_relocation (output_bfd, 1560+ (output_bfd,
1559+ htab->srelgot, htab->srelgot->reloc_count++, 1561+ htab->elf.srelgot,
1560+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32, 1562+ htab->elf.srelgot->reloc_count++,
1561+ got_offset, indx ? 0 : static_value); 1563+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
1562+ } 1564+ got_offset, indx ? 0 : static_value);
1563+ else 1565+ else
1564+ { 1566+ bfd_put_32 (output_bfd, static_value,
1565+ bfd_put_32 (output_bfd, static_value, 1567+ htab->elf.sgot->contents + off2);
1566+ htab->sgot->contents + off2);
1567+ }
1568+ } 1568+ }
1569+ else 1569+ else
1570+ { 1570+ {
1571+ bfd_put_32 (output_bfd, static_value, 1571+ bfd_put_32 (output_bfd, static_value,
1572+ htab->sgot->contents + off2); 1572+ htab->elf.sgot->contents + off2);
1573+ 1573+
1574+ /* Relocs for dyn symbols generated by 1574+ /* Relocs for dyn symbols generated by
1575+ finish_dynamic_symbols */ 1575+ finish_dynamic_symbols */
1576+ if (bfd_link_pic (info) && h == NULL) 1576+ if (bfd_link_pic (info) && h == NULL)
1577+ { 1577+ {
1578+ *offp |= 1; 1578+ *offp |= 1;
1579+ microblaze_elf_output_dynamic_relocation (output_bfd, 1579+ microblaze_elf_output_dynamic_relocation
1580+ htab->srelgot, htab->srelgot->reloc_count++, 1580+ (output_bfd,
1581+ /* symindex= */ indx, R_MICROBLAZE_REL, 1581+ htab->elf.srelgot,
1582+ got_offset, static_value); 1582+ htab->elf.srelgot->reloc_count++,
1583+ } 1583+ /* symindex= */ indx, R_MICROBLAZE_REL,
1584+ got_offset, static_value);
1585+ }
1584+ } 1586+ }
1585+ } 1587+ }
1586+ 1588+
1587+ /* 4. Fixup Relocation with GOT offset value 1589+ /* 4. Fixup Relocation with GOT offset value
1588+ Compute relative address of GOT entry for applying 1590+ Compute relative address of GOT entry for applying
1589+ the current relocation */ 1591+ the current relocation */
1590+ relocation = htab->sgot->output_section->vma 1592+ relocation = htab->elf.sgot->output_section->vma
1591+ + htab->sgot->output_offset 1593+ + htab->elf.sgot->output_offset
1592+ + off 1594+ + off
1593+ - htab->sgotplt->output_section->vma 1595+ - htab->elf.sgotplt->output_section->vma
1594+ - htab->sgotplt->output_offset; 1596+ - htab->elf.sgotplt->output_offset;
1595+ 1597+
1596+ /* Apply Current Relocation */ 1598+ /* Apply Current Relocation */
1597+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 1599+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
@@ -1608,8 +1610,8 @@ index 00000000000..fa4b95e47e0
1608+ bfd_vma immediate; 1610+ bfd_vma immediate;
1609+ unsigned short lo, high; 1611+ unsigned short lo, high;
1610+ relocation += addend; 1612+ relocation += addend;
1611+ relocation -= htab->sgotplt->output_section->vma 1613+ relocation -= (htab->elf.sgotplt->output_section->vma
1612+ + htab->sgotplt->output_offset; 1614+ + htab->elf.sgotplt->output_offset);
1613+ /* Write this value into correct location. */ 1615+ /* Write this value into correct location. */
1614+ immediate = relocation; 1616+ immediate = relocation;
1615+ lo = immediate & 0x0000ffff; 1617+ lo = immediate & 0x0000ffff;
@@ -1622,8 +1624,8 @@ index 00000000000..fa4b95e47e0
1622+ case (int) R_MICROBLAZE_GOTOFF_32: 1624+ case (int) R_MICROBLAZE_GOTOFF_32:
1623+ { 1625+ {
1624+ relocation += addend; 1626+ relocation += addend;
1625+ relocation -= htab->sgotplt->output_section->vma 1627+ relocation -= (htab->elf.sgotplt->output_section->vma
1626+ + htab->sgotplt->output_offset; 1628+ + htab->elf.sgotplt->output_offset);
1627+ /* Write this value into correct location. */ 1629+ /* Write this value into correct location. */
1628+ bfd_put_32 (input_bfd, relocation, contents + offset); 1630+ bfd_put_32 (input_bfd, relocation, contents + offset);
1629+ break; 1631+ break;
@@ -1665,7 +1667,8 @@ index 00000000000..fa4b95e47e0
1665+ 1667+
1666+ if ((bfd_link_pic (info) 1668+ if ((bfd_link_pic (info)
1667+ && (h == NULL 1669+ && (h == NULL
1668+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1670+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1671+ && !resolved_to_zero)
1669+ || h->root.type != bfd_link_hash_undefweak) 1672+ || h->root.type != bfd_link_hash_undefweak)
1670+ && (!howto->pc_relative 1673+ && (!howto->pc_relative
1671+ || (h != NULL 1674+ || (h != NULL
@@ -1726,7 +1729,7 @@ index 00000000000..fa4b95e47e0
1726+ { 1729+ {
1727+ BFD_FAIL (); 1730+ BFD_FAIL ();
1728+ (*_bfd_error_handler) 1731+ (*_bfd_error_handler)
1729+ (_("%pB: probably compiled without -fPIC?"), 1732+ (_("%B: probably compiled without -fPIC?"),
1730+ input_bfd); 1733+ input_bfd);
1731+ bfd_set_error (bfd_error_bad_value); 1734+ bfd_set_error (bfd_error_bad_value);
1732+ return FALSE; 1735+ return FALSE;
@@ -1825,6 +1828,21 @@ index 00000000000..fa4b95e47e0
1825+ return ret; 1828+ return ret;
1826+} 1829+}
1827+ 1830+
1831+/* Merge backend specific data from an object file to the output
1832+ object file when linking.
1833+
1834+ Note: We only use this hook to catch endian mismatches. */
1835+static bfd_boolean
1836+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
1837+{
1838+ /* Check if we have the same endianess. */
1839+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
1840+ return FALSE;
1841+
1842+ return TRUE;
1843+}
1844+
1845+
1828+/* Calculate fixup value for reference. */ 1846+/* Calculate fixup value for reference. */
1829+ 1847+
1830+static int 1848+static int
@@ -2141,7 +2159,7 @@ index 00000000000..fa4b95e47e0
2141+ irelscanend = irelocs + o->reloc_count; 2159+ irelscanend = irelocs + o->reloc_count;
2142+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 2160+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2143+ { 2161+ {
2144+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE) 2162+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2145+ { 2163+ {
2146+ unsigned int val; 2164+ unsigned int val;
2147+ 2165+
@@ -2500,6 +2518,17 @@ index 00000000000..fa4b95e47e0
2500+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); 2518+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2501+} 2519+}
2502+ 2520+
2521+/* Update the got entry reference counts for the section being removed. */
2522+
2523+static bfd_boolean
2524+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
2525+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
2526+ asection * sec ATTRIBUTE_UNUSED,
2527+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
2528+{
2529+ return TRUE;
2530+}
2531+
2503+/* PIC support. */ 2532+/* PIC support. */
2504+ 2533+
2505+#define PLT_ENTRY_SIZE 16 2534+#define PLT_ENTRY_SIZE 16
@@ -2616,10 +2645,9 @@ index 00000000000..fa4b95e47e0
2616+ else 2645+ else
2617+ { 2646+ {
2618+ h = sym_hashes [r_symndx - symtab_hdr->sh_info]; 2647+ h = sym_hashes [r_symndx - symtab_hdr->sh_info];
2619+ 2648+ while (h->root.type == bfd_link_hash_indirect
2620+ /* PR15323, ref flags aren't set for references in the same 2649+ || h->root.type == bfd_link_hash_warning)
2621+ object. */ 2650+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
2622+ h->root.non_ir_ref_regular = 1;
2623+ } 2651+ }
2624+ 2652+
2625+ switch (r_type) 2653+ switch (r_type)
@@ -2655,7 +2683,6 @@ index 00000000000..fa4b95e47e0
2655+ tls_type |= (TLS_TLS | TLS_LD); 2683+ tls_type |= (TLS_TLS | TLS_LD);
2656+ dogottls: 2684+ dogottls:
2657+ sec->has_tls_reloc = 1; 2685+ sec->has_tls_reloc = 1;
2658+ /* Fall through. */
2659+ case R_MICROBLAZE_GOT_64: 2686+ case R_MICROBLAZE_GOT_64:
2660+ if (htab->sgot == NULL) 2687+ if (htab->sgot == NULL)
2661+ { 2688+ {
@@ -2751,7 +2778,7 @@ index 00000000000..fa4b95e47e0
2751+ /* If this is a global symbol, we count the number of 2778+ /* If this is a global symbol, we count the number of
2752+ relocations we need for this symbol. */ 2779+ relocations we need for this symbol. */
2753+ if (h != NULL) 2780+ if (h != NULL)
2754+ head = &((struct elf64_mb_link_hash_entry *) h)->dyn_relocs; 2781+ head = &h->dyn_relocs;
2755+ else 2782+ else
2756+ { 2783+ {
2757+ /* Track dynamic relocs needed for local syms too. 2784+ /* Track dynamic relocs needed for local syms too.
@@ -2778,7 +2805,7 @@ index 00000000000..fa4b95e47e0
2778+ p = *head; 2805+ p = *head;
2779+ if (p == NULL || p->sec != sec) 2806+ if (p == NULL || p->sec != sec)
2780+ { 2807+ {
2781+ bfd_size_type amt = sizeof *p; 2808+ size_t amt = sizeof *p;
2782+ p = ((struct elf64_mb_dyn_relocs *) 2809+ p = ((struct elf64_mb_dyn_relocs *)
2783+ bfd_alloc (htab->elf.dynobj, amt)); 2810+ bfd_alloc (htab->elf.dynobj, amt));
2784+ if (p == NULL) 2811+ if (p == NULL)
@@ -2888,7 +2915,8 @@ index 00000000000..fa4b95e47e0
2888+ struct elf64_mb_link_hash_table *htab; 2915+ struct elf64_mb_link_hash_table *htab;
2889+ struct elf64_mb_link_hash_entry * eh; 2916+ struct elf64_mb_link_hash_entry * eh;
2890+ struct elf64_mb_dyn_relocs *p; 2917+ struct elf64_mb_dyn_relocs *p;
2891+ asection *sdynbss, *s; 2918+ asection *sdynbss;
2919+ asection *s, *srel;
2892+ unsigned int power_of_two; 2920+ unsigned int power_of_two;
2893+ bfd *dynobj; 2921+ bfd *dynobj;
2894+ 2922+
@@ -2970,7 +2998,7 @@ index 00000000000..fa4b95e47e0
2970+ 2998+
2971+ /* If we didn't find any dynamic relocs in read-only sections, then 2999+ /* If we didn't find any dynamic relocs in read-only sections, then
2972+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ 3000+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
2973+ if (p == NULL) 3001+ if (!_bfd_elf_readonly_dynrelocs (h))
2974+ { 3002+ {
2975+ h->non_got_ref = 0; 3003+ h->non_got_ref = 0;
2976+ return TRUE; 3004+ return TRUE;
@@ -2989,11 +3017,19 @@ index 00000000000..fa4b95e47e0
2989+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker 3017+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
2990+ to copy the initial value out of the dynamic object and into the 3018+ to copy the initial value out of the dynamic object and into the
2991+ runtime process image. */ 3019+ runtime process image. */
2992+ dynobj = elf_hash_table (info)->dynobj; 3020+ if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
2993+ BFD_ASSERT (dynobj != NULL); 3021+ {
3022+ s = htab->elf.sdynrelro;
3023+ srel = htab->elf.sreldynrelro;
3024+ }
3025+ else
3026+ {
3027+ s = htab->elf.sdynbss;
3028+ srel = htab->elf.srelbss;
3029+ }
2994+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) 3030+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
2995+ { 3031+ {
2996+ htab->srelbss->size += sizeof (Elf64_External_Rela); 3032+ srel->size += sizeof (Elf64_External_Rela);
2997+ h->needs_copy = 1; 3033+ h->needs_copy = 1;
2998+ } 3034+ }
2999+ 3035+
@@ -3003,21 +3039,20 @@ index 00000000000..fa4b95e47e0
3003+ if (power_of_two > 3) 3039+ if (power_of_two > 3)
3004+ power_of_two = 3; 3040+ power_of_two = 3;
3005+ 3041+
3006+ sdynbss = htab->sdynbss;
3007+ /* Apply the required alignment. */ 3042+ /* Apply the required alignment. */
3008+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two)); 3043+ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
3009+ if (power_of_two > bfd_section_alignment (sdynbss)) 3044+ if (power_of_two > s->alignment_power)
3010+ { 3045+ {
3011+ if (! bfd_set_section_alignment (sdynbss, power_of_two)) 3046+ if (!bfd_set_section_alignment (s, power_of_two))
3012+ return FALSE; 3047+ return FALSE;
3013+ } 3048+ }
3014+ 3049+
3015+ /* Define the symbol as being at this point in the section. */ 3050+ /* Define the symbol as being at this point in the section. */
3016+ h->root.u.def.section = sdynbss; 3051+ h->root.u.def.section = s;
3017+ h->root.u.def.value = sdynbss->size; 3052+ h->root.u.def.value = s->size;
3018+ 3053+
3019+ /* Increment the section size to make room for the symbol. */ 3054+ /* Increment the section size to make room for the symbol. */
3020+ sdynbss->size += h->size; 3055+ s->size += h->size;
3021+ return TRUE; 3056+ return TRUE;
3022+} 3057+}
3023+ 3058+
@@ -3077,13 +3112,13 @@ index 00000000000..fa4b95e47e0
3077+ /* Make room for this entry. */ 3112+ /* Make room for this entry. */
3078+ s->size += PLT_ENTRY_SIZE; 3113+ s->size += PLT_ENTRY_SIZE;
3079+ 3114+
3080+ /* We also need to make an entry in the .got.plt section, which 3115+ /* We also need to make an entry in the .got.plt section, which
3081+ will be placed in the .got section by the linker script. */ 3116+ will be placed in the .got section by the linker script. */
3082+ htab->sgotplt->size += 4; 3117+ htab->elf.sgotplt->size += 4;
3083+ 3118+
3084+ /* We also need to make an entry in the .rel.plt section. */ 3119+ /* We also need to make an entry in the .rel.plt section. */
3085+ htab->srelplt->size += sizeof (Elf64_External_Rela); 3120+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
3086+ } 3121+ }
3087+ else 3122+ else
3088+ { 3123+ {
3089+ h->plt.offset = (bfd_vma) -1; 3124+ h->plt.offset = (bfd_vma) -1;
@@ -3138,17 +3173,17 @@ index 00000000000..fa4b95e47e0
3138+ h->got.offset = (bfd_vma) -1; 3173+ h->got.offset = (bfd_vma) -1;
3139+ } 3174+ }
3140+ else 3175+ else
3141+ { 3176+ {
3142+ s = htab->sgot; 3177+ s = htab->elf.sgot;
3143+ h->got.offset = s->size; 3178+ h->got.offset = s->size;
3144+ s->size += need; 3179+ s->size += need;
3145+ htab->srelgot->size += need * (sizeof (Elf64_External_Rela) / 4); 3180+ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4);
3146+ } 3181+ }
3147+ } 3182+ }
3148+ else 3183+ else
3149+ h->got.offset = (bfd_vma) -1; 3184+ h->got.offset = (bfd_vma) -1;
3150+ 3185+
3151+ if (eh->dyn_relocs == NULL) 3186+ if (h->dyn_relocs == NULL)
3152+ return TRUE; 3187+ return TRUE;
3153+ 3188+
3154+ /* In the shared -Bsymbolic case, discard space allocated for 3189+ /* In the shared -Bsymbolic case, discard space allocated for
@@ -3165,7 +3200,7 @@ index 00000000000..fa4b95e47e0
3165+ { 3200+ {
3166+ struct elf64_mb_dyn_relocs **pp; 3201+ struct elf64_mb_dyn_relocs **pp;
3167+ 3202+
3168+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) 3203+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
3169+ { 3204+ {
3170+ p->count -= p->pc_count; 3205+ p->count -= p->pc_count;
3171+ p->pc_count = 0; 3206+ p->pc_count = 0;
@@ -3175,6 +3210,8 @@ index 00000000000..fa4b95e47e0
3175+ pp = &p->next; 3210+ pp = &p->next;
3176+ } 3211+ }
3177+ } 3212+ }
3213+ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
3214+ h->dyn_relocs = NULL;
3178+ } 3215+ }
3179+ else 3216+ else
3180+ { 3217+ {
@@ -3204,13 +3241,13 @@ index 00000000000..fa4b95e47e0
3204+ goto keep; 3241+ goto keep;
3205+ } 3242+ }
3206+ 3243+
3207+ eh->dyn_relocs = NULL; 3244+ h->dyn_relocs = NULL;
3208+ 3245+
3209+ keep: ; 3246+ keep: ;
3210+ } 3247+ }
3211+ 3248+
3212+ /* Finally, allocate space. */ 3249+ /* Finally, allocate space. */
3213+ for (p = eh->dyn_relocs; p != NULL; p = p->next) 3250+ for (p = h->dyn_relocs; p != NULL; p = p->next)
3214+ { 3251+ {
3215+ asection *sreloc = elf_section_data (p->sec)->sreloc; 3252+ asection *sreloc = elf_section_data (p->sec)->sreloc;
3216+ sreloc->size += p->count * sizeof (Elf64_External_Rela); 3253+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
@@ -3286,8 +3323,8 @@ index 00000000000..fa4b95e47e0
3286+ locsymcount = symtab_hdr->sh_info; 3323+ locsymcount = symtab_hdr->sh_info;
3287+ end_local_got = local_got + locsymcount; 3324+ end_local_got = local_got + locsymcount;
3288+ lgot_masks = (unsigned char *) end_local_got; 3325+ lgot_masks = (unsigned char *) end_local_got;
3289+ s = htab->sgot; 3326+ s = htab->elf.sgot;
3290+ srel = htab->srelgot; 3327+ srel = htab->elf.srelgot;
3291+ 3328+
3292+ for (; local_got < end_local_got; ++local_got, ++lgot_masks) 3329+ for (; local_got < end_local_got; ++local_got, ++lgot_masks)
3293+ { 3330+ {
@@ -3327,10 +3364,10 @@ index 00000000000..fa4b95e47e0
3327+ 3364+
3328+ if (htab->tlsld_got.refcount > 0) 3365+ if (htab->tlsld_got.refcount > 0)
3329+ { 3366+ {
3330+ htab->tlsld_got.offset = htab->sgot->size; 3367+ htab->tlsld_got.offset = htab->elf.sgot->size;
3331+ htab->sgot->size += 8; 3368+ htab->elf.sgot->size += 8;
3332+ if (bfd_link_pic (info)) 3369+ if (bfd_link_pic (info))
3333+ htab->srelgot->size += sizeof (Elf64_External_Rela); 3370+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
3334+ } 3371+ }
3335+ else 3372+ else
3336+ htab->tlsld_got.offset = (bfd_vma) -1; 3373+ htab->tlsld_got.offset = (bfd_vma) -1;
@@ -3338,8 +3375,8 @@ index 00000000000..fa4b95e47e0
3338+ if (elf_hash_table (info)->dynamic_sections_created) 3375+ if (elf_hash_table (info)->dynamic_sections_created)
3339+ { 3376+ {
3340+ /* Make space for the trailing nop in .plt. */ 3377+ /* Make space for the trailing nop in .plt. */
3341+ if (htab->splt->size > 0) 3378+ if (htab->elf.splt->size > 0)
3342+ htab->splt->size += 4; 3379+ htab->elf.splt->size += 4;
3343+ } 3380+ }
3344+ 3381+
3345+ /* The check_relocs and adjust_dynamic_symbol entry points have 3382+ /* The check_relocs and adjust_dynamic_symbol entry points have
@@ -3354,36 +3391,40 @@ index 00000000000..fa4b95e47e0
3354+ continue; 3391+ continue;
3355+ 3392+
3356+ /* It's OK to base decisions on the section name, because none 3393+ /* It's OK to base decisions on the section name, because none
3357+ of the dynobj section names depend upon the input files. */ 3394+ of the dynobj section names depend upon the input files. */
3358+ name = bfd_section_name (s); 3395+ name = bfd_section_name (s);
3359+ 3396+
3360+ if (strncmp (name, ".rela", 5) == 0) 3397+ if (strncmp (name, ".rela", 5) == 0)
3361+ { 3398+ {
3362+ if (s->size == 0) 3399+ if (s->size == 0)
3363+ { 3400+ {
3364+ /* If we don't need this section, strip it from the 3401+ /* If we don't need this section, strip it from the
3365+ output file. This is to handle .rela.bss and 3402+ output file. This is to handle .rela.bss and
3366+ .rela.plt. We must create it in 3403+ .rela.plt. We must create it in
3367+ create_dynamic_sections, because it must be created 3404+ create_dynamic_sections, because it must be created
3368+ before the linker maps input sections to output 3405+ before the linker maps input sections to output
3369+ sections. The linker does that before 3406+ sections. The linker does that before
3370+ adjust_dynamic_symbol is called, and it is that 3407+ adjust_dynamic_symbol is called, and it is that
3371+ function which decides whether anything needs to go 3408+ function which decides whether anything needs to go
3372+ into these sections. */ 3409+ into these sections. */
3373+ strip = TRUE; 3410+ strip = TRUE;
3374+ } 3411+ }
3375+ else 3412+ else
3376+ { 3413+ {
3377+ /* We use the reloc_count field as a counter if we need 3414+ /* We use the reloc_count field as a counter if we need
3378+ to copy relocs into the output file. */ 3415+ to copy relocs into the output file. */
3379+ s->reloc_count = 0; 3416+ s->reloc_count = 0;
3380+ } 3417+ }
3381+ } 3418+ }
3382+ else if (s != htab->splt && s != htab->sgot && s != htab->sgotplt) 3419+ else if (s != htab->elf.splt
3383+ { 3420+ && s != htab->elf.sgot
3384+ /* It's not one of our sections, so don't allocate space. */ 3421+ && s != htab->elf.sgotplt
3385+ continue; 3422+ && s != htab->elf.sdynbss
3386+ } 3423+ && s != htab->elf.sdynrelro)
3424+ {
3425+ /* It's not one of our sections, so don't allocate space. */
3426+ continue;
3427+ }
3387+ 3428+
3388+ if (strip) 3429+ if (strip)
3389+ { 3430+ {
@@ -3485,7 +3526,7 @@ index 00000000000..fa4b95e47e0
3485+ 3526+
3486+ /* For non-PIC objects we need absolute address of the GOT entry. */ 3527+ /* For non-PIC objects we need absolute address of the GOT entry. */
3487+ if (!bfd_link_pic (info)) 3528+ if (!bfd_link_pic (info))
3488+ got_addr += htab->sgotplt->output_section->vma + sgotplt->output_offset; 3529+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset;
3489+ 3530+
3490+ /* Fill in the entry in the procedure linkage table. */ 3531+ /* Fill in the entry in the procedure linkage table. */
3491+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff), 3532+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
@@ -3537,8 +3578,8 @@ index 00000000000..fa4b95e47e0
3537+ /* This symbol has an entry in the global offset table. Set it 3578+ /* This symbol has an entry in the global offset table. Set it
3538+ up. */ 3579+ up. */
3539+ 3580+
3540+ sgot = htab->sgot; 3581+ sgot = htab->elf.sgot;
3541+ srela = htab->srelgot; 3582+ srela = htab->elf.srelgot;
3542+ BFD_ASSERT (sgot != NULL && srela != NULL); 3583+ BFD_ASSERT (sgot != NULL && srela != NULL);
3543+ 3584+
3544+ offset = (sgot->output_section->vma + sgot->output_offset 3585+ offset = (sgot->output_section->vma + sgot->output_offset
@@ -3685,7 +3726,7 @@ index 00000000000..fa4b95e47e0
3685+ 3726+
3686+ /* Set the first entry in the global offset table to the address of 3727+ /* Set the first entry in the global offset table to the address of
3687+ the dynamic section. */ 3728+ the dynamic section. */
3688+ sgot = bfd_get_linker_section (dynobj, ".got.plt"); 3729+ sgot = htab->elf.sgotplt;
3689+ if (sgot && sgot->size > 0) 3730+ if (sgot && sgot->size > 0)
3690+ { 3731+ {
3691+ if (sdyn == NULL) 3732+ if (sdyn == NULL)
@@ -3697,8 +3738,8 @@ index 00000000000..fa4b95e47e0
3697+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; 3738+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
3698+ } 3739+ }
3699+ 3740+
3700+ if (htab->sgot && htab->sgot->size > 0) 3741+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
3701+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4; 3742+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
3702+ 3743+
3703+ return TRUE; 3744+ return TRUE;
3704+} 3745+}
@@ -3723,8 +3764,8 @@ index 00000000000..fa4b95e47e0
3723+ put into .sbss. */ 3764+ put into .sbss. */
3724+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 3765+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3725+ if (*secp == NULL 3766+ if (*secp == NULL
3726+ || ! bfd_set_section_flags (*secp, SEC_IS_COMMON)) 3767+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON))
3727+ return FALSE; 3768+ return FALSE;
3728+ 3769+
3729+ *valp = sym->st_size; 3770+ *valp = sym->st_size;
3730+ } 3771+ }
@@ -3750,10 +3791,11 @@ index 00000000000..fa4b95e47e0
3750+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name 3791+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3751+#define elf_backend_relocate_section microblaze_elf_relocate_section 3792+#define elf_backend_relocate_section microblaze_elf_relocate_section
3752+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section 3793+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3753+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match 3794+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
3754+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup 3795+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3755+ 3796+
3756+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook 3797+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3798+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
3757+#define elf_backend_check_relocs microblaze_elf_check_relocs 3799+#define elf_backend_check_relocs microblaze_elf_check_relocs
3758+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol 3800+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3759+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create 3801+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
@@ -3773,7 +3815,7 @@ index 00000000000..fa4b95e47e0
3773+ 3815+
3774+#include "elf64-target.h" 3816+#include "elf64-target.h"
3775diff --git a/bfd/targets.c b/bfd/targets.c 3817diff --git a/bfd/targets.c b/bfd/targets.c
3776index 0732c5e4292..1ec226b2f47 100644 3818index 0732c5e429..1ec226b2f4 100644
3777--- a/bfd/targets.c 3819--- a/bfd/targets.c
3778+++ b/bfd/targets.c 3820+++ b/bfd/targets.c
3779@@ -782,6 +782,8 @@ extern const bfd_target mep_elf32_le_vec; 3821@@ -782,6 +782,8 @@ extern const bfd_target mep_elf32_le_vec;
@@ -3797,7 +3839,7 @@ index 0732c5e4292..1ec226b2f47 100644
3797 3839
3798 &mips_ecoff_be_vec, 3840 &mips_ecoff_be_vec,
3799diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 3841diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
3800index 5810a74a5fc..ffbb843d33e 100644 3842index 5810a74a5f..ffbb843d33 100644
3801--- a/gas/config/tc-microblaze.c 3843--- a/gas/config/tc-microblaze.c
3802+++ b/gas/config/tc-microblaze.c 3844+++ b/gas/config/tc-microblaze.c
3803@@ -35,10 +35,13 @@ 3845@@ -35,10 +35,13 @@
@@ -4192,7 +4234,7 @@ index 5810a74a5fc..ffbb843d33e 100644
4192 4234
4193 4235
4194diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h 4236diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
4195index 01cb3e894f7..7435a70ef5e 100644 4237index 01cb3e894f..7435a70ef5 100644
4196--- a/gas/config/tc-microblaze.h 4238--- a/gas/config/tc-microblaze.h
4197+++ b/gas/config/tc-microblaze.h 4239+++ b/gas/config/tc-microblaze.h
4198@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[]; 4240@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[];
@@ -4207,7 +4249,7 @@ index 01cb3e894f7..7435a70ef5e 100644
4207 #define ELF_TC_SPECIAL_SECTIONS \ 4249 #define ELF_TC_SPECIAL_SECTIONS \
4208 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ 4250 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
4209diff --git a/include/elf/common.h b/include/elf/common.h 4251diff --git a/include/elf/common.h b/include/elf/common.h
4210index 4d94c4fd5b3..f709a01816c 100644 4252index 4d94c4fd5b..f709a01816 100644
4211--- a/include/elf/common.h 4253--- a/include/elf/common.h
4212+++ b/include/elf/common.h 4254+++ b/include/elf/common.h
4213@@ -340,6 +340,7 @@ 4255@@ -340,6 +340,7 @@
@@ -4219,7 +4261,7 @@ index 4d94c4fd5b3..f709a01816c 100644
4219 #define EM_CSKY 252 /* C-SKY processor family. */ 4261 #define EM_CSKY 252 /* C-SKY processor family. */
4220 4262
4221diff --git a/ld/Makefile.am b/ld/Makefile.am 4263diff --git a/ld/Makefile.am b/ld/Makefile.am
4222index 02c4fc16395..d063e2d32c5 100644 4264index 02c4fc1639..d063e2d32c 100644
4223--- a/ld/Makefile.am 4265--- a/ld/Makefile.am
4224+++ b/ld/Makefile.am 4266+++ b/ld/Makefile.am
4225@@ -416,6 +416,8 @@ ALL_64_EMULATION_SOURCES = \ 4267@@ -416,6 +416,8 @@ ALL_64_EMULATION_SOURCES = \
@@ -4241,18 +4283,10 @@ index 02c4fc16395..d063e2d32c5 100644
4241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@ 4283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@ 4284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4243diff --git a/ld/Makefile.in b/ld/Makefile.in 4285diff --git a/ld/Makefile.in b/ld/Makefile.in
4244index 2fe12e14f63..01ebb051faa 100644 4286index 2fe12e14f6..797212859f 100644
4245--- a/ld/Makefile.in 4287--- a/ld/Makefile.in
4246+++ b/ld/Makefile.in 4288+++ b/ld/Makefile.in
4247@@ -515,6 +515,7 @@ pdfdir = @pdfdir@ 4289@@ -898,6 +898,8 @@ ALL_64_EMULATION_SOURCES = \
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 = \
4256 eelf32ltsmipn32.c \ 4290 eelf32ltsmipn32.c \
4257 eelf32ltsmipn32_fbsd.c \ 4291 eelf32ltsmipn32_fbsd.c \
4258 eelf32mipswindiss.c \ 4292 eelf32mipswindiss.c \
@@ -4261,16 +4295,16 @@ index 2fe12e14f63..01ebb051faa 100644
4261 eelf64_aix.c \ 4295 eelf64_aix.c \
4262 eelf64bpf.c \ 4296 eelf64bpf.c \
4263 eelf64_ia64.c \ 4297 eelf64_ia64.c \
4264@@ -1360,6 +1363,8 @@ distclean-compile: 4298@@ -1338,6 +1340,8 @@ distclean-compile:
4265 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@ 4299 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@
4266 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@ 4300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@
4267 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Po@am__quote@ 4301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Po@am__quote@
4268+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Po@am__quote@
4269+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Po@am__quote@ 4302+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Po@am__quote@
4270 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@ 4303+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Po@am__quote@
4271 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc.Po@am__quote@ 4304 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@
4272 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc_fbsd.Po@am__quote@ 4305 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@
4273@@ -2493,6 +2498,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) 4306 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Po@am__quote@
4307@@ -2493,6 +2497,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4274 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@ 4308 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4275 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@ 4309 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4276 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@ 4310 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
@@ -4280,7 +4314,7 @@ index 2fe12e14f63..01ebb051faa 100644
4280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@ 4314 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@ 4315 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4282diff --git a/ld/configure.tgt b/ld/configure.tgt 4316diff --git a/ld/configure.tgt b/ld/configure.tgt
4283index 87c7d9a4cad..801d27c9e3f 100644 4317index 87c7d9a4ca..801d27c9e3 100644
4284--- a/ld/configure.tgt 4318--- a/ld/configure.tgt
4285+++ b/ld/configure.tgt 4319+++ b/ld/configure.tgt
4286@@ -469,6 +469,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux" 4320@@ -469,6 +469,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux"
@@ -4295,7 +4329,7 @@ index 87c7d9a4cad..801d27c9e3f 100644
4295 ;; 4329 ;;
4296diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh 4330diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
4297new file mode 100644 4331new file mode 100644
4298index 00000000000..7b4c7c411bd 4332index 0000000000..9c7b0eb708
4299--- /dev/null 4333--- /dev/null
4300+++ b/ld/emulparams/elf64microblaze.sh 4334+++ b/ld/emulparams/elf64microblaze.sh
4301@@ -0,0 +1,23 @@ 4335@@ -0,0 +1,23 @@
@@ -4320,11 +4354,11 @@ index 00000000000..7b4c7c411bd
4320+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} 4354+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4321+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);' 4355+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4322+ 4356+
4323+TEMPLATE_NAME=elf 4357+TEMPLATE_NAME=elf32
4324+#GENERATE_SHLIB_SCRIPT=yes 4358+#GENERATE_SHLIB_SCRIPT=yes
4325diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh 4359diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
4326new file mode 100644 4360new file mode 100644
4327index 00000000000..7b4c7c411bd 4361index 0000000000..9c7b0eb708
4328--- /dev/null 4362--- /dev/null
4329+++ b/ld/emulparams/elf64microblazeel.sh 4363+++ b/ld/emulparams/elf64microblazeel.sh
4330@@ -0,0 +1,23 @@ 4364@@ -0,0 +1,23 @@
@@ -4349,10 +4383,10 @@ index 00000000000..7b4c7c411bd
4349+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} 4383+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4350+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);' 4384+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4351+ 4385+
4352+TEMPLATE_NAME=elf 4386+TEMPLATE_NAME=elf32
4353+#GENERATE_SHLIB_SCRIPT=yes 4387+#GENERATE_SHLIB_SCRIPT=yes
4354diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 4388diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
4355index 52c9068805f..a03f5b7a55b 100644 4389index 315c6e9350..f643f2600d 100644
4356--- a/opcodes/microblaze-dis.c 4390--- a/opcodes/microblaze-dis.c
4357+++ b/opcodes/microblaze-dis.c 4391+++ b/opcodes/microblaze-dis.c
4358@@ -33,6 +33,7 @@ 4392@@ -33,6 +33,7 @@
@@ -4363,7 +4397,7 @@ index 52c9068805f..a03f5b7a55b 100644
4363 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW) 4397 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
4364 4398
4365 #define NUM_STRBUFS 3 4399 #define NUM_STRBUFS 3
4366@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr) 4400@@ -73,11 +74,19 @@ get_field_imm (struct string_buf *buf, long instr)
4367 } 4401 }
4368 4402
4369 static char * 4403 static char *
@@ -4371,12 +4405,11 @@ index 52c9068805f..a03f5b7a55b 100644
4371+get_field_imml (struct string_buf *buf, long instr) 4405+get_field_imml (struct string_buf *buf, long instr)
4372 { 4406 {
4373 char *p = strbuf (buf); 4407 char *p = strbuf (buf);
4374
4375- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
4376+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 4408+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
4377+ return p; 4409+ return p;
4378+} 4410+}
4379+ 4411
4412- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
4380+static char * 4413+static char *
4381+get_field_imms (struct string_buf *buf, long instr) 4414+get_field_imms (struct string_buf *buf, long instr)
4382+{ 4415+{
@@ -4386,7 +4419,7 @@ index 52c9068805f..a03f5b7a55b 100644
4386 return p; 4419 return p;
4387 } 4420 }
4388 4421
4389@@ -91,14 +101,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr) 4422@@ -91,14 +100,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
4390 } 4423 }
4391 4424
4392 static char * 4425 static char *
@@ -4404,53 +4437,46 @@ index 52c9068805f..a03f5b7a55b 100644
4404 return p; 4437 return p;
4405 } 4438 }
4406 4439
4407@@ -308,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 4440@@ -308,9 +317,13 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4408 } 4441 }
4409 } 4442 }
4410 break; 4443 break;
4411- case INST_TYPE_RD_R1_IMM5: 4444- case INST_TYPE_RD_R1_IMM5:
4412+ case INST_TYPE_RD_R1_IMML: 4445+ case INST_TYPE_RD_R1_IMML:
4413 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 4446+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4414- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst)); 4447+ get_field_r1 (&buf, inst), get_field_imm (&buf, inst));
4415+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
4416+ /* TODO: Also print symbol */ 4448+ /* TODO: Also print symbol */
4417+ break;
4418+ case INST_TYPE_RD_R1_IMMS: 4449+ case INST_TYPE_RD_R1_IMMS:
4419+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst), 4450 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4451- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
4420+ get_field_r1(&buf, inst), get_field_imms (&buf, inst)); 4452+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
4421 break; 4453 break;
4422 case INST_TYPE_RD_RFSL: 4454 case INST_TYPE_RD_RFSL:
4423 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 4455 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4424@@ -414,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 4456@@ -417,6 +430,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4425 } 4457 case INST_TYPE_RD_R2:
4426 } 4458 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4427 break; 4459 get_field_r2 (&buf, inst));
4428- case INST_TYPE_RD_R2: 4460+ break;
4429- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4430- get_field_r2 (&buf, inst));
4431+ case INST_TYPE_IMML: 4461+ case INST_TYPE_IMML:
4432+ print_func (stream, "\t%s", get_field_imml (&buf, inst)); 4462+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
4433+ /* TODO: Also print symbol */ 4463+ /* TODO: Also print symbol */
4434+ break;
4435+ case INST_TYPE_RD_R2:
4436+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
4437 break; 4464 break;
4438 case INST_TYPE_R2: 4465 case INST_TYPE_R2:
4439 print_func (stream, "\t%s", get_field_r2 (&buf, inst)); 4466 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) 4467@@ -440,8 +457,8 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4468 case INST_TYPE_NONE:
4441 break; 4469 break;
4442 /* For tuqula instruction */
4443 /* For bit field insns. */ 4470 /* For bit field insns. */
4444- case INST_TYPE_RD_R1_IMM5_IMM5: 4471- case INST_TYPE_RD_R1_IMM5_IMM5:
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)); 4472- 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));
4446+ case INST_TYPE_RD_R1_IMMW_IMMS: 4473+ case INST_TYPE_RD_R1_IMMW_IMMS:
4447+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst), 4474+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
4448+ get_field_immw (&buf, inst), get_field_imms (&buf, inst)); 4475 break;
4449 break;
4450 /* For tuqula instruction */ 4476 /* For tuqula instruction */
4451 case INST_TYPE_RD: 4477 case INST_TYPE_RD:
4452diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 4478diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
4453index f61f4ef66d9..61eaa39b3eb 100644 4479index f61f4ef66d..61eaa39b3e 100644
4454--- a/opcodes/microblaze-opc.h 4480--- a/opcodes/microblaze-opc.h
4455+++ b/opcodes/microblaze-opc.h 4481+++ b/opcodes/microblaze-opc.h
4456@@ -40,7 +40,7 @@ 4482@@ -40,7 +40,7 @@
@@ -4678,7 +4704,7 @@ index f61f4ef66d9..61eaa39b3eb 100644
4678 #endif /* MICROBLAZE_OPC */ 4704 #endif /* MICROBLAZE_OPC */
4679 4705
4680diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 4706diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
4681index fa921c90c98..1dcd3dca3d1 100644 4707index fa921c90c9..1dcd3dca3d 100644
4682--- a/opcodes/microblaze-opcm.h 4708--- a/opcodes/microblaze-opcm.h
4683+++ b/opcodes/microblaze-opcm.h 4709+++ b/opcodes/microblaze-opcm.h
4684@@ -25,6 +25,7 @@ 4710@@ -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/0015-MB-X-initial-commit.patch
index 06a8f70a..7b87f40f 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0016-MB-X-initial-commit.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch
@@ -1,22 +1,26 @@
1From 49a85544705ec3057f0a1f32807b7b986127cec1 Mon Sep 17 00:00:00 2001 1From 550150a8f97738902539ad774fbd0c977ab3a427 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 16:31:26 +0530 3Date: Sun, 30 Sep 2018 16:31:26 +0530
4Subject: [PATCH 16/40] MB-X initial commit code cleanup is needed. 4Subject: [PATCH 15/52] MB-X initial commit code cleanup is needed.
5 5
6Conflicts:
7 bfd/elf32-microblaze.c
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-opcm.h
6--- 10---
7 bfd/bfd-in2.h | 10 +++ 11 bfd/bfd-in2.h | 10 +++
8 bfd/elf32-microblaze.c | 63 +++++++++++++++++- 12 bfd/elf32-microblaze.c | 59 +++++++++++++-
9 bfd/elf64-microblaze.c | 59 +++++++++++++++++ 13 bfd/elf64-microblaze.c | 61 ++++++++++++++-
10 bfd/libbfd.h | 2 + 14 bfd/libbfd.h | 2 +
11 bfd/reloc.c | 12 ++++ 15 bfd/reloc.c | 12 +++
12 gas/config/tc-microblaze.c | 127 +++++++++++++++++++++++++++---------- 16 gas/config/tc-microblaze.c | 154 ++++++++++++++++++++++++++++++-------
13 include/elf/microblaze.h | 2 + 17 include/elf/microblaze.h | 2 +
14 opcodes/microblaze-opc.h | 4 +- 18 opcodes/microblaze-opc.h | 4 +-
15 opcodes/microblaze-opcm.h | 4 +- 19 opcodes/microblaze-opcm.h | 4 +-
16 9 files changed, 243 insertions(+), 40 deletions(-) 20 9 files changed, 275 insertions(+), 33 deletions(-)
17 21
18diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 22diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
19index 3fdbf8ed755..c55092c9ec7 100644 23index 1bd19a2b63..a335182ba1 100644
20--- a/bfd/bfd-in2.h 24--- a/bfd/bfd-in2.h
21+++ b/bfd/bfd-in2.h 25+++ b/bfd/bfd-in2.h
22@@ -5438,11 +5438,21 @@ value in two words (with an imm instruction). No relocation is 26@@ -5438,11 +5438,21 @@ value in two words (with an imm instruction). No relocation is
@@ -24,9 +28,9 @@ index 3fdbf8ed755..c55092c9ec7 100644
24 BFD_RELOC_MICROBLAZE_64_NONE, 28 BFD_RELOC_MICROBLAZE_64_NONE,
25 29
26+/* This is a 64 bit reloc that stores the 32 bit pc relative 30+/* This is a 64 bit reloc that stores the 32 bit pc relative
27+value in two words (with an imml instruction). No relocation is 31+ * +value in two words (with an imml instruction). No relocation is
28+done here - only used for relaxing */ 32+ * +done here - only used for relaxing */
29+ BFD_RELOC_MICROBLAZE_64, 33+ BFD_RELOC_MICROBLAZE_64,
30+ 34+
31 /* This is a 64 bit reloc that stores the 32 bit pc relative 35 /* 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 36 value in two words (with an imm instruction). The relocation is
@@ -42,7 +46,7 @@ index 3fdbf8ed755..c55092c9ec7 100644
42 value in two words (with an imm instruction). The relocation is 46 value in two words (with an imm instruction). The relocation is
43 GOT offset */ 47 GOT offset */
44diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 48diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
45index cf4a7fdba33..e1a66f57e79 100644 49index c22130fd8c..14bb6de052 100644
46--- a/bfd/elf32-microblaze.c 50--- a/bfd/elf32-microblaze.c
47+++ b/bfd/elf32-microblaze.c 51+++ b/bfd/elf32-microblaze.c
48@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 52@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -104,6 +108,15 @@ index cf4a7fdba33..e1a66f57e79 100644
104 case BFD_RELOC_MICROBLAZE_64_GOT: 108 case BFD_RELOC_MICROBLAZE_64_GOT:
105 microblaze_reloc = R_MICROBLAZE_GOT_64; 109 microblaze_reloc = R_MICROBLAZE_GOT_64;
106 break; 110 break;
111@@ -1463,7 +1498,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
112 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
113 {
114 relocation += addend;
115- if (r_type == R_MICROBLAZE_32)
116+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
117 bfd_put_32 (input_bfd, relocation, contents + offset);
118 else
119 {
107@@ -1929,6 +1964,28 @@ microblaze_elf_relax_section (bfd *abfd, 120@@ -1929,6 +1964,28 @@ microblaze_elf_relax_section (bfd *abfd,
108 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 121 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
109 } 122 }
@@ -111,7 +124,7 @@ index cf4a7fdba33..e1a66f57e79 100644
111+ case R_MICROBLAZE_IMML_64: 124+ case R_MICROBLAZE_IMML_64:
112+ { 125+ {
113+ /* This was a PC-relative instruction that was 126+ /* This was a PC-relative instruction that was
114+ completely resolved. */ 127+ completely resolved. */
115+ int sfix, efix; 128+ int sfix, efix;
116+ unsigned int val; 129+ unsigned int val;
117+ bfd_vma target_address; 130+ bfd_vma target_address;
@@ -133,21 +146,8 @@ index cf4a7fdba33..e1a66f57e79 100644
133 case R_MICROBLAZE_NONE: 146 case R_MICROBLAZE_NONE:
134 case R_MICROBLAZE_32_NONE: 147 case R_MICROBLAZE_32_NONE:
135 { 148 {
136@@ -2034,9 +2091,9 @@ microblaze_elf_relax_section (bfd *abfd,
137 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
138 irelscan->r_addend);
139 }
140- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
141- {
142- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
143+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
144+ {
145+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
146
147 /* Look at the reloc only if the value has been resolved. */
148 if (isym->st_shndx == shndx
149diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 149diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
150index fa4b95e47e0..d55700fc513 100644 150index a357388115..6b1f47d00d 100644
151--- a/bfd/elf64-microblaze.c 151--- a/bfd/elf64-microblaze.c
152+++ b/bfd/elf64-microblaze.c 152+++ b/bfd/elf64-microblaze.c
153@@ -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[] =
@@ -210,7 +210,7 @@ index fa4b95e47e0..d55700fc513 100644
210 case BFD_RELOC_MICROBLAZE_64_GOT: 210 case BFD_RELOC_MICROBLAZE_64_GOT:
211 microblaze_reloc = R_MICROBLAZE_GOT_64; 211 microblaze_reloc = R_MICROBLAZE_GOT_64;
212 break; 212 break;
213@@ -1162,6 +1198,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 213@@ -1172,6 +1208,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
214 break; /* Do nothing. */ 214 break; /* Do nothing. */
215 215
216 case (int) R_MICROBLAZE_GOTPC_64: 216 case (int) R_MICROBLAZE_GOTPC_64:
@@ -218,14 +218,23 @@ index fa4b95e47e0..d55700fc513 100644
218 relocation = htab->sgotplt->output_section->vma 218 relocation = htab->sgotplt->output_section->vma
219 + htab->sgotplt->output_offset; 219 + htab->sgotplt->output_offset;
220 relocation -= (input_section->output_section->vma 220 relocation -= (input_section->output_section->vma
221@@ -1863,6 +1900,28 @@ microblaze_elf_relax_section (bfd *abfd, 221@@ -1443,7 +1480,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
222 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
223 {
224 relocation += addend;
225- if (r_type == R_MICROBLAZE_32)
226+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
227 bfd_put_32 (input_bfd, relocation, contents + offset);
228 else
229 {
230@@ -1889,6 +1926,28 @@ microblaze_elf_relax_section (bfd *abfd,
222 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 231 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
223 } 232 }
224 break; 233 break;
225+ case R_MICROBLAZE_IMML_64: 234+ case R_MICROBLAZE_IMML_64:
226+ { 235+ {
227+ /* This was a PC-relative instruction that was 236+ /* This was a PC-relative instruction that was
228+ completely resolved. */ 237+ completely resolved. */
229+ int sfix, efix; 238+ int sfix, efix;
230+ unsigned int val; 239+ unsigned int val;
231+ bfd_vma target_address; 240+ bfd_vma target_address;
@@ -248,7 +257,7 @@ index fa4b95e47e0..d55700fc513 100644
248 case R_MICROBLAZE_32_NONE: 257 case R_MICROBLAZE_32_NONE:
249 { 258 {
250diff --git a/bfd/libbfd.h b/bfd/libbfd.h 259diff --git a/bfd/libbfd.h b/bfd/libbfd.h
251index c1551b92405..b4aace6a70d 100644 260index c1551b9240..b4aace6a70 100644
252--- a/bfd/libbfd.h 261--- a/bfd/libbfd.h
253+++ b/bfd/libbfd.h 262+++ b/bfd/libbfd.h
254@@ -2969,7 +2969,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 263@@ -2969,7 +2969,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
@@ -262,7 +271,7 @@ index c1551b92405..b4aace6a70d 100644
262 "BFD_RELOC_MICROBLAZE_64_PLT", 271 "BFD_RELOC_MICROBLAZE_64_PLT",
263 "BFD_RELOC_MICROBLAZE_64_GOTOFF", 272 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
264diff --git a/bfd/reloc.c b/bfd/reloc.c 273diff --git a/bfd/reloc.c b/bfd/reloc.c
265index 9b39b419415..0e8a24e9cb0 100644 274index 9b39b41941..0e8a24e9cb 100644
266--- a/bfd/reloc.c 275--- a/bfd/reloc.c
267+++ b/bfd/reloc.c 276+++ b/bfd/reloc.c
268@@ -6866,12 +6866,24 @@ ENUMDOC 277@@ -6866,12 +6866,24 @@ ENUMDOC
@@ -291,7 +300,7 @@ index 9b39b419415..0e8a24e9cb0 100644
291 This is a 64 bit reloc that stores the 32 bit pc relative 300 This is a 64 bit reloc that stores the 32 bit pc relative
292 value in two words (with an imm instruction). The relocation is 301 value in two words (with an imm instruction). The relocation is
293diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 302diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
294index ffbb843d33e..b8250e4cded 100644 303index ffbb843d33..33eda2a4da 100644
295--- a/gas/config/tc-microblaze.c 304--- a/gas/config/tc-microblaze.c
296+++ b/gas/config/tc-microblaze.c 305+++ b/gas/config/tc-microblaze.c
297@@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; 306@@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
@@ -302,17 +311,18 @@ index ffbb843d33e..b8250e4cded 100644
302 311
303 /* Initialize the relax table. */ 312 /* Initialize the relax table. */
304 const relax_typeS md_relax_table[] = 313 const relax_typeS md_relax_table[] =
305@@ -116,7 +117,8 @@ const relax_typeS md_relax_table[] = 314@@ -116,7 +117,9 @@ const relax_typeS md_relax_table[] =
306 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */ 315 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
307 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */ 316 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
308 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ 317 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
309- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */ 318- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
310+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */ 319+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
311+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */ 320+// { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
321+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */
312 }; 322 };
313 323
314 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ 324 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
315@@ -396,7 +398,8 @@ const pseudo_typeS md_pseudo_table[] = 325@@ -396,7 +399,8 @@ const pseudo_typeS md_pseudo_table[] =
316 {"data32", cons, 4}, /* Same as word. */ 326 {"data32", cons, 4}, /* Same as word. */
317 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 327 {"ent", s_func, 0}, /* Treat ent as function entry point. */
318 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 328 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
@@ -322,7 +332,7 @@ index ffbb843d33e..b8250e4cded 100644
322 {"weakext", microblaze_s_weakext, 0}, 332 {"weakext", microblaze_s_weakext, 0},
323 {"rodata", microblaze_s_rdata, 0}, 333 {"rodata", microblaze_s_rdata, 0},
324 {"sdata2", microblaze_s_rdata, 1}, 334 {"sdata2", microblaze_s_rdata, 1},
325@@ -405,6 +408,7 @@ const pseudo_typeS md_pseudo_table[] = 335@@ -405,6 +409,7 @@ const pseudo_typeS md_pseudo_table[] =
326 {"sbss", microblaze_s_bss, 1}, 336 {"sbss", microblaze_s_bss, 1},
327 {"text", microblaze_s_text, 0}, 337 {"text", microblaze_s_text, 0},
328 {"word", cons, 4}, 338 {"word", cons, 4},
@@ -330,7 +340,7 @@ index ffbb843d33e..b8250e4cded 100644
330 {"frame", s_ignore, 0}, 340 {"frame", s_ignore, 0},
331 {"mask", s_ignore, 0}, /* Emitted by gcc. */ 341 {"mask", s_ignore, 0}, /* Emitted by gcc. */
332 {NULL, NULL, 0} 342 {NULL, NULL, 0}
333@@ -898,7 +902,7 @@ check_got (int * got_type, int * got_len) 343@@ -898,7 +903,7 @@ check_got (int * got_type, int * got_len)
334 extern bfd_reloc_code_real_type 344 extern bfd_reloc_code_real_type
335 parse_cons_expression_microblaze (expressionS *exp, int size) 345 parse_cons_expression_microblaze (expressionS *exp, int size)
336 { 346 {
@@ -339,7 +349,7 @@ index ffbb843d33e..b8250e4cded 100644
339 { 349 {
340 /* Handle @GOTOFF et.al. */ 350 /* Handle @GOTOFF et.al. */
341 char *save, *gotfree_copy; 351 char *save, *gotfree_copy;
342@@ -930,6 +934,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size) 352@@ -930,6 +935,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
343 353
344 static const char * str_microblaze_ro_anchor = "RO"; 354 static const char * str_microblaze_ro_anchor = "RO";
345 static const char * str_microblaze_rw_anchor = "RW"; 355 static const char * str_microblaze_rw_anchor = "RW";
@@ -347,7 +357,41 @@ index ffbb843d33e..b8250e4cded 100644
347 357
348 static bfd_boolean 358 static bfd_boolean
349 check_spl_reg (unsigned * reg) 359 check_spl_reg (unsigned * reg)
350@@ -1926,6 +1931,7 @@ md_assemble (char * str) 360@@ -1174,6 +1180,33 @@ md_assemble (char * str)
361 inst |= (immed << IMM_LOW) & IMM_MASK;
362 }
363 }
364+#if 0 //revisit
365+ else if (streq (name, "lli") || streq (name, "sli"))
366+ {
367+ temp = immed & 0xFFFFFFFFFFFF8000;
368+ if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
369+ {
370+ /* Needs an immediate inst. */
371+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
372+ if (opcode1 == NULL)
373+ {
374+ as_bad (_("unknown opcode \"%s\""), "imml");
375+ return;
376+ }
377+
378+ inst1 = opcode1->bit_sequence;
379+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
380+ output[0] = INST_BYTE0 (inst1);
381+ output[1] = INST_BYTE1 (inst1);
382+ output[2] = INST_BYTE2 (inst1);
383+ output[3] = INST_BYTE3 (inst1);
384+ output = frag_more (isize);
385+ }
386+ inst |= (reg1 << RD_LOW) & RD_MASK;
387+ inst |= (reg2 << RA_LOW) & RA_MASK;
388+ inst |= (immed << IMM_LOW) & IMM_MASK;
389+ }
390+#endif
391 else
392 {
393 temp = immed & 0xFFFF8000;
394@@ -1926,6 +1959,7 @@ md_assemble (char * str)
351 if (exp.X_op != O_constant) 395 if (exp.X_op != O_constant)
352 { 396 {
353 char *opc = NULL; 397 char *opc = NULL;
@@ -355,7 +399,7 @@ index ffbb843d33e..b8250e4cded 100644
355 relax_substateT subtype; 399 relax_substateT subtype;
356 400
357 if (exp.X_md != 0) 401 if (exp.X_md != 0)
358@@ -1939,7 +1945,7 @@ md_assemble (char * str) 402@@ -1939,7 +1973,7 @@ md_assemble (char * str)
359 subtype, /* PC-relative or not. */ 403 subtype, /* PC-relative or not. */
360 exp.X_add_symbol, 404 exp.X_add_symbol,
361 exp.X_add_number, 405 exp.X_add_number,
@@ -364,7 +408,7 @@ index ffbb843d33e..b8250e4cded 100644
364 immedl = 0L; 408 immedl = 0L;
365 } 409 }
366 else 410 else
367@@ -1977,7 +1983,7 @@ md_assemble (char * str) 411@@ -1977,7 +2011,7 @@ md_assemble (char * str)
368 reg1 = 0; 412 reg1 = 0;
369 } 413 }
370 if (strcmp (op_end, "")) 414 if (strcmp (op_end, ""))
@@ -373,17 +417,17 @@ index ffbb843d33e..b8250e4cded 100644
373 else 417 else
374 as_fatal (_("Error in statement syntax")); 418 as_fatal (_("Error in statement syntax"));
375 419
376@@ -1987,7 +1993,8 @@ md_assemble (char * str) 420@@ -1987,7 +2021,8 @@ md_assemble (char * str)
377 421
378 if (exp.X_op != O_constant) 422 if (exp.X_op != O_constant)
379 { 423 {
380- char *opc = NULL; 424- char *opc = NULL;
381+ //char *opc = NULL; 425+ //char *opc = NULL;
382+ char *opc = strdup(str_microblaze_64); 426+ char *opc = str_microblaze_64;
383 relax_substateT subtype; 427 relax_substateT subtype;
384 428
385 if (exp.X_md != 0) 429 if (exp.X_md != 0)
386@@ -2001,14 +2008,13 @@ md_assemble (char * str) 430@@ -2001,14 +2036,13 @@ md_assemble (char * str)
387 subtype, /* PC-relative or not. */ 431 subtype, /* PC-relative or not. */
388 exp.X_add_symbol, 432 exp.X_add_symbol,
389 exp.X_add_number, 433 exp.X_add_number,
@@ -399,7 +443,7 @@ index ffbb843d33e..b8250e4cded 100644
399 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 443 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
400 if (opcode1 == NULL) 444 if (opcode1 == NULL)
401 { 445 {
402@@ -2184,13 +2190,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 446@@ -2184,13 +2218,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
403 fragP->fr_fix += INST_WORD_SIZE * 2; 447 fragP->fr_fix += INST_WORD_SIZE * 2;
404 fragP->fr_var = 0; 448 fragP->fr_var = 0;
405 break; 449 break;
@@ -424,7 +468,7 @@ index ffbb843d33e..b8250e4cded 100644
424 fragP->fr_fix += INST_WORD_SIZE * 2; 468 fragP->fr_fix += INST_WORD_SIZE * 2;
425 fragP->fr_var = 0; 469 fragP->fr_var = 0;
426 break; 470 break;
427@@ -2412,22 +2428,38 @@ md_apply_fix (fixS * fixP, 471@@ -2412,22 +2456,38 @@ md_apply_fix (fixS * fixP,
428 case BFD_RELOC_64_PCREL: 472 case BFD_RELOC_64_PCREL:
429 case BFD_RELOC_64: 473 case BFD_RELOC_64:
430 case BFD_RELOC_MICROBLAZE_64_TEXTREL: 474 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
@@ -475,7 +519,7 @@ index ffbb843d33e..b8250e4cded 100644
475 buf[0] = INST_BYTE0 (inst1); 519 buf[0] = INST_BYTE0 (inst1);
476 buf[1] = INST_BYTE1 (inst1); 520 buf[1] = INST_BYTE1 (inst1);
477 buf[2] = INST_BYTE2 (inst1); 521 buf[2] = INST_BYTE2 (inst1);
478@@ -2456,6 +2488,7 @@ md_apply_fix (fixS * fixP, 522@@ -2456,6 +2516,7 @@ md_apply_fix (fixS * fixP,
479 /* Fall through. */ 523 /* Fall through. */
480 524
481 case BFD_RELOC_MICROBLAZE_64_GOTPC: 525 case BFD_RELOC_MICROBLAZE_64_GOTPC:
@@ -483,7 +527,7 @@ index ffbb843d33e..b8250e4cded 100644
483 case BFD_RELOC_MICROBLAZE_64_GOT: 527 case BFD_RELOC_MICROBLAZE_64_GOT:
484 case BFD_RELOC_MICROBLAZE_64_PLT: 528 case BFD_RELOC_MICROBLAZE_64_PLT:
485 case BFD_RELOC_MICROBLAZE_64_GOTOFF: 529 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
486@@ -2463,12 +2496,16 @@ md_apply_fix (fixS * fixP, 530@@ -2463,12 +2524,16 @@ md_apply_fix (fixS * fixP,
487 /* Add an imm instruction. First save the current instruction. */ 531 /* Add an imm instruction. First save the current instruction. */
488 for (i = 0; i < INST_WORD_SIZE; i++) 532 for (i = 0; i < INST_WORD_SIZE; i++)
489 buf[i + INST_WORD_SIZE] = buf[i]; 533 buf[i + INST_WORD_SIZE] = buf[i];
@@ -504,27 +548,22 @@ index ffbb843d33e..b8250e4cded 100644
504 return; 548 return;
505 } 549 }
506 550
507@@ -2490,7 +2527,7 @@ md_apply_fix (fixS * fixP, 551@@ -2492,6 +2557,8 @@ md_apply_fix (fixS * fixP,
508 {
509 /* This fixup has been resolved. Create a reloc in case the linker
510 moves code around due to relaxing. */ 552 moves code around due to relaxing. */
511- if (fixP->fx_r_type == BFD_RELOC_64_PCREL) 553 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
512+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
513 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 554 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
555+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
556+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
514 else if (fixP->fx_r_type == BFD_RELOC_32) 557 else if (fixP->fx_r_type == BFD_RELOC_32)
515 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 558 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
516@@ -2535,12 +2572,30 @@ md_estimate_size_before_relax (fragS * fragP, 559 else
560@@ -2535,6 +2602,32 @@ md_estimate_size_before_relax (fragS * fragP,
517 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error.....")); 561 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
518 abort (); 562 abort ();
519 } 563 }
520- else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
521- !S_IS_WEAK (fragP->fr_symbol))
522+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type 564+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
523+ && !S_IS_WEAK (fragP->fr_symbol)) 565+ && !S_IS_WEAK (fragP->fr_symbol))
524 { 566+ {
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;
528+ if (fragP->fr_opcode != NULL) { 567+ if (fragP->fr_opcode != NULL) {
529+ if(streq (fragP->fr_opcode, str_microblaze_64)) 568+ if(streq (fragP->fr_opcode, str_microblaze_64))
530+ { 569+ {
@@ -546,10 +585,20 @@ index ffbb843d33e..b8250e4cded 100644
546+ /* Don't know now whether we need an imm instruction. */ 585+ /* Don't know now whether we need an imm instruction. */
547+ fragP->fr_var = INST_WORD_SIZE; 586+ fragP->fr_var = INST_WORD_SIZE;
548+ } 587+ }
588+ }
589+ #if 0
590 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
591 !S_IS_WEAK (fragP->fr_symbol))
592 {
593@@ -2542,6 +2635,7 @@ md_estimate_size_before_relax (fragS * fragP,
594 /* Don't know now whether we need an imm instruction. */
595 fragP->fr_var = INST_WORD_SIZE;
549 } 596 }
597+#endif
550 else if (S_IS_DEFINED (fragP->fr_symbol) 598 else if (S_IS_DEFINED (fragP->fr_symbol)
551 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0)) 599 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
552@@ -2644,6 +2699,7 @@ md_estimate_size_before_relax (fragS * fragP, 600 {
601@@ -2644,6 +2738,7 @@ md_estimate_size_before_relax (fragS * fragP,
553 case TLSLD_OFFSET: 602 case TLSLD_OFFSET:
554 case TLSTPREL_OFFSET: 603 case TLSTPREL_OFFSET:
555 case TLSDTPREL_OFFSET: 604 case TLSDTPREL_OFFSET:
@@ -557,16 +606,16 @@ index ffbb843d33e..b8250e4cded 100644
557 fragP->fr_var = INST_WORD_SIZE*2; 606 fragP->fr_var = INST_WORD_SIZE*2;
558 break; 607 break;
559 case DEFINED_RO_SEGMENT: 608 case DEFINED_RO_SEGMENT:
560@@ -2697,7 +2753,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) 609@@ -2697,7 +2792,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
561 else 610 else
562 { 611 {
563 /* The case where we are going to resolve things... */ 612 /* The case where we are going to resolve things... */
564- if (fixp->fx_r_type == BFD_RELOC_64_PCREL) 613- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
565+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) 614+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
566 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; 615 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
567 else 616 else
568 return fixp->fx_where + fixp->fx_frag->fr_address; 617 return fixp->fx_where + fixp->fx_frag->fr_address;
569@@ -2730,6 +2786,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 618@@ -2730,6 +2825,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
570 case BFD_RELOC_MICROBLAZE_32_RWSDA: 619 case BFD_RELOC_MICROBLAZE_32_RWSDA:
571 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 620 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
572 case BFD_RELOC_MICROBLAZE_64_GOTPC: 621 case BFD_RELOC_MICROBLAZE_64_GOTPC:
@@ -575,7 +624,7 @@ index ffbb843d33e..b8250e4cded 100644
575 case BFD_RELOC_MICROBLAZE_64_GOT: 624 case BFD_RELOC_MICROBLAZE_64_GOT:
576 case BFD_RELOC_MICROBLAZE_64_PLT: 625 case BFD_RELOC_MICROBLAZE_64_PLT:
577 case BFD_RELOC_MICROBLAZE_64_GOTOFF: 626 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
578@@ -2872,7 +2930,10 @@ cons_fix_new_microblaze (fragS * frag, 627@@ -2872,7 +2969,10 @@ cons_fix_new_microblaze (fragS * frag,
579 r = BFD_RELOC_32; 628 r = BFD_RELOC_32;
580 break; 629 break;
581 case 8: 630 case 8:
@@ -588,7 +637,7 @@ index ffbb843d33e..b8250e4cded 100644
588 default: 637 default:
589 as_bad (_("unsupported BFD relocation size %u"), size); 638 as_bad (_("unsupported BFD relocation size %u"), size);
590diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 639diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
591index 55f34f72b0d..8576e55cb8a 100644 640index 3978a3dc01..938841b240 100644
592--- a/include/elf/microblaze.h 641--- a/include/elf/microblaze.h
593+++ b/include/elf/microblaze.h 642+++ b/include/elf/microblaze.h
594@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 643@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
@@ -597,11 +646,11 @@ index 55f34f72b0d..8576e55cb8a 100644
597 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) 646 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
598+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) 647+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
599+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ 648+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
649
600 END_RELOC_NUMBERS (R_MICROBLAZE_max) 650 END_RELOC_NUMBERS (R_MICROBLAZE_max)
601 651
602 /* Global base address names. */
603diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 652diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
604index 61eaa39b3eb..f2139a6839b 100644 653index 61eaa39b3e..f2139a6839 100644
605--- a/opcodes/microblaze-opc.h 654--- a/opcodes/microblaze-opc.h
606+++ b/opcodes/microblaze-opc.h 655+++ b/opcodes/microblaze-opc.h
607@@ -538,8 +538,8 @@ struct op_code_struct 656@@ -538,8 +538,8 @@ struct op_code_struct
@@ -616,7 +665,7 @@ index 61eaa39b3eb..f2139a6839b 100644
616 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 665 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, 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 }, 666 {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
618diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 667diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
619index 1dcd3dca3d1..ad8b8ce345b 100644 668index 1dcd3dca3d..fcf259a362 100644
620--- a/opcodes/microblaze-opcm.h 669--- a/opcodes/microblaze-opcm.h
621+++ b/opcodes/microblaze-opcm.h 670+++ b/opcodes/microblaze-opcm.h
622@@ -40,8 +40,8 @@ enum microblaze_instr 671@@ -40,8 +40,8 @@ enum microblaze_instr
@@ -626,7 +675,7 @@ index 1dcd3dca3d1..ad8b8ce345b 100644
626- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, 675- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
627- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, 676- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
628+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, 677+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
629+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, 678+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
630 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, 679 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
631 fint, fsqrt, 680 fint, fsqrt,
632 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, 681 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/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
index 067d9266..6a3e34c4 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
@@ -1,16 +1,15 @@
1From 48f658aba97d74c702b2fc5f1577d63c800b91f5 Mon Sep 17 00:00:00 2001 1From 5b9a1079eefbfbe23992f231ad69af488040e302 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 11 Sep 2018 13:48:33 +0530 3Date: Tue, 11 Sep 2018 13:48:33 +0530
4Subject: [PATCH 17/40] [Patch,Microblaze] : negl instruction is overriding 4Subject: [PATCH 16/52] [Patch,Microblaze] : negl instruction is overriding
5 rsubl 5 rsubl,fixed it by changing the instruction order...
6 6
7fixed it by changing the instruction order...
8--- 7---
9 opcodes/microblaze-opc.h | 4 ++-- 8 opcodes/microblaze-opc.h | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-) 9 1 file changed, 2 insertions(+), 2 deletions(-)
11 10
12diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
13index f2139a6839b..f9709412097 100644 12index f2139a6839..f970941209 100644
14--- a/opcodes/microblaze-opc.h 13--- a/opcodes/microblaze-opc.h
15+++ b/opcodes/microblaze-opc.h 14+++ b/opcodes/microblaze-opc.h
16@@ -275,9 +275,7 @@ struct op_code_struct 15@@ -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/0017-Added-relocations-for-MB-X.patch
index 0ed01b79..3e0773b0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Added-relocations-for-MB-X.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Added-relocations-for-MB-X.patch
@@ -1,45 +1,45 @@
1From 90d732c25cb6b55b33837e1d23d6850e4cbe10f7 Mon Sep 17 00:00:00 2001 1From 442430f1010a9e16821e68ca2842579538ff564b Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530 3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 18/40] Added relocations for MB-X 4Subject: [PATCH 17/52] Added relocations for MB-X
5 5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
6--- 9---
7 bfd/bfd-in2.h | 11 +++++--- 10 bfd/bfd-in2.h | 9 +++-
8 bfd/libbfd.h | 4 +-- 11 bfd/libbfd.h | 4 +-
9 bfd/reloc.c | 26 +++++++++--------- 12 bfd/reloc.c | 26 ++++++-----
10 gas/config/tc-microblaze.c | 54 +++++++++++++++++++++++++++----------- 13 gas/config/tc-microblaze.c | 90 ++++++++++++++++----------------------
11 4 files changed, 63 insertions(+), 32 deletions(-) 14 4 files changed, 61 insertions(+), 68 deletions(-)
12 15
13diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 16diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
14index c55092c9ec7..88f89bcdbcd 100644 17index a335182ba1..57ea4f6132 100644
15--- a/bfd/bfd-in2.h 18--- a/bfd/bfd-in2.h
16+++ b/bfd/bfd-in2.h 19+++ b/bfd/bfd-in2.h
17@@ -5434,15 +5434,20 @@ done here - only used for relaxing */ 20@@ -5436,13 +5436,18 @@ done here - only used for relaxing */
18 BFD_RELOC_MICROBLAZE_32_NONE,
19
20 /* This is a 64 bit reloc that stores the 32 bit pc relative 21 /* This is a 64 bit reloc that stores the 32 bit pc relative
21-value in two words (with an imm instruction). No relocation is 22 value in two words (with an imm 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 b4aace6a70d..b4b7ee29a30 100644 42index b4aace6a70..b4b7ee29a3 100644
43--- a/bfd/libbfd.h 43--- a/bfd/libbfd.h
44+++ b/bfd/libbfd.h 44+++ b/bfd/libbfd.h
45@@ -2969,14 +2969,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@@",
@@ -60,7 +60,7 @@ index b4aace6a70d..b4b7ee29a30 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 0e8a24e9cb0..b5c97da3ffd 100644 63index 0e8a24e9cb..b5c97da3ff 100644
64--- a/bfd/reloc.c 64--- a/bfd/reloc.c
65+++ b/bfd/reloc.c 65+++ b/bfd/reloc.c
66@@ -6866,24 +6866,12 @@ ENUMDOC 66@@ -6866,24 +6866,12 @@ ENUMDOC
@@ -110,7 +110,7 @@ index 0e8a24e9cb0..b5c97da3ffd 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 b8250e4cded..9c8b6284fb1 100644 113index 33eda2a4da..5e11a77e70 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,28 +121,62 @@ index b8250e4cded..9c8b6284fb1 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@@ -118,7 +119,8 @@ const relax_typeS md_relax_table[] = 124@@ -119,7 +120,8 @@ const relax_typeS md_relax_table[] =
125 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
126 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ 125 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
127 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */ 126 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
128- { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */ 127 // { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_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@@ -1930,8 +1932,8 @@ md_assemble (char * str) 134@@ -1180,33 +1182,6 @@ 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)
135 169
136 if (exp.X_op != O_constant) 170 if (exp.X_op != O_constant)
137 { 171 {
138- char *opc = NULL; 172- char *opc = NULL;
139- //char *opc = str_microblaze_64; 173- //char *opc = str_microblaze_64;
140+ //char *opc = NULL; 174+ //char *opc = NULL;
141+ char *opc = strdup(str_microblaze_64); 175+ char *opc = str_microblaze_64;
142 relax_substateT subtype; 176 relax_substateT subtype;
143 177
144 if (exp.X_md != 0) 178 if (exp.X_md != 0)
145@@ -2190,13 +2192,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 179@@ -2218,13 +2193,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
146 fragP->fr_fix += INST_WORD_SIZE * 2; 180 fragP->fr_fix += INST_WORD_SIZE * 2;
147 fragP->fr_var = 0; 181 fragP->fr_var = 0;
148 break; 182 break;
@@ -164,7 +198,7 @@ index b8250e4cded..9c8b6284fb1 100644
164 fragP->fr_fix += INST_WORD_SIZE * 2; 198 fragP->fr_fix += INST_WORD_SIZE * 2;
165 fragP->fr_var = 0; 199 fragP->fr_var = 0;
166 break; 200 break;
167@@ -2206,7 +2214,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 201@@ -2234,7 +2215,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
168 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC); 202 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC);
169 else 203 else
170 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, 204 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
@@ -173,7 +207,7 @@ index b8250e4cded..9c8b6284fb1 100644
173 fragP->fr_fix += INST_WORD_SIZE * 2; 207 fragP->fr_fix += INST_WORD_SIZE * 2;
174 fragP->fr_var = 0; 208 fragP->fr_var = 0;
175 break; 209 break;
176@@ -2425,14 +2433,17 @@ md_apply_fix (fixS * fixP, 210@@ -2453,14 +2434,17 @@ md_apply_fix (fixS * fixP,
177 } 211 }
178 } 212 }
179 break; 213 break;
@@ -192,7 +226,7 @@ index b8250e4cded..9c8b6284fb1 100644
192 { 226 {
193 /* Generate the imm instruction. */ 227 /* Generate the imm instruction. */
194 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 228 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
195@@ -2445,6 +2456,10 @@ md_apply_fix (fixS * fixP, 229@@ -2473,6 +2457,10 @@ md_apply_fix (fixS * fixP,
196 inst1 = opcode1->bit_sequence; 230 inst1 = opcode1->bit_sequence;
197 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 231 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
198 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; 232 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
@@ -203,7 +237,7 @@ index b8250e4cded..9c8b6284fb1 100644
203 } 237 }
204 else 238 else
205 { 239 {
206@@ -2455,7 +2470,7 @@ md_apply_fix (fixS * fixP, 240@@ -2483,7 +2471,7 @@ md_apply_fix (fixS * fixP,
207 as_bad (_("unknown opcode \"%s\""), "imm"); 241 as_bad (_("unknown opcode \"%s\""), "imm");
208 return; 242 return;
209 } 243 }
@@ -212,7 +246,7 @@ index b8250e4cded..9c8b6284fb1 100644
212 inst1 = opcode1->bit_sequence; 246 inst1 = opcode1->bit_sequence;
213 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 247 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
214 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 248 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
215@@ -2502,7 +2517,7 @@ md_apply_fix (fixS * fixP, 249@@ -2530,7 +2518,7 @@ md_apply_fix (fixS * fixP,
216 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 250 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
217 if (opcode1 == NULL) 251 if (opcode1 == NULL)
218 { 252 {
@@ -221,16 +255,16 @@ index b8250e4cded..9c8b6284fb1 100644
221 as_bad (_("unknown opcode \"%s\""), "imml"); 255 as_bad (_("unknown opcode \"%s\""), "imml");
222 else 256 else
223 as_bad (_("unknown opcode \"%s\""), "imm"); 257 as_bad (_("unknown opcode \"%s\""), "imm");
224@@ -2527,7 +2542,7 @@ md_apply_fix (fixS * fixP, 258@@ -2557,8 +2545,6 @@ md_apply_fix (fixS * fixP,
225 {
226 /* This fixup has been resolved. Create a reloc in case the linker
227 moves code around due to relaxing. */ 259 moves code around due to relaxing. */
228- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 260 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
229+ if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
230 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 261 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
262- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
263- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
231 else if (fixP->fx_r_type == BFD_RELOC_32) 264 else if (fixP->fx_r_type == BFD_RELOC_32)
232 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 265 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
233@@ -2579,21 +2594,21 @@ md_estimate_size_before_relax (fragS * fragP, 266 else
267@@ -2609,33 +2595,24 @@ md_estimate_size_before_relax (fragS * fragP,
234 if(streq (fragP->fr_opcode, str_microblaze_64)) 268 if(streq (fragP->fr_opcode, str_microblaze_64))
235 { 269 {
236 /* Used as an absolute value. */ 270 /* Used as an absolute value. */
@@ -256,7 +290,19 @@ index b8250e4cded..9c8b6284fb1 100644
256 fragP->fr_var = INST_WORD_SIZE; 290 fragP->fr_var = INST_WORD_SIZE;
257 } 291 }
258 } 292 }
259@@ -2626,6 +2641,13 @@ md_estimate_size_before_relax (fragS * fragP, 293- #if 0
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@@ -2665,6 +2642,13 @@ md_estimate_size_before_relax (fragS * fragP,
260 /* Variable part does not change. */ 306 /* Variable part does not change. */
261 fragP->fr_var = INST_WORD_SIZE*2; 307 fragP->fr_var = INST_WORD_SIZE*2;
262 } 308 }
@@ -270,7 +316,7 @@ index b8250e4cded..9c8b6284fb1 100644
270 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor)) 316 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
271 { 317 {
272 /* It is accessed using the small data read only anchor. */ 318 /* It is accessed using the small data read only anchor. */
273@@ -2700,6 +2722,7 @@ md_estimate_size_before_relax (fragS * fragP, 319@@ -2739,6 +2723,7 @@ md_estimate_size_before_relax (fragS * fragP,
274 case TLSTPREL_OFFSET: 320 case TLSTPREL_OFFSET:
275 case TLSDTPREL_OFFSET: 321 case TLSDTPREL_OFFSET:
276 case DEFINED_64_OFFSET: 322 case DEFINED_64_OFFSET:
@@ -278,16 +324,16 @@ index b8250e4cded..9c8b6284fb1 100644
278 fragP->fr_var = INST_WORD_SIZE*2; 324 fragP->fr_var = INST_WORD_SIZE*2;
279 break; 325 break;
280 case DEFINED_RO_SEGMENT: 326 case DEFINED_RO_SEGMENT:
281@@ -2753,7 +2776,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) 327@@ -2792,7 +2777,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
282 else 328 else
283 { 329 {
284 /* The case where we are going to resolve things... */ 330 /* The case where we are going to resolve things... */
285- if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) 331- if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
286+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 332+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
287 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; 333 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
288 else 334 else
289 return fixp->fx_where + fixp->fx_frag->fr_address; 335 return fixp->fx_where + fixp->fx_frag->fr_address;
290@@ -2788,6 +2811,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 336@@ -2827,6 +2812,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
291 case BFD_RELOC_MICROBLAZE_64_GOTPC: 337 case BFD_RELOC_MICROBLAZE_64_GOTPC:
292 case BFD_RELOC_MICROBLAZE_64_GPC: 338 case BFD_RELOC_MICROBLAZE_64_GPC:
293 case BFD_RELOC_MICROBLAZE_64: 339 case BFD_RELOC_MICROBLAZE_64:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch
index a621fb05..315d0445 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Update-MB-x.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch
@@ -1,29 +1,28 @@
1From c3e194e231529c1b642f7f1a19a2a7b1ea644bd9 Mon Sep 17 00:00:00 2001 1From 5b1793fe6dfb16755f584821023145bdfc4b55d7 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530 3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 19/40] Update MB-x 4Subject: [PATCH 18/52] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions
5 6
6-Fixed MB-x relocation issues
7-Added imml for required MB-x instructions
8--- 7---
9 bfd/elf64-microblaze.c | 68 ++++++++++-- 8 bfd/elf64-microblaze.c | 68 ++++++++++++++---
10 gas/config/tc-microblaze.c | 221 +++++++++++++++++++++++++------------ 9 gas/config/tc-microblaze.c | 152 +++++++++++++++++++++++++++----------
11 gas/tc.h | 2 +- 10 gas/tc.h | 2 +-
12 3 files changed, 209 insertions(+), 82 deletions(-) 11 3 files changed, 167 insertions(+), 55 deletions(-)
13 12
14diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 13diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
15index d55700fc513..f8f52870639 100644 14index 6b1f47d00d..6676d9f93d 100644
16--- a/bfd/elf64-microblaze.c 15--- a/bfd/elf64-microblaze.c
17+++ b/bfd/elf64-microblaze.c 16+++ b/bfd/elf64-microblaze.c
18@@ -1478,8 +1478,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, 17@@ -1488,8 +1488,17 @@ microblaze_elf_relocate_section (bfd *output_bfd,
19 relocation -= (input_section->output_section->vma 18 relocation -= (input_section->output_section->vma
20 + input_section->output_offset 19 + input_section->output_offset
21 + offset + INST_WORD_SIZE); 20 + offset + INST_WORD_SIZE);
22- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 21- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
23+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 22+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
24+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 23+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
25+ { 24+ {
26+ insn &= ~0x00ffffff; 25+ insn &= ~0x00ffffff;
27+ insn |= (relocation >> 16) & 0xffffff; 26+ insn |= (relocation >> 16) & 0xffffff;
28+ bfd_put_32 (input_bfd, insn, 27+ bfd_put_32 (input_bfd, insn,
29 contents + offset + endian); 28 contents + offset + endian);
@@ -34,7 +33,7 @@ index d55700fc513..f8f52870639 100644
34 bfd_put_16 (input_bfd, relocation & 0xffff, 33 bfd_put_16 (input_bfd, relocation & 0xffff,
35 contents + offset + endian + INST_WORD_SIZE); 34 contents + offset + endian + INST_WORD_SIZE);
36 } 35 }
37@@ -1569,11 +1578,28 @@ microblaze_elf_relocate_section (bfd *output_bfd, 36@@ -1580,11 +1589,28 @@ microblaze_elf_relocate_section (bfd *output_bfd,
38 else 37 else
39 { 38 {
40 if (r_type == R_MICROBLAZE_64_PCREL) 39 if (r_type == R_MICROBLAZE_64_PCREL)
@@ -44,7 +43,7 @@ index d55700fc513..f8f52870639 100644
44- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 43- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
45+ { 44+ {
46+ if (!input_section->output_section->vma && 45+ if (!input_section->output_section->vma &&
47+ !input_section->output_offset && !offset) 46+ !input_section->output_offset && !offset)
48+ relocation -= (input_section->output_section->vma 47+ relocation -= (input_section->output_section->vma
49+ + input_section->output_offset 48+ + input_section->output_offset
50+ + offset); 49+ + offset);
@@ -54,9 +53,9 @@ index d55700fc513..f8f52870639 100644
54+ + offset + INST_WORD_SIZE); 53+ + offset + INST_WORD_SIZE);
55+ } 54+ }
56+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 55+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
57+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 56+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
58+ { 57+ {
59+ insn &= ~0x00ffffff; 58+ insn &= ~0x00ffffff;
60+ insn |= (relocation >> 16) & 0xffffff; 59+ insn |= (relocation >> 16) & 0xffffff;
61+ bfd_put_32 (input_bfd, insn, 60+ bfd_put_32 (input_bfd, insn,
62 contents + offset + endian); 61 contents + offset + endian);
@@ -67,7 +66,7 @@ index d55700fc513..f8f52870639 100644
67 bfd_put_16 (input_bfd, relocation & 0xffff, 66 bfd_put_16 (input_bfd, relocation & 0xffff,
68 contents + offset + endian + INST_WORD_SIZE); 67 contents + offset + endian + INST_WORD_SIZE);
69 } 68 }
70@@ -1677,9 +1703,19 @@ static void 69@@ -1703,9 +1729,19 @@ static void
71 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 70 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
72 { 71 {
73 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 72 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
@@ -90,7 +89,7 @@ index d55700fc513..f8f52870639 100644
90 } 89 }
91 90
92 /* Read-modify-write into the bfd, an immediate value into appropriate fields of 91 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
93@@ -1691,10 +1727,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 92@@ -1717,10 +1753,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
94 unsigned long instr_lo; 93 unsigned long instr_lo;
95 94
96 instr_hi = bfd_get_32 (abfd, bfd_addr); 95 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -114,10 +113,10 @@ index d55700fc513..f8f52870639 100644
114 instr_lo &= ~0x0000ffff; 113 instr_lo &= ~0x0000ffff;
115 instr_lo |= (val & 0x0000ffff); 114 instr_lo |= (val & 0x0000ffff);
116diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 115diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
117index 9c8b6284fb1..f61fdf3b90a 100644 116index 5e11a77e70..48f306ef41 100644
118--- a/gas/config/tc-microblaze.c 117--- a/gas/config/tc-microblaze.c
119+++ b/gas/config/tc-microblaze.c 118+++ b/gas/config/tc-microblaze.c
120@@ -391,7 +391,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 119@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
121 Integer arg to pass to the function. */ 120 Integer arg to pass to the function. */
122 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c, 121 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
123 and then in the read.c table. */ 122 and then in the read.c table. */
@@ -126,7 +125,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
126 { 125 {
127 {"lcomm", microblaze_s_lcomm, 1}, 126 {"lcomm", microblaze_s_lcomm, 1},
128 {"data", microblaze_s_data, 0}, 127 {"data", microblaze_s_data, 0},
129@@ -400,7 +400,7 @@ const pseudo_typeS md_pseudo_table[] = 128@@ -401,7 +401,7 @@ const pseudo_typeS md_pseudo_table[] =
130 {"data32", cons, 4}, /* Same as word. */ 129 {"data32", cons, 4}, /* Same as word. */
131 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 130 {"ent", s_func, 0}, /* Treat ent as function entry point. */
132 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 131 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
@@ -135,84 +134,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
135 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */ 134 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
136 {"weakext", microblaze_s_weakext, 0}, 135 {"weakext", microblaze_s_weakext, 0},
137 {"rodata", microblaze_s_rdata, 0}, 136 {"rodata", microblaze_s_rdata, 0},
138@@ -538,30 +538,6 @@ parse_reg (char * s, unsigned * reg) 137@@ -996,7 +996,7 @@ md_assemble (char * str)
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)
216 unsigned reg2; 138 unsigned reg2;
217 unsigned reg3; 139 unsigned reg3;
218 unsigned isize; 140 unsigned isize;
@@ -221,7 +143,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
221 expressionS exp; 143 expressionS exp;
222 char name[20]; 144 char name[20];
223 long immedl; 145 long immedl;
224@@ -1117,8 +1132,9 @@ md_assemble (char * str) 146@@ -1118,8 +1118,9 @@ md_assemble (char * str)
225 as_fatal (_("lmi pseudo instruction should not use a label in imm field")); 147 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
226 else if (streq (name, "smi")) 148 else if (streq (name, "smi"))
227 as_fatal (_("smi pseudo instruction should not use a label in imm field")); 149 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
@@ -233,7 +155,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
233 opc = str_microblaze_ro_anchor; 155 opc = str_microblaze_ro_anchor;
234 else if (reg2 == REG_RWSDP) 156 else if (reg2 == REG_RWSDP)
235 opc = str_microblaze_rw_anchor; 157 opc = str_microblaze_rw_anchor;
236@@ -1181,31 +1197,55 @@ md_assemble (char * str) 158@@ -1182,31 +1183,55 @@ md_assemble (char * str)
237 inst |= (immed << IMM_LOW) & IMM_MASK; 159 inst |= (immed << IMM_LOW) & IMM_MASK;
238 } 160 }
239 } 161 }
@@ -275,7 +197,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
275+ inst |= (reg2 << RA_LOW) & RA_MASK; 197+ inst |= (reg2 << RA_LOW) & RA_MASK;
276+ inst |= (immed << IMM_LOW) & IMM_MASK; 198+ inst |= (immed << IMM_LOW) & IMM_MASK;
277+ } 199+ }
278+ else 200+ else
279+ { 201+ {
280+ temp = immed & 0xFFFF8000; 202+ temp = immed & 0xFFFF8000;
281+ if ((temp != 0) && (temp != 0xFFFF8000)) 203+ if ((temp != 0) && (temp != 0xFFFF8000))
@@ -303,34 +225,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
303 break; 225 break;
304 226
305 case INST_TYPE_RD_R1_IMMS: 227 case INST_TYPE_RD_R1_IMMS:
306@@ -1400,7 +1440,7 @@ md_assemble (char * str) 228@@ -1832,12 +1857,20 @@ 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)
334 case INST_TYPE_IMM: 229 case INST_TYPE_IMM:
335 if (streq (name, "imm")) 230 if (streq (name, "imm"))
336 as_fatal (_("An IMM instruction should not be present in the .s file")); 231 as_fatal (_("An IMM instruction should not be present in the .s file"));
@@ -345,21 +240,21 @@ index 9c8b6284fb1..f61fdf3b90a 100644
345 { 240 {
346- char *opc = NULL; 241- char *opc = NULL;
347+ char *opc; 242+ char *opc;
348+ if (microblaze_arch_size == 64 && (streq (name, "breai") || 243+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
349+ streq (name, "breaid") || 244+ streq (name, "breaid") ||
350+ streq (name, "brai") || streq (name, "braid"))) 245+ streq (name, "brai") || streq (name, "braid")))
351+ opc = strdup(str_microblaze_64); 246+ opc = str_microblaze_64;
352+ else 247+ else
353+ opc = NULL; 248+ opc = NULL;
354 relax_substateT subtype; 249 relax_substateT subtype;
355 250
356 if (exp.X_md != 0) 251 if (exp.X_md != 0)
357@@ -1859,27 +1907,54 @@ md_assemble (char * str) 252@@ -1860,27 +1893,54 @@ md_assemble (char * str)
358 immed = exp.X_add_number; 253 immed = exp.X_add_number;
359 } 254 }
360 255
361+ if (microblaze_arch_size == 64 && (streq (name, "breai") || 256+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
362+ streq (name, "breaid") || 257+ streq (name, "breaid") ||
363+ streq (name, "brai") || streq (name, "braid"))) 258+ streq (name, "brai") || streq (name, "braid")))
364+ { 259+ {
365+ temp = immed & 0xFFFFFF8000; 260+ temp = immed & 0xFFFFFF8000;
@@ -427,7 +322,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
427 break; 322 break;
428 323
429 case INST_TYPE_NONE: 324 case INST_TYPE_NONE:
430@@ -2455,7 +2530,7 @@ md_apply_fix (fixS * fixP, 325@@ -2456,7 +2516,7 @@ md_apply_fix (fixS * fixP,
431 326
432 inst1 = opcode1->bit_sequence; 327 inst1 = opcode1->bit_sequence;
433 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 328 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
@@ -436,13 +331,13 @@ index 9c8b6284fb1..f61fdf3b90a 100644
436 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 331 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
437 fixP->fx_r_type = BFD_RELOC_64; 332 fixP->fx_r_type = BFD_RELOC_64;
438 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 333 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
439@@ -2623,7 +2698,14 @@ md_estimate_size_before_relax (fragS * fragP, 334@@ -2624,7 +2684,14 @@ md_estimate_size_before_relax (fragS * fragP,
440 } 335 }
441 else 336 else
442 { 337 {
443- fragP->fr_subtype = UNDEFINED_PC_OFFSET; 338- fragP->fr_subtype = UNDEFINED_PC_OFFSET;
444+ if (fragP->fr_opcode != NULL) { 339+ if (fragP->fr_opcode != NULL) {
445+ if (streq (fragP->fr_opcode, str_microblaze_64)) 340+ if (streq (fragP->fr_opcode, str_microblaze_64))
446+ fragP->fr_subtype = DEFINED_64_PC_OFFSET; 341+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
447+ else 342+ else
448+ fragP->fr_subtype = UNDEFINED_PC_OFFSET; 343+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
@@ -452,7 +347,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
452 fragP->fr_var = INST_WORD_SIZE*2; 347 fragP->fr_var = INST_WORD_SIZE*2;
453 } 348 }
454 break; 349 break;
455@@ -2900,6 +2982,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 350@@ -2901,6 +2968,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
456 case OPTION_M64: 351 case OPTION_M64:
457 //if (arg != NULL && strcmp (arg, "64") == 0) 352 //if (arg != NULL && strcmp (arg, "64") == 0)
458 microblaze_arch_size = 64; 353 microblaze_arch_size = 64;
@@ -461,7 +356,7 @@ index 9c8b6284fb1..f61fdf3b90a 100644
461 default: 356 default:
462 return 0; 357 return 0;
463diff --git a/gas/tc.h b/gas/tc.h 358diff --git a/gas/tc.h b/gas/tc.h
464index da1738d67a8..5bdfe5c3475 100644 359index da1738d67a..5bdfe5c347 100644
465--- a/gas/tc.h 360--- a/gas/tc.h
466+++ b/gas/tc.h 361+++ b/gas/tc.h
467@@ -22,7 +22,7 @@ 362@@ -22,7 +22,7 @@
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch
new file mode 100644
index 00000000..027b8e83
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch
@@ -0,0 +1,28 @@
1From 33081da0bb8820f3c695d8f865582436b16002bf Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 17:06:58 +0530
4Subject: [PATCH 19/52] Fixing the branch related issues
5
6Conflicts:
7 bfd/elf64-microblaze.c
8---
9 bfd/elf64-microblaze.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index 6676d9f93d..d7b7d9f5e7 100644
14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c
16@@ -2545,6 +2545,9 @@ microblaze_elf_check_relocs (bfd * abfd,
17 while (h->root.type == bfd_link_hash_indirect
18 || h->root.type == bfd_link_hash_warning)
19 h = (struct elf_link_hash_entry *) h->root.u.i.link;
20+ /* PR15323, ref flags aren't set for references in the same
21+ object. */
22+ h->root.non_ir_ref_regular = 1;
23 }
24
25 switch (r_type)
26--
272.17.1
28
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch
index ad2fd5fe..d9de811d 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Various-fixes.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch
@@ -1,10 +1,12 @@
1From 1594b2f497822ebdb923b4ae55e81a10bfd4817d Mon Sep 17 00:00:00 2001 1From 22b1b41a7873fa117642cad6b150f465eb9b60cb Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530 3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 20/40] Various fixes 4Subject: [PATCH 20/52] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
5 6
6- Fixed address computation issues with 64bit address 7Conflicts:
7- Fixed imml dissassamble issue 8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
8--- 10---
9 bfd/bfd-in2.h | 5 +++ 11 bfd/bfd-in2.h | 5 +++
10 bfd/elf64-microblaze.c | 14 ++++---- 12 bfd/elf64-microblaze.c | 14 ++++----
@@ -13,23 +15,23 @@ Subject: [PATCH 20/40] Various fixes
13 4 files changed, 79 insertions(+), 16 deletions(-) 15 4 files changed, 79 insertions(+), 16 deletions(-)
14 16
15diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 17diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
16index 88f89bcdbcd..8902d9c7939 100644 18index 57ea4f6132..05fbeb9b3a 100644
17--- a/bfd/bfd-in2.h 19--- a/bfd/bfd-in2.h
18+++ b/bfd/bfd-in2.h 20+++ b/bfd/bfd-in2.h
19@@ -5443,6 +5443,11 @@ value in two words (with an imml instruction). No relocation is 21@@ -5443,6 +5443,11 @@ done here - only used for relaxing */
20 done here - only used for relaxing */ 22 * +done here - only used for relaxing */
21 BFD_RELOC_MICROBLAZE_64, 23 BFD_RELOC_MICROBLAZE_64,
22 24
23+/* This is a 64 bit reloc that stores the 32 bit relative 25+/* This is a 64 bit reloc that stores the 32 bit relative
24+value in two words (with an imml instruction). No relocation is 26+ * +value in two words (with an imml instruction). No relocation is
25+done here - only used for relaxing */ 27+ * +done here - only used for relaxing */
26+ BFD_RELOC_MICROBLAZE_EA64, 28+ BFD_RELOC_MICROBLAZE_EA64,
27+ 29+
28 /* This is a 64 bit reloc that stores the 32 bit pc relative 30 /* This is a 64 bit reloc that stores the 32 bit pc relative
29 value in two words (with an imm instruction). No relocation is 31 * +value in two words (with an imm instruction). No relocation is
30 done here - only used for relaxing */ 32 * +done here - only used for relaxing */
31diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 33diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
32index f8f52870639..17e58748a0b 100644 34index d7b7d9f5e7..f42d7f429b 100644
33--- a/bfd/elf64-microblaze.c 35--- a/bfd/elf64-microblaze.c
34+++ b/bfd/elf64-microblaze.c 36+++ b/bfd/elf64-microblaze.c
35@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 37@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
@@ -72,7 +74,7 @@ index f8f52870639..17e58748a0b 100644
72 microblaze_reloc = R_MICROBLAZE_IMML_64; 74 microblaze_reloc = R_MICROBLAZE_IMML_64;
73 break; 75 break;
74 case BFD_RELOC_MICROBLAZE_64_GOTPC: 76 case BFD_RELOC_MICROBLAZE_64_GOTPC:
75@@ -1956,7 +1956,7 @@ microblaze_elf_relax_section (bfd *abfd, 77@@ -1982,7 +1982,7 @@ microblaze_elf_relax_section (bfd *abfd,
76 efix = calc_fixup (target_address, 0, sec); 78 efix = calc_fixup (target_address, 0, sec);
77 79
78 /* Validate the in-band val. */ 80 /* Validate the in-band val. */
@@ -82,10 +84,10 @@ index f8f52870639..17e58748a0b 100644
82 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); 84 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
83 } 85 }
84diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 86diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
85index f61fdf3b90a..0dfb59ffe8b 100644 87index 48f306ef41..bfb3104720 100644
86--- a/gas/config/tc-microblaze.c 88--- a/gas/config/tc-microblaze.c
87+++ b/gas/config/tc-microblaze.c 89+++ b/gas/config/tc-microblaze.c
88@@ -401,7 +401,6 @@ pseudo_typeS md_pseudo_table[] = 90@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] =
89 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 91 {"ent", s_func, 0}, /* Treat ent as function entry point. */
90 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 92 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
91 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */ 93 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
@@ -93,7 +95,7 @@ index f61fdf3b90a..0dfb59ffe8b 100644
93 {"weakext", microblaze_s_weakext, 0}, 95 {"weakext", microblaze_s_weakext, 0},
94 {"rodata", microblaze_s_rdata, 0}, 96 {"rodata", microblaze_s_rdata, 0},
95 {"sdata2", microblaze_s_rdata, 1}, 97 {"sdata2", microblaze_s_rdata, 1},
96@@ -2489,18 +2488,74 @@ md_apply_fix (fixS * fixP, 98@@ -2475,18 +2474,74 @@ md_apply_fix (fixS * fixP,
97 case BFD_RELOC_RVA: 99 case BFD_RELOC_RVA:
98 case BFD_RELOC_32_PCREL: 100 case BFD_RELOC_32_PCREL:
99 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 101 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
@@ -143,7 +145,7 @@ index f61fdf3b90a..0dfb59ffe8b 100644
143+ } 145+ }
144+ } 146+ }
145+ break; 147+ break;
146+ 148+
147+ case BFD_RELOC_MICROBLAZE_EA64: 149+ case BFD_RELOC_MICROBLAZE_EA64:
148 /* Don't do anything if the symbol is not defined. */ 150 /* Don't do anything if the symbol is not defined. */
149 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 151 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
@@ -172,16 +174,16 @@ index f61fdf3b90a..0dfb59ffe8b 100644
172 buf[3] |= ((val >> 24) & 0xff); 174 buf[3] |= ((val >> 24) & 0xff);
173 buf[2] |= ((val >> 16) & 0xff); 175 buf[2] |= ((val >> 16) & 0xff);
174 buf[1] |= ((val >> 8) & 0xff); 176 buf[1] |= ((val >> 8) & 0xff);
175@@ -2621,6 +2676,8 @@ md_apply_fix (fixS * fixP, 177@@ -2607,6 +2662,8 @@ md_apply_fix (fixS * fixP,
176 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 178 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
177 else if (fixP->fx_r_type == BFD_RELOC_32) 179 else if (fixP->fx_r_type == BFD_RELOC_32)
178 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 180 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
179+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64) 181+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64)
180+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64; 182+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64;
181 else 183 else
182 fixP->fx_r_type = BFD_RELOC_NONE; 184 fixP->fx_r_type = BFD_RELOC_NONE;
183 fixP->fx_addsy = section_symbol (absolute_section); 185 fixP->fx_addsy = section_symbol (absolute_section);
184@@ -2892,6 +2949,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 186@@ -2878,6 +2935,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
185 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 187 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
186 case BFD_RELOC_MICROBLAZE_64_GOTPC: 188 case BFD_RELOC_MICROBLAZE_64_GOTPC:
187 case BFD_RELOC_MICROBLAZE_64_GPC: 189 case BFD_RELOC_MICROBLAZE_64_GPC:
@@ -189,7 +191,7 @@ index f61fdf3b90a..0dfb59ffe8b 100644
189 case BFD_RELOC_MICROBLAZE_64: 191 case BFD_RELOC_MICROBLAZE_64:
190 case BFD_RELOC_MICROBLAZE_64_PCREL: 192 case BFD_RELOC_MICROBLAZE_64_PCREL:
191 case BFD_RELOC_MICROBLAZE_64_GOT: 193 case BFD_RELOC_MICROBLAZE_64_GOT:
192@@ -3037,10 +3095,10 @@ cons_fix_new_microblaze (fragS * frag, 194@@ -3023,10 +3081,10 @@ cons_fix_new_microblaze (fragS * frag,
193 r = BFD_RELOC_32; 195 r = BFD_RELOC_32;
194 break; 196 break;
195 case 8: 197 case 8:
@@ -204,13 +206,13 @@ index f61fdf3b90a..0dfb59ffe8b 100644
204 default: 206 default:
205 as_bad (_("unsupported BFD relocation size %u"), size); 207 as_bad (_("unsupported BFD relocation size %u"), size);
206diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 208diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
207index a03f5b7a55b..fc8e79b19cf 100644 209index f643f2600d..1dc11a2653 100644
208--- a/opcodes/microblaze-dis.c 210--- a/opcodes/microblaze-dis.c
209+++ b/opcodes/microblaze-dis.c 211+++ b/opcodes/microblaze-dis.c
210@@ -78,7 +78,7 @@ get_field_imml (struct string_buf *buf, long instr) 212@@ -77,7 +77,7 @@ static char *
213 get_field_imml (struct string_buf *buf, long instr)
211 { 214 {
212 char *p = strbuf (buf); 215 char *p = strbuf (buf);
213
214- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW)); 216- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
215+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW)); 217+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
216 return p; 218 return p;
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0021-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 99f285f2..908f7572 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0021-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 b33fdfda4af069859ebe6588a5b9774cb5a2f14d Mon Sep 17 00:00:00 2001 1From 9880b06269a176c0b5c4f0ecb9e3784f630a76be Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sat, 13 Oct 2018 21:17:01 +0530 3Date: Sat, 13 Oct 2018 21:17:01 +0530
4Subject: [PATCH 21/40] Adding new relocation to support 64bit rodata 4Subject: [PATCH 21/52] Adding new relocation to support 64bit rodata
5 5
6--- 6---
7 bfd/elf64-microblaze.c | 11 +++++++-- 7 bfd/elf64-microblaze.c | 11 +++++++--
@@ -9,10 +9,10 @@ Subject: [PATCH 21/40] 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 17e58748a0b..b62c47e8514 100644 12index f42d7f429b..ddcb5baf74 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@@ -1463,6 +1463,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 15@@ -1473,6 +1473,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 17e58748a0b..b62c47e8514 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@@ -1472,6 +1473,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1482,6 +1483,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
24 relocation += addend; 24 relocation += addend;
25 if (r_type == R_MICROBLAZE_32) 25 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
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@@ -1549,7 +1552,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 32@@ -1560,7 +1563,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
33 } 33 }
34 else 34 else
35 { 35 {
@@ -38,7 +38,7 @@ index 17e58748a0b..b62c47e8514 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@@ -1575,6 +1578,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 41@@ -1586,6 +1589,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 17e58748a0b..b62c47e8514 100644
47 else 47 else
48 { 48 {
49 if (r_type == R_MICROBLAZE_64_PCREL) 49 if (r_type == R_MICROBLAZE_64_PCREL)
50@@ -2072,7 +2077,8 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2098,7 +2103,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 17e58748a0b..b62c47e8514 100644
57 { 57 {
58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
59 59
60@@ -2568,6 +2574,7 @@ microblaze_elf_check_relocs (bfd * abfd, 60@@ -2606,6 +2612,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 17e58748a0b..b62c47e8514 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 0dfb59ffe8b..4bd71557ca2 100644 69index bfb3104720..532a26eaa5 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@@ -1133,6 +1133,13 @@ md_assemble (char * str) 72@@ -1119,6 +1119,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 0dfb59ffe8b..4bd71557ca2 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@@ -1196,7 +1203,10 @@ md_assemble (char * str) 86@@ -1182,7 +1189,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 0dfb59ffe8b..4bd71557ca2 100644
95 { 95 {
96 temp = immed & 0xFFFFFF8000; 96 temp = immed & 0xFFFFFF8000;
97 if (temp != 0 && temp != 0xFFFFFF8000) 97 if (temp != 0 && temp != 0xFFFFFF8000)
98@@ -1808,6 +1818,11 @@ md_assemble (char * str) 98@@ -1794,6 +1804,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 = strdup(str_microblaze_64); 104+ opc = 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@@ -1825,6 +1840,31 @@ md_assemble (char * str) 110@@ -1811,6 +1826,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 0dfb59ffe8b..4bd71557ca2 100644
139 139
140 temp = immed & 0xFFFF8000; 140 temp = immed & 0xFFFF8000;
141 if ((temp != 0) && (temp != 0xFFFF8000)) 141 if ((temp != 0) && (temp != 0xFFFF8000))
142@@ -1848,6 +1888,7 @@ md_assemble (char * str) 142@@ -1834,6 +1874,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 0dfb59ffe8b..4bd71557ca2 100644
147 break; 147 break;
148 148
149 case INST_TYPE_R2: 149 case INST_TYPE_R2:
150@@ -3095,10 +3136,10 @@ cons_fix_new_microblaze (fragS * frag, 150@@ -3081,10 +3122,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/0022-fixing-the-.bss-relocation-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch
index 48b89d64..6c144b8a 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0022-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 118e1717ef8421bc86bcf56c9186f065bd607efd Mon Sep 17 00:00:00 2001 1From e7b6ab1b28fc3ca13ed25687d5e851795ed6e1a3 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 24 Oct 2018 12:34:37 +0530 3Date: Wed, 24 Oct 2018 12:34:37 +0530
4Subject: [PATCH 22/40] fixing the .bss relocation issue 4Subject: [PATCH 22/52] fixing the .bss relocation issue
5 5
6--- 6---
7 bfd/elf64-microblaze.c | 18 ++++++++++++------ 7 bfd/elf64-microblaze.c | 18 ++++++++++++------
8 1 file changed, 12 insertions(+), 6 deletions(-) 8 1 file changed, 12 insertions(+), 6 deletions(-)
9 9
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
11index b62c47e8514..cb3b40b574c 100644 11index ddcb5baf74..861420789b 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@@ -1482,7 +1482,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 14@@ -1492,7 +1492,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@@ -1595,7 +1595,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 23@@ -1606,7 +1606,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@@ -1709,7 +1709,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 32@@ -1735,7 +1735,7 @@ microblaze_bfd_write_imm_value_32 (bfd *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 b62c47e8514..cb3b40b574c 100644
38 { 38 {
39 instr &= ~0x00ffffff; 39 instr &= ~0x00ffffff;
40 instr |= (val & 0xffffff); 40 instr |= (val & 0xffffff);
41@@ -1732,7 +1732,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 41@@ -1758,7 +1758,7 @@ microblaze_bfd_write_imm_value_64 (bfd *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 b62c47e8514..cb3b40b574c 100644
47 { 47 {
48 instr_hi &= ~0x00ffffff; 48 instr_hi &= ~0x00ffffff;
49 instr_hi |= (val >> 16) & 0xffffff; 49 instr_hi |= (val >> 16) & 0xffffff;
50@@ -2225,7 +2225,10 @@ microblaze_elf_relax_section (bfd *abfd, 50@@ -2251,7 +2251,10 @@ microblaze_elf_relax_section (bfd *abfd,
51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
52 + irelscan->r_offset 52 + irelscan->r_offset
53 + INST_WORD_SIZE); 53 + INST_WORD_SIZE);
@@ -59,7 +59,7 @@ index b62c47e8514..cb3b40b574c 100644
59 immediate |= (instr_lo & 0x0000ffff); 59 immediate |= (instr_lo & 0x0000ffff);
60 offset = calc_fixup (irelscan->r_addend, 0, sec); 60 offset = calc_fixup (irelscan->r_addend, 0, sec);
61 immediate -= offset; 61 immediate -= offset;
62@@ -2269,7 +2272,10 @@ microblaze_elf_relax_section (bfd *abfd, 62@@ -2295,7 +2298,10 @@ microblaze_elf_relax_section (bfd *abfd,
63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
64 + irelscan->r_offset 64 + irelscan->r_offset
65 + INST_WORD_SIZE); 65 + INST_WORD_SIZE);
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0023-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 c84767fa..98f05ac8 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0023-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 04d4e164cec91078b1b1155bae6ae4b508758969 Mon Sep 17 00:00:00 2001 1From 9b9f53c95e5b1fbccd4de2dd579c6cfae34c191d Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 28 Nov 2018 14:00:29 +0530 3Date: Wed, 28 Nov 2018 14:00:29 +0530
4Subject: [PATCH 23/40] Fixed the bug in the R_MICROBLAZE_64_NONE relocation. 4Subject: [PATCH 23/52] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
5 It was adjusting only lower 16bits. 5 It was adjusting only lower 16bits.
6 6
7--- 7---
@@ -10,7 +10,7 @@ Subject: [PATCH 23/40] 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 e1a66f57e79..bf09c68afd9 100644 13index 14bb6de052..d77710b1f3 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@@ -2019,8 +2019,8 @@ microblaze_elf_relax_section (bfd *abfd, 16@@ -2019,8 +2019,8 @@ microblaze_elf_relax_section (bfd *abfd,
@@ -25,10 +25,10 @@ index e1a66f57e79..bf09c68afd9 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 cb3b40b574c..b002b414d64 100644 28index 861420789b..338f16eeee 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@@ -2004,8 +2004,8 @@ microblaze_elf_relax_section (bfd *abfd, 31@@ -2030,8 +2030,8 @@ microblaze_elf_relax_section (bfd *abfd,
32 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); 32 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
33 efix = calc_fixup (target_address, 0, sec); 33 efix = calc_fixup (target_address, 0, sec);
34 irel->r_addend -= (efix - sfix); 34 irel->r_addend -= (efix - sfix);
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch
index 9a8e799c..25d0d7eb 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0024-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 7d26e7f32769e1a324a8dfd3bc3eaa2a5fbfe62a Mon Sep 17 00:00:00 2001 1From 70fcc4fe0635bdc871bc2ec1087173e3f93cab86 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 24/40] Revert "ld: Remove unused expression state" 4Subject: [PATCH 24/52] Revert "ld: Remove unused expression state"
5 5
6This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb. 6This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb.
7 7
@@ -13,7 +13,7 @@ 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 b4e7c41209d..dd3b058110a 100644 16index b4e7c41209..dd3b058110 100644
17--- a/ld/ldexp.c 17--- a/ld/ldexp.c
18+++ b/ld/ldexp.c 18+++ b/ld/ldexp.c
19@@ -1360,6 +1360,7 @@ static etree_type * 19@@ -1360,6 +1360,7 @@ static etree_type *
@@ -60,7 +60,7 @@ index b4e7c41209d..dd3b058110a 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 717e839bd41..852ac6c5889 100644 63index 717e839bd4..852ac6c588 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-Binutils-security-check-is-causing-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
deleted file mode 100644
index 97d75650..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Patch-Microblaze-Binutils-security-check-is-causing-.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 8293b0cf15d4411402a2b0b50e4c532093c5d952 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 11 Mar 2019 14:23:58 +0530
4Subject: [PATCH 25/40] [Patch,Microblaze] : Binutils security check is causing
5 build error for windows builds.commenting for now.
6
7---
8 bfd/elf-attrs.c | 2 ++
9 1 file changed, 2 insertions(+)
10
11diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
12index 070104c2734..8331c8759d5 100644
13--- a/bfd/elf-attrs.c
14+++ b/bfd/elf-attrs.c
15@@ -442,6 +442,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
16 if (hdr->sh_size == 0)
17 return;
18
19+ #if 0
20 filesize = bfd_get_file_size (abfd);
21 if (filesize != 0 && hdr->sh_size > filesize)
22 {
23@@ -451,6 +452,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
24 bfd_set_error (bfd_error_invalid_operation);
25 return;
26 }
27+ #endif
28
29 contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1);
30 if (!contents)
31--
322.17.1
33
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch
index ebd1fa4c..9d1b1794 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0026-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -1,7 +1,7 @@
1From 987bd08638fab099dcfdce412448734182be51e6 Mon Sep 17 00:00:00 2001 1From 49fdaa5a4f0ed7e20b82ccb8d0db53075777abe9 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530 3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 26/40] fixing the long & long long mingw toolchain issue 4Subject: [PATCH 25/52] fixing the long & long long mingw toolchain issue
5 5
6--- 6---
7 gas/config/tc-microblaze.c | 10 +++++----- 7 gas/config/tc-microblaze.c | 10 +++++-----
@@ -9,10 +9,10 @@ Subject: [PATCH 26/40] 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 4bd71557ca2..83e17c60fa0 100644 12index 532a26eaa5..b00b759893 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@@ -797,7 +797,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) 15@@ -783,7 +783,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 4bd71557ca2..83e17c60fa0 100644
21 { 21 {
22 char *new_pointer; 22 char *new_pointer;
23 char *atp; 23 char *atp;
24@@ -848,11 +848,11 @@ parse_imml (char * s, expressionS * e, long min, long max) 24@@ -834,11 +834,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 4bd71557ca2..83e17c60fa0 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 f9709412097..77d74c17f3a 100644 41index f970941209..77d74c17f3 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/0027-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Added-support-to-new-arithmetic-single-register-inst.patch
index 12f44a6d..6379a5c4 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Added-support-to-new-arithmetic-single-register-inst.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -1,21 +1,23 @@
1From dde3395588ca91a7c484cc4a003f72f80848c534 Mon Sep 17 00:00:00 2001 1From b29e6a15c9f65837dbb560aa6c41c49e591915e9 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530 3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 27/40] Added support to new arithmetic single register 4Subject: [PATCH 26/52] Added support to new arithmetic single register
5 instructions 5 instructions
6 6
7Conflicts:
8 opcodes/microblaze-dis.c
7--- 9---
8 gas/config/tc-microblaze.c | 145 ++++++++++++++++++++++++++++++++++++- 10 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
9 opcodes/microblaze-dis.c | 13 +++- 11 opcodes/microblaze-dis.c | 13 +++-
10 opcodes/microblaze-opc.h | 45 +++++++++++- 12 opcodes/microblaze-opc.h | 43 ++++++++++-
11 opcodes/microblaze-opcm.h | 5 +- 13 opcodes/microblaze-opcm.h | 5 +-
12 4 files changed, 201 insertions(+), 7 deletions(-) 14 4 files changed, 201 insertions(+), 7 deletions(-)
13 15
14diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 16diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
15index 83e17c60fa0..b4330652758 100644 17index b00b759893..eca060b262 100644
16--- a/gas/config/tc-microblaze.c 18--- a/gas/config/tc-microblaze.c
17+++ b/gas/config/tc-microblaze.c 19+++ b/gas/config/tc-microblaze.c
18@@ -422,12 +422,33 @@ void 20@@ -423,12 +423,33 @@ void
19 md_begin (void) 21 md_begin (void)
20 { 22 {
21 struct op_code_struct * opcode; 23 struct op_code_struct * opcode;
@@ -26,7 +28,7 @@ index 83e17c60fa0..b4330652758 100644
26 /* Insert unique names into hash table. */ 28 /* Insert unique names into hash table. */
27- for (opcode = opcodes; opcode->name; opcode ++) 29- for (opcode = opcodes; opcode->name; opcode ++)
28- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); 30- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
29+ for (opcode = (struct op_code_struct *)opcodes; opcode->name; opcode ++) 31+ for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++)
30+ { 32+ {
31+ if (strcmp (prev_name, opcode->name)) 33+ if (strcmp (prev_name, opcode->name))
32+ { 34+ {
@@ -51,7 +53,7 @@ index 83e17c60fa0..b4330652758 100644
51 } 53 }
52 54
53 /* Try to parse a reg name. */ 55 /* Try to parse a reg name. */
54@@ -1000,6 +1021,7 @@ md_assemble (char * str) 56@@ -986,6 +1007,7 @@ md_assemble (char * str)
55 { 57 {
56 char * op_start; 58 char * op_start;
57 char * op_end; 59 char * op_end;
@@ -59,15 +61,19 @@ index 83e17c60fa0..b4330652758 100644
59 struct op_code_struct * opcode, *opcode1; 61 struct op_code_struct * opcode, *opcode1;
60 char * output = NULL; 62 char * output = NULL;
61 int nlen = 0; 63 int nlen = 0;
62@@ -1013,6 +1035,7 @@ md_assemble (char * str) 64@@ -996,9 +1018,10 @@ md_assemble (char * str)
63 expressionS exp; 65 unsigned reg3;
66 unsigned isize;
67 unsigned long immed, immed2, temp;
68- expressionS exp;
69+ expressionS exp,exp1;
64 char name[20]; 70 char name[20];
65 long immedl; 71 long immedl;
66+ int reg=0; 72+ int reg=0;
67 73
68 /* Drop leading whitespace. */ 74 /* Drop leading whitespace. */
69 while (ISSPACE (* str)) 75 while (ISSPACE (* str))
70@@ -1043,7 +1066,78 @@ md_assemble (char * str) 76@@ -1029,7 +1052,78 @@ md_assemble (char * str)
71 as_bad (_("unknown opcode \"%s\""), name); 77 as_bad (_("unknown opcode \"%s\""), name);
72 return; 78 return;
73 } 79 }
@@ -147,7 +153,7 @@ index 83e17c60fa0..b4330652758 100644
147 inst = opcode->bit_sequence; 153 inst = opcode->bit_sequence;
148 isize = 4; 154 isize = 4;
149 155
150@@ -1494,6 +1588,51 @@ md_assemble (char * str) 156@@ -1480,6 +1574,51 @@ md_assemble (char * str)
151 inst |= (immed << IMM_LOW) & IMM15_MASK; 157 inst |= (immed << IMM_LOW) & IMM15_MASK;
152 break; 158 break;
153 159
@@ -200,14 +206,13 @@ index 83e17c60fa0..b4330652758 100644
200 if (strcmp (op_end, "")) 206 if (strcmp (op_end, ""))
201 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 207 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
202diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 208diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
203index fc8e79b19cf..f5db1189240 100644 209index 1dc11a2653..90d2328659 100644
204--- a/opcodes/microblaze-dis.c 210--- a/opcodes/microblaze-dis.c
205+++ b/opcodes/microblaze-dis.c 211+++ b/opcodes/microblaze-dis.c
206@@ -131,6 +131,15 @@ get_field_imm15 (struct string_buf *buf, long instr) 212@@ -130,9 +130,17 @@ get_field_imm15 (struct string_buf *buf, long instr)
207 return p; 213 return p;
208 } 214 }
209 215
210+static char *
211+get_field_imm16 (struct string_buf *buf, long instr) 216+get_field_imm16 (struct string_buf *buf, long instr)
212+{ 217+{
213+ char *p = strbuf (buf); 218+ char *p = strbuf (buf);
@@ -218,27 +223,23 @@ index fc8e79b19cf..f5db1189240 100644
218+ 223+
219 static char * 224 static char *
220 get_field_special (struct string_buf *buf, long instr, 225 get_field_special (struct string_buf *buf, long instr,
221 struct op_code_struct *op) 226- struct op_code_struct *op)
222@@ -450,6 +459,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 227+ struct op_code_struct *op)
223 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), 228 {
224 get_field_imm15 (&buf, inst)); 229 char *p = strbuf (buf);
225 break; 230 char *spr;
226+ case INST_TYPE_RD_IMML: 231@@ -456,6 +464,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
227+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
228+ break;
229 /* For mbar insn. */
230 case INST_TYPE_IMM5:
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. */ 232 /* For mbar 16 or sleep insn. */
234 case INST_TYPE_NONE: 233 case INST_TYPE_NONE:
235 break; 234 break;
236- /* For tuqula instruction */ 235+ case INST_TYPE_RD_IMML:
236+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
237+ break;
237 /* For bit field insns. */ 238 /* For bit field insns. */
238 case INST_TYPE_RD_R1_IMMW_IMMS: 239 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), 240 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_immw (&buf, inst), get_field_imms (&buf, inst));
240diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 241diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
241index 77d74c17f3a..bd1cc90bff6 100644 242index 77d74c17f3..c1b453c95e 100644
242--- a/opcodes/microblaze-opc.h 243--- a/opcodes/microblaze-opc.h
243+++ b/opcodes/microblaze-opc.h 244+++ b/opcodes/microblaze-opc.h
244@@ -69,6 +69,7 @@ 245@@ -69,6 +69,7 @@
@@ -291,7 +292,7 @@ index 77d74c17f3a..bd1cc90bff6 100644
291 /* New Mask for msrset, msrclr insns. */ 292 /* New Mask for msrset, msrclr insns. */
292 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */ 293 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
293 /* Mask for mbar insn. */ 294 /* Mask for mbar insn. */
294@@ -114,13 +143,13 @@ 295@@ -114,7 +143,7 @@
295 #define DELAY_SLOT 1 296 #define DELAY_SLOT 1
296 #define NO_DELAY_SLOT 0 297 #define NO_DELAY_SLOT 0
297 298
@@ -300,13 +301,6 @@ index 77d74c17f3a..bd1cc90bff6 100644
300 301
301 struct op_code_struct 302 struct op_code_struct
302 { 303 {
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
310@@ -444,13 +473,21 @@ struct op_code_struct 304@@ -444,13 +473,21 @@ struct op_code_struct
311 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst }, 305 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, 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 }, 306 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
@@ -344,7 +338,7 @@ index 77d74c17f3a..bd1cc90bff6 100644
344 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst }, 338 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
345 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst }, 339 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
346diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 340diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
347index ad8b8ce345b..86cdb3b0715 100644 341index fcf259a362..eca247c63b 100644
348--- a/opcodes/microblaze-opcm.h 342--- a/opcodes/microblaze-opcm.h
349+++ b/opcodes/microblaze-opcm.h 343+++ b/opcodes/microblaze-opcm.h
350@@ -61,7 +61,9 @@ enum microblaze_instr 344@@ -61,7 +61,9 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
index a8d5a385..e3826d6f 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
@@ -1,19 +1,19 @@
1From 623f4e7ea6c18bec0e141c7471c7bd609bd9a6d7 Mon Sep 17 00:00:00 2001 1From 653712c23456574468c426aebbeb5ee8dae7237e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530 3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 28/40] [Patch,MicroBlaze] : double imml generation for 64 bit 4Subject: [PATCH 27/52] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values. 5 values.
6 6
7--- 7---
8 gas/config/tc-microblaze.c | 324 ++++++++++++++++++++++++++++++------- 8 gas/config/tc-microblaze.c | 322 ++++++++++++++++++++++++++++++-------
9 opcodes/microblaze-opc.h | 4 +- 9 opcodes/microblaze-opc.h | 4 +-
10 2 files changed, 264 insertions(+), 64 deletions(-) 10 2 files changed, 263 insertions(+), 63 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 b4330652758..f5cc1e05f7e 100644 13index eca060b262..aef54ad83f 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@@ -1022,7 +1022,7 @@ md_assemble (char * str) 16@@ -1008,7 +1008,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,21 +22,20 @@ index b4330652758..f5cc1e05f7e 100644
22 char * output = NULL; 22 char * output = NULL;
23 int nlen = 0; 23 int nlen = 0;
24 int i; 24 int i;
25@@ -1206,7 +1206,12 @@ md_assemble (char * str) 25@@ -1192,7 +1192,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);
30+ { 29+ {
31+ if (microblaze_arch_size == 64) 30+ if(microblaze_arch_size == 64)
32+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML); 31+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
33+ else 32+ else
34+ op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM); 33 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
35+ } 34+ }
36 else 35 else
37 as_fatal (_("Error in statement syntax")); 36 as_fatal (_("Error in statement syntax"));
38 37
39@@ -1302,24 +1307,51 @@ md_assemble (char * str) 38@@ -1288,24 +1293,51 @@ md_assemble (char * str)
40 || streq (name, "lwi") || streq (name, "sbi") 39 || streq (name, "lwi") || streq (name, "sbi")
41 || streq (name, "shi") || streq (name, "swi")))) 40 || streq (name, "shi") || streq (name, "swi"))))
42 { 41 {
@@ -52,48 +51,48 @@ index b4330652758..f5cc1e05f7e 100644
52+ { 51+ {
53+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 52+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
54+ if (opcode1 == NULL) 53+ if (opcode1 == NULL)
55 {
56 as_bad (_("unknown opcode \"%s\""), "imml");
57 return;
58 }
59 inst1 = opcode1->bit_sequence;
60- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
61+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
62 output[0] = INST_BYTE0 (inst1);
63 output[1] = INST_BYTE1 (inst1);
64 output[2] = INST_BYTE2 (inst1);
65 output[3] = INST_BYTE3 (inst1);
66 output = frag_more (isize);
67 }
68+ else
69+ {
70+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
71+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
72+ if (opcode1 == NULL || opcode2 == NULL)
73+ { 54+ {
74+ as_bad (_("unknown opcode \"%s\""), "imml"); 55+ as_bad (_("unknown opcode \"%s\""), "imml");
75+ return; 56+ return;
76+ } 57+ }
77+ inst1 = opcode2->bit_sequence; 58+ inst1 = opcode1->bit_sequence;
78+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; 59+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
79+ output[0] = INST_BYTE0 (inst1); 60+ output[0] = INST_BYTE0 (inst1);
80+ output[1] = INST_BYTE1 (inst1); 61+ output[1] = INST_BYTE1 (inst1);
81+ output[2] = INST_BYTE2 (inst1); 62+ output[2] = INST_BYTE2 (inst1);
82+ output[3] = INST_BYTE3 (inst1); 63+ output[3] = INST_BYTE3 (inst1);
83+ output = frag_more (isize); 64+ output = frag_more (isize);
84+ inst1 = opcode1->bit_sequence; 65+ }
85+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 66+ else
67+ {
68+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
69+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
70+ if (opcode1 == NULL || opcode2 == NULL)
71 {
72 as_bad (_("unknown opcode \"%s\""), "imml");
73 return;
74 }
75+ inst1 = opcode2->bit_sequence;
76+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
86+ output[0] = INST_BYTE0 (inst1); 77+ output[0] = INST_BYTE0 (inst1);
87+ output[1] = INST_BYTE1 (inst1); 78+ output[1] = INST_BYTE1 (inst1);
88+ output[2] = INST_BYTE2 (inst1); 79+ output[2] = INST_BYTE2 (inst1);
89+ output[3] = INST_BYTE3 (inst1); 80+ output[3] = INST_BYTE3 (inst1);
90+ output = frag_more (isize); 81+ output = frag_more (isize);
91+ } 82 inst1 = opcode1->bit_sequence;
83- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
84+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
85 output[0] = INST_BYTE0 (inst1);
86 output[1] = INST_BYTE1 (inst1);
87 output[2] = INST_BYTE2 (inst1);
88 output[3] = INST_BYTE3 (inst1);
89 output = frag_more (isize);
90 }
92+ } 91+ }
93 inst |= (reg1 << RD_LOW) & RD_MASK; 92 inst |= (reg1 << RD_LOW) & RD_MASK;
94 inst |= (reg2 << RA_LOW) & RA_MASK; 93 inst |= (reg2 << RA_LOW) & RA_MASK;
95 inst |= (immed << IMM_LOW) & IMM_MASK; 94 inst |= (immed << IMM_LOW) & IMM_MASK;
96@@ -1330,14 +1362,13 @@ md_assemble (char * str) 95@@ -1316,14 +1348,13 @@ md_assemble (char * str)
97 if ((temp != 0) && (temp != 0xFFFF8000)) 96 if ((temp != 0) && (temp != 0xFFFF8000))
98 { 97 {
99 /* Needs an immediate inst. */ 98 /* Needs an immediate inst. */
@@ -110,7 +109,7 @@ index b4330652758..f5cc1e05f7e 100644
110 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK; 109 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
111 output[0] = INST_BYTE0 (inst1); 110 output[0] = INST_BYTE0 (inst1);
112 output[1] = INST_BYTE1 (inst1); 111 output[1] = INST_BYTE1 (inst1);
113@@ -1578,7 +1609,7 @@ md_assemble (char * str) 112@@ -1564,7 +1595,7 @@ md_assemble (char * str)
114 as_fatal (_("Cannot use special register with this instruction")); 113 as_fatal (_("Cannot use special register with this instruction"));
115 114
116 if (exp.X_op != O_constant) 115 if (exp.X_op != O_constant)
@@ -119,7 +118,7 @@ index b4330652758..f5cc1e05f7e 100644
119 else 118 else
120 { 119 {
121 output = frag_more (isize); 120 output = frag_more (isize);
122@@ -1912,8 +1943,9 @@ md_assemble (char * str) 121@@ -1898,8 +1929,9 @@ md_assemble (char * str)
123 temp = immed & 0xFFFF8000; 122 temp = immed & 0xFFFF8000;
124 if ((temp != 0) && (temp != 0xFFFF8000)) 123 if ((temp != 0) && (temp != 0xFFFF8000))
125 { 124 {
@@ -130,7 +129,7 @@ index b4330652758..f5cc1e05f7e 100644
130 if (opcode1 == NULL) 129 if (opcode1 == NULL)
131 { 130 {
132 as_bad (_("unknown opcode \"%s\""), "imm"); 131 as_bad (_("unknown opcode \"%s\""), "imm");
133@@ -1942,7 +1974,12 @@ md_assemble (char * str) 132@@ -1928,7 +1960,12 @@ md_assemble (char * str)
134 reg1 = 0; 133 reg1 = 0;
135 } 134 }
136 if (strcmp (op_end, "")) 135 if (strcmp (op_end, ""))
@@ -143,7 +142,7 @@ index b4330652758..f5cc1e05f7e 100644
143 else 142 else
144 as_fatal (_("Error in statement syntax")); 143 as_fatal (_("Error in statement syntax"));
145 144
146@@ -1981,30 +2018,55 @@ md_assemble (char * str) 145@@ -1967,30 +2004,55 @@ md_assemble (char * str)
147 } 146 }
148 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai")) 147 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
149 { 148 {
@@ -204,8 +203,8 @@ index b4330652758..f5cc1e05f7e 100644
204 temp = immed & 0xFFFF8000; 203 temp = immed & 0xFFFF8000;
205 if ((temp != 0) && (temp != 0xFFFF8000)) 204 if ((temp != 0) && (temp != 0xFFFF8000))
206 { 205 {
207@@ -2090,25 +2152,50 @@ md_assemble (char * str) 206@@ -2076,25 +2138,50 @@ md_assemble (char * str)
208 streq (name, "breaid") || 207 streq (name, "breaid") ||
209 streq (name, "brai") || streq (name, "braid"))) 208 streq (name, "brai") || streq (name, "braid")))
210 { 209 {
211- temp = immed & 0xFFFFFF8000; 210- temp = immed & 0xFFFFFF8000;
@@ -259,7 +258,7 @@ index b4330652758..f5cc1e05f7e 100644
259 inst |= (immed << IMM_LOW) & IMM_MASK; 258 inst |= (immed << IMM_LOW) & IMM_MASK;
260 } 259 }
261 else 260 else
262@@ -2208,21 +2295,45 @@ md_assemble (char * str) 261@@ -2194,21 +2281,45 @@ md_assemble (char * str)
263 { 262 {
264 output = frag_more (isize); 263 output = frag_more (isize);
265 immedl = exp.X_add_number; 264 immedl = exp.X_add_number;
@@ -320,7 +319,7 @@ index b4330652758..f5cc1e05f7e 100644
320 } 319 }
321 320
322 inst |= (reg1 << RD_LOW) & RD_MASK; 321 inst |= (reg1 << RD_LOW) & RD_MASK;
323@@ -2271,21 +2382,46 @@ md_assemble (char * str) 322@@ -2257,21 +2368,46 @@ md_assemble (char * str)
324 { 323 {
325 output = frag_more (isize); 324 output = frag_more (isize);
326 immedl = exp.X_add_number; 325 immedl = exp.X_add_number;
@@ -375,7 +374,7 @@ index b4330652758..f5cc1e05f7e 100644
375 374
376 inst |= (reg1 << RA_LOW) & RA_MASK; 375 inst |= (reg1 << RA_LOW) & RA_MASK;
377 inst |= (immedl << IMM_LOW) & IMM_MASK; 376 inst |= (immedl << IMM_LOW) & IMM_MASK;
378@@ -2565,8 +2701,8 @@ md_apply_fix (fixS * fixP, 377@@ -2551,8 +2687,8 @@ md_apply_fix (fixS * fixP,
379 /* Note: use offsetT because it is signed, valueT is unsigned. */ 378 /* Note: use offsetT because it is signed, valueT is unsigned. */
380 offsetT val = (offsetT) * valp; 379 offsetT val = (offsetT) * valp;
381 int i; 380 int i;
@@ -386,7 +385,7 @@ index b4330652758..f5cc1e05f7e 100644
386 385
387 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>"); 386 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
388 387
389@@ -2749,30 +2885,75 @@ md_apply_fix (fixS * fixP, 388@@ -2735,30 +2871,75 @@ md_apply_fix (fixS * fixP,
390 case BFD_RELOC_MICROBLAZE_64_TEXTREL: 389 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
391 case BFD_RELOC_MICROBLAZE_64: 390 case BFD_RELOC_MICROBLAZE_64:
392 case BFD_RELOC_MICROBLAZE_64_PCREL: 391 case BFD_RELOC_MICROBLAZE_64_PCREL:
@@ -472,7 +471,7 @@ index b4330652758..f5cc1e05f7e 100644
472 /* Generate the imm instruction. */ 471 /* Generate the imm instruction. */
473 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 472 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
474 if (opcode1 == NULL) 473 if (opcode1 == NULL)
475@@ -2784,12 +2965,11 @@ md_apply_fix (fixS * fixP, 474@@ -2770,12 +2951,11 @@ md_apply_fix (fixS * fixP,
476 inst1 = opcode1->bit_sequence; 475 inst1 = opcode1->bit_sequence;
477 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 476 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
478 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 477 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
@@ -486,7 +485,7 @@ index b4330652758..f5cc1e05f7e 100644
486 /* Add the value only if the symbol is defined. */ 485 /* Add the value only if the symbol is defined. */
487 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 486 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
488 { 487 {
489@@ -2821,21 +3001,41 @@ md_apply_fix (fixS * fixP, 488@@ -2807,21 +2987,41 @@ md_apply_fix (fixS * fixP,
490 /* Add an imm instruction. First save the current instruction. */ 489 /* Add an imm instruction. First save the current instruction. */
491 for (i = 0; i < INST_WORD_SIZE; i++) 490 for (i = 0; i < INST_WORD_SIZE; i++)
492 buf[i + INST_WORD_SIZE] = buf[i]; 491 buf[i + INST_WORD_SIZE] = buf[i];
@@ -533,7 +532,7 @@ index b4330652758..f5cc1e05f7e 100644
533 within the same section only. */ 532 within the same section only. */
534 buf[0] = INST_BYTE0 (inst1); 533 buf[0] = INST_BYTE0 (inst1);
535diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 534diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
536index bd1cc90bff6..cf5b5920921 100644 535index c1b453c95e..ba0b3f8b62 100644
537--- a/opcodes/microblaze-opc.h 536--- a/opcodes/microblaze-opc.h
538+++ b/opcodes/microblaze-opc.h 537+++ b/opcodes/microblaze-opc.h
539@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; 538@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
@@ -542,7 +541,7 @@ index bd1cc90bff6..cf5b5920921 100644
542 541
543-#define MIN_IMML ((long long) 0xffffff8000000000L) 542-#define MIN_IMML ((long long) 0xffffff8000000000L)
544-#define MAX_IMML ((long long) 0x0000007fffffffffL) 543-#define MAX_IMML ((long long) 0x0000007fffffffffL)
545+#define MIN_IMML ((long long) -9223372036854775807) 544+#define MIN_IMML ((long long) -9223372036854775808)
546+#define MAX_IMML ((long long) 9223372036854775807) 545+#define MAX_IMML ((long long) 9223372036854775807)
547 546
548 #endif /* MICROBLAZE_OPC */ 547 #endif /* MICROBLAZE_OPC */
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
index 3720f2dc..e8c55106 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0029-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
@@ -1,7 +1,7 @@
1From b7b5caa314177cfe8aeb0fb6d748f6e52fe51a83 Mon Sep 17 00:00:00 2001 1From 2c051a6d5326e34cb4a3170073cda17e7269055d 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 29/40] Fixed bug in generation of IMML instruction for the new 4Subject: [PATCH 28/52] 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 29/40] 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 f5cc1e05f7e..efd1a42769e 100644 12index aef54ad83f..647cfb6869 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@@ -1653,12 +1653,56 @@ md_assemble (char * str) 15@@ -1639,12 +1639,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 f5cc1e05f7e..efd1a42769e 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@@ -2152,8 +2196,8 @@ md_assemble (char * str) 73@@ -2138,8 +2182,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/0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
new file mode 100644
index 00000000..abfcdabc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
@@ -0,0 +1,38 @@
1From 77751e719ba1470f3dc869ae309485adb02819b6 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH 29/52] [Patch,MicroBlaze m64] : This patch will remove imml 0
5 and imml -1 instructions when the offset is less than 16 bit for Type A
6 branch EA 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 647cfb6869..e565b2a99d 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@@ -2916,7 +2914,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/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
new file mode 100644
index 00000000..b8f8b8bd
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
@@ -0,0 +1,39 @@
1From 2a43e06f14cac633d87f5b213a6bacd16085967f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Jun 2020 21:20:26 +0530
4Subject: [PATCH 30/52] [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 9977195074..a2c44cf719 100644
15--- a/ld/ldlang.c
16+++ b/ld/ldlang.c
17@@ -3657,10 +3657,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/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
deleted file mode 100644
index 8cd3563b..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-m64-Update-imml-instructions-for-Ty.patch
+++ /dev/null
@@ -1,47 +0,0 @@
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/0032-gas-revert-moving-of-md_pseudo_table-from-const.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0031-gas-revert-moving-of-md_pseudo_table-from-const.patch
index 0e813f96..83b293f3 100644
--- 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/0031-gas-revert-moving-of-md_pseudo_table-from-const.patch
@@ -1,7 +1,7 @@
1From 4d0c68ffb688c23f984de8c0a22af824c3902d83 Mon Sep 17 00:00:00 2001 1From c45a69deeb210ebdb80cf055cef9e62bd0bda053 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org> 2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 16 Jul 2020 12:38:11 -0500 3Date: Thu, 16 Jul 2020 12:38:11 -0500
4Subject: [PATCH 32/40] gas: revert moving of md_pseudo_table from const 4Subject: [PATCH 31/52] gas: revert moving of md_pseudo_table from const
5 5
6The base system expect md_pseudo_table to be constant, Changing the 6The base system expect md_pseudo_table to be constant, Changing the
7definition will break other architectures when compiled with a 7definition will break other architectures when compiled with a
@@ -18,10 +18,10 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
18 2 files changed, 14 insertions(+), 4 deletions(-) 18 2 files changed, 14 insertions(+), 4 deletions(-)
19 19
20diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 20diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
21index 1d838abfefa..da99d4ef482 100644 21index e565b2a99d..c6ca913f8b 100644
22--- a/gas/config/tc-microblaze.c 22--- a/gas/config/tc-microblaze.c
23+++ b/gas/config/tc-microblaze.c 23+++ b/gas/config/tc-microblaze.c
24@@ -384,6 +384,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 24@@ -385,6 +385,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
25 demand_empty_rest_of_line (); 25 demand_empty_rest_of_line ();
26 } 26 }
27 27
@@ -39,7 +39,7 @@ index 1d838abfefa..da99d4ef482 100644
39 /* This table describes all the machine specific pseudo-ops the assembler 39 /* This table describes all the machine specific pseudo-ops the assembler
40 has to support. The fields are: 40 has to support. The fields are:
41 Pseudo-op name without dot 41 Pseudo-op name without dot
42@@ -391,7 +402,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 42@@ -392,7 +403,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
43 Integer arg to pass to the function. */ 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, 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. */ 45 and then in the read.c table. */
@@ -48,7 +48,7 @@ index 1d838abfefa..da99d4ef482 100644
48 { 48 {
49 {"lcomm", microblaze_s_lcomm, 1}, 49 {"lcomm", microblaze_s_lcomm, 1},
50 {"data", microblaze_s_data, 0}, 50 {"data", microblaze_s_data, 0},
51@@ -400,7 +411,7 @@ pseudo_typeS md_pseudo_table[] = 51@@ -401,7 +412,7 @@ pseudo_typeS md_pseudo_table[] =
52 {"data32", cons, 4}, /* Same as word. */ 52 {"data32", cons, 4}, /* Same as word. */
53 {"ent", s_func, 0}, /* Treat ent as function entry point. */ 53 {"ent", s_func, 0}, /* Treat ent as function entry point. */
54 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ 54 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
@@ -57,7 +57,7 @@ index 1d838abfefa..da99d4ef482 100644
57 {"weakext", microblaze_s_weakext, 0}, 57 {"weakext", microblaze_s_weakext, 0},
58 {"rodata", microblaze_s_rdata, 0}, 58 {"rodata", microblaze_s_rdata, 0},
59 {"sdata2", microblaze_s_rdata, 1}, 59 {"sdata2", microblaze_s_rdata, 1},
60@@ -3464,7 +3475,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 60@@ -3448,7 +3459,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
61 case OPTION_M64: 61 case OPTION_M64:
62 //if (arg != NULL && strcmp (arg, "64") == 0) 62 //if (arg != NULL && strcmp (arg, "64") == 0)
63 microblaze_arch_size = 64; 63 microblaze_arch_size = 64;
@@ -66,7 +66,7 @@ index 1d838abfefa..da99d4ef482 100644
66 default: 66 default:
67 return 0; 67 return 0;
68diff --git a/gas/tc.h b/gas/tc.h 68diff --git a/gas/tc.h b/gas/tc.h
69index 5bdfe5c3475..da1738d67a8 100644 69index 5bdfe5c347..da1738d67a 100644
70--- a/gas/tc.h 70--- a/gas/tc.h
71+++ b/gas/tc.h 71+++ b/gas/tc.h
72@@ -22,7 +22,7 @@ 72@@ -22,7 +22,7 @@
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
deleted file mode 100644
index fda23a1a..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0031-ldlang.c-Workaround-for-improper-address-mapping-cau.patch
+++ /dev/null
@@ -1,38 +0,0 @@
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-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
new file mode 100644
index 00000000..8891a77f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
@@ -0,0 +1,43 @@
1From 7b285c827edbc34cf79d4ed0f46cdfd4916b687c Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Mon, 30 Nov 2020 16:17:36 -0800
4Subject: [PATCH 32/52] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14---
15 ld/emulparams/elf64microblaze.sh | 2 +-
16 ld/emulparams/elf64microblazeel.sh | 2 +-
17 2 files changed, 2 insertions(+), 2 deletions(-)
18
19diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
20index 9c7b0eb708..7b4c7c411b 100644
21--- a/ld/emulparams/elf64microblaze.sh
22+++ b/ld/emulparams/elf64microblaze.sh
23@@ -19,5 +19,5 @@ NOP=0x80000000
24 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
25 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
26
27-TEMPLATE_NAME=elf32
28+TEMPLATE_NAME=elf
29 #GENERATE_SHLIB_SCRIPT=yes
30diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
31index 9c7b0eb708..7b4c7c411b 100644
32--- a/ld/emulparams/elf64microblazeel.sh
33+++ b/ld/emulparams/elf64microblazeel.sh
34@@ -19,5 +19,5 @@ NOP=0x80000000
35 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
36 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
37
38-TEMPLATE_NAME=elf32
39+TEMPLATE_NAME=elf
40 #GENERATE_SHLIB_SCRIPT=yes
41--
422.17.1
43
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
index 00e5410c..b296e1b1 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -1,7 +1,7 @@
1From c466a54f6ac8fae44f3e79e33bb782086dc08a2b Mon Sep 17 00:00:00 2001 1From 3f506a7c6a8f7b746102276f3c41a7b11bd7ac3c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 23 Jan 2017 19:07:44 +0530 3Date: Mon, 23 Jan 2017 19:07:44 +0530
4Subject: [PATCH 34/40] Add initial port of linux gdbserver add 4Subject: [PATCH 33/52] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux 5 gdb_proc_service_h to gdbserver microblaze-linux
6 6
7gdbserver needs to initialise the microblaze registers 7gdbserver needs to initialise the microblaze registers
@@ -20,22 +20,18 @@ architecture specific setup - may need to add in future
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22--- 22---
23 gdb/configure.host | 3 + 23 gdb/configure.host | 3 +
24 gdb/features/microblaze-linux.xml | 12 ++ 24 gdb/microblaze-linux-tdep.c | 29 ++++-
25 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++++++++++++++++++++++ 25 gdb/microblaze-tdep.c | 35 +++++-
26 gdb/microblaze-linux-tdep.c | 29 +++- 26 gdb/microblaze-tdep.h | 4 +-
27 gdb/microblaze-tdep.c | 35 ++++- 27 gdb/regformats/reg-microblaze.dat | 41 +++++++
28 gdb/microblaze-tdep.h | 4 +- 28 gdbserver/linux-microblaze-low.c | 189 ++++++++++++++++++++++++++++++
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
34 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
35 create mode 100644 gdb/regformats/reg-microblaze.dat 30 create mode 100644 gdb/regformats/reg-microblaze.dat
31 create mode 100644 gdbserver/linux-microblaze-low.c
36 32
37diff --git a/gdb/configure.host b/gdb/configure.host 33diff --git a/gdb/configure.host b/gdb/configure.host
38index ce528237291..cf1a08e8b28 100644 34index ce52823729..cf1a08e8b2 100644
39--- a/gdb/configure.host 35--- a/gdb/configure.host
40+++ b/gdb/configure.host 36+++ b/gdb/configure.host
41@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;; 37@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;;
@@ -55,29 +51,195 @@ index ce528237291..cf1a08e8b28 100644
55 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) 51 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
56 gdb_host=aix ;; 52 gdb_host=aix ;;
57 powerpc*-*-freebsd*) gdb_host=fbsd ;; 53 powerpc*-*-freebsd*) gdb_host=fbsd ;;
58diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml 54diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
55index be710bedb6..fb8241884b 100644
56--- a/gdb/microblaze-linux-tdep.c
57+++ b/gdb/microblaze-linux-tdep.c
58@@ -37,6 +37,22 @@
59 #include "tramp-frame.h"
60 #include "linux-tdep.h"
61
62+static int microblaze_debug_flag = 0;
63+
64+static void
65+microblaze_debug (const char *fmt, ...)
66+{
67+ if (microblaze_debug_flag)
68+ {
69+ va_list args;
70+
71+ va_start (args, fmt);
72+ printf_unfiltered ("MICROBLAZE LINUX: ");
73+ vprintf_unfiltered (fmt, args);
74+ va_end (args);
75+ }
76+}
77+
78 static int
79 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
80 struct bp_target_info *bp_tgt)
81@@ -46,18 +62,25 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
82 int val;
83 int bplen;
84 gdb_byte old_contents[BREAKPOINT_MAX];
85+ struct cleanup *cleanup;
86
87 /* Determine appropriate breakpoint contents and size for this address. */
88 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
89
90+ /* Make sure we see the memory breakpoints. */
91+ cleanup = make_show_memory_breakpoints_cleanup (1);
92 val = target_read_memory (addr, old_contents, bplen);
93
94 /* If our breakpoint is no longer at the address, this means that the
95 program modified the code on us, so it is wrong to put back the
96 old value. */
97 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
98- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
99+ {
100+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
101+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
102+ }
103
104+ do_cleanups (cleanup);
105 return val;
106 }
107
108@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
109 /* Trampolines. */
110 tramp_frame_prepend_unwinder (gdbarch,
111 &microblaze_linux_sighandler_tramp_frame);
112+
113+ /* Enable TLS support. */
114+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
115+ svr4_fetch_objfile_link_map);
116 }
117
118 void _initialize_microblaze_linux_tdep ();
119diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
120index 5c80413304..443adfb364 100644
121--- a/gdb/microblaze-tdep.c
122+++ b/gdb/microblaze-tdep.c
123@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
124 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
125
126 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
127-
128+static int
129+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
130+ struct bp_target_info *bp_tgt)
131+{
132+ CORE_ADDR addr = bp_tgt->placed_address;
133+ const unsigned char *bp;
134+ int val;
135+ int bplen;
136+ gdb_byte old_contents[BREAKPOINT_MAX];
137+ struct cleanup *cleanup;
138+
139+ /* Determine appropriate breakpoint contents and size for this address. */
140+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
141+ if (bp == NULL)
142+ error (_("Software breakpoints not implemented for this target."));
143+
144+ /* Make sure we see the memory breakpoints. */
145+ cleanup = make_show_memory_breakpoints_cleanup (1);
146+ val = target_read_memory (addr, old_contents, bplen);
147+
148+ /* If our breakpoint is no longer at the address, this means that the
149+ program modified the code on us, so it is wrong to put back the
150+ old value. */
151+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
152+ {
153+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
154+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
155+ }
156+
157+ do_cleanups (cleanup);
158+ return val;
159+}
160
161 /* Allocate and initialize a frame cache. */
162
163@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
164 microblaze_breakpoint::kind_from_pc);
165 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
166 microblaze_breakpoint::bp_from_kind);
167+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
168
169 set_gdbarch_frame_args_skip (gdbarch, 8);
170
171@@ -771,4 +803,5 @@ When non-zero, microblaze specific debugging is enabled."),
172 NULL,
173 &setdebuglist, &showdebuglist);
174
175+
176 }
177diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
178index 4fbdf9933f..db0772643d 100644
179--- a/gdb/microblaze-tdep.h
180+++ b/gdb/microblaze-tdep.h
181@@ -117,6 +117,8 @@ struct microblaze_frame_cache
182
183 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
184 Only used for native debugging. */
185-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
186+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
187+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
188+
189
190 #endif /* microblaze-tdep.h */
191diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
59new file mode 100644 192new file mode 100644
60index 00000000000..8983e66eb3d 193index 0000000000..bd8a438442
61--- /dev/null 194--- /dev/null
62+++ b/gdb/features/microblaze-linux.xml 195+++ b/gdb/regformats/reg-microblaze.dat
63@@ -0,0 +1,12 @@ 196@@ -0,0 +1,41 @@
64+<?xml version="1.0"?> 197+name:microblaze
65+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. 198+expedite:r1,pc
66+ 199+32:r0
67+ Copying and distribution of this file, with or without modification, 200+32:r1
68+ are permitted in any medium without royalty provided the copyright 201+32:r2
69+ notice and this notice are preserved. --> 202+32:r3
70+ 203+32:r4
71+<!DOCTYPE target SYSTEM "gdb-target.dtd"> 204+32:r5
72+<target> 205+32:r6
73+ <osabi>GNU/Linux</osabi> 206+32:r7
74+ <xi:include href="microblaze-core.xml"/> 207+32:r8
75+</target> 208+32:r9
76diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 209+32:r10
210+32:r11
211+32:r12
212+32:r13
213+32:r14
214+32:r15
215+32:r16
216+32:r17
217+32:r18
218+32:r19
219+32:r20
220+32:r21
221+32:r22
222+32:r23
223+32:r24
224+32:r25
225+32:r26
226+32:r27
227+32:r28
228+32:r29
229+32:r30
230+32:r31
231+32:pc
232+32:msr
233+32:ear
234+32:esr
235+32:fsr
236+32:slr
237+32:shr
238diff --git a/gdbserver/linux-microblaze-low.c b/gdbserver/linux-microblaze-low.c
77new file mode 100644 239new file mode 100644
78index 00000000000..cba5d6fc585 240index 0000000000..cba5d6fc58
79--- /dev/null 241--- /dev/null
80+++ b/gdb/gdbserver/linux-microblaze-low.c 242+++ b/gdbserver/linux-microblaze-low.c
81@@ -0,0 +1,189 @@ 243@@ -0,0 +1,189 @@
82+/* GNU/Linux/Microblaze specific low level interface, for the remote server for 244+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
83+ GDB. 245+ GDB.
@@ -268,233 +430,6 @@ index 00000000000..cba5d6fc585
268+ microblaze_collect_ptrace_register, 430+ microblaze_collect_ptrace_register,
269+ microblaze_supply_ptrace_register, 431+ microblaze_supply_ptrace_register,
270+}; 432+};
271diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
272index be710bedb64..d15b24d619e 100644
273--- a/gdb/microblaze-linux-tdep.c
274+++ b/gdb/microblaze-linux-tdep.c
275@@ -37,6 +37,22 @@
276 #include "tramp-frame.h"
277 #include "linux-tdep.h"
278
279+static int microblaze_debug_flag = 0;
280+
281+static void
282+microblaze_debug (const char *fmt, ...)
283+{
284+ if (microblaze_debug_flag)
285+ {
286+ va_list args;
287+
288+ va_start (args, fmt);
289+ printf_unfiltered ("MICROBLAZE LINUX: ");
290+ vprintf_unfiltered (fmt, args);
291+ va_end (args);
292+ }
293+}
294+
295 static int
296 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
297 struct bp_target_info *bp_tgt)
298@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
299 /* Determine appropriate breakpoint contents and size for this address. */
300 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
301
302+ /* Make sure we see the memory breakpoints. */
303+ scoped_restore restore_memory
304+ = make_scoped_restore_show_memory_breakpoints (1);
305+
306 val = target_read_memory (addr, old_contents, bplen);
307
308 /* If our breakpoint is no longer at the address, this means that the
309 program modified the code on us, so it is wrong to put back the
310 old value. */
311 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
312- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
313+ {
314+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
315+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
316+ }
317
318 return val;
319 }
320@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
321 /* Trampolines. */
322 tramp_frame_prepend_unwinder (gdbarch,
323 &microblaze_linux_sighandler_tramp_frame);
324+
325+ /* Enable TLS support. */
326+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
327+ svr4_fetch_objfile_link_map);
328 }
329
330 void _initialize_microblaze_linux_tdep ();
331diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
332index 5c804133040..5972a69eb5f 100644
333--- a/gdb/microblaze-tdep.c
334+++ b/gdb/microblaze-tdep.c
335@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
336 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
337
338 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
339-
340+static int
341+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
342+ struct bp_target_info *bp_tgt)
343+{
344+ CORE_ADDR addr = bp_tgt->placed_address;
345+ const unsigned char *bp;
346+ int val;
347+ int bplen;
348+ gdb_byte old_contents[BREAKPOINT_MAX];
349+
350+ /* Determine appropriate breakpoint contents and size for this address. */
351+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
352+ if (bp == NULL)
353+ error (_("Software breakpoints not implemented for this target."));
354+
355+ /* Make sure we see the memory breakpoints. */
356+ scoped_restore restore_memory
357+ = make_scoped_restore_show_memory_breakpoints (1);
358+
359+ val = target_read_memory (addr, old_contents, bplen);
360+
361+ /* If our breakpoint is no longer at the address, this means that the
362+ program modified the code on us, so it is wrong to put back the
363+ old value. */
364+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
365+ {
366+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
367+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
368+ }
369+
370+ return val;
371+}
372
373 /* Allocate and initialize a frame cache. */
374
375@@ -731,6 +762,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
376 microblaze_breakpoint::kind_from_pc);
377 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
378 microblaze_breakpoint::bp_from_kind);
379+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
380
381 set_gdbarch_frame_args_skip (gdbarch, 8);
382
383@@ -771,4 +803,5 @@ When non-zero, microblaze specific debugging is enabled."),
384 NULL,
385 &setdebuglist, &showdebuglist);
386
387+
388 }
389diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
390index 4fbdf9933f0..db0772643dc 100644
391--- a/gdb/microblaze-tdep.h
392+++ b/gdb/microblaze-tdep.h
393@@ -117,6 +117,8 @@ struct microblaze_frame_cache
394
395 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
396 Only used for native debugging. */
397-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
398+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
399+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
400+
401
402 #endif /* microblaze-tdep.h */
403diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
404new file mode 100644
405index 00000000000..bd8a4384424
406--- /dev/null
407+++ b/gdb/regformats/reg-microblaze.dat
408@@ -0,0 +1,41 @@
409+name:microblaze
410+expedite:r1,pc
411+32:r0
412+32:r1
413+32:r2
414+32:r3
415+32:r4
416+32:r5
417+32:r6
418+32:r7
419+32:r8
420+32:r9
421+32:r10
422+32:r11
423+32:r12
424+32:r13
425+32:r14
426+32:r15
427+32:r16
428+32:r17
429+32:r18
430+32:r19
431+32:r20
432+32:r21
433+32:r22
434+32:r23
435+32:r24
436+32:r25
437+32:r26
438+32:r27
439+32:r28
440+32:r29
441+32:r30
442+32:r31
443+32:pc
444+32:msr
445+32:ear
446+32:esr
447+32:fsr
448+32:slr
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"
498-- 433--
4992.17.1 4342.17.1
500 435
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
deleted file mode 100644
index 7339995e..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Fix-various-compile-warnings.patch
+++ /dev/null
@@ -1,105 +0,0 @@
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/0035-Initial-port-of-core-reading-support.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support-Added-support-f.patch
index 4eeeb7da..3d5f7ae2 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0035-Initial-port-of-core-reading-support.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -1,22 +1,22 @@
1From b6c01467951b83f9cca621ffeb89151eba1d73a1 Mon Sep 17 00:00:00 2001 1From bcb8a5479a617eea7b4da869bee5e00d4b750c73 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 24 Jan 2017 14:55:56 +0530 3Date: Tue, 24 Jan 2017 14:55:56 +0530
4Subject: [PATCH 35/40] Initial port of core reading support Added support for 4Subject: [PATCH 34/52] Initial port of core reading support Added support for
5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO 5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 information for rebuilding ".reg" sections of core dumps at run time. 6 information for rebuilding ".reg" sections of core dumps at run time.
7 7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10--- 10---
11 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++ 11 bfd/elf32-microblaze.c | 84 ++++++++++++++++++++++++++++++++++
12 gdb/configure.tgt | 2 +- 12 gdb/configure.tgt | 2 +-
13 gdb/microblaze-linux-tdep.c | 17 +++++++- 13 gdb/microblaze-linux-tdep.c | 57 +++++++++++++++++++++++
14 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++ 14 gdb/microblaze-tdep.c | 90 +++++++++++++++++++++++++++++++++++++
15 gdb/microblaze-tdep.h | 27 ++++++++++++ 15 gdb/microblaze-tdep.h | 27 +++++++++++
16 5 files changed, 176 insertions(+), 2 deletions(-) 16 5 files changed, 259 insertions(+), 1 deletion(-)
17 17
18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
19index bf09c68afd9..a4b15882d77 100644 19index d77710b1f3..7a27e50111 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 bf09c68afd9..a4b15882d77 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@@ -3574,4 +3655,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 110@@ -3576,4 +3657,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,7 +116,7 @@ index bf09c68afd9..a4b15882d77 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 d66f01bb9f7..2938fddfe82 100644 119index d66f01bb9f..2938fddfe8 100644
120--- a/gdb/configure.tgt 120--- a/gdb/configure.tgt
121+++ b/gdb/configure.tgt 121+++ b/gdb/configure.tgt
122@@ -389,7 +389,7 @@ mep-*-*) 122@@ -389,7 +389,7 @@ mep-*-*)
@@ -129,34 +129,65 @@ index d66f01bb9f7..2938fddfe82 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 d15b24d619e..0d5c08d24f6 100644 132index fb8241884b..2725ce1789 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@@ -36,6 +36,7 @@ 135@@ -135,11 +135,54 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
136 #include "frame-unwind.h"
137 #include "tramp-frame.h"
138 #include "linux-tdep.h"
139+#include "glibc-tdep.h"
140
141 static int microblaze_debug_flag = 0;
142
143@@ -135,11 +136,14 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
144 microblaze_linux_sighandler_cache_init 136 microblaze_linux_sighandler_cache_init
145 }; 137 };
146 138
147- 139+const struct microblaze_gregset microblaze_linux_core_gregset;
140+
141+static void
142+microblaze_linux_supply_core_gregset (const struct regset *regset,
143+ struct regcache *regcache,
144+ int regnum, const void *gregs, size_t len)
145+{
146+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
147+ regnum, gregs);
148+}
149+
150+static void
151+microblaze_linux_collect_core_gregset (const struct regset *regset,
152+ const struct regcache *regcache,
153+ int regnum, void *gregs, size_t len)
154+{
155+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
156+ regnum, gregs);
157+}
158+
159+static void
160+microblaze_linux_supply_core_fpregset (const struct regset *regset,
161+ struct regcache *regcache,
162+ int regnum, const void *fpregs, size_t len)
163+{
164+ /* FIXME. */
165+ microblaze_supply_fpregset (regcache, regnum, fpregs);
166+}
167+
168+static void
169+microblaze_linux_collect_core_fpregset (const struct regset *regset,
170+ const struct regcache *regcache,
171+ int regnum, void *fpregs, size_t len)
172+{
173+ /* FIXME. */
174+ microblaze_collect_fpregset (regcache, regnum, fpregs);
175+}
176
148 static void 177 static void
149 microblaze_linux_init_abi (struct gdbarch_info info, 178 microblaze_linux_init_abi (struct gdbarch_info info,
150 struct gdbarch *gdbarch) 179 struct gdbarch *gdbarch)
151 { 180 {
152+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 181+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
153+ 182+
183+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
184+ microblaze_linux_collect_core_gregset);
154+ tdep->sizeof_gregset = 200; 185+ tdep->sizeof_gregset = 200;
155+ 186+
156 linux_init_abi (info, gdbarch); 187 linux_init_abi (info, gdbarch);
157 188
158 set_gdbarch_memory_remove_breakpoint (gdbarch, 189 set_gdbarch_memory_remove_breakpoint (gdbarch,
159@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info, 190@@ -153,6 +196,20 @@ microblaze_linux_init_abi (struct gdbarch_info info,
160 tramp_frame_prepend_unwinder (gdbarch, 191 tramp_frame_prepend_unwinder (gdbarch,
161 &microblaze_linux_sighandler_tramp_frame); 192 &microblaze_linux_sighandler_tramp_frame);
162 193
@@ -171,50 +202,109 @@ index d15b24d619e..0d5c08d24f6 100644
171+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 202+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
172+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); 203+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
173+ 204+
205+ set_gdbarch_regset_from_core_section (gdbarch,
206+ microblaze_regset_from_core_section);
207+
174 /* Enable TLS support. */ 208 /* Enable TLS support. */
175 set_gdbarch_fetch_tls_load_module_address (gdbarch, 209 set_gdbarch_fetch_tls_load_module_address (gdbarch,
176 svr4_fetch_objfile_link_map); 210 svr4_fetch_objfile_link_map);
177diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 211diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
178index 5972a69eb5f..7462a1f7ce6 100644 212index 443adfb364..1b5cf38e45 100644
179--- a/gdb/microblaze-tdep.c 213--- a/gdb/microblaze-tdep.c
180+++ b/gdb/microblaze-tdep.c 214+++ b/gdb/microblaze-tdep.c
181@@ -677,6 +677,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 215@@ -137,6 +137,14 @@ microblaze_fetch_instruction (CORE_ADDR pc)
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)
182 tdesc_microblaze_with_stack_protect); 244 tdesc_microblaze_with_stack_protect);
183 } 245 }
184 246
185+void 247+void
186+microblaze_supply_gregset (const struct regset *regset, 248+microblaze_supply_gregset (const struct microblaze_gregset *gregset,
187+ struct regcache *regcache, 249+ struct regcache *regcache,
188+ int regnum, const void *gregs) 250+ int regnum, const void *gregs)
189+{ 251+{
190+ const unsigned int *regs = (const unsigned int *)gregs; 252+ unsigned int *regs = gregs;
191+ if (regnum >= 0) 253+ if (regnum >= 0)
192+ regcache->raw_supply (regnum, regs + regnum); 254+ regcache_raw_supply (regcache, regnum, regs + regnum);
193+ 255+
194+ if (regnum == -1) { 256+ if (regnum == -1) {
195+ int i; 257+ int i;
196+ 258+
197+ for (i = 0; i < 50; i++) { 259+ for (i = 0; i < 50; i++) {
198+ regcache->raw_supply (i, regs + i); 260+ regcache_raw_supply (regcache, i, regs + i);
199+ } 261+ }
200+ } 262+ }
201+} 263+}
202+ 264+
203+ 265+
266+void
267+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
268+ const struct regcache *regcache,
269+ int regnum, void *gregs)
270+{
271+ /* FIXME. */
272+}
273+
274+void
275+microblaze_supply_fpregset (struct regcache *regcache,
276+ int regnum, const void *fpregs)
277+{
278+ /* FIXME. */
279+}
280+
281+void
282+microblaze_collect_fpregset (const struct regcache *regcache,
283+ int regnum, void *fpregs)
284+{
285+ /* FIXME. */
286+}
287+
288+
204+/* Return the appropriate register set for the core section identified 289+/* Return the appropriate register set for the core section identified
205+ by SECT_NAME and SECT_SIZE. */ 290+ by SECT_NAME and SECT_SIZE. */
206+ 291+
207+static void 292+const struct regset *
208+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, 293+microblaze_regset_from_core_section (struct gdbarch *gdbarch,
209+ iterate_over_regset_sections_cb *cb, 294+ const char *sect_name, size_t sect_size)
210+ void *cb_data,
211+ const struct regcache *regcache)
212+{ 295+{
213+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 296+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
214+ 297+
215+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data); 298+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name);
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;
216+ 305+
217+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data); 306+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n");
307+ return NULL;
218+} 308+}
219+ 309+
220+ 310+
@@ -222,7 +312,7 @@ index 5972a69eb5f..7462a1f7ce6 100644
222 static struct gdbarch * 312 static struct gdbarch *
223 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 313 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
224 { 314 {
225@@ -733,6 +770,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 315@@ -733,6 +812,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
226 tdep = XCNEW (struct gdbarch_tdep); 316 tdep = XCNEW (struct gdbarch_tdep);
227 gdbarch = gdbarch_alloc (&info, tdep); 317 gdbarch = gdbarch_alloc (&info, tdep);
228 318
@@ -233,7 +323,7 @@ index 5972a69eb5f..7462a1f7ce6 100644
233 set_gdbarch_long_double_bit (gdbarch, 128); 323 set_gdbarch_long_double_bit (gdbarch, 128);
234 324
235 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 325 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
236@@ -781,6 +822,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 326@@ -781,6 +864,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
237 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 327 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
238 if (tdesc_data != NULL) 328 if (tdesc_data != NULL)
239 tdesc_use_registers (gdbarch, tdesc, tdesc_data); 329 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
@@ -241,14 +331,14 @@ index 5972a69eb5f..7462a1f7ce6 100644
241+ 331+
242+ /* If we have register sets, enable the generic core file support. */ 332+ /* If we have register sets, enable the generic core file support. */
243+ if (tdep->gregset) { 333+ if (tdep->gregset) {
244+ set_gdbarch_iterate_over_regset_sections (gdbarch, 334+ set_gdbarch_regset_from_core_section (gdbarch,
245+ microblaze_iterate_over_regset_sections); 335+ microblaze_regset_from_core_section);
246+ } 336+ }
247 337
248 return gdbarch; 338 return gdbarch;
249 } 339 }
250diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 340diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
251index db0772643dc..8f41ba19351 100644 341index db0772643d..de66a05cab 100644
252--- a/gdb/microblaze-tdep.h 342--- a/gdb/microblaze-tdep.h
253+++ b/gdb/microblaze-tdep.h 343+++ b/gdb/microblaze-tdep.h
254@@ -22,8 +22,22 @@ 344@@ -22,8 +22,22 @@
@@ -278,10 +368,10 @@ index db0772643dc..8f41ba19351 100644
278 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} 368 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
279 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} 369 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
280 370
281+extern void microblaze_supply_gregset (const struct regset *regset, 371+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
282+ struct regcache *regcache, 372+ struct regcache *regcache,
283+ int regnum, const void *gregs); 373+ int regnum, const void *gregs);
284+extern void microblaze_collect_gregset (const struct regset *regset, 374+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset,
285+ const struct regcache *regcache, 375+ const struct regcache *regcache,
286+ int regnum, void *gregs); 376+ int regnum, void *gregs);
287+extern void microblaze_supply_fpregset (struct regcache *regcache, 377+extern void microblaze_supply_fpregset (struct regcache *regcache,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-debug-message-when-register-is-unavailable.patch
index 79d08da9..4c26f259 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-debug-message-when-register-is-unavailable.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-debug-message-when-register-is-unavailable.patch
@@ -1,7 +1,7 @@
1From dc76254a84fa1086983aefe9db4d8f94b42efb9b Mon Sep 17 00:00:00 2001 1From bc2b702d7f73a231bd67c60465137fe37f67479a Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com> 2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000 3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 36/40] Fix debug message when register is unavailable 4Subject: [PATCH 35/52] Fix debug message when register is unavailable
5 5
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7--- 7---
@@ -9,7 +9,7 @@ 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 ff27b9f00e9..bf931b370c9 100644 12index ff27b9f00e..bf931b370c 100644
13--- a/gdb/frame.c 13--- a/gdb/frame.c
14+++ b/gdb/frame.c 14+++ b/gdb/frame.c
15@@ -1263,12 +1263,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)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch
new file mode 100644
index 00000000..81f55f76
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch
@@ -0,0 +1,31 @@
1From c84c1a62142bcd18c242ec476539f0c505285d6c Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 22 Jul 2013 11:16:05 +1000
4Subject: [PATCH 36/52] revert master-rebase changes to gdbserver
5
6Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
7---
8 gdbserver/configure.srv | 7 +++++++
9 1 file changed, 7 insertions(+)
10
11diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
12index 5e33bd9c54..7e81388850 100644
13--- a/gdbserver/configure.srv
14+++ b/gdbserver/configure.srv
15@@ -155,6 +155,13 @@ case "${gdbserver_host}" in
16 srv_linux_usrregs=yes
17 srv_linux_thread_db=yes
18 ;;
19+ microblaze*-*-linux*) srv_regobj=microblaze-linux.o
20+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
21+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
22+ srv_linux_regsets=yes
23+ srv_linux_usrregs=yes
24+ srv_linux_thread_db=yes
25+ ;;
26 powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
27 srv_regobj="${srv_regobj} powerpc-altivec32l.o"
28 srv_regobj="${srv_regobj} powerpc-vsx32l.o"
29--
302.17.1
31
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
new file mode 100644
index 00000000..24ae7a8c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
@@ -0,0 +1,36 @@
1From 06f1e66daaa1c8a2e1e43254a66f35840945e63b Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 30 Apr 2018 17:09:55 +0530
4Subject: [PATCH 37/52] revert master-rebase changes to gdbserver , previous
5 commit typo's
6
7Note: This _WILL NOT WORK_, the format of the files in gdbserver have changed!
8
9Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
10---
11 gdbserver/Makefile.in | 2 ++
12 1 file changed, 2 insertions(+)
13
14diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
15index 9d7687be53..df354d636c 100644
16--- a/gdbserver/Makefile.in
17+++ b/gdbserver/Makefile.in
18@@ -183,6 +183,7 @@ SFILES = \
19 $(srcdir)/linux-ia64-low.cc \
20 $(srcdir)/linux-low.cc \
21 $(srcdir)/linux-m68k-low.cc \
22+ $(srcdir)/linux-microblaze-low.c \
23 $(srcdir)/linux-mips-low.cc \
24 $(srcdir)/linux-nios2-low.cc \
25 $(srcdir)/linux-ppc-low.cc \
26@@ -217,6 +218,7 @@ SFILES = \
27 $(srcdir)/../gdb/nat/linux-osdata.c \
28 $(srcdir)/../gdb/nat/linux-personality.c \
29 $(srcdir)/../gdb/nat/mips-linux-watch.c \
30+ $(srcdir)/../gdb/nat/microblaze-linux.c \
31 $(srcdir)/../gdb/nat/ppc-linux.c \
32 $(srcdir)/../gdb/nat/riscv-linux-tdesc.c \
33 $(srcdir)/../gdb/nat/fork-inferior.c \
34--
352.17.1
36
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/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index 80b70fcc..dede70e8 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/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 23376adc47cf72e46a1edf99e7fbc40164d39cd6 Mon Sep 17 00:00:00 2001 1From 463a2d331ab68484913a2957614e852eac793583 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 16 Dec 2013 16:37:32 +1000 3Date: Mon, 16 Dec 2013 16:37:32 +1000
4Subject: [PATCH 37/40] microblaze: Add build_gdbserver=yes to top level 4Subject: [PATCH 38/52] microblaze: Add build_gdbserver=yes to top level
5 configure.tgt 5 configure.tgt
6 6
7For Microblaze linux toolchains, set the build_gdbserver=yes 7For Microblaze linux toolchains, set the build_gdbserver=yes
@@ -16,7 +16,7 @@ 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 2938fddfe82..ac2d35a9917 100644 19index 2938fddfe8..ac2d35a991 100644
20--- a/gdb/configure.tgt 20--- a/gdb/configure.tgt
21+++ b/gdb/configure.tgt 21+++ b/gdb/configure.tgt
22@@ -397,6 +397,7 @@ microblaze*-*-*) 22@@ -397,6 +397,7 @@ microblaze*-*-*)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch
index 9360bc5a..646914a4 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0038-Initial-support-for-native-gdb.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch
@@ -1,12 +1,15 @@
1From f34017e4cec8ad571accfd964187ab1f2db8de7f Mon Sep 17 00:00:00 2001 1From eef1384ec08bbbac893e4a564981517f92f90b57 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com> 2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 20 Jul 2012 15:18:35 +1000 3Date: Fri, 20 Jul 2012 15:18:35 +1000
4Subject: [PATCH 38/40] Initial support for native gdb 4Subject: [PATCH 39/52] Initial support for native gdb
5 5
6microblaze: Follow PPC method of getting setting registers 6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE 7using PTRACE PEEK/POKE
8 8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10
11Conflicts:
12 gdb/Makefile.in
10--- 13---
11 gdb/Makefile.in | 2 + 14 gdb/Makefile.in | 2 +
12 gdb/config/microblaze/linux.mh | 9 + 15 gdb/config/microblaze/linux.mh | 9 +
@@ -16,7 +19,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
16 create mode 100644 gdb/microblaze-linux-nat.c 19 create mode 100644 gdb/microblaze-linux-nat.c
17 20
18diff --git a/gdb/Makefile.in b/gdb/Makefile.in 21diff --git a/gdb/Makefile.in b/gdb/Makefile.in
19index 9ae9fe2d1e1..a44464b9830 100644 22index 9ae9fe2d1e..a44464b983 100644
20--- a/gdb/Makefile.in 23--- a/gdb/Makefile.in
21+++ b/gdb/Makefile.in 24+++ b/gdb/Makefile.in
22@@ -1328,6 +1328,7 @@ HFILES_NO_SRCDIR = \ 25@@ -1328,6 +1328,7 @@ HFILES_NO_SRCDIR = \
@@ -37,7 +40,7 @@ index 9ae9fe2d1e1..a44464b9830 100644
37 mips-fbsd-tdep.c \ 40 mips-fbsd-tdep.c \
38diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 41diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
39new file mode 100644 42new file mode 100644
40index 00000000000..a4eaf540e1d 43index 0000000000..a4eaf540e1
41--- /dev/null 44--- /dev/null
42+++ b/gdb/config/microblaze/linux.mh 45+++ b/gdb/config/microblaze/linux.mh
43@@ -0,0 +1,9 @@ 46@@ -0,0 +1,9 @@
@@ -52,7 +55,7 @@ index 00000000000..a4eaf540e1d
52+LOADLIBES = -ldl $(RDYNAMIC) 55+LOADLIBES = -ldl $(RDYNAMIC)
53diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 56diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
54new file mode 100644 57new file mode 100644
55index 00000000000..e9b8c9c5221 58index 0000000000..e9b8c9c522
56--- /dev/null 59--- /dev/null
57+++ b/gdb/microblaze-linux-nat.c 60+++ b/gdb/microblaze-linux-nat.c
58@@ -0,0 +1,431 @@ 61@@ -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/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
index 136291f2..e08f16df 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/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
@@ -1,19 +1,20 @@
1From 1a493a6fc3bebb50d9679a4d11709676f933ab04 Mon Sep 17 00:00:00 2001 1From 976a0e2664559cc194eee8040280cd29e2672d26 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 17 Feb 2017 14:09:40 +0530 3Date: Fri, 17 Feb 2017 14:09:40 +0530
4Subject: [PATCH 39/40] Fixing the issues related to GDB-7.12 4Subject: [PATCH 40/52] Fixing the issues related to GDB-7.12 added all the
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
5 7
6added all the required function which are new in 7.12 and removed
7few deprecated functions from 7.6
8--- 8---
9 gdb/config/microblaze/linux.mh | 4 +- 9 gdb/config/microblaze/linux.mh | 4 +-
10 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++---- 10 gdb/microblaze-linux-tdep.c | 68 ++++++++++++++++++++--
11 gdb/microblaze-tdep.h | 1 + 11 gdb/microblaze-tdep.h | 1 +
12 gdbserver/configure.srv | 3 +- 12 gdbserver/configure.srv | 3 +-
13 4 files changed, 89 insertions(+), 16 deletions(-) 13 gdbserver/linux-microblaze-low.c | 97 +++++++++++++++++++++++++++-----
14 5 files changed, 153 insertions(+), 20 deletions(-)
14 15
15diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 16diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
16index a4eaf540e1d..74a53b854a4 100644 17index a4eaf540e1..74a53b854a 100644
17--- a/gdb/config/microblaze/linux.mh 18--- a/gdb/config/microblaze/linux.mh
18+++ b/gdb/config/microblaze/linux.mh 19+++ b/gdb/config/microblaze/linux.mh
19@@ -1,9 +1,11 @@ 20@@ -1,9 +1,11 @@
@@ -29,10 +30,128 @@ index a4eaf540e1d..74a53b854a4 100644
29 NAT_CDEPS = $(srcdir)/proc-service.list 30 NAT_CDEPS = $(srcdir)/proc-service.list
30 31
31 LOADLIBES = -ldl $(RDYNAMIC) 32 LOADLIBES = -ldl $(RDYNAMIC)
32diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c 33diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
33index cba5d6fc585..a2733f3c21c 100644 34index 2725ce1789..a2e858d10f 100644
34--- a/gdb/gdbserver/linux-microblaze-low.c 35--- a/gdb/microblaze-linux-tdep.c
35+++ b/gdb/gdbserver/linux-microblaze-low.c 36+++ b/gdb/microblaze-linux-tdep.c
37@@ -29,13 +29,76 @@
38 #include "regcache.h"
39 #include "value.h"
40 #include "osabi.h"
41-#include "regset.h"
42 #include "solib-svr4.h"
43 #include "microblaze-tdep.h"
44 #include "trad-frame.h"
45 #include "frame-unwind.h"
46 #include "tramp-frame.h"
47 #include "linux-tdep.h"
48+#include "glibc-tdep.h"
49+
50+#include "gdb_assert.h"
51+
52+#ifndef REGSET_H
53+#define REGSET_H 1
54+
55+struct gdbarch;
56+struct regcache;
57+
58+/* Data structure for the supported register notes in a core file. */
59+struct core_regset_section
60+{
61+ const char *sect_name;
62+ int size;
63+ const char *human_name;
64+};
65+
66+/* Data structure describing a register set. */
67+
68+typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
69+ int, const void *, size_t);
70+typedef void (collect_regset_ftype) (const struct regset *,
71+ const struct regcache *,
72+ int, void *, size_t);
73+
74+struct regset
75+{
76+ /* Data pointer for private use by the methods below, presumably
77+ providing some sort of description of the register set. */
78+ const void *descr;
79+
80+ /* Function supplying values in a register set to a register cache. */
81+ supply_regset_ftype *supply_regset;
82+
83+ /* Function collecting values in a register set from a register cache. */
84+ collect_regset_ftype *collect_regset;
85+
86+ /* Architecture associated with the register set. */
87+ struct gdbarch *arch;
88+};
89+
90+#endif
91+
92+/* Allocate a fresh 'struct regset' whose supply_regset function is
93+ SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
94+ If the regset has no collect_regset function, pass NULL for
95+ COLLECT_REGSET.
96+
97+ The object returned is allocated on ARCH's obstack. */
98+
99+struct regset *
100+regset_alloc (struct gdbarch *arch,
101+ supply_regset_ftype *supply_regset,
102+ collect_regset_ftype *collect_regset)
103+{
104+ struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
105+
106+ regset->arch = arch;
107+ regset->supply_regset = supply_regset;
108+ regset->collect_regset = collect_regset;
109+
110+ return regset;
111+}
112
113 static int microblaze_debug_flag = 0;
114
115@@ -207,9 +270,6 @@ microblaze_linux_init_abi (struct gdbarch_info info,
116 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
117 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
118
119- set_gdbarch_regset_from_core_section (gdbarch,
120- microblaze_regset_from_core_section);
121-
122 /* Enable TLS support. */
123 set_gdbarch_fetch_tls_load_module_address (gdbarch,
124 svr4_fetch_objfile_link_map);
125diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
126index de66a05cab..1234f8a36f 100644
127--- a/gdb/microblaze-tdep.h
128+++ b/gdb/microblaze-tdep.h
129@@ -24,6 +24,7 @@
130 /* Microblaze architecture-specific information. */
131 struct microblaze_gregset
132 {
133+ microblaze_gregset() {}
134 unsigned int gregs[32];
135 unsigned int fpregs[32];
136 unsigned int pregs[16];
137diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
138index 7e81388850..456f4b3349 100644
139--- a/gdbserver/configure.srv
140+++ b/gdbserver/configure.srv
141@@ -156,8 +156,7 @@ case "${gdbserver_host}" in
142 srv_linux_thread_db=yes
143 ;;
144 microblaze*-*-linux*) srv_regobj=microblaze-linux.o
145- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
146- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
147+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
148 srv_linux_regsets=yes
149 srv_linux_usrregs=yes
150 srv_linux_thread_db=yes
151diff --git a/gdbserver/linux-microblaze-low.c b/gdbserver/linux-microblaze-low.c
152index cba5d6fc58..a2733f3c21 100644
153--- a/gdbserver/linux-microblaze-low.c
154+++ b/gdbserver/linux-microblaze-low.c
36@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 155@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
37 PT_FSR 156 PT_FSR
38 }; 157 };
@@ -185,32 +304,6 @@ index cba5d6fc585..a2733f3c21c 100644
185+{ 304+{
186+ init_registers_microblaze (); 305+ init_registers_microblaze ();
187+} 306+}
188diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
189index 8f41ba19351..d2112dc07e1 100644
190--- a/gdb/microblaze-tdep.h
191+++ b/gdb/microblaze-tdep.h
192@@ -24,6 +24,7 @@
193 /* Microblaze architecture-specific information. */
194 struct microblaze_gregset
195 {
196+ microblaze_gregset() {}
197 unsigned int gregs[32];
198 unsigned int fpregs[32];
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
214-- 307--
2152.17.1 3082.17.1
216 309
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/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
index 1dc6b695..2cb1cc81 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0040-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
@@ -1,33 +1,33 @@
1From 928d8d1f05274ab6029e4da7d659312c769beded Mon Sep 17 00:00:00 2001 1From 90412eba37c683e0526470c39926318ae7f5bd27 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530 3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 40/40] [Patch, microblaze]: Adding 64 bit MB support 4Subject: [PATCH 41/52] Adding 64 bit MB support Added new architecture to
5 Microblaze 64-bit support to GDB Signed-off-by :Nagaraju Mekala
6 <nmekala@xilix.com>
5 7
6Added new architecture to Microblaze 64-bit support to GDB 8Conflicts:
7 9 gdb/Makefile.in
8Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
9--- 10---
10 bfd/archures.c | 2 + 11 bfd/archures.c | 2 +
11 bfd/bfd-in2.h | 2 + 12 bfd/bfd-in2.h | 2 +
12 bfd/cpu-microblaze.c | 16 +- 13 bfd/cpu-microblaze.c | 8 +-
13 bfd/elf32-microblaze.c | 9 + 14 gas/config/tc-microblaze.c | 13 ++
14 gas/config/tc-microblaze.c | 14 ++
15 gas/config/tc-microblaze.h | 4 + 15 gas/config/tc-microblaze.h | 4 +
16 gdb/features/Makefile | 3 + 16 gdb/features/Makefile | 3 +
17 gdb/features/microblaze-core.xml | 6 +- 17 gdb/features/microblaze-core.xml | 6 +-
18 gdb/features/microblaze-with-stack-protect.c | 4 +- 18 gdb/features/microblaze-stack-protect.xml | 4 +-
19 gdb/features/microblaze-with-stack-protect.c | 8 +-
19 gdb/features/microblaze.c | 6 +- 20 gdb/features/microblaze.c | 6 +-
20 gdb/features/microblaze64-core.xml | 69 +++++++ 21 gdb/features/microblaze64-core.xml | 69 ++++++
21 gdb/features/microblaze64-stack-protect.xml | 12 ++ 22 gdb/features/microblaze64-stack-protect.xml | 12 +
22 .../microblaze64-with-stack-protect.c | 79 ++++++++ 23 .../microblaze64-with-stack-protect.c | 79 +++++++
23 .../microblaze64-with-stack-protect.xml | 12 ++ 24 .../microblaze64-with-stack-protect.xml | 12 +
24 gdb/features/microblaze64.c | 77 ++++++++ 25 gdb/features/microblaze64.c | 77 +++++++
25 gdb/features/microblaze64.xml | 11 ++ 26 gdb/features/microblaze64.xml | 11 +
26 gdb/microblaze-linux-tdep.c | 29 ++- 27 gdb/microblaze-tdep.c | 207 ++++++++++++++++--
27 gdb/microblaze-tdep.c | 176 ++++++++++++++++-- 28 gdb/microblaze-tdep.h | 8 +-
28 gdb/microblaze-tdep.h | 9 +-
29 .../microblaze-with-stack-protect.dat | 4 +- 29 .../microblaze-with-stack-protect.dat | 4 +-
30 20 files changed, 504 insertions(+), 40 deletions(-) 30 19 files changed, 491 insertions(+), 44 deletions(-)
31 create mode 100644 gdb/features/microblaze64-core.xml 31 create mode 100644 gdb/features/microblaze64-core.xml
32 create mode 100644 gdb/features/microblaze64-stack-protect.xml 32 create mode 100644 gdb/features/microblaze64-stack-protect.xml
33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c 33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
@@ -36,7 +36,7 @@ Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
36 create mode 100644 gdb/features/microblaze64.xml 36 create mode 100644 gdb/features/microblaze64.xml
37 37
38diff --git a/bfd/archures.c b/bfd/archures.c 38diff --git a/bfd/archures.c b/bfd/archures.c
39index 551ec8732f0..627d81261da 100644 39index 551ec8732f..627d81261d 100644
40--- a/bfd/archures.c 40--- a/bfd/archures.c
41+++ b/bfd/archures.c 41+++ b/bfd/archures.c
42@@ -522,6 +522,8 @@ DESCRIPTION 42@@ -522,6 +522,8 @@ DESCRIPTION
@@ -49,7 +49,7 @@ index 551ec8732f0..627d81261da 100644
49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *} 49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
50 .#define bfd_mach_tilepro 1 50 .#define bfd_mach_tilepro 1
51diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 51diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
52index 8902d9c7939..0e5071c235d 100644 52index 05fbeb9b3a..788fb2b48b 100644
53--- a/bfd/bfd-in2.h 53--- a/bfd/bfd-in2.h
54+++ b/bfd/bfd-in2.h 54+++ b/bfd/bfd-in2.h
55@@ -1922,6 +1922,8 @@ enum bfd_architecture 55@@ -1922,6 +1922,8 @@ enum bfd_architecture
@@ -62,37 +62,28 @@ index 8902d9c7939..0e5071c235d 100644
62 bfd_arch_tilegx, /* Tilera TILE-Gx. */ 62 bfd_arch_tilegx, /* Tilera TILE-Gx. */
63 #define bfd_mach_tilepro 1 63 #define bfd_mach_tilepro 1
64diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 64diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
65index f94dc2c177b..4dbc149155e 100644 65index 194920b20b..f3e8bbda75 100644
66--- a/bfd/cpu-microblaze.c 66--- a/bfd/cpu-microblaze.c
67+++ b/bfd/cpu-microblaze.c 67+++ b/bfd/cpu-microblaze.c
68@@ -30,8 +30,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 68@@ -31,7 +31,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
69 64, /* 32 bits in a word. */
70 64, /* 32 bits in an address. */ 69 64, /* 32 bits in an address. */
71 8, /* 8 bits in a byte. */ 70 8, /* 8 bits in a byte. */
72- bfd_arch_microblaze, /* Architecture. */ 71 bfd_arch_microblaze, /* Architecture. */
73- 0, /* Machine number - 0 for now. */ 72- 0, /* Machine number - 0 for now. */
74+ bfd_arch_microblaze, /* Architecture. */ 73+ bfd_mach_microblaze64, /* 64 bit Machine */
75+ bfd_mach_microblaze64, /* 64 bit Machine */
76 "microblaze", /* Architecture name. */ 74 "microblaze", /* Architecture name. */
77 "MicroBlaze", /* Printable name. */ 75 "MicroBlaze", /* Printable name. */
78 3, /* Section align power. */ 76 3, /* Section align power. */
79@@ -43,11 +43,11 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 77@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
80 0 /* Maximum offset of a reloc from the start of an insn. */ 78 32, /* Bits in an address. */
81 }, 79 8, /* Bits in a byte. */
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. */ 80 bfd_arch_microblaze, /* Architecture number. */
90- 0, /* Machine number - 0 for now. */ 81- 0, /* Machine number - 0 for now. */
91+ bfd_mach_microblaze, /* 32 bit Machine */ 82+ bfd_mach_microblaze, /* 32 bit Machine */
92 "microblaze", /* Architecture name. */ 83 "microblaze", /* Architecture name. */
93 "MicroBlaze", /* Printable name. */ 84 "MicroBlaze", /* Printable name. */
94 3, /* Section align power. */ 85 3, /* Section align power. */
95@@ -64,7 +64,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 86@@ -63,7 +63,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
96 32, /* 32 bits in an address. */ 87 32, /* 32 bits in an address. */
97 8, /* 8 bits in a byte. */ 88 8, /* 8 bits in a byte. */
98 bfd_arch_microblaze, /* Architecture. */ 89 bfd_arch_microblaze, /* Architecture. */
@@ -101,7 +92,7 @@ index f94dc2c177b..4dbc149155e 100644
101 "microblaze", /* Architecture name. */ 92 "microblaze", /* Architecture name. */
102 "MicroBlaze", /* Printable name. */ 93 "MicroBlaze", /* Printable name. */
103 3, /* Section align power. */ 94 3, /* Section align power. */
104@@ -80,7 +80,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] = 95@@ -78,7 +78,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
105 64, /* 32 bits in an address. */ 96 64, /* 32 bits in an address. */
106 8, /* 8 bits in a byte. */ 97 8, /* 8 bits in a byte. */
107 bfd_arch_microblaze, /* Architecture. */ 98 bfd_arch_microblaze, /* Architecture. */
@@ -110,37 +101,11 @@ index f94dc2c177b..4dbc149155e 100644
110 "microblaze", /* Architecture name. */ 101 "microblaze", /* Architecture name. */
111 "MicroBlaze", /* Printable name. */ 102 "MicroBlaze", /* Printable name. */
112 3, /* Section align power. */ 103 3, /* Section align power. */
113diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
114index a4b15882d77..d33f709b8b3 100644
115--- a/bfd/elf32-microblaze.c
116+++ b/bfd/elf32-microblaze.c
117@@ -3585,6 +3585,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
118 return TRUE;
119 }
120
121+
122+static bfd_boolean
123+elf_microblaze_object_p (bfd *abfd)
124+{
125+ /* Set the right machine number for an s390 elf32 file. */
126+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
127+}
128+
129 /* Hook called by the linker routine which adds symbols from an object
130 file. We use it to put .comm items in .sbss, and not .bss. */
131
132@@ -3657,5 +3665,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
133
134 #define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
135 #define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
136+#define elf_backend_object_p elf_microblaze_object_p
137
138 #include "elf32-target.h"
139diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 104diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
140index 62daa56b47a..b22f6de2df6 100644 105index c6ca913f8b..df7088d6c3 100644
141--- a/gas/config/tc-microblaze.c 106--- a/gas/config/tc-microblaze.c
142+++ b/gas/config/tc-microblaze.c 107+++ b/gas/config/tc-microblaze.c
143@@ -437,6 +437,11 @@ md_begin (void) 108@@ -438,6 +438,11 @@ md_begin (void)
144 109
145 opcode_hash_control = hash_new (); 110 opcode_hash_control = hash_new ();
146 111
@@ -150,12 +115,12 @@ index 62daa56b47a..b22f6de2df6 100644
150+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze); 115+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze);
151+ 116+
152 /* Insert unique names into hash table. */ 117 /* Insert unique names into hash table. */
153 for (opcode = (struct op_code_struct *)opcodes; opcode->name; opcode ++) 118 for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++)
154 { 119 {
155@@ -3494,6 +3499,15 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) 120@@ -3478,6 +3483,14 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
121 fprintf (stream, " -%-23s%s\n", "m64", N_("generate 64-bit elf"));
156 } 122 }
157 123
158
159+unsigned long 124+unsigned long
160+microblaze_mach (void) 125+microblaze_mach (void)
161+{ 126+{
@@ -164,12 +129,11 @@ index 62daa56b47a..b22f6de2df6 100644
164+ else 129+ else
165+ return bfd_mach_microblaze; 130+ return bfd_mach_microblaze;
166+} 131+}
167+ 132
168 /* Create a fixup for a cons expression. If parse_cons_expression_microblaze 133 /* Create a fixup for a cons expression. If parse_cons_expression_microblaze
169 found a machine specific op in an expression, 134 found a machine specific op in an expression,
170 then we create relocs accordingly. */
171diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h 135diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
172index 7435a70ef5e..90c2a4a5558 100644 136index 7435a70ef5..90c2a4a555 100644
173--- a/gas/config/tc-microblaze.h 137--- a/gas/config/tc-microblaze.h
174+++ b/gas/config/tc-microblaze.h 138+++ b/gas/config/tc-microblaze.h
175@@ -23,6 +23,10 @@ 139@@ -23,6 +23,10 @@
@@ -184,7 +148,7 @@ index 7435a70ef5e..90c2a4a5558 100644
184 /* Used to initialise target_big_endian. */ 148 /* Used to initialise target_big_endian. */
185 #define TARGET_BYTES_BIG_ENDIAN 1 149 #define TARGET_BYTES_BIG_ENDIAN 1
186diff --git a/gdb/features/Makefile b/gdb/features/Makefile 150diff --git a/gdb/features/Makefile b/gdb/features/Makefile
187index d0af9a47b48..2c3cf91b69f 100644 151index d0af9a47b4..2c3cf91b69 100644
188--- a/gdb/features/Makefile 152--- a/gdb/features/Makefile
189+++ b/gdb/features/Makefile 153+++ b/gdb/features/Makefile
190@@ -46,6 +46,7 @@ 154@@ -46,6 +46,7 @@
@@ -206,7 +170,7 @@ index d0af9a47b48..2c3cf91b69f 100644
206 mips-linux.xml \ 170 mips-linux.xml \
207 mips64-dsp-linux.xml \ 171 mips64-dsp-linux.xml \
208diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml 172diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
209index f272650a41b..d1f2282fd1e 100644 173index f272650a41..a87f0f2319 100644
210--- a/gdb/features/microblaze-core.xml 174--- a/gdb/features/microblaze-core.xml
211+++ b/gdb/features/microblaze-core.xml 175+++ b/gdb/features/microblaze-core.xml
212@@ -8,7 +8,7 @@ 176@@ -8,7 +8,7 @@
@@ -231,11 +195,24 @@ index f272650a41b..d1f2282fd1e 100644
231 <reg name="rtlbsx" bitsize="32"/> 195 <reg name="rtlbsx" bitsize="32"/>
232 <reg name="rtlblo" bitsize="32"/> 196 <reg name="rtlblo" bitsize="32"/>
233 <reg name="rtlbhi" bitsize="32"/> 197 <reg name="rtlbhi" bitsize="32"/>
234+ <reg name="rslr" bitsize="32"/> 198+ <reg name="slr" bitsize="32"/>
235+ <reg name="rshr" bitsize="32"/> 199+ <reg name="shr" bitsize="32"/>
200 </feature>
201diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
202index 1b16223406..1a67f88c18 100644
203--- a/gdb/features/microblaze-stack-protect.xml
204+++ b/gdb/features/microblaze-stack-protect.xml
205@@ -7,6 +7,6 @@
206
207 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
208 <feature name="org.gnu.gdb.microblaze.stack-protect">
209- <reg name="rslr" bitsize="32"/>
210- <reg name="rshr" bitsize="32"/>
211+ <reg name="slr" bitsize="32"/>
212+ <reg name="shr" bitsize="32"/>
236 </feature> 213 </feature>
237diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c 214diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
238index b39aa198874..ab162fd2588 100644 215index b39aa19887..609934e2b4 100644
239--- a/gdb/features/microblaze-with-stack-protect.c 216--- a/gdb/features/microblaze-with-stack-protect.c
240+++ b/gdb/features/microblaze-with-stack-protect.c 217+++ b/gdb/features/microblaze-with-stack-protect.c
241@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void) 218@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
@@ -256,8 +233,19 @@ index b39aa198874..ab162fd2588 100644
256 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int"); 233 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
257 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int"); 234 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
258 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int"); 235 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
236@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
237 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
238
239 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
240- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
241- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
242+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
243+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
244
245 tdesc_microblaze_with_stack_protect = result;
246 }
259diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c 247diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
260index 6c86fc07700..7919ac96e62 100644 248index 6c86fc0770..ceb98ca8b8 100644
261--- a/gdb/features/microblaze.c 249--- a/gdb/features/microblaze.c
262+++ b/gdb/features/microblaze.c 250+++ b/gdb/features/microblaze.c
263@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void) 251@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
@@ -282,14 +270,14 @@ index 6c86fc07700..7919ac96e62 100644
282 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 270 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
283 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 271 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
284 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 272 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
285+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 273+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
286+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 274+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
287 275
288 tdesc_microblaze = result; 276 tdesc_microblaze = result;
289 } 277 }
290diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml 278diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
291new file mode 100644 279new file mode 100644
292index 00000000000..b9adadfade6 280index 0000000000..96e99e2fb2
293--- /dev/null 281--- /dev/null
294+++ b/gdb/features/microblaze64-core.xml 282+++ b/gdb/features/microblaze64-core.xml
295@@ -0,0 +1,69 @@ 283@@ -0,0 +1,69 @@
@@ -359,12 +347,12 @@ index 00000000000..b9adadfade6
359+ <reg name="rtlbsx" bitsize="32"/> 347+ <reg name="rtlbsx" bitsize="32"/>
360+ <reg name="rtlblo" bitsize="32"/> 348+ <reg name="rtlblo" bitsize="32"/>
361+ <reg name="rtlbhi" bitsize="32"/> 349+ <reg name="rtlbhi" bitsize="32"/>
362+ <reg name="rslr" bitsize="64"/> 350+ <reg name="slr" bitsize="64"/>
363+ <reg name="rshr" bitsize="64"/> 351+ <reg name="shr" bitsize="64"/>
364+</feature> 352+</feature>
365diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml 353diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
366new file mode 100644 354new file mode 100644
367index 00000000000..9d7ea8b9fd7 355index 0000000000..1bbf5fc3ce
368--- /dev/null 356--- /dev/null
369+++ b/gdb/features/microblaze64-stack-protect.xml 357+++ b/gdb/features/microblaze64-stack-protect.xml
370@@ -0,0 +1,12 @@ 358@@ -0,0 +1,12 @@
@@ -377,12 +365,12 @@ index 00000000000..9d7ea8b9fd7
377+ 365+
378+<!DOCTYPE feature SYSTEM "gdb-target.dtd"> 366+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
379+<feature name="org.gnu.gdb.microblaze64.stack-protect"> 367+<feature name="org.gnu.gdb.microblaze64.stack-protect">
380+ <reg name="rslr" bitsize="64"/> 368+ <reg name="slr" bitsize="64"/>
381+ <reg name="rshr" bitsize="64"/> 369+ <reg name="shr" bitsize="64"/>
382+</feature> 370+</feature>
383diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c 371diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
384new file mode 100644 372new file mode 100644
385index 00000000000..249cb534daa 373index 0000000000..f448c9a749
386--- /dev/null 374--- /dev/null
387+++ b/gdb/features/microblaze64-with-stack-protect.c 375+++ b/gdb/features/microblaze64-with-stack-protect.c
388@@ -0,0 +1,79 @@ 376@@ -0,0 +1,79 @@
@@ -460,14 +448,14 @@ index 00000000000..249cb534daa
460+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 448+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
461+ 449+
462+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect"); 450+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
463+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 451+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
464+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 452+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
465+ 453+
466+ tdesc_microblaze64_with_stack_protect = result; 454+ tdesc_microblaze64_with_stack_protect = result;
467+} 455+}
468diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml 456diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
469new file mode 100644 457new file mode 100644
470index 00000000000..0e9f01611f3 458index 0000000000..0e9f01611f
471--- /dev/null 459--- /dev/null
472+++ b/gdb/features/microblaze64-with-stack-protect.xml 460+++ b/gdb/features/microblaze64-with-stack-protect.xml
473@@ -0,0 +1,12 @@ 461@@ -0,0 +1,12 @@
@@ -485,7 +473,7 @@ index 00000000000..0e9f01611f3
485+</target> 473+</target>
486diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c 474diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
487new file mode 100644 475new file mode 100644
488index 00000000000..5d3e2c8cd91 476index 0000000000..1aa37c4512
489--- /dev/null 477--- /dev/null
490+++ b/gdb/features/microblaze64.c 478+++ b/gdb/features/microblaze64.c
491@@ -0,0 +1,77 @@ 479@@ -0,0 +1,77 @@
@@ -561,14 +549,14 @@ index 00000000000..5d3e2c8cd91
561+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int"); 549+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
562+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int"); 550+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
563+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int"); 551+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
564+ tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64"); 552+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
565+ tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64"); 553+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
566+ 554+
567+ tdesc_microblaze64 = result; 555+ tdesc_microblaze64 = result;
568+} 556+}
569diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml 557diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
570new file mode 100644 558new file mode 100644
571index 00000000000..515d18e65cf 559index 0000000000..515d18e65c
572--- /dev/null 560--- /dev/null
573+++ b/gdb/features/microblaze64.xml 561+++ b/gdb/features/microblaze64.xml
574@@ -0,0 +1,11 @@ 562@@ -0,0 +1,11 @@
@@ -583,55 +571,8 @@ index 00000000000..515d18e65cf
583+<target> 571+<target>
584+ <xi:include href="microblaze64-core.xml"/> 572+ <xi:include href="microblaze64-core.xml"/>
585+</target> 573+</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 }
633diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 574diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
634index 7462a1f7ce6..5dd0b3ea532 100644 575index 1b5cf38e45..f4ea3cc342 100644
635--- a/gdb/microblaze-tdep.c 576--- a/gdb/microblaze-tdep.c
636+++ b/gdb/microblaze-tdep.c 577+++ b/gdb/microblaze-tdep.c
637@@ -40,7 +40,9 @@ 578@@ -40,7 +40,9 @@
@@ -644,34 +585,57 @@ index 7462a1f7ce6..5dd0b3ea532 100644
644 585
645 /* Instruction macros used for analyzing the prologue. */ 586 /* Instruction macros used for analyzing the prologue. */
646 /* This set of instruction macros need to be changed whenever the 587 /* This set of instruction macros need to be changed whenever the
647@@ -79,8 +81,9 @@ static const char *microblaze_register_names[] = 588@@ -75,12 +77,13 @@ static const char *microblaze_register_names[] =
589 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
590 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
591 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
592- "rslr", "rshr"
593+ "slr", "shr"
648 }; 594 };
649 595
650 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names) 596 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
651- 597
652+
653 static unsigned int microblaze_debug_flag = 0; 598 static unsigned int microblaze_debug_flag = 0;
654+int MICROBLAZE_REGISTER_SIZE = 4; 599+int reg_size = 4;
655 600
656 static void ATTRIBUTE_PRINTF (1, 2) 601 static void ATTRIBUTE_PRINTF (1, 2)
657 microblaze_debug (const char *fmt, ...) 602 microblaze_debug (const char *fmt, ...)
658@@ -137,6 +140,7 @@ microblaze_fetch_instruction (CORE_ADDR pc) 603@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regcache *regcache, int nargs,
659 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; 604 error (_("store_arguments not implemented"));
660 605 return sp;
661 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint; 606 }
662+#if 0 607+#if 0
663 static int 608 static int
664 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 609 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
665 struct bp_target_info *bp_tgt) 610 struct bp_target_info *bp_tgt)
666@@ -169,6 +173,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 611@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
667 612 int val;
613 int bplen;
614 gdb_byte old_contents[BREAKPOINT_MAX];
615- struct cleanup *cleanup;
616+ //struct cleanup *cleanup;
617
618 /* Determine appropriate breakpoint contents and size for this address. */
619 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
620@@ -162,7 +166,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
621 error (_("Software breakpoints not implemented for this target."));
622
623 /* Make sure we see the memory breakpoints. */
624- cleanup = make_show_memory_breakpoints_cleanup (1);
625+ scoped_restore
626+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
627 val = target_read_memory (addr, old_contents, bplen);
628
629 /* If our breakpoint is no longer at the address, this means that the
630@@ -178,6 +183,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
668 return val; 631 return val;
669 } 632 }
670+#endif
671 633
634+#endif
672 /* Allocate and initialize a frame cache. */ 635 /* Allocate and initialize a frame cache. */
673 636
674@@ -556,7 +561,6 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache, 637 static struct microblaze_frame_cache *
638@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
675 gdb_byte *valbuf) 639 gdb_byte *valbuf)
676 { 640 {
677 gdb_byte buf[8]; 641 gdb_byte buf[8];
@@ -679,7 +643,19 @@ index 7462a1f7ce6..5dd0b3ea532 100644
679 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */ 643 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
680 switch (TYPE_LENGTH (type)) 644 switch (TYPE_LENGTH (type))
681 { 645 {
682@@ -633,7 +637,113 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) 646 case 1: /* return last byte in the register. */
647 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
648- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
649+ memcpy(valbuf, buf + reg_size - 1, 1);
650 return;
651 case 2: /* return last 2 bytes in register. */
652 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
653- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
654+ memcpy(valbuf, buf + reg_size - 2, 2);
655 return;
656 case 4: /* for sizes 4 or 8, copy the required length. */
657 case 8:
658@@ -647,7 +652,119 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
683 return (TYPE_LENGTH (type) == 16); 659 return (TYPE_LENGTH (type) == 16);
684 } 660 }
685 661
@@ -791,14 +767,16 @@ index 7462a1f7ce6..5dd0b3ea532 100644
791+} 767+}
792+#endif 768+#endif
793+ 769+
770+static void
771+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
772+{
773+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
774+}
775+
794 static int dwarf2_to_reg_map[78] = 776 static int dwarf2_to_reg_map[78] =
795 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 777 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
796 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 778 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
797@@ -665,24 +775,27 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) 779@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
798 return -1;
799 }
800
801+#if 0
802 static void 780 static void
803 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 781 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
804 { 782 {
@@ -814,27 +792,46 @@ index 7462a1f7ce6..5dd0b3ea532 100644
814- tdesc_microblaze_with_stack_protect); 792- tdesc_microblaze_with_stack_protect);
815+ tdesc_microblaze64_with_stack_protect); 793+ tdesc_microblaze64_with_stack_protect);
816 } 794 }
817+#endif
818 795
819 void 796 void
820 microblaze_supply_gregset (const struct regset *regset, 797@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct microblaze_gregset *gregset,
821 struct regcache *regcache, 798 struct regcache *regcache,
822 int regnum, const void *gregs) 799 int regnum, const void *gregs)
823 { 800 {
824- const unsigned int *regs = (const unsigned int *)gregs; 801- unsigned int *regs = gregs;
825+ const gdb_byte *regs = (const gdb_byte *) gregs; 802+ const gdb_byte *regs = (const gdb_byte *) gregs;
826 if (regnum >= 0) 803 if (regnum >= 0)
827 regcache->raw_supply (regnum, regs + regnum); 804- regcache_raw_supply (regcache, regnum, regs + regnum);
805+ regcache->raw_supply (regnum, regs + regnum);
806
807 if (regnum == -1) {
808 int i;
828 809
829@@ -713,7 +826,6 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch, 810 for (i = 0; i < 50; i++) {
811- regcache_raw_supply (regcache, i, regs + i);
812+ regcache->raw_supply (regnum, regs + i);
813 }
814 }
815 }
816@@ -755,6 +873,17 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
830 } 817 }
831 818
832 819
833- 820+static void
821+make_regs (struct gdbarch *arch)
822+{
823+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
824+ int mach = gdbarch_bfd_arch_info (arch)->mach;
825+
826+ if (mach == bfd_mach_microblaze64)
827+ {
828+ set_gdbarch_ptr_bit (arch, 64);
829+ }
830+}
831
834 static struct gdbarch * 832 static struct gdbarch *
835 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 833 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
836 { 834@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
837@@ -727,8 +839,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
838 if (arches != NULL) 835 if (arches != NULL)
839 return arches->gdbarch; 836 return arches->gdbarch;
840 if (tdesc == NULL) 837 if (tdesc == NULL)
@@ -844,7 +841,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
844+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 841+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
845+ { 842+ {
846+ tdesc = tdesc_microblaze64; 843+ tdesc = tdesc_microblaze64;
847+ MICROBLAZE_REGISTER_SIZE = 8; 844+ reg_size = 8;
848+ } 845+ }
849+ else 846+ else
850+ tdesc = tdesc_microblaze; 847+ tdesc = tdesc_microblaze;
@@ -852,7 +849,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
852 /* Check any target description for validity. */ 849 /* Check any target description for validity. */
853 if (tdesc_has_registers (tdesc)) 850 if (tdesc_has_registers (tdesc))
854 { 851 {
855@@ -736,27 +855,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 852@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
856 int valid_p; 853 int valid_p;
857 int i; 854 int i;
858 855
@@ -893,7 +890,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
893 } 890 }
894 891
895 if (!valid_p) 892 if (!valid_p)
896@@ -764,6 +891,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 893@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
897 tdesc_data_cleanup (tdesc_data); 894 tdesc_data_cleanup (tdesc_data);
898 return NULL; 895 return NULL;
899 } 896 }
@@ -901,7 +898,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
901 } 898 }
902 899
903 /* Allocate space for the new architecture. */ 900 /* Allocate space for the new architecture. */
904@@ -783,7 +911,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 901@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
905 /* Register numbers of various important registers. */ 902 /* Register numbers of various important registers. */
906 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM); 903 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
907 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM); 904 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
@@ -919,7 +916,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
919 /* Map Dwarf2 registers to GDB registers. */ 916 /* Map Dwarf2 registers to GDB registers. */
920 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 917 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
921 918
922@@ -803,13 +941,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 919@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
923 microblaze_breakpoint::kind_from_pc); 920 microblaze_breakpoint::kind_from_pc);
924 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 921 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
925 microblaze_breakpoint::bp_from_kind); 922 microblaze_breakpoint::bp_from_kind);
@@ -937,7 +934,21 @@ index 7462a1f7ce6..5dd0b3ea532 100644
937 934
938 frame_base_set_default (gdbarch, &microblaze_frame_base); 935 frame_base_set_default (gdbarch, &microblaze_frame_base);
939 936
940@@ -841,6 +981,8 @@ _initialize_microblaze_tdep () 937@@ -866,11 +1023,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
938 tdesc_use_registers (gdbarch, tdesc, tdesc_data);
939 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
940
941- /* If we have register sets, enable the generic core file support. */
942+ /* If we have register sets, enable the generic core file support.
943 if (tdep->gregset) {
944 set_gdbarch_regset_from_core_section (gdbarch,
945 microblaze_regset_from_core_section);
946- }
947+ }*/
948
949 return gdbarch;
950 }
951@@ -883,6 +1040,8 @@ _initialize_microblaze_tdep ()
941 952
942 initialize_tdesc_microblaze_with_stack_protect (); 953 initialize_tdesc_microblaze_with_stack_protect ();
943 initialize_tdesc_microblaze (); 954 initialize_tdesc_microblaze ();
@@ -947,7 +958,7 @@ index 7462a1f7ce6..5dd0b3ea532 100644
947 add_setshow_zuinteger_cmd ("microblaze", class_maintenance, 958 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
948 &microblaze_debug_flag, _("\ 959 &microblaze_debug_flag, _("\
949diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 960diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
950index d2112dc07e1..bd03e969b9b 100644 961index 1234f8a36f..c0fc900733 100644
951--- a/gdb/microblaze-tdep.h 962--- a/gdb/microblaze-tdep.h
952+++ b/gdb/microblaze-tdep.h 963+++ b/gdb/microblaze-tdep.h
953@@ -27,7 +27,7 @@ struct microblaze_gregset 964@@ -27,7 +27,7 @@ struct microblaze_gregset
@@ -971,18 +982,17 @@ index d2112dc07e1..bd03e969b9b 100644
971 }; 982 };
972 983
973 struct microblaze_frame_cache 984 struct microblaze_frame_cache
974@@ -128,7 +128,8 @@ struct microblaze_frame_cache 985@@ -128,7 +128,7 @@ struct microblaze_frame_cache
975 struct trad_frame_saved_reg *saved_regs; 986 struct trad_frame_saved_reg *saved_regs;
976 }; 987 };
977 /* All registers are 32 bits. */ 988 /* All registers are 32 bits. */
978-#define MICROBLAZE_REGISTER_SIZE 4 989-#define MICROBLAZE_REGISTER_SIZE 4
979+extern int microblaze_reg_size; 990+//#define MICROBLAZE_REGISTER_SIZE 8
980+#define MICROBLAZE_REGISTER_SIZE microblaze_reg_size
981 991
982 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used. 992 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
983 Only used for native debugging. */ 993 Only used for native debugging. */
984diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat 994diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat
985index 8040a7b3fd0..450e321d49e 100644 995index 8040a7b3fd..450e321d49 100644
986--- a/gdb/regformats/microblaze-with-stack-protect.dat 996--- a/gdb/regformats/microblaze-with-stack-protect.dat
987+++ b/gdb/regformats/microblaze-with-stack-protect.dat 997+++ b/gdb/regformats/microblaze-with-stack-protect.dat
988@@ -60,5 +60,5 @@ expedite:r1,rpc 998@@ -60,5 +60,5 @@ expedite:r1,rpc
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0042-porting-GDB-for-linux.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0042-porting-GDB-for-linux.patch
new file mode 100644
index 00000000..e115666c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0042-porting-GDB-for-linux.patch
@@ -0,0 +1,155 @@
1From c810c6e2a6ae66426444580d04659e8b2d0b2daa Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Dec 2019 14:56:17 +0530
4Subject: [PATCH 42/52] porting GDB for linux
5
6---
7 gdb/features/microblaze-linux.xml | 12 ++++++++++
8 gdb/microblaze-linux-tdep.c | 39 ++++++++++++++++++++++++-------
9 gdbserver/Makefile.in | 2 ++
10 gdbserver/configure.srv | 3 ++-
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/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
33index a2e858d10f..a37c4c86f4 100644
34--- a/gdb/microblaze-linux-tdep.c
35+++ b/gdb/microblaze-linux-tdep.c
36@@ -41,7 +41,7 @@
37
38 #ifndef REGSET_H
39 #define REGSET_H 1
40-
41+int MICROBLAZE_REGISTER_SIZE=4;
42 struct gdbarch;
43 struct regcache;
44
45@@ -115,7 +115,7 @@ microblaze_debug (const char *fmt, ...)
46 va_end (args);
47 }
48 }
49-
50+#if 0
51 static int
52 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
53 struct bp_target_info *bp_tgt)
54@@ -131,7 +131,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
55 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
56
57 /* Make sure we see the memory breakpoints. */
58- cleanup = make_show_memory_breakpoints_cleanup (1);
59+ cleanup = make_scoped_restore_show_memory_breakpoints (1);
60 val = target_read_memory (addr, old_contents, bplen);
61
62 /* If our breakpoint is no longer at the address, this means that the
63@@ -146,6 +146,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
64 do_cleanups (cleanup);
65 return val;
66 }
67+#endif
68
69 static void
70 microblaze_linux_sigtramp_cache (struct frame_info *next_frame,
71@@ -248,8 +249,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
72
73 linux_init_abi (info, gdbarch);
74
75- set_gdbarch_memory_remove_breakpoint (gdbarch,
76- microblaze_linux_memory_remove_breakpoint);
77+// set_gdbarch_memory_remove_breakpoint (gdbarch,
78+// microblaze_linux_memory_remove_breakpoint);
79
80 /* Shared library handling. */
81 set_solib_svr4_fetch_link_map_offsets (gdbarch,
82@@ -261,10 +262,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
83
84 /* BFD target for core files. */
85 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
86- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
87+ {
88+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
89+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
90+ MICROBLAZE_REGISTER_SIZE=8;
91+ }
92+ else
93+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
94+ }
95 else
96- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
97+ {
98+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
99+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
100+ MICROBLAZE_REGISTER_SIZE=8;
101+ }
102+ else
103+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
104+ }
105
106+ switch (info.bfd_arch_info->mach)
107+ {
108+ case bfd_mach_microblaze64:
109+ set_gdbarch_ptr_bit (gdbarch, 64);
110+ break;
111+ }
112
113 /* Shared library handling. */
114 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
115@@ -279,6 +300,8 @@ void _initialize_microblaze_linux_tdep ();
116 void
117 _initialize_microblaze_linux_tdep ()
118 {
119- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
120+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
121+ microblaze_linux_init_abi);
122+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
123 microblaze_linux_init_abi);
124 }
125diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
126index df354d636c..680f536c06 100644
127--- a/gdbserver/Makefile.in
128+++ b/gdbserver/Makefile.in
129@@ -559,6 +559,8 @@ target/%.o: ../gdb/target/%.c
130
131 %-generated.cc: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
132 $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
133+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
134+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
135
136 #
137 # Dependency tracking.
138diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
139index 456f4b3349..ff9ada71b0 100644
140--- a/gdbserver/configure.srv
141+++ b/gdbserver/configure.srv
142@@ -155,8 +155,9 @@ case "${gdbserver_host}" in
143 srv_linux_usrregs=yes
144 srv_linux_thread_db=yes
145 ;;
146- microblaze*-*-linux*) srv_regobj=microblaze-linux.o
147+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
148 srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
149+ srv_xmlfiles="microblaze-linux.xml"
150 srv_linux_regsets=yes
151 srv_linux_usrregs=yes
152 srv_linux_thread_db=yes
153--
1542.17.1
155
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0043-Binutils-security-check-is-causing-build-error-for-w.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0043-Binutils-security-check-is-causing-build-error-for-w.patch
new file mode 100644
index 00000000..969ac2c0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0043-Binutils-security-check-is-causing-build-error-for-w.patch
@@ -0,0 +1,41 @@
1From 27c8f7f202ea66cd0f4745ca3a77b4f33b6f5990 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 11 Mar 2019 13:57:42 +0530
4Subject: [PATCH 43/52] Binutils security check is causing build error for
5 windows builds.commenting for now.
6
7---
8 bfd/elf-attrs.c | 4 ++++
9 1 file changed, 4 insertions(+)
10
11diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
12index 070104c273..b135ac8f11 100644
13--- a/bfd/elf-attrs.c
14+++ b/bfd/elf-attrs.c
15@@ -436,12 +436,15 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
16 bfd_byte *p_end;
17 bfd_vma len;
18 const char *std_sec;
19+#if 0
20 ufile_ptr filesize;
21+#endif
22
23 /* PR 17512: file: 2844a11d. */
24 if (hdr->sh_size == 0)
25 return;
26
27+#if 0
28 filesize = bfd_get_file_size (abfd);
29 if (filesize != 0 && hdr->sh_size > filesize)
30 {
31@@ -451,6 +454,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
32 bfd_set_error (bfd_error_invalid_operation);
33 return;
34 }
35+#endif
36
37 contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1);
38 if (!contents)
39--
402.17.1
41
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
new file mode 100644
index 00000000..48c9c2c9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
@@ -0,0 +1,146 @@
1From ba70b41346a8d5c9c1a4435f70edbb06e117564d Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 19 Dec 2019 12:22:04 +0530
4Subject: [PATCH 44/52] Correcting the register names from slr & shr to rslr &
5 rshr
6
7---
8 gdb/features/microblaze-core.xml | 4 ++--
9 gdb/features/microblaze-stack-protect.xml | 4 ++--
10 gdb/features/microblaze-with-stack-protect.c | 4 ++--
11 gdb/features/microblaze.c | 4 ++--
12 gdb/features/microblaze64-core.xml | 4 ++--
13 gdb/features/microblaze64-stack-protect.xml | 4 ++--
14 gdb/features/microblaze64-with-stack-protect.c | 4 ++--
15 gdb/features/microblaze64.c | 4 ++--
16 gdb/microblaze-tdep.c | 2 +-
17 9 files changed, 17 insertions(+), 17 deletions(-)
18
19diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
20index a87f0f2319..d1f2282fd1 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 1a67f88c18..1b16223406 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 f4ea3cc342..041ebf1fca 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/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
new file mode 100644
index 00000000..46124c12
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
@@ -0,0 +1,24 @@
1From 5fac707a9894ec9d0fcac14bbf0eb3ff631d0499 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 17 Jan 2020 15:45:48 +0530
4Subject: [PATCH 45/52] Removing the header "gdb_assert.h" from MB target file
5
6---
7 gdb/microblaze-linux-tdep.c | 1 -
8 1 file changed, 1 deletion(-)
9
10diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
11index a37c4c86f4..68e73d2e56 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/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
new file mode 100644
index 00000000..46d51dd6
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
@@ -0,0 +1,39 @@
1From 1751b6fbc3170d29a3e2873b4394d058f8cb7d36 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 10:08:53 -0800
4Subject: [PATCH 46/52] bfd/cpu-microblaze.c: Enhance disassembler
5
6See commit aebcfb76fc165795e67917cb67cf985c4dfdc577 for why this is needed.
7
8Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
9---
10 bfd/cpu-microblaze.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
14index f3e8bbda75..f3501df0e2 100644
15--- a/bfd/cpu-microblaze.c
16+++ b/bfd/cpu-microblaze.c
17@@ -39,7 +39,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
18 bfd_default_compatible, /* Architecture comparison function. */
19 bfd_default_scan, /* String to architecture conversion. */
20 bfd_arch_default_fill, /* Default fill. */
21- &bfd_microblaze_arch[1] /* Next in list. */
22+ &bfd_microblaze_arch[1], /* Next in list. */
23+ 0 /* Maximum offset of a reloc from the start of an insn. */
24 },
25 {
26 32, /* Bits in a word. */
27@@ -71,7 +72,8 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
28 bfd_default_compatible, /* Architecture comparison function. */
29 bfd_default_scan, /* String to architecture conversion. */
30 bfd_arch_default_fill, /* Default fill. */
31- &bfd_microblaze_arch[1] /* Next in list. */
32+ &bfd_microblaze_arch[1], /* Next in list. */
33+ 0 /* Maximum offset of a reloc from the start of an insn. */
34 },
35 {
36 64, /* 32 bits in a word. */
37--
382.17.1
39
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
new file mode 100644
index 00000000..3bc5f04d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
@@ -0,0 +1,87 @@
1From 4500a281317093e78b7029e3dcb0037e7c628347 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 11:02:11 -0800
4Subject: [PATCH 47/52] bfd/elf64-microblaze.c: Fix build failures
5
6Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
7---
8 bfd/elf64-microblaze.c | 16 ++++++++--------
9 1 file changed, 8 insertions(+), 8 deletions(-)
10
11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
12index 338f16eeee..cf84e0db4e 100644
13--- a/bfd/elf64-microblaze.c
14+++ b/bfd/elf64-microblaze.c
15@@ -1572,7 +1572,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
16 {
17 BFD_FAIL ();
18 (*_bfd_error_handler)
19- (_("%B: probably compiled without -fPIC?"),
20+ (_("%pB: probably compiled without -fPIC?"),
21 input_bfd);
22 bfd_set_error (bfd_error_bad_value);
23 return FALSE;
24@@ -2691,7 +2691,7 @@ microblaze_elf_check_relocs (bfd * abfd,
25 /* If this is a global symbol, we count the number of
26 relocations we need for this symbol. */
27 if (h != NULL)
28- head = &h->dyn_relocs;
29+ head = &((struct elf64_mb_link_hash_entry *) h)->dyn_relocs;
30 else
31 {
32 /* Track dynamic relocs needed for local syms too.
33@@ -2911,7 +2911,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
34
35 /* If we didn't find any dynamic relocs in read-only sections, then
36 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
37- if (!_bfd_elf_readonly_dynrelocs (h))
38+ if (p == NULL)
39 {
40 h->non_got_ref = 0;
41 return TRUE;
42@@ -3096,7 +3096,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
43 else
44 h->got.offset = (bfd_vma) -1;
45
46- if (h->dyn_relocs == NULL)
47+ if (eh->dyn_relocs == NULL)
48 return TRUE;
49
50 /* In the shared -Bsymbolic case, discard space allocated for
51@@ -3113,7 +3113,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
52 {
53 struct elf64_mb_dyn_relocs **pp;
54
55- for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
56+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
57 {
58 p->count -= p->pc_count;
59 p->pc_count = 0;
60@@ -3124,7 +3124,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
61 }
62 }
63 else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
64- h->dyn_relocs = NULL;
65+ eh->dyn_relocs = NULL;
66 }
67 else
68 {
69@@ -3154,13 +3154,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
70 goto keep;
71 }
72
73- h->dyn_relocs = NULL;
74+ eh->dyn_relocs = NULL;
75
76 keep: ;
77 }
78
79 /* Finally, allocate space. */
80- for (p = h->dyn_relocs; p != NULL; p = p->next)
81+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
82 {
83 asection *sreloc = elf_section_data (p->sec)->sreloc;
84 sreloc->size += p->count * sizeof (Elf64_External_Rela);
85--
862.17.1
87
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
new file mode 100644
index 00000000..7feaceb9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
@@ -0,0 +1,75 @@
1From 2f07425ca330dd357c374acdc30a27c6647454c9 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 11:23:26 -0800
4Subject: [PATCH 48/52] bfd/elf*-microblaze.c: Remove obsolete entries
5
6Replace microblaze_elf_merge_private_bfd_data with a direct call to
7_bfd_generic_verify_endian_match, this simplifies the implementation.
8
9Remove microblaze_elf_gc_sweep_hook, removed in 2017.
10
11Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
12---
13 bfd/elf64-microblaze.c | 29 +----------------------------
14 1 file changed, 1 insertion(+), 28 deletions(-)
15
16diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
17index cf84e0db4e..786f659232 100644
18--- a/bfd/elf64-microblaze.c
19+++ b/bfd/elf64-microblaze.c
20@@ -1690,21 +1690,6 @@ microblaze_elf_relocate_section (bfd *output_bfd,
21 return ret;
22 }
23
24-/* Merge backend specific data from an object file to the output
25- object file when linking.
26-
27- Note: We only use this hook to catch endian mismatches. */
28-static bfd_boolean
29-microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
30-{
31- /* Check if we have the same endianess. */
32- if (! _bfd_generic_verify_endian_match (ibfd, obfd))
33- return FALSE;
34-
35- return TRUE;
36-}
37-
38-
39 /* Calculate fixup value for reference. */
40
41 static int
42@@ -2427,17 +2412,6 @@ microblaze_elf_gc_mark_hook (asection *sec,
43 return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
44 }
45
46-/* Update the got entry reference counts for the section being removed. */
47-
48-static bfd_boolean
49-microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
50- struct bfd_link_info * info ATTRIBUTE_UNUSED,
51- asection * sec ATTRIBUTE_UNUSED,
52- const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
53-{
54- return TRUE;
55-}
56-
57 /* PIC support. */
58
59 #define PLT_ENTRY_SIZE 16
60@@ -3704,11 +3678,10 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
61 #define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
62 #define elf_backend_relocate_section microblaze_elf_relocate_section
63 #define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
64-#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
65+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
66 #define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
67
68 #define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
69-#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
70 #define elf_backend_check_relocs microblaze_elf_check_relocs
71 #define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
72 #define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
73--
742.17.1
75
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
new file mode 100644
index 00000000..5f4a2714
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
@@ -0,0 +1,45 @@
1From a86506136a738c3ab64d42a876fbfdfa1d46ad64 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 12:02:25 -0800
4Subject: [PATCH 49/52] bfd/elf64-microblaze.c: Resolve various compiler
5 warnings
6
7Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
8---
9 bfd/elf64-microblaze.c | 4 ++--
10 1 file changed, 2 insertions(+), 2 deletions(-)
11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index 786f659232..70cd80cdf2 100644
14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c
16@@ -1258,6 +1258,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
17 goto dogot;
18 case (int) R_MICROBLAZE_TLSLD:
19 tls_type = (TLS_TLS | TLS_LD);
20+ /* Fall through. */
21 dogot:
22 case (int) R_MICROBLAZE_GOT_64:
23 {
24@@ -2569,6 +2570,7 @@ microblaze_elf_check_relocs (bfd * abfd,
25 tls_type |= (TLS_TLS | TLS_LD);
26 dogottls:
27 sec->has_tls_reloc = 1;
28+ /* Fall through. */
29 case R_MICROBLAZE_GOT_64:
30 if (htab->sgot == NULL)
31 {
32@@ -2802,10 +2804,8 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
33 struct elf64_mb_link_hash_table *htab;
34 struct elf64_mb_link_hash_entry * eh;
35 struct elf64_mb_dyn_relocs *p;
36- asection *sdynbss;
37 asection *s, *srel;
38 unsigned int power_of_two;
39- bfd *dynobj;
40
41 htab = elf64_mb_hash_table (info);
42 if (htab == NULL)
43--
442.17.1
45
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
new file mode 100644
index 00000000..475a53ba
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
@@ -0,0 +1,37 @@
1From de38a354e40a9dcc486c93faf02bee4b059fa34a Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 12:30:09 -0800
4Subject: [PATCH 50/52] opcodes/microblaze-dis.c: Fix compile warnings
5
6Two compiler warnings were evident, it appears both are likely real bugs.
7
8Missing type declaration for a function, and a case statement without a break.
9
10Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
11---
12 opcodes/microblaze-dis.c | 2 ++
13 1 file changed, 2 insertions(+)
14
15diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
16index 90d2328659..f1c33dca14 100644
17--- a/opcodes/microblaze-dis.c
18+++ b/opcodes/microblaze-dis.c
19@@ -130,6 +130,7 @@ get_field_imm15 (struct string_buf *buf, long instr)
20 return p;
21 }
22
23+static char *
24 get_field_imm16 (struct string_buf *buf, long instr)
25 {
26 char *p = strbuf (buf);
27@@ -329,6 +330,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
28 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
29 get_field_r1 (&buf, inst), get_field_imm (&buf, inst));
30 /* TODO: Also print symbol */
31+ break;
32 case INST_TYPE_RD_R1_IMMS:
33 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
34 get_field_r1(&buf, inst), get_field_imms (&buf, inst));
35--
362.17.1
37
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
new file mode 100644
index 00000000..263f0a9b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
@@ -0,0 +1,99 @@
1From f1686db8735972637d2bbcc6e2fbf391c1e848d9 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com>
3Date: Thu, 3 Dec 2020 14:51:37 -0800
4Subject: [PATCH 51/52] gdb/microblaze-tdep.c: Remove unused functions
5
6Compiler warns the removed functions are not referenced anywhere.
7
8Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
9---
10 gdb/microblaze-tdep.c | 45 -------------------------------------------
11 1 file changed, 45 deletions(-)
12
13diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
14index 041ebf1fca..28f79f9ffc 100644
15--- a/gdb/microblaze-tdep.c
16+++ b/gdb/microblaze-tdep.c
17@@ -140,14 +140,6 @@ microblaze_fetch_instruction (CORE_ADDR pc)
18 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
19
20 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
21-static CORE_ADDR
22-microblaze_store_arguments (struct regcache *regcache, int nargs,
23- struct value **args, CORE_ADDR sp,
24- int struct_return, CORE_ADDR struct_addr)
25-{
26- error (_("store_arguments not implemented"));
27- return sp;
28-}
29 #if 0
30 static int
31 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
32@@ -555,12 +547,6 @@ microblaze_frame_base_address (struct frame_info *next_frame,
33 return cache->base;
34 }
35
36-static const struct frame_unwind *
37-microblaze_frame_sniffer (struct frame_info *next_frame)
38-{
39- return &microblaze_frame_unwind;
40-}
41-
42 static const struct frame_base microblaze_frame_base =
43 {
44 &microblaze_frame_unwind,
45@@ -759,12 +745,6 @@ microblaze_software_single_step (struct regcache *regcache)
46 }
47 #endif
48
49-static void
50-microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
51-{
52- regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
53-}
54-
55 static int dwarf2_to_reg_map[78] =
56 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
57 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
58@@ -796,19 +776,6 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
59 return -1;
60 }
61
62-static void
63-microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
64-{
65-
66- register_remote_g_packet_guess (gdbarch,
67- 4 * MICROBLAZE_NUM_REGS,
68- tdesc_microblaze64);
69-
70- register_remote_g_packet_guess (gdbarch,
71- 4 * MICROBLAZE_NUM_REGS,
72- tdesc_microblaze64_with_stack_protect);
73-}
74-
75 void
76 microblaze_supply_gregset (const struct microblaze_gregset *gregset,
77 struct regcache *regcache,
78@@ -873,18 +840,6 @@ microblaze_regset_from_core_section (struct gdbarch *gdbarch,
79 }
80
81
82-static void
83-make_regs (struct gdbarch *arch)
84-{
85- struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
86- int mach = gdbarch_bfd_arch_info (arch)->mach;
87-
88- if (mach == bfd_mach_microblaze64)
89- {
90- set_gdbarch_ptr_bit (arch, 64);
91- }
92-}
93-
94 static struct gdbarch *
95 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
96 {
97--
982.17.1
99
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0052-sim-Allow-microblaze-architecture.patch
index 9671968a..ee5caf0a 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0001-sim-Allow-microblaze-architecture.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0052-sim-Allow-microblaze-architecture.patch
@@ -1,7 +1,7 @@
1From 501b60af6b36fc69987e1610645742f5593a6da2 Mon Sep 17 00:00:00 2001 1From 5fa859e73662f96c9cfaf21bd2cf01b92afc9c1c Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org> 2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 6 Aug 2020 15:37:52 -0500 3Date: Thu, 6 Aug 2020 15:37:52 -0500
4Subject: [PATCH 01/40] sim: Allow microblaze* architecture 4Subject: [PATCH 52/52] sim: Allow microblaze* architecture
5 5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> 6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7--- 7---
@@ -10,7 +10,7 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
10 2 files changed, 2 insertions(+), 2 deletions(-) 10 2 files changed, 2 insertions(+), 2 deletions(-)
11 11
12diff --git a/sim/configure b/sim/configure 12diff --git a/sim/configure b/sim/configure
13index 72f95cd5c7a..9e28cc78687 100755 13index 72f95cd5c7..9e28cc7868 100755
14--- a/sim/configure 14--- a/sim/configure
15+++ b/sim/configure 15+++ b/sim/configure
16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64" 16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64"
@@ -23,7 +23,7 @@ index 72f95cd5c7a..9e28cc78687 100755
23 sim_arch=microblaze 23 sim_arch=microblaze
24 subdirs="$subdirs microblaze" 24 subdirs="$subdirs microblaze"
25diff --git a/sim/configure.tgt b/sim/configure.tgt 25diff --git a/sim/configure.tgt b/sim/configure.tgt
26index 8a8e03d96f4..f6743fe8d41 100644 26index 8a8e03d96f..f6743fe8d4 100644
27--- a/sim/configure.tgt 27--- a/sim/configure.tgt
28+++ b/sim/configure.tgt 28+++ b/sim/configure.tgt
29@@ -59,7 +59,7 @@ case "${target}" in 29@@ -59,7 +59,7 @@ case "${target}" in