summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@xilinx.com>2021-12-02 04:23:52 -0800
committerMark Hatle <mark.hatle@xilinx.com>2022-01-14 11:21:32 -0800
commitd458a64c2f6828c41a69b4c223fe42c3c6cdfefd (patch)
treee3b7ed7851c643dcf2f3fa32d71abcc718bae328 /meta-microblaze/recipes-devtools
parent29a9511c3004d3ad8a0e9a66e6cd312677b8cc68 (diff)
downloadmeta-xilinx-d458a64c2f6828c41a69b4c223fe42c3c6cdfefd.tar.gz
binutils: Upgraade to honister version
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc62
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch14
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch11
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch47
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch13
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch14
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0008-fixing-the-MAX_OPCODES-to-correct-value.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-Add-new-bit-field-instructions.patch18
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch)1829
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch684
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0016-Added-relocations-for-MB-X.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0017-Added-relocations-for-MB-X.patch)73
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-MB-x-relocation-issues.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch)149
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixing-the-branch-related-issues.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-address-computation-issues-with-64bit-address.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch)43
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch)37
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0021-fixing-the-.bss-relocation-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch)60
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0022-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0023-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0023-Revert-ld-Remove-unused-expression-state.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch)44
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0024-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch)8
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Added-support-to-new-arithmetic-single-register-inst.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0026-Added-support-to-new-arithmetic-single-register-inst.patch)48
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch)206
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0027-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch)6
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0056-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0031-gas-revert-moving-of-md_pseudo_table-from-const.patch14
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch12
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch435
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver.patch1580
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support-Added-support-f.patch)202
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-debug-message-when-register-is-unavailable.patch29
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch)8
-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-Fixing-the-issues-related-to-GDB-7.12.patch (renamed from meta-microblaze/recipes-devtools/binutils/binutils/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch)185
-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-Patch-MB-MB-binutils-Upstream-port-issues.patch556
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch495
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch1008
-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.patch78
-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.patch40
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0053-gdb-Fix-microblaze-target-compilation.patch288
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0054-Patch-MicroBlaze.patch173
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch31
59 files changed, 3912 insertions, 5446 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
index 44f4cc79..462bbefd 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
@@ -14,47 +14,29 @@ SRC_URI:append = " \
14 file://0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch \ 14 file://0011-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch \
15 file://0012-fixing-the-constant-range-check-issue.patch \ 15 file://0012-fixing-the-constant-range-check-issue.patch \
16 file://0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch \ 16 file://0013-Patch-Microblaze-Compiler-will-give-error-messages-i.patch \
17 file://0014-intial-commit-of-MB-64-bit.patch \ 17 file://0014-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch \
18 file://0015-MB-X-initial-commit.patch \ 18 file://0015-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
19 file://0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \ 19 file://0016-Added-relocations-for-MB-X.patch \
20 file://0017-Added-relocations-for-MB-X.patch \ 20 file://0017-Fixed-MB-x-relocation-issues.patch \
21 file://0018-Fixed-MB-x-relocation-issues.patch \ 21 file://0018-Fixing-the-branch-related-issues.patch \
22 file://0019-Fixing-the-branch-related-issues.patch \ 22 file://0019-Fixed-address-computation-issues-with-64bit-address.patch \
23 file://0020-Fixed-address-computation-issues-with-64bit-address.patch \ 23 file://0020-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch \
24 file://0021-Adding-new-relocation-to-support-64bit-rodata.patch \ 24 file://0021-fixing-the-.bss-relocation-issue.patch \
25 file://0022-fixing-the-.bss-relocation-issue.patch \ 25 file://0022-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 \ 26 file://0023-Revert-ld-Remove-unused-expression-state.patch \
27 file://0024-Revert-ld-Remove-unused-expression-state.patch \ 27 file://0024-fixing-the-long-long-long-mingw-toolchain-issue.patch \
28 file://0025-fixing-the-long-long-long-mingw-toolchain-issue.patch \ 28 file://0025-Added-support-to-new-arithmetic-single-register-inst.patch \
29 file://0026-Added-support-to-new-arithmetic-single-register-inst.patch \ 29 file://0026-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
30 file://0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \ 30 file://0027-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \
31 file://0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \ 31 file://0028-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch \
32 file://0029-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch \ 32 file://0029-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch \
33 file://0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch \ 33 file://0030-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch \
34 file://0031-gas-revert-moving-of-md_pseudo_table-from-const.patch \ 34 file://0031-gas-revert-moving-of-md_pseudo_table-from-const.patch \
35 file://0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \ 35 file://0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
36 file://0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \ 36 file://0033-Add-initial-port-of-linux-gdbserver.patch \
37 file://0034-Initial-port-of-core-reading-support-Added-support-f.patch \ 37 file://0034-Initial-port-of-core-reading-support.patch \
38 file://0035-Fix-debug-message-when-register-is-unavailable.patch \ 38 file://0035-Fix-debug-message-when-register-is-unavailable.patch \
39 file://0036-revert-master-rebase-changes-to-gdbserver.patch \ 39 file://0036-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \
40 file://0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch \ 40 file://0037-Fixing-the-issues-related-to-GDB-7.12.patch \
41 file://0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch \ 41 file://0038-Patch-MB-MB-binutils-Upstream-port-issues.patch \
42 file://0039-Initial-support-for-native-gdb.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 \
56 file://0053-gdb-Fix-microblaze-target-compilation.patch \
57 file://0054-Patch-MicroBlaze.patch \
58 file://0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \
59 file://0056-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch \
60 " 42 "
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
index fe3f2bff..c34600e5 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
@@ -1,7 +1,7 @@
1From 212bd1115f13cc0904fb5556751585c775bc51a6 Mon Sep 17 00:00:00 2001 1From baa73267935dc5854f4e07c809a46e42aa8cca4b Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000 3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 01/52] Add wdc.ext.clear and wdc.ext.flush insns 4Subject: [PATCH 01/38] 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 27d8684df0..b6c5016e4d 100644 18index 080d238bd2b..746566fdb87 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 @@
@@ -33,9 +33,9 @@ index 27d8684df0..b6c5016e4d 100644
33-#define MAX_OPCODES 289 33-#define MAX_OPCODES 289
34+#define MAX_OPCODES 291 34+#define MAX_OPCODES 291
35 35
36 struct op_code_struct 36 const struct op_code_struct
37 { 37 {
38@@ -174,7 +175,9 @@ struct op_code_struct 38@@ -174,7 +175,9 @@ const struct op_code_struct
39 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst }, 39 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
40 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst }, 40 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
41 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst }, 41 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
@@ -46,7 +46,7 @@ index 27d8684df0..b6c5016e4d 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 aa53dfe6bb..795c57b5ff 100644 49index 6dd3694f4be..10d7e883366 100644
50--- a/opcodes/microblaze-opcm.h 50--- a/opcodes/microblaze-opcm.h
51+++ b/opcodes/microblaze-opcm.h 51+++ b/opcodes/microblaze-opcm.h
52@@ -33,8 +33,8 @@ enum microblaze_instr 52@@ -33,8 +33,8 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
index 78f4be14..03fcf2f0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0002-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 23ed5e7ab73a2b5dc1ca09362d4815a643a2d187 Mon Sep 17 00:00:00 2001 1From 2c240d885b5871571d93af64baf2e67f077f735c Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com> 2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 19 Mar 2013 17:18:23 +0530 3Date: Tue, 19 Mar 2013 17:18:23 +0530
4Subject: [PATCH 02/52] Add mlittle-endian and mbig-endian flags 4Subject: [PATCH 02/38] 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 ae5d36dc9c..34eeb97235 100644 19index 881172d5274..d6fc400cef9 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 @@
@@ -27,8 +27,8 @@ index ae5d36dc9c..34eeb97235 100644
27+#define OPTION_BIG (OPTION_MD_BASE + 3) 27+#define OPTION_BIG (OPTION_MD_BASE + 3)
28 28
29 void microblaze_generate_symbol (char *sym); 29 void microblaze_generate_symbol (char *sym);
30 static bfd_boolean check_spl_reg (unsigned *); 30 static bool check_spl_reg (unsigned *);
31@@ -1842,6 +1844,8 @@ struct option md_longopts[] = 31@@ -1854,6 +1856,8 @@ struct option md_longopts[] =
32 { 32 {
33 {"EB", no_argument, NULL, OPTION_EB}, 33 {"EB", no_argument, NULL, OPTION_EB},
34 {"EL", no_argument, NULL, OPTION_EL}, 34 {"EL", no_argument, NULL, OPTION_EL},
@@ -37,7 +37,7 @@ index ae5d36dc9c..34eeb97235 100644
37 { NULL, no_argument, NULL, 0} 37 { NULL, no_argument, NULL, 0}
38 }; 38 };
39 39
40@@ -2494,9 +2498,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 40@@ -2507,9 +2511,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
41 switch (c) 41 switch (c)
42 { 42 {
43 case OPTION_EB: 43 case OPTION_EB:
@@ -49,7 +49,7 @@ index ae5d36dc9c..34eeb97235 100644
49 target_big_endian = 0; 49 target_big_endian = 0;
50 break; 50 break;
51 default: 51 default:
52@@ -2511,6 +2517,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) 52@@ -2524,6 +2530,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
53 /* fprintf(stream, _("\ 53 /* fprintf(stream, _("\
54 MicroBlaze options:\n\ 54 MicroBlaze options:\n\
55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */ 55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
index 96ddefa0..b76020f5 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -1,15 +1,18 @@
1From f74d7754befd636c6139261e6c6b23ed49aa0fa9 Mon Sep 17 00:00:00 2001 1From fc6844169e72155a008d963c3991ed084e0d0890 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> 2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200 3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 03/52] Disable the warning message for eh_frame_hdr 4Subject: [PATCH 03/38] 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
8Conflicts:
9 bfd/elf-eh-frame.c
7--- 10---
8 bfd/elf-eh-frame.c | 3 +++ 11 bfd/elf-eh-frame.c | 3 +++
9 1 file changed, 3 insertions(+) 12 1 file changed, 3 insertions(+)
10 13
11diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c 14diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
12index 7a129b00f8..d5e4a5c062 100644 15index 6ce6d225cff..c6b0c122459 100644
13--- a/bfd/elf-eh-frame.c 16--- a/bfd/elf-eh-frame.c
14+++ b/bfd/elf-eh-frame.c 17+++ b/bfd/elf-eh-frame.c
15@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, 18@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
@@ -23,7 +26,7 @@ index 7a129b00f8..d5e4a5c062 100644
23 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"), 26 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
24 abfd, sec); 27 abfd, sec);
25+} 28+}
26 hdr_info->u.dwarf.table = FALSE; 29 hdr_info->u.dwarf.table = false;
27 free (sec_info); 30 free (sec_info);
28 success: 31 success:
29-- 32--
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
index a63ad020..03b84798 100644
--- 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
@@ -1,7 +1,7 @@
1From 6aadc146948741df27125cc2253ba9a50efa5cfc Mon Sep 17 00:00:00 2001 1From 786c2252440ed07d05c1ab37675e5138e7b44bb8 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 8 Nov 2016 11:54:08 +0530 3Date: Tue, 8 Nov 2016 11:54:08 +0530
4Subject: [PATCH 04/52] [LOCAL]: Fix relaxation of assembler resolved 4Subject: [PATCH 04/38] [LOCAL]: Fix relaxation of assembler resolved
5 references,Fixup debug_loc sections after linker relaxation Adds a new 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 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 7 assembler to the linker when the linker manages to fully resolve a local
@@ -17,6 +17,9 @@ Conflicts:
17 bfd/elf32-microblaze.c 17 bfd/elf32-microblaze.c
18 binutils/readelf.c 18 binutils/readelf.c
19 include/elf/microblaze.h 19 include/elf/microblaze.h
20
21Conflicts:
22 binutils/readelf.c
20--- 23---
21 bfd/bfd-in2.h | 5 ++ 24 bfd/bfd-in2.h | 5 ++
22 bfd/elf32-microblaze.c | 126 ++++++++++++++++++++++++++++--------- 25 bfd/elf32-microblaze.c | 126 ++++++++++++++++++++++++++++---------
@@ -28,10 +31,10 @@ Conflicts:
28 7 files changed, 119 insertions(+), 29 deletions(-) 31 7 files changed, 119 insertions(+), 29 deletions(-)
29 32
30diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 33diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
31index 35ef4d755b..1bd19a2b63 100644 34index 9a698316980..943bc2e914c 100644
32--- a/bfd/bfd-in2.h 35--- a/bfd/bfd-in2.h
33+++ b/bfd/bfd-in2.h 36+++ b/bfd/bfd-in2.h
34@@ -5428,6 +5428,11 @@ value relative to the read-write small data area anchor */ 37@@ -5423,6 +5423,11 @@ value relative to the read-write small data area anchor */
35 expressions of the form "Symbol Op Symbol" */ 38 expressions of the form "Symbol Op Symbol" */
36 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, 39 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
37 40
@@ -44,11 +47,11 @@ index 35ef4d755b..1bd19a2b63 100644
44 value in two words (with an imm instruction). No relocation is 47 value in two words (with an imm instruction). No relocation is
45 done here - only used for relaxing */ 48 done here - only used for relaxing */
46diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 49diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
47index 693fc71f73..e9715eae6a 100644 50index d9c0d93a01a..2316e085d1f 100644
48--- a/bfd/elf32-microblaze.c 51--- a/bfd/elf32-microblaze.c
49+++ b/bfd/elf32-microblaze.c 52+++ b/bfd/elf32-microblaze.c
50@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 53@@ -175,6 +175,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
51 FALSE), /* PC relative offset? */ 54 false), /* PC relative offset? */
52 55
53 /* This reloc does nothing. Used for relaxation. */ 56 /* This reloc does nothing. Used for relaxation. */
54+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ 57+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
@@ -68,7 +71,7 @@ index 693fc71f73..e9715eae6a 100644
68 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ 71 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
69 0, /* Rightshift. */ 72 0, /* Rightshift. */
70 3, /* Size (0 = byte, 1 = short, 2 = long). */ 73 3, /* Size (0 = byte, 1 = short, 2 = long). */
71@@ -562,7 +576,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 74@@ -560,7 +574,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
72 case BFD_RELOC_NONE: 75 case BFD_RELOC_NONE:
73 microblaze_reloc = R_MICROBLAZE_NONE; 76 microblaze_reloc = R_MICROBLAZE_NONE;
74 break; 77 break;
@@ -80,7 +83,7 @@ index 693fc71f73..e9715eae6a 100644
80 microblaze_reloc = R_MICROBLAZE_64_NONE; 83 microblaze_reloc = R_MICROBLAZE_64_NONE;
81 break; 84 break;
82 case BFD_RELOC_32: 85 case BFD_RELOC_32:
83@@ -1914,18 +1931,26 @@ microblaze_elf_relax_section (bfd *abfd, 86@@ -1910,18 +1927,26 @@ microblaze_elf_relax_section (bfd *abfd,
84 } 87 }
85 break; 88 break;
86 case R_MICROBLAZE_NONE: 89 case R_MICROBLAZE_NONE:
@@ -111,7 +114,7 @@ index 693fc71f73..e9715eae6a 100644
111 } 114 }
112 break; 115 break;
113 case R_MICROBLAZE_64_NONE: 116 case R_MICROBLAZE_64_NONE:
114@@ -1969,30 +1994,73 @@ microblaze_elf_relax_section (bfd *abfd, 117@@ -1965,30 +1990,73 @@ microblaze_elf_relax_section (bfd *abfd,
115 irelscanend = irelocs + o->reloc_count; 118 irelscanend = irelocs + o->reloc_count;
116 for (irelscan = irelocs; irelscan < irelscanend; irelscan++) 119 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
117 { 120 {
@@ -208,7 +211,7 @@ index 693fc71f73..e9715eae6a 100644
208 o->rawsize)) 211 o->rawsize))
209 goto error_return; 212 goto error_return;
210 elf_section_data (o)->this_hdr.contents = ocontents; 213 elf_section_data (o)->this_hdr.contents = ocontents;
211@@ -2028,7 +2096,7 @@ microblaze_elf_relax_section (bfd *abfd, 214@@ -2024,7 +2092,7 @@ microblaze_elf_relax_section (bfd *abfd,
212 elf_section_data (o)->this_hdr.contents = ocontents; 215 elf_section_data (o)->this_hdr.contents = ocontents;
213 } 216 }
214 } 217 }
@@ -218,10 +221,10 @@ index 693fc71f73..e9715eae6a 100644
218 0, 221 0,
219 sec); 222 sec);
220diff --git a/bfd/libbfd.h b/bfd/libbfd.h 223diff --git a/bfd/libbfd.h b/bfd/libbfd.h
221index b97534fc9f..c1551b9240 100644 224index c37ddc03cfd..4153b94564d 100644
222--- a/bfd/libbfd.h 225--- a/bfd/libbfd.h
223+++ b/bfd/libbfd.h 226+++ b/bfd/libbfd.h
224@@ -2967,6 +2967,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 227@@ -2988,6 +2988,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
225 "BFD_RELOC_MICROBLAZE_32_ROSDA", 228 "BFD_RELOC_MICROBLAZE_32_ROSDA",
226 "BFD_RELOC_MICROBLAZE_32_RWSDA", 229 "BFD_RELOC_MICROBLAZE_32_RWSDA",
227 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 230 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
@@ -230,10 +233,10 @@ index b97534fc9f..c1551b9240 100644
230 "BFD_RELOC_MICROBLAZE_64_GOTPC", 233 "BFD_RELOC_MICROBLAZE_64_GOTPC",
231 "BFD_RELOC_MICROBLAZE_64_GOT", 234 "BFD_RELOC_MICROBLAZE_64_GOT",
232diff --git a/bfd/reloc.c b/bfd/reloc.c 235diff --git a/bfd/reloc.c b/bfd/reloc.c
233index 9aba84ca81..9b39b41941 100644 236index 6d920e1df06..3a08f7a8a42 100644
234--- a/bfd/reloc.c 237--- a/bfd/reloc.c
235+++ b/bfd/reloc.c 238+++ b/bfd/reloc.c
236@@ -6858,6 +6858,12 @@ ENUM 239@@ -6896,6 +6896,12 @@ ENUM
237 ENUMDOC 240 ENUMDOC
238 This is a 32 bit reloc for the microblaze to handle 241 This is a 32 bit reloc for the microblaze to handle
239 expressions of the form "Symbol Op Symbol" 242 expressions of the form "Symbol Op Symbol"
@@ -247,13 +250,13 @@ index 9aba84ca81..9b39b41941 100644
247 BFD_RELOC_MICROBLAZE_64_NONE 250 BFD_RELOC_MICROBLAZE_64_NONE
248 ENUMDOC 251 ENUMDOC
249diff --git a/binutils/readelf.c b/binutils/readelf.c 252diff --git a/binutils/readelf.c b/binutils/readelf.c
250index 6057515a89..2b797ef2db 100644 253index a6073f7ec80..5b25fb9a52a 100644
251--- a/binutils/readelf.c 254--- a/binutils/readelf.c
252+++ b/binutils/readelf.c 255+++ b/binutils/readelf.c
253@@ -13187,6 +13187,10 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) 256@@ -14057,6 +14057,10 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
254 return reloc_type == 1; /* R_Z80_8. */ 257 return reloc_type == 1; /* R_Z80_8. */
255 default: 258 default:
256 return FALSE; 259 return false;
257+ case EM_MICROBLAZE: 260+ case EM_MICROBLAZE:
258+ return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */ 261+ return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */
259+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */ 262+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
@@ -262,10 +265,10 @@ index 6057515a89..2b797ef2db 100644
262 } 265 }
263 266
264diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 267diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
265index 34eeb97235..74a63abeb0 100644 268index d6fc400cef9..87efc2b7a46 100644
266--- a/gas/config/tc-microblaze.c 269--- a/gas/config/tc-microblaze.c
267+++ b/gas/config/tc-microblaze.c 270+++ b/gas/config/tc-microblaze.c
268@@ -2198,9 +2198,12 @@ md_apply_fix (fixS * fixP, 271@@ -2211,9 +2211,12 @@ md_apply_fix (fixS * fixP,
269 moves code around due to relaxing. */ 272 moves code around due to relaxing. */
270 if (fixP->fx_r_type == BFD_RELOC_64_PCREL) 273 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
271 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 274 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
@@ -278,7 +281,7 @@ index 34eeb97235..74a63abeb0 100644
278 } 281 }
279 return; 282 return;
280 } 283 }
281@@ -2421,6 +2424,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 284@@ -2434,6 +2437,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
282 switch (fixp->fx_r_type) 285 switch (fixp->fx_r_type)
283 { 286 {
284 case BFD_RELOC_NONE: 287 case BFD_RELOC_NONE:
@@ -287,7 +290,7 @@ index 34eeb97235..74a63abeb0 100644
287 case BFD_RELOC_32: 290 case BFD_RELOC_32:
288 case BFD_RELOC_MICROBLAZE_32_LO: 291 case BFD_RELOC_MICROBLAZE_32_LO:
289diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h 292diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
290index 2fec296967..3978a3dc01 100644 293index 66b4fda8f54..936ef484289 100644
291--- a/include/elf/microblaze.h 294--- a/include/elf/microblaze.h
292+++ b/include/elf/microblaze.h 295+++ b/include/elf/microblaze.h
293@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) 296@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0005-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 95e4a363..f2419c4c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0005-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 4fc5075cebc9c76053b5ff683ab75c9e8b46ca1a Mon Sep 17 00:00:00 2001 1From 48e989bf1ff9ce0250256afc95d40d75fa098e21 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 05/52] upstream change to garbage collection sweep causes mb 4Subject: [PATCH 05/38] 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
@@ -18,18 +18,21 @@ This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs 18relocations for a shared lib with garbage collection this occurs
19 19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21
22Conflicts:
23 bfd/elflink.c
21--- 24---
22 bfd/elflink.c | 1 - 25 bfd/elflink.c | 1 -
23 1 file changed, 1 deletion(-) 26 1 file changed, 1 deletion(-)
24 27
25diff --git a/bfd/elflink.c b/bfd/elflink.c 28diff --git a/bfd/elflink.c b/bfd/elflink.c
26index 998b72f228..2daf8fdf6a 100644 29index 9a05208253c..bdfbcecef92 100644
27--- a/bfd/elflink.c 30--- a/bfd/elflink.c
28+++ b/bfd/elflink.c 31+++ b/bfd/elflink.c
29@@ -6372,7 +6372,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) 32@@ -6432,7 +6432,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
30 33
31 inf = (struct elf_gc_sweep_symbol_info *) data; 34 inf = (struct elf_gc_sweep_symbol_info *) data;
32 (*inf->hide_symbol) (inf->info, h, TRUE); 35 (*inf->hide_symbol) (inf->info, h, true);
33- h->def_regular = 0; 36- h->def_regular = 0;
34 h->ref_regular = 0; 37 h->ref_regular = 0;
35 h->ref_regular_nonweak = 0; 38 h->ref_regular_nonweak = 0;
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch
index fcbd662e..5221bb33 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0006-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 4e8bd012d3025a6f6b2b2794930f1bfbad7932e8 Mon Sep 17 00:00:00 2001 1From a150edd000f83578755a749bb8c44553e0dbc1f0 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 06/52] Fix bug in TLSTPREL Relocation 4Subject: [PATCH 06/38] Fix bug in TLSTPREL Relocation
5 5
6Fixed the problem related to the fixup/relocations TLSTPREL. 6Fixed the problem related to the fixup/relocations TLSTPREL.
7When the fixup is applied the addend is not added at the correct offset 7When the fixup is applied the addend is not added at the correct offset
@@ -13,10 +13,10 @@ big & little-endian compilers
13 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
14 14
15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
16index e9715eae6a..9c4f809eaa 100644 16index 2316e085d1f..e0729c6a194 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@@ -1443,9 +1443,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
20 relocation += addend; 20 relocation += addend;
21 relocation -= dtprel_base(info); 21 relocation -= dtprel_base(info);
22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
index fd15e23c..2f1d83d7 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
@@ -1,7 +1,7 @@
1From 1d1344e5786d435f4f492739d0c477befa4c6906 Mon Sep 17 00:00:00 2001 1From fc3bbcce05e1726bf98948cebfef841b84df73cb 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 07/52] Added Address extension instructions 4Subject: [PATCH 07/38] 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.
@@ -24,10 +24,10 @@ Conflicts:
24 2 files changed, 16 insertions(+), 5 deletions(-) 24 2 files changed, 16 insertions(+), 5 deletions(-)
25 25
26diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 26diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
27index b6c5016e4d..1f1ade40b2 100644 27index 746566fdb87..5d165dcdf91 100644
28--- a/opcodes/microblaze-opc.h 28--- a/opcodes/microblaze-opc.h
29+++ b/opcodes/microblaze-opc.h 29+++ b/opcodes/microblaze-opc.h
30@@ -178,8 +178,11 @@ struct op_code_struct 30@@ -178,8 +178,11 @@ const struct op_code_struct
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 }, 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 },
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 }, 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 },
33 {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst }, 33 {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
@@ -39,7 +39,7 @@ index b6c5016e4d..1f1ade40b2 100644
39 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst }, 39 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
40 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst }, 40 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
41 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst }, 41 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
42@@ -229,18 +232,24 @@ struct op_code_struct 42@@ -229,18 +232,24 @@ const struct op_code_struct
43 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst }, 43 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
44 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst }, 44 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
45 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst }, 45 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
@@ -64,7 +64,7 @@ index b6c5016e4d..1f1ade40b2 100644
64 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst }, 64 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
65 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst }, 65 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
66 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst }, 66 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
67@@ -405,6 +414,8 @@ struct op_code_struct 67@@ -405,6 +414,8 @@ const struct op_code_struct
68 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst }, 68 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
69 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst }, 69 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
70 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */ 70 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
@@ -74,7 +74,7 @@ index b6c5016e4d..1f1ade40b2 100644
74 {"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 },
75 {"", 0, 0, 0, 0, 0, 0, 0, 0}, 75 {"", 0, 0, 0, 0, 0, 0, 0, 0},
76diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 76diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
77index 795c57b5ff..b05e319862 100644 77index 10d7e883366..250fd6a250a 100644
78--- a/opcodes/microblaze-opcm.h 78--- a/opcodes/microblaze-opcm.h
79+++ b/opcodes/microblaze-opcm.h 79+++ b/opcodes/microblaze-opcm.h
80@@ -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
index 8564003c..4c3caa51 100644
--- 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
@@ -1,14 +1,14 @@
1From b2e494ee992ef0509bd2a4512f62841098631219 Mon Sep 17 00:00:00 2001 1From bb27e620e2911e472eee6c1ee4fb2a1e722b65aa Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 28 Jan 2016 14:07:34 +0530 3Date: Thu, 28 Jan 2016 14:07:34 +0530
4Subject: [PATCH 08/52] fixing the MAX_OPCODES to correct value 4Subject: [PATCH 08/38] fixing the MAX_OPCODES to correct value
5 5
6--- 6---
7 opcodes/microblaze-opc.h | 2 +- 7 opcodes/microblaze-opc.h | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-) 8 1 file changed, 1 insertion(+), 1 deletion(-)
9 9
10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 10diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
11index 1f1ade40b2..c7a506b845 100644 11index 5d165dcdf91..bf53e492b9a 100644
12--- a/opcodes/microblaze-opc.h 12--- a/opcodes/microblaze-opc.h
13+++ b/opcodes/microblaze-opc.h 13+++ b/opcodes/microblaze-opc.h
14@@ -102,7 +102,7 @@ 14@@ -102,7 +102,7 @@
@@ -18,7 +18,7 @@ index 1f1ade40b2..c7a506b845 100644
18-#define MAX_OPCODES 291 18-#define MAX_OPCODES 291
19+#define MAX_OPCODES 299 19+#define MAX_OPCODES 299
20 20
21 struct op_code_struct 21 const struct op_code_struct
22 { 22 {
23-- 23--
242.17.1 242.17.1
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0009-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Add-new-bit-field-instructions.patch
index 0188629d..16e086fb 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0009-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 cea8d524fca305c2878374433d9745b938e4c78f Mon Sep 17 00:00:00 2001 1From c5c42765e7436fa20cc2069fa0426995cf940e5a 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 09/52] Add new bit-field instructions 4Subject: [PATCH 09/38] 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
@@ -23,7 +23,7 @@ Conflicts:
23 4 files changed, 104 insertions(+), 5 deletions(-) 23 4 files changed, 104 insertions(+), 5 deletions(-)
24 24
25diff --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
26index 74a63abeb0..765abfb388 100644 26index 87efc2b7a46..aa58a18f05c 100644
27--- a/gas/config/tc-microblaze.c 27--- a/gas/config/tc-microblaze.c
28+++ b/gas/config/tc-microblaze.c 28+++ b/gas/config/tc-microblaze.c
29@@ -917,7 +917,7 @@ md_assemble (char * str) 29@@ -917,7 +917,7 @@ md_assemble (char * str)
@@ -35,7 +35,7 @@ index 74a63abeb0..765abfb388 100644
35 expressionS exp; 35 expressionS exp;
36 char name[20]; 36 char name[20];
37 37
38@@ -1172,7 +1172,76 @@ md_assemble (char * str) 38@@ -1178,7 +1178,76 @@ md_assemble (char * str)
39 inst |= (reg2 << RA_LOW) & RA_MASK; 39 inst |= (reg2 << RA_LOW) & RA_MASK;
40 inst |= (immed << IMM_LOW) & IMM5_MASK; 40 inst |= (immed << IMM_LOW) & IMM5_MASK;
41 break; 41 break;
@@ -113,7 +113,7 @@ index 74a63abeb0..765abfb388 100644
113 if (strcmp (op_end, "")) 113 if (strcmp (op_end, ""))
114 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 114 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
115diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 115diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
116index be1534c257..315c6e9350 100644 116index 1696f559a0b..1fe8da2e51b 100644
117--- a/opcodes/microblaze-dis.c 117--- a/opcodes/microblaze-dis.c
118+++ b/opcodes/microblaze-dis.c 118+++ b/opcodes/microblaze-dis.c
119@@ -91,7 +91,19 @@ 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)
@@ -151,7 +151,7 @@ index be1534c257..315c6e9350 100644
151 print_func (stream, "\t%s", get_field_rd (&buf, inst)); 151 print_func (stream, "\t%s", get_field_rd (&buf, inst));
152 break; 152 break;
153diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 153diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
154index c7a506b845..f61f4ef66d 100644 154index bf53e492b9a..6fcded04b49 100644
155--- a/opcodes/microblaze-opc.h 155--- a/opcodes/microblaze-opc.h
156+++ b/opcodes/microblaze-opc.h 156+++ b/opcodes/microblaze-opc.h
157@@ -59,6 +59,9 @@ 157@@ -59,6 +59,9 @@
@@ -181,9 +181,9 @@ index c7a506b845..f61f4ef66d 100644
181-#define MAX_OPCODES 299 181-#define MAX_OPCODES 299
182+#define MAX_OPCODES 301 182+#define MAX_OPCODES 301
183 183
184 struct op_code_struct 184 const struct op_code_struct
185 { 185 {
186@@ -159,6 +164,8 @@ struct op_code_struct 186@@ -159,6 +164,8 @@ const struct op_code_struct
187 {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst }, 187 {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
188 {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst }, 188 {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
189 {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst }, 189 {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
@@ -202,7 +202,7 @@ index c7a506b845..f61f4ef66d 100644
202 #endif /* MICROBLAZE_OPC */ 202 #endif /* MICROBLAZE_OPC */
203 203
204diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 204diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
205index b05e319862..fa921c90c9 100644 205index 250fd6a250a..78a2ac44960 100644
206--- a/opcodes/microblaze-opcm.h 206--- a/opcodes/microblaze-opcm.h
207+++ b/opcodes/microblaze-opcm.h 207+++ b/opcodes/microblaze-opcm.h
208@@ -29,7 +29,7 @@ enum microblaze_instr 208@@ -29,7 +29,7 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch
index 892205cd..1c939a84 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-imm-bug.patch
@@ -1,7 +1,7 @@
1From d6ccef90be40de63ee6da4943a601edaf7b1a136 Mon Sep 17 00:00:00 2001 1From ca1e831754eba0e38c1b7ceefd6a3d25c7d36e59 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 10/52] fixing the imm bug. with relax option imm -1 is also 4Subject: [PATCH 10/38] fixing the imm bug. with relax option imm -1 is also
5 getting removed this is corrected now. 5 getting removed this is corrected now.
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 10/52] fixing the imm bug. with relax option imm -1 is also
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 9c4f809eaa..c22130fd8c 100644 12index e0729c6a194..e378542b902 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@@ -1861,8 +1861,7 @@ microblaze_elf_relax_section (bfd *abfd,
16 else 16 else
17 symval += irel->r_addend; 17 symval += irel->r_addend;
18 18
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0011-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 db23fe14..3118ea8c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0011-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 3bb637b058c5f2622950e6984695e36f9cac067a Mon Sep 17 00:00:00 2001 1From b844e6bdbb6aa0dd63055e8c763f68f83ab15318 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 11/52] [Patch,Microblaze]: fixed bug in GCC so that It will 4Subject: [PATCH 11/38] [Patch,Microblaze]: fixed bug in GCC so that It will
5 support .long 0U and .long 0u 5 support .long 0U and .long 0u
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 11/52] [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 6f8ccb8230..0e34ca53d9 100644 12index 03caa91f4d1..469a52cfd56 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@@ -832,6 +832,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
16 break; 16 break;
17 } 17 }
18 } 18 }
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch
index 4145b0da..45953906 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0012-fixing-the-constant-range-check-issue.patch
@@ -1,7 +1,7 @@
1From e1cb5c37efd76b44a878574ee3baad4c7a882e3b Mon Sep 17 00:00:00 2001 1From 5d4d7383a152bfc87ac7fdf5fcaef7eaca500836 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 12/52] fixing the constant range check issue sample error: not 4Subject: [PATCH 12/38] fixing the constant range check issue sample error: not
5 in range ffffffff80000000..7fffffff, not ffffffff70000000 5 in range ffffffff80000000..7fffffff, not ffffffff70000000
6 6
7--- 7---
@@ -9,7 +9,7 @@ Subject: [PATCH 12/52] fixing the constant range check issue sample error: not
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 765abfb388..5810a74a5f 100644 12index aa58a18f05c..98d0c259246 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/0013-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 a74f2b9e..22404408 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0013-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 1a3f130008b4ebcd9a6e45cdac7188bde88f2f28 Mon Sep 17 00:00:00 2001 1From 094a9534b55a51982857859553c582492bf91815 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 13/52] [Patch,Microblaze]: Compiler will give error messages 4Subject: [PATCH 13/38] [Patch,Microblaze]: Compiler will give error messages
5 in more detail for mxl-gp-opt flag.. 5 in more detail for mxl-gp-opt flag..
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 13/52] [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 08be9030cb..613d748fef 100644 12index 42660eb9a3c..7849f060aad 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@@ -1562,6 +1562,18 @@ reloc_overflow (struct bfd_link_info *info,
16 break; 16 break;
17 case bfd_link_hash_defined: 17 case bfd_link_hash_defined:
18 case bfd_link_hash_defweak: 18 case bfd_link_hash_defweak:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch
index f0037e1f..0ba67003 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0014-intial-commit-of-MB-64-bit.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch
@@ -1,27 +1,26 @@
1From d25d934f076297615cb0287488449fb32b9c46e8 Mon Sep 17 00:00:00 2001 1From b53570b1b4eb3e57b21e44515c202dc710b438ce Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 30 Sep 2018 16:28:28 +0530 3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 14/52] intial commit of MB 64-bit 4Subject: [PATCH 14/38] [Patch,MicroBlaze] : initial support for MicroBlaze 64
5 bit [-m64]
5 6
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
13--- 7---
14 bfd/Makefile.am | 2 + 8 bfd/Makefile.am | 2 +
15 bfd/Makefile.in | 3 + 9 bfd/Makefile.in | 3 +
10 bfd/bfd-in2.h | 10 +
16 bfd/config.bfd | 4 + 11 bfd/config.bfd | 4 +
17 bfd/configure | 2 + 12 bfd/configure | 2 +
18 bfd/configure.ac | 2 + 13 bfd/configure.ac | 2 +
19 bfd/cpu-microblaze.c | 53 +- 14 bfd/cpu-microblaze.c | 53 +-
20 bfd/elf64-microblaze.c | 3610 ++++++++++++++++++++++++++++ 15 bfd/elf32-microblaze.c | 65 +-
16 bfd/elf64-microblaze.c | 3577 ++++++++++++++++++++++++++++
17 bfd/libbfd.h | 2 +
18 bfd/reloc.c | 12 +
21 bfd/targets.c | 6 + 19 bfd/targets.c | 6 +
22 gas/config/tc-microblaze.c | 274 ++- 20 gas/config/tc-microblaze.c | 419 +++-
23 gas/config/tc-microblaze.h | 4 +- 21 gas/config/tc-microblaze.h | 4 +-
24 include/elf/common.h | 1 + 22 include/elf/common.h | 1 +
23 include/elf/microblaze.h | 2 +
25 ld/Makefile.am | 4 + 24 ld/Makefile.am | 4 +
26 ld/Makefile.in | 6 + 25 ld/Makefile.in | 6 +
27 ld/configure.tgt | 3 + 26 ld/configure.tgt | 3 +
@@ -29,17 +28,17 @@ Conflicts:
29 ld/emulparams/elf64microblazeel.sh | 23 + 28 ld/emulparams/elf64microblazeel.sh | 23 +
30 opcodes/microblaze-dis.c | 35 +- 29 opcodes/microblaze-dis.c | 35 +-
31 opcodes/microblaze-opc.h | 162 +- 30 opcodes/microblaze-opc.h | 162 +-
32 opcodes/microblaze-opcm.h | 20 +- 31 opcodes/microblaze-opcm.h | 24 +-
33 19 files changed, 4197 insertions(+), 40 deletions(-) 32 24 files changed, 4375 insertions(+), 69 deletions(-)
34 create mode 100644 bfd/elf64-microblaze.c 33 create mode 100644 bfd/elf64-microblaze.c
35 create mode 100644 ld/emulparams/elf64microblaze.sh 34 create mode 100644 ld/emulparams/elf64microblaze.sh
36 create mode 100644 ld/emulparams/elf64microblazeel.sh 35 create mode 100644 ld/emulparams/elf64microblazeel.sh
37 36
38diff --git a/bfd/Makefile.am b/bfd/Makefile.am 37diff --git a/bfd/Makefile.am b/bfd/Makefile.am
39index c88c448000..d86f1c5697 100644 38index ed2f701805d..0dc77afa8ad 100644
40--- a/bfd/Makefile.am 39--- a/bfd/Makefile.am
41+++ b/bfd/Makefile.am 40+++ b/bfd/Makefile.am
42@@ -562,6 +562,7 @@ BFD64_BACKENDS = \ 41@@ -558,6 +558,7 @@ BFD64_BACKENDS = \
43 elf64-riscv.lo \ 42 elf64-riscv.lo \
44 elfxx-riscv.lo \ 43 elfxx-riscv.lo \
45 elf64-s390.lo \ 44 elf64-s390.lo \
@@ -47,7 +46,7 @@ index c88c448000..d86f1c5697 100644
47 elf64-sparc.lo \ 46 elf64-sparc.lo \
48 elf64-tilegx.lo \ 47 elf64-tilegx.lo \
49 elf64-x86-64.lo \ 48 elf64-x86-64.lo \
50@@ -596,6 +597,7 @@ BFD64_BACKENDS_CFILES = \ 49@@ -592,6 +593,7 @@ BFD64_BACKENDS_CFILES = \
51 elf64-nfp.c \ 50 elf64-nfp.c \
52 elf64-ppc.c \ 51 elf64-ppc.c \
53 elf64-s390.c \ 52 elf64-s390.c \
@@ -56,10 +55,10 @@ index c88c448000..d86f1c5697 100644
56 elf64-tilegx.c \ 55 elf64-tilegx.c \
57 elf64-x86-64.c \ 56 elf64-x86-64.c \
58diff --git a/bfd/Makefile.in b/bfd/Makefile.in 57diff --git a/bfd/Makefile.in b/bfd/Makefile.in
59index d0d14c6ab3..a54abeca48 100644 58index 12807d99760..01ac4805eb8 100644
60--- a/bfd/Makefile.in 59--- a/bfd/Makefile.in
61+++ b/bfd/Makefile.in 60+++ b/bfd/Makefile.in
62@@ -988,6 +988,7 @@ BFD64_BACKENDS = \ 61@@ -985,6 +985,7 @@ BFD64_BACKENDS = \
63 elf64-riscv.lo \ 62 elf64-riscv.lo \
64 elfxx-riscv.lo \ 63 elfxx-riscv.lo \
65 elf64-s390.lo \ 64 elf64-s390.lo \
@@ -67,7 +66,7 @@ index d0d14c6ab3..a54abeca48 100644
67 elf64-sparc.lo \ 66 elf64-sparc.lo \
68 elf64-tilegx.lo \ 67 elf64-tilegx.lo \
69 elf64-x86-64.lo \ 68 elf64-x86-64.lo \
70@@ -1022,6 +1023,7 @@ BFD64_BACKENDS_CFILES = \ 69@@ -1019,6 +1020,7 @@ BFD64_BACKENDS_CFILES = \
71 elf64-nfp.c \ 70 elf64-nfp.c \
72 elf64-ppc.c \ 71 elf64-ppc.c \
73 elf64-s390.c \ 72 elf64-s390.c \
@@ -75,7 +74,7 @@ index d0d14c6ab3..a54abeca48 100644
75 elf64-sparc.c \ 74 elf64-sparc.c \
76 elf64-tilegx.c \ 75 elf64-tilegx.c \
77 elf64-x86-64.c \ 76 elf64-x86-64.c \
78@@ -1501,6 +1503,7 @@ distclean-compile: 77@@ -1498,6 +1500,7 @@ distclean-compile:
79 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@ 78 @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@ 79 @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@ 80 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
@@ -83,11 +82,37 @@ index d0d14c6ab3..a54abeca48 100644
83 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@ 82 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@ 83 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@ 84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
85diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
86index 943bc2e914c..2a1d7563643 100644
87--- a/bfd/bfd-in2.h
88+++ b/bfd/bfd-in2.h
89@@ -5433,11 +5433,21 @@ value in two words (with an imm instruction). No relocation is
90 done here - only used for relaxing */
91 BFD_RELOC_MICROBLAZE_64_NONE,
92
93+/* This is a 64 bit reloc that stores the 32 bit pc relative
94+ * +value in two words (with an imml instruction). No relocation is
95+ * +done here - only used for relaxing */
96+ BFD_RELOC_MICROBLAZE_64,
97+
98 /* This is a 64 bit reloc that stores the 32 bit pc relative
99 value in two words (with an imm instruction). The relocation is
100 PC-relative GOT offset */
101 BFD_RELOC_MICROBLAZE_64_GOTPC,
102
103+/* This is a 64 bit reloc that stores the 32 bit pc relative
104+value in two words (with an imml instruction). The relocation is
105+PC-relative GOT offset */
106+ BFD_RELOC_MICROBLAZE_64_GPC,
107+
108 /* This is a 64 bit reloc that stores the 32 bit pc relative
109 value in two words (with an imm instruction). The relocation is
110 GOT offset */
86diff --git a/bfd/config.bfd b/bfd/config.bfd 111diff --git a/bfd/config.bfd b/bfd/config.bfd
87index 14523caf0c..437c03bb9d 100644 112index 30087e3b8f8..108b77ac9c1 100644
88--- a/bfd/config.bfd 113--- a/bfd/config.bfd
89+++ b/bfd/config.bfd 114+++ b/bfd/config.bfd
90@@ -825,11 +825,15 @@ case "${targ}" in 115@@ -822,11 +822,15 @@ case "${targ}" in
91 microblazeel*-*) 116 microblazeel*-*)
92 targ_defvec=microblaze_elf32_le_vec 117 targ_defvec=microblaze_elf32_le_vec
93 targ_selvecs=microblaze_elf32_vec 118 targ_selvecs=microblaze_elf32_vec
@@ -104,10 +129,10 @@ index 14523caf0c..437c03bb9d 100644
104 129
105 #ifdef BFD64 130 #ifdef BFD64
106diff --git a/bfd/configure b/bfd/configure 131diff --git a/bfd/configure b/bfd/configure
107index 0340ed541b..ff5ae4706c 100755 132index 41586f00f93..ffcd8ad4be0 100755
108--- a/bfd/configure 133--- a/bfd/configure
109+++ b/bfd/configure 134+++ b/bfd/configure
110@@ -14903,6 +14903,8 @@ do 135@@ -13445,6 +13445,8 @@ do
111 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 136 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
112 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; 137 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
113 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; 138 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
@@ -117,10 +142,10 @@ index 0340ed541b..ff5ae4706c 100755
117 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;; 142 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
118 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;; 143 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
119diff --git a/bfd/configure.ac b/bfd/configure.ac 144diff --git a/bfd/configure.ac b/bfd/configure.ac
120index 8e86f8399c..408092d3be 100644 145index fec067b2135..9a7df353285 100644
121--- a/bfd/configure.ac 146--- a/bfd/configure.ac
122+++ b/bfd/configure.ac 147+++ b/bfd/configure.ac
123@@ -639,6 +639,8 @@ do 148@@ -625,6 +625,8 @@ do
124 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;; 149 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
125 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; 150 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
126 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;; 151 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
@@ -130,7 +155,7 @@ index 8e86f8399c..408092d3be 100644
130 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;; 155 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
131 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;; 156 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
132diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c 157diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
133index 05a3f767e2..194920b20b 100644 158index d461d01e08f..ec94cc13595 100644
134--- a/bfd/cpu-microblaze.c 159--- a/bfd/cpu-microblaze.c
135+++ b/bfd/cpu-microblaze.c 160+++ b/bfd/cpu-microblaze.c
136@@ -23,7 +23,24 @@ 161@@ -23,7 +23,24 @@
@@ -150,7 +175,7 @@ index 05a3f767e2..194920b20b 100644
150+ "microblaze", /* Architecture name. */ 175+ "microblaze", /* Architecture name. */
151+ "MicroBlaze", /* Printable name. */ 176+ "MicroBlaze", /* Printable name. */
152+ 3, /* Section align power. */ 177+ 3, /* Section align power. */
153+ FALSE, /* Is this the default architecture ? */ 178+ false, /* Is this the default architecture ? */
154+ bfd_default_compatible, /* Architecture comparison function. */ 179+ bfd_default_compatible, /* Architecture comparison function. */
155+ bfd_default_scan, /* String to architecture conversion. */ 180+ bfd_default_scan, /* String to architecture conversion. */
156+ bfd_arch_default_fill, /* Default fill. */ 181+ bfd_arch_default_fill, /* Default fill. */
@@ -174,7 +199,7 @@ index 05a3f767e2..194920b20b 100644
174+ "microblaze", /* Architecture name. */ 199+ "microblaze", /* Architecture name. */
175+ "MicroBlaze", /* Printable name. */ 200+ "MicroBlaze", /* Printable name. */
176+ 3, /* Section align power. */ 201+ 3, /* Section align power. */
177+ TRUE, /* Is this the default architecture ? */ 202+ true, /* Is this the default architecture ? */
178+ bfd_default_compatible, /* Architecture comparison function. */ 203+ bfd_default_compatible, /* Architecture comparison function. */
179+ bfd_default_scan, /* String to architecture conversion. */ 204+ bfd_default_scan, /* String to architecture conversion. */
180+ bfd_arch_default_fill, /* Default fill. */ 205+ bfd_arch_default_fill, /* Default fill. */
@@ -189,7 +214,7 @@ index 05a3f767e2..194920b20b 100644
189+ "microblaze", /* Architecture name. */ 214+ "microblaze", /* Architecture name. */
190+ "MicroBlaze", /* Printable name. */ 215+ "MicroBlaze", /* Printable name. */
191+ 3, /* Section align power. */ 216+ 3, /* Section align power. */
192+ FALSE, /* Is this the default architecture ? */ 217+ false, /* Is this the default architecture ? */
193+ bfd_default_compatible, /* Architecture comparison function. */ 218+ bfd_default_compatible, /* Architecture comparison function. */
194+ bfd_default_scan, /* String to architecture conversion. */ 219+ bfd_default_scan, /* String to architecture conversion. */
195+ bfd_arch_default_fill, /* Default fill. */ 220+ bfd_arch_default_fill, /* Default fill. */
@@ -198,15 +223,135 @@ index 05a3f767e2..194920b20b 100644
198+} 223+}
199+#endif 224+#endif
200 }; 225 };
226diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
227index e378542b902..2f2e1ef7f41 100644
228--- a/bfd/elf32-microblaze.c
229+++ b/bfd/elf32-microblaze.c
230@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
231 0x0000ffff, /* Dest Mask. */
232 true), /* PC relative offset? */
233
234+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
235+ 0, /* Rightshift. */
236+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
237+ 16, /* Bitsize. */
238+ true, /* PC_relative. */
239+ 0, /* Bitpos. */
240+ complain_overflow_dont, /* Complain on overflow. */
241+ bfd_elf_generic_reloc,/* Special Function. */
242+ "R_MICROBLAZE_IMML_64", /* Name. */
243+ false, /* Partial Inplace. */
244+ 0, /* Source Mask. */
245+ 0x0000ffff, /* Dest Mask. */
246+ false), /* PC relative offset? */
247+
248 /* A 64 bit relocation. Table entry not really used. */
249 HOWTO (R_MICROBLAZE_64, /* Type. */
250 0, /* Rightshift. */
251@@ -179,15 +193,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
252 0, /* Rightshift. */
253 2, /* Size (0 = byte, 1 = short, 2 = long). */
254 32, /* Bitsize. */
255- TRUE, /* PC_relative. */
256+ false, /* PC_relative. */
257 0, /* Bitpos. */
258 complain_overflow_bitfield, /* Complain on overflow. */
259 NULL, /* Special Function. */
260 "R_MICROBLAZE_32_NONE",/* Name. */
261- FALSE, /* Partial Inplace. */
262+ false, /* Partial Inplace. */
263 0, /* Source Mask. */
264 0, /* Dest Mask. */
265- FALSE), /* PC relative offset? */
266+ false), /* PC relative offset? */
267
268 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
269 0, /* Rightshift. */
270@@ -278,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
271 0x0000ffff, /* Dest Mask. */
272 true), /* PC relative offset? */
273
274+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
275+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
276+ 0, /* Rightshift. */
277+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
278+ 16, /* Bitsize. */
279+ true, /* PC_relative. */
280+ 0, /* Bitpos. */
281+ complain_overflow_dont, /* Complain on overflow. */
282+ bfd_elf_generic_reloc, /* Special Function. */
283+ "R_MICROBLAZE_GPC_64", /* Name. */
284+ false, /* Partial Inplace. */
285+ 0, /* Source Mask. */
286+ 0x0000ffff, /* Dest Mask. */
287+ true), /* PC relative offset? */
288+
289 /* A 64 bit GOT relocation. Table-entry not really used. */
290 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
291 0, /* Rightshift. */
292@@ -617,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
293 case BFD_RELOC_VTABLE_ENTRY:
294 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
295 break;
296+ case BFD_RELOC_MICROBLAZE_64:
297+ microblaze_reloc = R_MICROBLAZE_IMML_64;
298+ break;
299 case BFD_RELOC_MICROBLAZE_64_GOTPC:
300 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
301 break;
302+ case BFD_RELOC_MICROBLAZE_64_GPC:
303+ microblaze_reloc = R_MICROBLAZE_GPC_64;
304+ break;
305 case BFD_RELOC_MICROBLAZE_64_GOT:
306 microblaze_reloc = R_MICROBLAZE_GOT_64;
307 break;
308@@ -1459,7 +1494,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
309 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
310 {
311 relocation += addend;
312- if (r_type == R_MICROBLAZE_32)
313+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
314 bfd_put_32 (input_bfd, relocation, contents + offset);
315 else
316 {
317@@ -1925,6 +1960,28 @@ microblaze_elf_relax_section (bfd *abfd,
318 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
319 }
320 break;
321+ case R_MICROBLAZE_IMML_64:
322+ {
323+ /* This was a PC-relative instruction that was
324+ completely resolved. */
325+ int sfix, efix;
326+ unsigned int val;
327+ bfd_vma target_address;
328+ target_address = irel->r_addend + irel->r_offset;
329+ sfix = calc_fixup (irel->r_offset, 0, sec);
330+ efix = calc_fixup (target_address, 0, sec);
331+
332+ /* Validate the in-band val. */
333+ val = bfd_get_32 (abfd, contents + irel->r_offset);
334+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
335+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
336+ }
337+ irel->r_addend -= (efix - sfix);
338+ /* Should use HOWTO. */
339+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
340+ irel->r_addend);
341+ }
342+ break;
343 case R_MICROBLAZE_NONE:
344 case R_MICROBLAZE_32_NONE:
345 {
201diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 346diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
202new file mode 100644 347new file mode 100644
203index 0000000000..a357388115 348index 00000000000..46c4aba46f1
204--- /dev/null 349--- /dev/null
205+++ b/bfd/elf64-microblaze.c 350+++ b/bfd/elf64-microblaze.c
206@@ -0,0 +1,3610 @@ 351@@ -0,0 +1,3577 @@
207+/* Xilinx MicroBlaze-specific support for 32-bit ELF 352+/* Xilinx MicroBlaze-specific support for 32-bit ELF
208+ 353+
209+ Copyright (C) 2009-2016 Free Software Foundation, Inc. 354+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
210+ 355+
211+ This file is part of BFD, the Binary File Descriptor library. 356+ This file is part of BFD, the Binary File Descriptor library.
212+ 357+
@@ -226,8 +371,6 @@ index 0000000000..a357388115
226+ Boston, MA 02110-1301, USA. */ 371+ Boston, MA 02110-1301, USA. */
227+ 372+
228+ 373+
229+int dbg1 = 0;
230+
231+#include "sysdep.h" 374+#include "sysdep.h"
232+#include "bfd.h" 375+#include "bfd.h"
233+#include "bfdlink.h" 376+#include "bfdlink.h"
@@ -252,387 +395,448 @@ index 0000000000..a357388115
252+ 0, /* Rightshift. */ 395+ 0, /* Rightshift. */
253+ 3, /* Size (0 = byte, 1 = short, 2 = long). */ 396+ 3, /* Size (0 = byte, 1 = short, 2 = long). */
254+ 0, /* Bitsize. */ 397+ 0, /* Bitsize. */
255+ FALSE, /* PC_relative. */ 398+ false, /* PC_relative. */
256+ 0, /* Bitpos. */ 399+ 0, /* Bitpos. */
257+ complain_overflow_dont, /* Complain on overflow. */ 400+ complain_overflow_dont, /* Complain on overflow. */
258+ NULL, /* Special Function. */ 401+ NULL, /* Special Function. */
259+ "R_MICROBLAZE_NONE", /* Name. */ 402+ "R_MICROBLAZE_NONE", /* Name. */
260+ FALSE, /* Partial Inplace. */ 403+ false, /* Partial Inplace. */
261+ 0, /* Source Mask. */ 404+ 0, /* Source Mask. */
262+ 0, /* Dest Mask. */ 405+ 0, /* Dest Mask. */
263+ FALSE), /* PC relative offset? */ 406+ false), /* PC relative offset? */
264+ 407+
265+ /* A standard 32 bit relocation. */ 408+ /* A standard 32 bit relocation. */
266+ HOWTO (R_MICROBLAZE_32, /* Type. */ 409+ HOWTO (R_MICROBLAZE_32, /* Type. */
267+ 0, /* Rightshift. */ 410+ 0, /* Rightshift. */
268+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 411+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
269+ 32, /* Bitsize. */ 412+ 32, /* Bitsize. */
270+ FALSE, /* PC_relative. */ 413+ false, /* PC_relative. */
271+ 0, /* Bitpos. */ 414+ 0, /* Bitpos. */
272+ complain_overflow_bitfield, /* Complain on overflow. */ 415+ complain_overflow_bitfield, /* Complain on overflow. */
273+ bfd_elf_generic_reloc,/* Special Function. */ 416+ bfd_elf_generic_reloc,/* Special Function. */
274+ "R_MICROBLAZE_32", /* Name. */ 417+ "R_MICROBLAZE_32", /* Name. */
275+ FALSE, /* Partial Inplace. */ 418+ false, /* Partial Inplace. */
276+ 0, /* Source Mask. */ 419+ 0, /* Source Mask. */
277+ 0xffffffff, /* Dest Mask. */ 420+ 0xffffffff, /* Dest Mask. */
278+ FALSE), /* PC relative offset? */ 421+ false), /* PC relative offset? */
279+ 422+
280+ /* A standard PCREL 32 bit relocation. */ 423+ /* A standard PCREL 32 bit relocation. */
281+ HOWTO (R_MICROBLAZE_32_PCREL,/* Type. */ 424+ HOWTO (R_MICROBLAZE_32_PCREL,/* Type. */
282+ 0, /* Rightshift. */ 425+ 0, /* Rightshift. */
283+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 426+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
284+ 32, /* Bitsize. */ 427+ 32, /* Bitsize. */
285+ TRUE, /* PC_relative. */ 428+ true, /* PC_relative. */
286+ 0, /* Bitpos. */ 429+ 0, /* Bitpos. */
287+ complain_overflow_bitfield, /* Complain on overflow. */ 430+ complain_overflow_bitfield, /* Complain on overflow. */
288+ bfd_elf_generic_reloc,/* Special Function. */ 431+ bfd_elf_generic_reloc,/* Special Function. */
289+ "R_MICROBLAZE_32_PCREL", /* Name. */ 432+ "R_MICROBLAZE_32_PCREL", /* Name. */
290+ TRUE, /* Partial Inplace. */ 433+ true, /* Partial Inplace. */
291+ 0, /* Source Mask. */ 434+ 0, /* Source Mask. */
292+ 0xffffffff, /* Dest Mask. */ 435+ 0xffffffff, /* Dest Mask. */
293+ TRUE), /* PC relative offset? */ 436+ true), /* PC relative offset? */
294+ 437+
295+ /* A 64 bit PCREL relocation. Table-entry not really used. */ 438+ /* A 64 bit PCREL relocation. Table-entry not really used. */
296+ HOWTO (R_MICROBLAZE_64_PCREL,/* Type. */ 439+ HOWTO (R_MICROBLAZE_64_PCREL,/* Type. */
297+ 0, /* Rightshift. */ 440+ 0, /* Rightshift. */
298+ 4, /* Size (0 = byte, 1 = short, 2 = long). */ 441+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
299+ 64, /* Bitsize. */ 442+ 64, /* Bitsize. */
300+ TRUE, /* PC_relative. */ 443+ true, /* PC_relative. */
301+ 0, /* Bitpos. */ 444+ 0, /* Bitpos. */
302+ complain_overflow_dont, /* Complain on overflow. */ 445+ complain_overflow_dont, /* Complain on overflow. */
303+ bfd_elf_generic_reloc,/* Special Function. */ 446+ bfd_elf_generic_reloc,/* Special Function. */
304+ "R_MICROBLAZE_64_PCREL", /* Name. */ 447+ "R_MICROBLAZE_64_PCREL", /* Name. */
305+ FALSE, /* Partial Inplace. */ 448+ false, /* Partial Inplace. */
306+ 0, /* Source Mask. */ 449+ 0, /* Source Mask. */
307+ 0x0000ffff, /* Dest Mask. */ 450+ 0x0000ffff, /* Dest Mask. */
308+ TRUE), /* PC relative offset? */ 451+ true), /* PC relative offset? */
309+ 452+
310+ /* The low half of a PCREL 32 bit relocation. */ 453+ /* The low half of a PCREL 32 bit relocation. */
311+ HOWTO (R_MICROBLAZE_32_PCREL_LO, /* Type. */ 454+ HOWTO (R_MICROBLAZE_32_PCREL_LO, /* Type. */
312+ 0, /* Rightshift. */ 455+ 0, /* Rightshift. */
313+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 456+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
314+ 16, /* Bitsize. */ 457+ 16, /* Bitsize. */
315+ TRUE, /* PC_relative. */ 458+ true, /* PC_relative. */
316+ 0, /* Bitpos. */ 459+ 0, /* Bitpos. */
317+ complain_overflow_signed, /* Complain on overflow. */ 460+ complain_overflow_signed, /* Complain on overflow. */
318+ bfd_elf_generic_reloc, /* Special Function. */ 461+ bfd_elf_generic_reloc, /* Special Function. */
319+ "R_MICROBLAZE_32_PCREL_LO", /* Name. */ 462+ "R_MICROBLAZE_32_PCREL_LO", /* Name. */
320+ FALSE, /* Partial Inplace. */ 463+ false, /* Partial Inplace. */
321+ 0, /* Source Mask. */ 464+ 0, /* Source Mask. */
322+ 0x0000ffff, /* Dest Mask. */ 465+ 0x0000ffff, /* Dest Mask. */
323+ TRUE), /* PC relative offset? */ 466+ true), /* PC relative offset? */
467+
468+ /* A 64 bit relocation. Table entry not really used. */
469+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
470+ 0, /* Rightshift. */
471+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
472+ 64, /* Bitsize. */
473+ true, /* PC_relative. */
474+ 0, /* Bitpos. */
475+ complain_overflow_dont, /* Complain on overflow. */
476+ bfd_elf_generic_reloc,/* Special Function. */
477+ "R_MICROBLAZE_IMML_64", /* Name. */
478+ false, /* Partial Inplace. */
479+ 0, /* Source Mask. */
480+ 0x0000ffff, /* Dest Mask. */
481+ true), /* PC relative offset? */
324+ 482+
325+ /* A 64 bit relocation. Table entry not really used. */ 483+ /* A 64 bit relocation. Table entry not really used. */
326+ HOWTO (R_MICROBLAZE_64, /* Type. */ 484+ HOWTO (R_MICROBLAZE_64, /* Type. */
327+ 0, /* Rightshift. */ 485+ 0, /* Rightshift. */
328+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 486+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
329+ 16, /* Bitsize. */ 487+ 16, /* Bitsize. */
330+ FALSE, /* PC_relative. */ 488+ false, /* PC_relative. */
331+ 0, /* Bitpos. */ 489+ 0, /* Bitpos. */
332+ complain_overflow_dont, /* Complain on overflow. */ 490+ complain_overflow_dont, /* Complain on overflow. */
333+ bfd_elf_generic_reloc,/* Special Function. */ 491+ bfd_elf_generic_reloc,/* Special Function. */
334+ "R_MICROBLAZE_64", /* Name. */ 492+ "R_MICROBLAZE_64", /* Name. */
335+ FALSE, /* Partial Inplace. */ 493+ false, /* Partial Inplace. */
336+ 0, /* Source Mask. */ 494+ 0, /* Source Mask. */
337+ 0x0000ffff, /* Dest Mask. */ 495+ 0x0000ffff, /* Dest Mask. */
338+ FALSE), /* PC relative offset? */ 496+ false), /* PC relative offset? */
339+ 497+
340+ /* The low half of a 32 bit relocation. */ 498+ /* The low half of a 32 bit relocation. */
341+ HOWTO (R_MICROBLAZE_32_LO, /* Type. */ 499+ HOWTO (R_MICROBLAZE_32_LO, /* Type. */
342+ 0, /* Rightshift. */ 500+ 0, /* Rightshift. */
343+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 501+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
344+ 16, /* Bitsize. */ 502+ 16, /* Bitsize. */
345+ FALSE, /* PC_relative. */ 503+ false, /* PC_relative. */
346+ 0, /* Bitpos. */ 504+ 0, /* Bitpos. */
347+ complain_overflow_signed, /* Complain on overflow. */ 505+ complain_overflow_signed, /* Complain on overflow. */
348+ bfd_elf_generic_reloc,/* Special Function. */ 506+ bfd_elf_generic_reloc,/* Special Function. */
349+ "R_MICROBLAZE_32_LO", /* Name. */ 507+ "R_MICROBLAZE_32_LO", /* Name. */
350+ FALSE, /* Partial Inplace. */ 508+ false, /* Partial Inplace. */
351+ 0, /* Source Mask. */ 509+ 0, /* Source Mask. */
352+ 0x0000ffff, /* Dest Mask. */ 510+ 0x0000ffff, /* Dest Mask. */
353+ FALSE), /* PC relative offset? */ 511+ false), /* PC relative offset? */
354+ 512+
355+ /* Read-only small data section relocation. */ 513+ /* Read-only small data section relocation. */
356+ HOWTO (R_MICROBLAZE_SRO32, /* Type. */ 514+ HOWTO (R_MICROBLAZE_SRO32, /* Type. */
357+ 0, /* Rightshift. */ 515+ 0, /* Rightshift. */
358+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 516+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
359+ 16, /* Bitsize. */ 517+ 16, /* Bitsize. */
360+ FALSE, /* PC_relative. */ 518+ false, /* PC_relative. */
361+ 0, /* Bitpos. */ 519+ 0, /* Bitpos. */
362+ complain_overflow_bitfield, /* Complain on overflow. */ 520+ complain_overflow_bitfield, /* Complain on overflow. */
363+ bfd_elf_generic_reloc,/* Special Function. */ 521+ bfd_elf_generic_reloc,/* Special Function. */
364+ "R_MICROBLAZE_SRO32", /* Name. */ 522+ "R_MICROBLAZE_SRO32", /* Name. */
365+ FALSE, /* Partial Inplace. */ 523+ false, /* Partial Inplace. */
366+ 0, /* Source Mask. */ 524+ 0, /* Source Mask. */
367+ 0x0000ffff, /* Dest Mask. */ 525+ 0x0000ffff, /* Dest Mask. */
368+ FALSE), /* PC relative offset? */ 526+ false), /* PC relative offset? */
369+ 527+
370+ /* Read-write small data area relocation. */ 528+ /* Read-write small data area relocation. */
371+ HOWTO (R_MICROBLAZE_SRW32, /* Type. */ 529+ HOWTO (R_MICROBLAZE_SRW32, /* Type. */
372+ 0, /* Rightshift. */ 530+ 0, /* Rightshift. */
373+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 531+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
374+ 16, /* Bitsize. */ 532+ 16, /* Bitsize. */
375+ FALSE, /* PC_relative. */ 533+ false, /* PC_relative. */
376+ 0, /* Bitpos. */ 534+ 0, /* Bitpos. */
377+ complain_overflow_bitfield, /* Complain on overflow. */ 535+ complain_overflow_bitfield, /* Complain on overflow. */
378+ bfd_elf_generic_reloc,/* Special Function. */ 536+ bfd_elf_generic_reloc,/* Special Function. */
379+ "R_MICROBLAZE_SRW32", /* Name. */ 537+ "R_MICROBLAZE_SRW32", /* Name. */
380+ FALSE, /* Partial Inplace. */ 538+ false, /* Partial Inplace. */
381+ 0, /* Source Mask. */ 539+ 0, /* Source Mask. */
382+ 0x0000ffff, /* Dest Mask. */ 540+ 0x0000ffff, /* Dest Mask. */
383+ FALSE), /* PC relative offset? */ 541+ false), /* PC relative offset? */
384+ 542+
385+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */ 543+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
386+ 0, /* Rightshift. */ 544+ 0, /* Rightshift. */
387+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 545+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
388+ 32, /* Bitsize. */ 546+ 32, /* Bitsize. */
389+ TRUE, /* PC_relative. */ 547+ true, /* PC_relative. */
390+ 0, /* Bitpos. */ 548+ 0, /* Bitpos. */
391+ complain_overflow_bitfield, /* Complain on overflow. */ 549+ complain_overflow_bitfield, /* Complain on overflow. */
392+ NULL, /* Special Function. */ 550+ NULL, /* Special Function. */
393+ "R_MICROBLAZE_32_NONE",/* Name. */ 551+ "R_MICROBLAZE_32_NONE",/* Name. */
394+ FALSE, /* Partial Inplace. */ 552+ false, /* Partial Inplace. */
395+ 0, /* Source Mask. */ 553+ 0, /* Source Mask. */
396+ 0, /* Dest Mask. */ 554+ 0, /* Dest Mask. */
397+ FALSE), /* PC relative offset? */ 555+ false), /* PC relative offset? */
398+ 556+
399+ /* This reloc does nothing. Used for relaxation. */ 557+ /* This reloc does nothing. Used for relaxation. */
400+ HOWTO (R_MICROBLAZE_64_NONE, /* Type. */ 558+ HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
401+ 0, /* Rightshift. */ 559+ 0, /* Rightshift. */
402+ 3, /* Size (0 = byte, 1 = short, 2 = long). */ 560+ 3, /* Size (0 = byte, 1 = short, 2 = long). */
403+ 0, /* Bitsize. */ 561+ 0, /* Bitsize. */
404+ TRUE, /* PC_relative. */ 562+ true, /* PC_relative. */
405+ 0, /* Bitpos. */ 563+ 0, /* Bitpos. */
406+ complain_overflow_dont, /* Complain on overflow. */ 564+ complain_overflow_dont, /* Complain on overflow. */
407+ NULL, /* Special Function. */ 565+ NULL, /* Special Function. */
408+ "R_MICROBLAZE_64_NONE",/* Name. */ 566+ "R_MICROBLAZE_64_NONE",/* Name. */
409+ FALSE, /* Partial Inplace. */ 567+ false, /* Partial Inplace. */
410+ 0, /* Source Mask. */ 568+ 0, /* Source Mask. */
411+ 0, /* Dest Mask. */ 569+ 0, /* Dest Mask. */
412+ FALSE), /* PC relative offset? */ 570+ false), /* PC relative offset? */
413+ 571+
414+ /* Symbol Op Symbol relocation. */ 572+ /* Symbol Op Symbol relocation. */
415+ HOWTO (R_MICROBLAZE_32_SYM_OP_SYM, /* Type. */ 573+ HOWTO (R_MICROBLAZE_32_SYM_OP_SYM, /* Type. */
416+ 0, /* Rightshift. */ 574+ 0, /* Rightshift. */
417+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 575+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
418+ 32, /* Bitsize. */ 576+ 32, /* Bitsize. */
419+ FALSE, /* PC_relative. */ 577+ false, /* PC_relative. */
420+ 0, /* Bitpos. */ 578+ 0, /* Bitpos. */
421+ complain_overflow_bitfield, /* Complain on overflow. */ 579+ complain_overflow_bitfield, /* Complain on overflow. */
422+ bfd_elf_generic_reloc,/* Special Function. */ 580+ bfd_elf_generic_reloc,/* Special Function. */
423+ "R_MICROBLAZE_32_SYM_OP_SYM", /* Name. */ 581+ "R_MICROBLAZE_32_SYM_OP_SYM", /* Name. */
424+ FALSE, /* Partial Inplace. */ 582+ false, /* Partial Inplace. */
425+ 0, /* Source Mask. */ 583+ 0, /* Source Mask. */
426+ 0xffffffff, /* Dest Mask. */ 584+ 0xffffffff, /* Dest Mask. */
427+ FALSE), /* PC relative offset? */ 585+ false), /* PC relative offset? */
428+ 586+
429+ /* GNU extension to record C++ vtable hierarchy. */ 587+ /* GNU extension to record C++ vtable hierarchy. */
430+ HOWTO (R_MICROBLAZE_GNU_VTINHERIT, /* Type. */ 588+ HOWTO (R_MICROBLAZE_GNU_VTINHERIT, /* Type. */
431+ 0, /* Rightshift. */ 589+ 0, /* Rightshift. */
432+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 590+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
433+ 0, /* Bitsize. */ 591+ 0, /* Bitsize. */
434+ FALSE, /* PC_relative. */ 592+ false, /* PC_relative. */
435+ 0, /* Bitpos. */ 593+ 0, /* Bitpos. */
436+ complain_overflow_dont,/* Complain on overflow. */ 594+ complain_overflow_dont,/* Complain on overflow. */
437+ NULL, /* Special Function. */ 595+ NULL, /* Special Function. */
438+ "R_MICROBLAZE_GNU_VTINHERIT", /* Name. */ 596+ "R_MICROBLAZE_GNU_VTINHERIT", /* Name. */
439+ FALSE, /* Partial Inplace. */ 597+ false, /* Partial Inplace. */
440+ 0, /* Source Mask. */ 598+ 0, /* Source Mask. */
441+ 0, /* Dest Mask. */ 599+ 0,
442+ FALSE), /* PC relative offset? */ 600+ /* Dest Mask. */
601+ false), /* PC relative offset? */
443+ 602+
444+ /* GNU extension to record C++ vtable member usage. */ 603+ /* GNU extension to record C++ vtable member usage. */
445+ HOWTO (R_MICROBLAZE_GNU_VTENTRY, /* Type. */ 604+ HOWTO (R_MICROBLAZE_GNU_VTENTRY, /* Type. */
446+ 0, /* Rightshift. */ 605+ 0, /* Rightshift. */
447+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 606+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
448+ 0, /* Bitsize. */ 607+ 0, /* Bitsize. */
449+ FALSE, /* PC_relative. */ 608+ false, /* PC_relative. */
450+ 0, /* Bitpos. */ 609+ 0, /* Bitpos. */
451+ complain_overflow_dont,/* Complain on overflow. */ 610+ complain_overflow_dont,/* Complain on overflow. */
452+ _bfd_elf_rel_vtable_reloc_fn, /* Special Function. */ 611+ _bfd_elf_rel_vtable_reloc_fn, /* Special Function. */
453+ "R_MICROBLAZE_GNU_VTENTRY", /* Name. */ 612+ "R_MICROBLAZE_GNU_VTENTRY", /* Name. */
454+ FALSE, /* Partial Inplace. */ 613+ false, /* Partial Inplace. */
455+ 0, /* Source Mask. */ 614+ 0, /* Source Mask. */
456+ 0, /* Dest Mask. */ 615+ 0, /* Dest Mask. */
457+ FALSE), /* PC relative offset? */ 616+ false), /* PC relative offset? */
458+ 617+
459+ /* A 64 bit GOTPC relocation. Table-entry not really used. */ 618+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
460+ HOWTO (R_MICROBLAZE_GOTPC_64, /* Type. */ 619+ HOWTO (R_MICROBLAZE_GOTPC_64, /* Type. */
461+ 0, /* Rightshift. */ 620+ 0, /* Rightshift. */
462+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 621+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
463+ 16, /* Bitsize. */ 622+ 16, /* Bitsize. */
464+ TRUE, /* PC_relative. */ 623+ true, /* PC_relative. */
465+ 0, /* Bitpos. */ 624+ 0, /* Bitpos. */
466+ complain_overflow_dont, /* Complain on overflow. */ 625+ complain_overflow_dont, /* Complain on overflow. */
467+ bfd_elf_generic_reloc, /* Special Function. */ 626+ bfd_elf_generic_reloc, /* Special Function. */
468+ "R_MICROBLAZE_GOTPC_64", /* Name. */ 627+ "R_MICROBLAZE_GOTPC_64", /* Name. */
469+ FALSE, /* Partial Inplace. */ 628+ false, /* Partial Inplace. */
470+ 0, /* Source Mask. */ 629+ 0, /* Source Mask. */
471+ 0x0000ffff, /* Dest Mask. */ 630+ 0x0000ffff, /* Dest Mask. */
472+ TRUE), /* PC relative offset? */ 631+ true), /* PC relative offset? */
632+
633+ /* A 64 bit TEXTPCREL relocation. Table-entry not really used. */
634+ HOWTO (R_MICROBLAZE_TEXTPCREL_64, /* Type. */
635+ 0, /* Rightshift. */
636+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
637+ 16, /* Bitsize. */
638+ true, /* PC_relative. */
639+ 0, /* Bitpos. */
640+ complain_overflow_dont, /* Complain on overflow. */
641+ bfd_elf_generic_reloc, /* Special Function. */
642+ "R_MICROBLAZE_TEXTPCREL_64", /* Name. */
643+ false, /* Partial Inplace. */
644+ 0, /* Source Mask. */
645+ 0x0000ffff, /* Dest Mask. */
646+ true), /* PC relative offset? */
473+ 647+
474+ /* A 64 bit GOT relocation. Table-entry not really used. */ 648+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
475+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ 649+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
476+ 0, /* Rightshift. */ 650+ 0, /* Rightshift. */
477+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 651+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
478+ 16, /* Bitsize. */ 652+ 16, /* Bitsize. */
479+ FALSE, /* PC_relative. */ 653+ true, /* PC_relative. */
480+ 0, /* Bitpos. */ 654+ 0, /* Bitpos. */
481+ complain_overflow_dont, /* Complain on overflow. */ 655+ complain_overflow_dont, /* Complain on overflow. */
482+ bfd_elf_generic_reloc,/* Special Function. */ 656+ bfd_elf_generic_reloc, /* Special Function. */
483+ "R_MICROBLAZE_GOT_64",/* Name. */ 657+ "R_MICROBLAZE_GPC_64", /* Name. */
484+ FALSE, /* Partial Inplace. */ 658+ false, /* Partial Inplace. */
485+ 0, /* Source Mask. */ 659+ 0, /* Source Mask. */
486+ 0x0000ffff, /* Dest Mask. */ 660+ 0x0000ffff, /* Dest Mask. */
487+ FALSE), /* PC relative offset? */ 661+ true), /* PC relative offset? */
662+
663+ /* A 64 bit GOT relocation. Table-entry not really used. */
664+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
665+ 0, /* Rightshift. */
666+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
667+ 16, /* Bitsize. */
668+ false, /* PC_relative. */
669+ 0, /* Bitpos. */
670+ complain_overflow_dont, /* Complain on overflow. */
671+ bfd_elf_generic_reloc,/* Special Function. */
672+ "R_MICROBLAZE_GOT_64",/* Name. */
673+ false, /* Partial Inplace. */
674+ 0, /* Source Mask. */
675+ 0x0000ffff, /* Dest Mask. */
676+ false), /* PC relative offset? */
677+
678+ /* A 64 bit TEXTREL relocation. Table-entry not really used. */
679+ HOWTO (R_MICROBLAZE_TEXTREL_64, /* Type. */
680+ 0, /* Rightshift. */
681+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
682+ 16, /* Bitsize. */
683+ false, /* PC_relative. */
684+ 0, /* Bitpos. */
685+ complain_overflow_dont, /* Complain on overflow. */
686+ bfd_elf_generic_reloc,/* Special Function. */
687+ "R_MICROBLAZE_TEXTREL_64",/* Name. */
688+ false, /* Partial Inplace. */
689+ 0, /* Source Mask. */
690+ 0x0000ffff, /* Dest Mask. */
691+ false), /* PC relative offset? */
488+ 692+
489+ /* A 64 bit PLT relocation. Table-entry not really used. */ 693+ /* A 64 bit PLT relocation. Table-entry not really used. */
490+ HOWTO (R_MICROBLAZE_PLT_64, /* Type. */ 694+ HOWTO (R_MICROBLAZE_PLT_64, /* Type. */
491+ 0, /* Rightshift. */ 695+ 0, /* Rightshift. */
492+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 696+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
493+ 16, /* Bitsize. */ 697+ 16, /* Bitsize. */
494+ TRUE, /* PC_relative. */ 698+ true, /* PC_relative. */
495+ 0, /* Bitpos. */ 699+ 0, /* Bitpos. */
496+ complain_overflow_dont, /* Complain on overflow. */ 700+ complain_overflow_dont, /* Complain on overflow. */
497+ bfd_elf_generic_reloc,/* Special Function. */ 701+ bfd_elf_generic_reloc,/* Special Function. */
498+ "R_MICROBLAZE_PLT_64",/* Name. */ 702+ "R_MICROBLAZE_PLT_64",/* Name. */
499+ FALSE, /* Partial Inplace. */ 703+ false, /* Partial Inplace. */
500+ 0, /* Source Mask. */ 704+ 0, /* Source Mask. */
501+ 0x0000ffff, /* Dest Mask. */ 705+ 0x0000ffff, /* Dest Mask. */
502+ TRUE), /* PC relative offset? */ 706+ true), /* PC relative offset? */
503+ 707+
504+ /* Table-entry not really used. */ 708+ /* Table-entry not really used. */
505+ HOWTO (R_MICROBLAZE_REL, /* Type. */ 709+ HOWTO (R_MICROBLAZE_REL, /* Type. */
506+ 0, /* Rightshift. */ 710+ 0, /* Rightshift. */
507+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 711+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
508+ 16, /* Bitsize. */ 712+ 16, /* Bitsize. */
509+ TRUE, /* PC_relative. */ 713+ true, /* PC_relative. */
510+ 0, /* Bitpos. */ 714+ 0, /* Bitpos. */
511+ complain_overflow_dont, /* Complain on overflow. */ 715+ complain_overflow_dont, /* Complain on overflow. */
512+ bfd_elf_generic_reloc,/* Special Function. */ 716+ bfd_elf_generic_reloc,/* Special Function. */
513+ "R_MICROBLAZE_REL", /* Name. */ 717+ "R_MICROBLAZE_REL", /* Name. */
514+ FALSE, /* Partial Inplace. */ 718+ false, /* Partial Inplace. */
515+ 0, /* Source Mask. */ 719+ 0, /* Source Mask. */
516+ 0x0000ffff, /* Dest Mask. */ 720+ 0x0000ffff, /* Dest Mask. */
517+ TRUE), /* PC relative offset? */ 721+ true), /* PC relative offset? */
518+ 722+
519+ /* Table-entry not really used. */ 723+ /* Table-entry not really used. */
520+ HOWTO (R_MICROBLAZE_JUMP_SLOT,/* Type. */ 724+ HOWTO (R_MICROBLAZE_JUMP_SLOT,/* Type. */
521+ 0, /* Rightshift. */ 725+ 0, /* Rightshift. */
522+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 726+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
523+ 16, /* Bitsize. */ 727+ 16, /* Bitsize. */
524+ TRUE, /* PC_relative. */ 728+ true, /* PC_relative. */
525+ 0, /* Bitpos. */ 729+ 0, /* Bitpos. */
526+ complain_overflow_dont, /* Complain on overflow. */ 730+ complain_overflow_dont, /* Complain on overflow. */
527+ bfd_elf_generic_reloc,/* Special Function. */ 731+ bfd_elf_generic_reloc,/* Special Function. */
528+ "R_MICROBLAZE_JUMP_SLOT", /* Name. */ 732+ "R_MICROBLAZE_JUMP_SLOT", /* Name. */
529+ FALSE, /* Partial Inplace. */ 733+ false, /* Partial Inplace. */
530+ 0, /* Source Mask. */ 734+ 0, /* Source Mask. */
531+ 0x0000ffff, /* Dest Mask. */ 735+ 0x0000ffff, /* Dest Mask. */
532+ TRUE), /* PC relative offset? */ 736+ true), /* PC relative offset? */
533+ 737+
534+ /* Table-entry not really used. */ 738+ /* Table-entry not really used. */
535+ HOWTO (R_MICROBLAZE_GLOB_DAT,/* Type. */ 739+ HOWTO (R_MICROBLAZE_GLOB_DAT,/* Type. */
536+ 0, /* Rightshift. */ 740+ 0, /* Rightshift. */
537+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 741+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
538+ 16, /* Bitsize. */ 742+ 16, /* Bitsize. */
539+ TRUE, /* PC_relative. */ 743+ true, /* PC_relative. */
540+ 0, /* Bitpos. */ 744+ 0, /* Bitpos. */
541+ complain_overflow_dont, /* Complain on overflow. */ 745+ complain_overflow_dont, /* Complain on overflow. */
542+ bfd_elf_generic_reloc,/* Special Function. */ 746+ bfd_elf_generic_reloc,/* Special Function. */
543+ "R_MICROBLAZE_GLOB_DAT", /* Name. */ 747+ "R_MICROBLAZE_GLOB_DAT", /* Name. */
544+ FALSE, /* Partial Inplace. */ 748+ false, /* Partial Inplace. */
545+ 0, /* Source Mask. */ 749+ 0, /* Source Mask. */
546+ 0x0000ffff, /* Dest Mask. */ 750+ 0x0000ffff, /* Dest Mask. */
547+ TRUE), /* PC relative offset? */ 751+ true), /* PC relative offset? */
548+ 752+
549+ /* A 64 bit GOT relative relocation. Table-entry not really used. */ 753+ /* A 64 bit GOT relative relocation. Table-entry not really used. */
550+ HOWTO (R_MICROBLAZE_GOTOFF_64, /* Type. */ 754+ HOWTO (R_MICROBLAZE_GOTOFF_64, /* Type. */
551+ 0, /* Rightshift. */ 755+ 0, /* Rightshift. */
552+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 756+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
553+ 16, /* Bitsize. */ 757+ 16, /* Bitsize. */
554+ FALSE, /* PC_relative. */ 758+ false, /* PC_relative. */
555+ 0, /* Bitpos. */ 759+ 0, /* Bitpos. */
556+ complain_overflow_dont, /* Complain on overflow. */ 760+ complain_overflow_dont, /* Complain on overflow. */
557+ bfd_elf_generic_reloc,/* Special Function. */ 761+ bfd_elf_generic_reloc,/* Special Function. */
558+ "R_MICROBLAZE_GOTOFF_64", /* Name. */ 762+ "R_MICROBLAZE_GOTOFF_64", /* Name. */
559+ FALSE, /* Partial Inplace. */ 763+ false, /* Partial Inplace. */
560+ 0, /* Source Mask. */ 764+ 0, /* Source Mask. */
561+ 0x0000ffff, /* Dest Mask. */ 765+ 0x0000ffff, /* Dest Mask. */
562+ FALSE), /* PC relative offset? */ 766+ false), /* PC relative offset? */
563+ 767+
564+ /* A 32 bit GOT relative relocation. Table-entry not really used. */ 768+ /* A 32 bit GOT relative relocation. Table-entry not really used. */
565+ HOWTO (R_MICROBLAZE_GOTOFF_32, /* Type. */ 769+ HOWTO (R_MICROBLAZE_GOTOFF_32, /* Type. */
566+ 0, /* Rightshift. */ 770+ 0, /* Rightshift. */
567+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 771+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
568+ 16, /* Bitsize. */ 772+ 16, /* Bitsize. */
569+ FALSE, /* PC_relative. */ 773+ false, /* PC_relative. */
570+ 0, /* Bitpos. */ 774+ 0, /* Bitpos. */
571+ complain_overflow_dont, /* Complain on overflow. */ 775+ complain_overflow_dont, /* Complain on overflow. */
572+ bfd_elf_generic_reloc, /* Special Function. */ 776+ bfd_elf_generic_reloc, /* Special Function. */
573+ "R_MICROBLAZE_GOTOFF_32", /* Name. */ 777+ "R_MICROBLAZE_GOTOFF_32", /* Name. */
574+ FALSE, /* Partial Inplace. */ 778+ false, /* Partial Inplace. */
575+ 0, /* Source Mask. */ 779+ 0, /* Source Mask. */
576+ 0x0000ffff, /* Dest Mask. */ 780+ 0x0000ffff, /* Dest Mask. */
577+ FALSE), /* PC relative offset? */ 781+ false), /* PC relative offset? */
578+ 782+
579+ /* COPY relocation. Table-entry not really used. */ 783+ /* COPY relocation. Table-entry not really used. */
580+ HOWTO (R_MICROBLAZE_COPY, /* Type. */ 784+ HOWTO (R_MICROBLAZE_COPY, /* Type. */
581+ 0, /* Rightshift. */ 785+ 0, /* Rightshift. */
582+ 2, /* Size (0 = byte, 1 = short, 2 = long). */ 786+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
583+ 16, /* Bitsize. */ 787+ 16, /* Bitsize. */
584+ FALSE, /* PC_relative. */ 788+ false, /* PC_relative. */
585+ 0, /* Bitpos. */ 789+ 0, /* Bitpos. */
586+ complain_overflow_dont, /* Complain on overflow. */ 790+ complain_overflow_dont, /* Complain on overflow. */
587+ bfd_elf_generic_reloc,/* Special Function. */ 791+ bfd_elf_generic_reloc,/* Special Function. */
588+ "R_MICROBLAZE_COPY", /* Name. */ 792+ "R_MICROBLAZE_COPY", /* Name. */
589+ FALSE, /* Partial Inplace. */ 793+ false, /* Partial Inplace. */
590+ 0, /* Source Mask. */ 794+ 0, /* Source Mask. */
591+ 0x0000ffff, /* Dest Mask. */ 795+ 0x0000ffff, /* Dest Mask. */
592+ FALSE), /* PC relative offset? */ 796+ false), /* PC relative offset? */
593+ 797+
594+ /* Marker relocs for TLS. */ 798+ /* Marker relocs for TLS. */
595+ HOWTO (R_MICROBLAZE_TLS, 799+ HOWTO (R_MICROBLAZE_TLS,
596+ 0, /* rightshift */ 800+ 0, /* rightshift */
597+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 801+ 2, /* size (0 = byte, 1 = short, 2 = long) */
598+ 32, /* bitsize */ 802+ 32, /* bitsize */
599+ FALSE, /* pc_relative */ 803+ false, /* pc_relative */
600+ 0, /* bitpos */ 804+ 0, /* bitpos */
601+ complain_overflow_dont, /* complain_on_overflow */ 805+ complain_overflow_dont, /* complain_on_overflow */
602+ bfd_elf_generic_reloc, /* special_function */ 806+ bfd_elf_generic_reloc, /* special_function */
603+ "R_MICROBLAZE_TLS", /* name */ 807+ "R_MICROBLAZE_TLS", /* name */
604+ FALSE, /* partial_inplace */ 808+ false, /* partial_inplace */
605+ 0, /* src_mask */ 809+ 0, /* src_mask */
606+ 0x0000ffff, /* dst_mask */ 810+ 0x0000ffff, /* dst_mask */
607+ FALSE), /* pcrel_offset */ 811+ false), /* pcrel_offset */
608+ 812+
609+ HOWTO (R_MICROBLAZE_TLSGD, 813+ HOWTO (R_MICROBLAZE_TLSGD,
610+ 0, /* rightshift */ 814+ 0, /* rightshift */
611+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 815+ 2, /* size (0 = byte, 1 = short, 2 = long) */
612+ 32, /* bitsize */ 816+ 32, /* bitsize */
613+ FALSE, /* pc_relative */ 817+ false, /* pc_relative */
614+ 0, /* bitpos */ 818+ 0, /* bitpos */
615+ complain_overflow_dont, /* complain_on_overflow */ 819+ complain_overflow_dont, /* complain_on_overflow */
616+ bfd_elf_generic_reloc, /* special_function */ 820+ bfd_elf_generic_reloc, /* special_function */
617+ "R_MICROBLAZE_TLSGD", /* name */ 821+ "R_MICROBLAZE_TLSGD", /* name */
618+ FALSE, /* partial_inplace */ 822+ false, /* partial_inplace */
619+ 0, /* src_mask */ 823+ 0, /* src_mask */
620+ 0x0000ffff, /* dst_mask */ 824+ 0x0000ffff, /* dst_mask */
621+ FALSE), /* pcrel_offset */ 825+ false), /* pcrel_offset */
622+ 826+
623+ HOWTO (R_MICROBLAZE_TLSLD, 827+ HOWTO (R_MICROBLAZE_TLSLD,
624+ 0, /* rightshift */ 828+ 0, /* rightshift */
625+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 829+ 2, /* size (0 = byte, 1 = short, 2 = long) */
626+ 32, /* bitsize */ 830+ 32, /* bitsize */
627+ FALSE, /* pc_relative */ 831+ false, /* pc_relative */
628+ 0, /* bitpos */ 832+ 0, /* bitpos */
629+ complain_overflow_dont, /* complain_on_overflow */ 833+ complain_overflow_dont, /* complain_on_overflow */
630+ bfd_elf_generic_reloc, /* special_function */ 834+ bfd_elf_generic_reloc, /* special_function */
631+ "R_MICROBLAZE_TLSLD", /* name */ 835+ "R_MICROBLAZE_TLSLD", /* name */
632+ FALSE, /* partial_inplace */ 836+ false, /* partial_inplace */
633+ 0, /* src_mask */ 837+ 0, /* src_mask */
634+ 0x0000ffff, /* dst_mask */ 838+ 0x0000ffff, /* dst_mask */
635+ FALSE), /* pcrel_offset */ 839+ false), /* pcrel_offset */
636+ 840+
637+ /* Computes the load module index of the load module that contains the 841+ /* Computes the load module index of the load module that contains the
638+ definition of its TLS sym. */ 842+ definition of its TLS sym. */
@@ -640,15 +844,15 @@ index 0000000000..a357388115
640+ 0, /* rightshift */ 844+ 0, /* rightshift */
641+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 845+ 2, /* size (0 = byte, 1 = short, 2 = long) */
642+ 32, /* bitsize */ 846+ 32, /* bitsize */
643+ FALSE, /* pc_relative */ 847+ false, /* pc_relative */
644+ 0, /* bitpos */ 848+ 0, /* bitpos */
645+ complain_overflow_dont, /* complain_on_overflow */ 849+ complain_overflow_dont, /* complain_on_overflow */
646+ bfd_elf_generic_reloc, /* special_function */ 850+ bfd_elf_generic_reloc, /* special_function */
647+ "R_MICROBLAZE_TLSDTPMOD32", /* name */ 851+ "R_MICROBLAZE_TLSDTPMOD32", /* name */
648+ FALSE, /* partial_inplace */ 852+ false, /* partial_inplace */
649+ 0, /* src_mask */ 853+ 0, /* src_mask */
650+ 0x0000ffff, /* dst_mask */ 854+ 0x0000ffff, /* dst_mask */
651+ FALSE), /* pcrel_offset */ 855+ false), /* pcrel_offset */
652+ 856+
653+ /* Computes a dtv-relative displacement, the difference between the value 857+ /* Computes a dtv-relative displacement, the difference between the value
654+ of sym+add and the base address of the thread-local storage block that 858+ of sym+add and the base address of the thread-local storage block that
@@ -657,15 +861,15 @@ index 0000000000..a357388115
657+ 0, /* rightshift */ 861+ 0, /* rightshift */
658+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 862+ 2, /* size (0 = byte, 1 = short, 2 = long) */
659+ 32, /* bitsize */ 863+ 32, /* bitsize */
660+ FALSE, /* pc_relative */ 864+ false, /* pc_relative */
661+ 0, /* bitpos */ 865+ 0, /* bitpos */
662+ complain_overflow_dont, /* complain_on_overflow */ 866+ complain_overflow_dont, /* complain_on_overflow */
663+ bfd_elf_generic_reloc, /* special_function */ 867+ bfd_elf_generic_reloc, /* special_function */
664+ "R_MICROBLAZE_TLSDTPREL32", /* name */ 868+ "R_MICROBLAZE_TLSDTPREL32", /* name */
665+ FALSE, /* partial_inplace */ 869+ false, /* partial_inplace */
666+ 0, /* src_mask */ 870+ 0, /* src_mask */
667+ 0x0000ffff, /* dst_mask */ 871+ 0x0000ffff, /* dst_mask */
668+ FALSE), /* pcrel_offset */ 872+ false), /* pcrel_offset */
669+ 873+
670+ /* Computes a dtv-relative displacement, the difference between the value 874+ /* Computes a dtv-relative displacement, the difference between the value
671+ of sym+add and the base address of the thread-local storage block that 875+ of sym+add and the base address of the thread-local storage block that
@@ -674,15 +878,15 @@ index 0000000000..a357388115
674+ 0, /* rightshift */ 878+ 0, /* rightshift */
675+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 879+ 2, /* size (0 = byte, 1 = short, 2 = long) */
676+ 32, /* bitsize */ 880+ 32, /* bitsize */
677+ FALSE, /* pc_relative */ 881+ false, /* pc_relative */
678+ 0, /* bitpos */ 882+ 0, /* bitpos */
679+ complain_overflow_dont, /* complain_on_overflow */ 883+ complain_overflow_dont, /* complain_on_overflow */
680+ bfd_elf_generic_reloc, /* special_function */ 884+ bfd_elf_generic_reloc, /* special_function */
681+ "R_MICROBLAZE_TLSDTPREL64", /* name */ 885+ "R_MICROBLAZE_TLSDTPREL64", /* name */
682+ FALSE, /* partial_inplace */ 886+ false, /* partial_inplace */
683+ 0, /* src_mask */ 887+ 0, /* src_mask */
684+ 0x0000ffff, /* dst_mask */ 888+ 0x0000ffff, /* dst_mask */
685+ FALSE), /* pcrel_offset */ 889+ false), /* pcrel_offset */
686+ 890+
687+ /* Computes a tp-relative displacement, the difference between the value of 891+ /* Computes a tp-relative displacement, the difference between the value of
688+ sym+add and the value of the thread pointer (r13). */ 892+ sym+add and the value of the thread pointer (r13). */
@@ -690,15 +894,15 @@ index 0000000000..a357388115
690+ 0, /* rightshift */ 894+ 0, /* rightshift */
691+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 895+ 2, /* size (0 = byte, 1 = short, 2 = long) */
692+ 32, /* bitsize */ 896+ 32, /* bitsize */
693+ FALSE, /* pc_relative */ 897+ false, /* pc_relative */
694+ 0, /* bitpos */ 898+ 0, /* bitpos */
695+ complain_overflow_dont, /* complain_on_overflow */ 899+ complain_overflow_dont, /* complain_on_overflow */
696+ bfd_elf_generic_reloc, /* special_function */ 900+ bfd_elf_generic_reloc, /* special_function */
697+ "R_MICROBLAZE_TLSGOTTPREL32", /* name */ 901+ "R_MICROBLAZE_TLSGOTTPREL32", /* name */
698+ FALSE, /* partial_inplace */ 902+ false, /* partial_inplace */
699+ 0, /* src_mask */ 903+ 0, /* src_mask */
700+ 0x0000ffff, /* dst_mask */ 904+ 0x0000ffff, /* dst_mask */
701+ FALSE), /* pcrel_offset */ 905+ false), /* pcrel_offset */
702+ 906+
703+ /* Computes a tp-relative displacement, the difference between the value of 907+ /* Computes a tp-relative displacement, the difference between the value of
704+ sym+add and the value of the thread pointer (r13). */ 908+ sym+add and the value of the thread pointer (r13). */
@@ -706,15 +910,15 @@ index 0000000000..a357388115
706+ 0, /* rightshift */ 910+ 0, /* rightshift */
707+ 2, /* size (0 = byte, 1 = short, 2 = long) */ 911+ 2, /* size (0 = byte, 1 = short, 2 = long) */
708+ 32, /* bitsize */ 912+ 32, /* bitsize */
709+ FALSE, /* pc_relative */ 913+ false, /* pc_relative */
710+ 0, /* bitpos */ 914+ 0, /* bitpos */
711+ complain_overflow_dont, /* complain_on_overflow */ 915+ complain_overflow_dont, /* complain_on_overflow */
712+ bfd_elf_generic_reloc, /* special_function */ 916+ bfd_elf_generic_reloc, /* special_function */
713+ "R_MICROBLAZE_TLSTPREL32", /* name */ 917+ "R_MICROBLAZE_TLSTPREL32", /* name */
714+ FALSE, /* partial_inplace */ 918+ false, /* partial_inplace */
715+ 0, /* src_mask */ 919+ 0, /* src_mask */
716+ 0x0000ffff, /* dst_mask */ 920+ 0x0000ffff, /* dst_mask */
717+ FALSE), /* pcrel_offset */ 921+ false), /* pcrel_offset */
718+ 922+
719+}; 923+};
720+ 924+
@@ -795,12 +999,24 @@ index 0000000000..a357388115
795+ case BFD_RELOC_VTABLE_ENTRY: 999+ case BFD_RELOC_VTABLE_ENTRY:
796+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 1000+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
797+ break; 1001+ break;
1002+ case BFD_RELOC_MICROBLAZE_64:
1003+ microblaze_reloc = R_MICROBLAZE_IMML_64;
1004+ break;
798+ case BFD_RELOC_MICROBLAZE_64_GOTPC: 1005+ case BFD_RELOC_MICROBLAZE_64_GOTPC:
799+ microblaze_reloc = R_MICROBLAZE_GOTPC_64; 1006+ microblaze_reloc = R_MICROBLAZE_GOTPC_64;
800+ break; 1007+ break;
1008+ case BFD_RELOC_MICROBLAZE_64_GPC:
1009+ microblaze_reloc = R_MICROBLAZE_GPC_64;
1010+ break;
801+ case BFD_RELOC_MICROBLAZE_64_GOT: 1011+ case BFD_RELOC_MICROBLAZE_64_GOT:
802+ microblaze_reloc = R_MICROBLAZE_GOT_64; 1012+ microblaze_reloc = R_MICROBLAZE_GOT_64;
803+ break; 1013+ break;
1014+ case BFD_RELOC_MICROBLAZE_64_TEXTPCREL:
1015+ microblaze_reloc = R_MICROBLAZE_TEXTPCREL_64;
1016+ break;
1017+ case BFD_RELOC_MICROBLAZE_64_TEXTREL:
1018+ microblaze_reloc = R_MICROBLAZE_TEXTREL_64;
1019+ break;
804+ case BFD_RELOC_MICROBLAZE_64_PLT: 1020+ case BFD_RELOC_MICROBLAZE_64_PLT:
805+ microblaze_reloc = R_MICROBLAZE_PLT_64; 1021+ microblaze_reloc = R_MICROBLAZE_PLT_64;
806+ break; 1022+ break;
@@ -861,7 +1077,7 @@ index 0000000000..a357388115
861+ 1077+
862+/* Set the howto pointer for a RCE ELF reloc. */ 1078+/* Set the howto pointer for a RCE ELF reloc. */
863+ 1079+
864+static bfd_boolean 1080+static bool
865+microblaze_elf_info_to_howto (bfd * abfd, 1081+microblaze_elf_info_to_howto (bfd * abfd,
866+ arelent * cache_ptr, 1082+ arelent * cache_ptr,
867+ Elf_Internal_Rela * dst) 1083+ Elf_Internal_Rela * dst)
@@ -879,58 +1095,35 @@ index 0000000000..a357388115
879+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), 1095+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
880+ abfd, r_type); 1096+ abfd, r_type);
881+ bfd_set_error (bfd_error_bad_value); 1097+ bfd_set_error (bfd_error_bad_value);
882+ return FALSE; 1098+ return false;
883+ } 1099+ }
884+ 1100+
885+ cache_ptr->howto = microblaze_elf_howto_table [r_type]; 1101+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
886+ return TRUE; 1102+ return true;
887+} 1103+}
888+ 1104+
889+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */ 1105+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
890+ 1106+
891+static bfd_boolean 1107+static bool
892+microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 1108+microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
893+{ 1109+{
894+ if (name[0] == 'L' && name[1] == '.') 1110+ if (name[0] == 'L' && name[1] == '.')
895+ return TRUE; 1111+ return true;
896+ 1112+
897+ if (name[0] == '$' && name[1] == 'L') 1113+ if (name[0] == '$' && name[1] == 'L')
898+ return TRUE; 1114+ return true;
899+ 1115+
900+ /* With gcc, the labels go back to starting with '.', so we accept 1116+ /* With gcc, the labels go back to starting with '.', so we accept
901+ the generic ELF local label syntax as well. */ 1117+ the generic ELF local label syntax as well. */
902+ return _bfd_elf_is_local_label_name (abfd, name); 1118+ return _bfd_elf_is_local_label_name (abfd, name);
903+} 1119+}
904+ 1120+
905+/* The microblaze linker (like many others) needs to keep track of
906+ the number of relocs that it decides to copy as dynamic relocs in
907+ check_relocs for each symbol. This is so that it can later discard
908+ them if they are found to be unnecessary. We store the information
909+ in a field extending the regular ELF linker hash table. */
910+
911+struct elf64_mb_dyn_relocs
912+{
913+ struct elf64_mb_dyn_relocs *next;
914+
915+ /* The input section of the reloc. */
916+ asection *sec;
917+
918+ /* Total number of relocs copied for the input section. */
919+ bfd_size_type count;
920+
921+ /* Number of pc-relative relocs copied for the input section. */
922+ bfd_size_type pc_count;
923+};
924+
925+/* ELF linker hash entry. */ 1121+/* ELF linker hash entry. */
926+ 1122+
927+struct elf64_mb_link_hash_entry 1123+struct elf64_mb_link_hash_entry
928+{ 1124+{
929+ struct elf_link_hash_entry elf; 1125+ struct elf_link_hash_entry elf;
930+ 1126+
931+ /* Track dynamic relocs copied for this symbol. */
932+ struct elf64_mb_dyn_relocs *dyn_relocs;
933+
934+ /* TLS Reference Types for the symbol; Updated by check_relocs */ 1127+ /* TLS Reference Types for the symbol; Updated by check_relocs */
935+#define TLS_GD 1 /* GD reloc. */ 1128+#define TLS_GD 1 /* GD reloc. */
936+#define TLS_LD 2 /* LD reloc. */ 1129+#define TLS_LD 2 /* LD reloc. */
@@ -954,18 +1147,6 @@ index 0000000000..a357388115
954+{ 1147+{
955+ struct elf_link_hash_table elf; 1148+ struct elf_link_hash_table elf;
956+ 1149+
957+ /* Short-cuts to get to dynamic linker sections. */
958+ asection *sgot;
959+ asection *sgotplt;
960+ asection *srelgot;
961+ asection *splt;
962+ asection *srelplt;
963+ asection *sdynbss;
964+ asection *srelbss;
965+
966+ /* Small local sym to section mapping cache. */
967+ struct sym_cache sym_sec;
968+
969+ /* TLS Local Dynamic GOT Entry */ 1150+ /* TLS Local Dynamic GOT Entry */
970+ union { 1151+ union {
971+ bfd_signed_vma refcount; 1152+ bfd_signed_vma refcount;
@@ -978,9 +1159,10 @@ index 0000000000..a357388115
978+ 1159+
979+/* Get the ELF linker hash table from a link_info structure. */ 1160+/* Get the ELF linker hash table from a link_info structure. */
980+ 1161+
981+#define elf64_mb_hash_table(p) \ 1162+#define elf64_mb_hash_table(p) \
982+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ 1163+ ((is_elf_hash_table ((p)->hash) \
983+ == MICROBLAZE_ELF_DATA ? ((struct elf64_mb_link_hash_table *) ((p)->hash)) : NULL) 1164+ && elf_hash_table_id (elf_hash_table (p)) == MICROBLAZE_ELF_DATA) \
1165+ ? (struct elf64_mb_link_hash_table *) (p)->hash : NULL)
984+ 1166+
985+/* Create an entry in a microblaze ELF linker hash table. */ 1167+/* Create an entry in a microblaze ELF linker hash table. */
986+ 1168+
@@ -1042,14 +1224,14 @@ index 0000000000..a357388115
1042+{ 1224+{
1043+ struct bfd_link_hash_entry *h; 1225+ struct bfd_link_hash_entry *h;
1044+ 1226+
1045+ h = bfd_link_hash_lookup (info->hash, RO_SDA_ANCHOR_NAME, FALSE, FALSE, TRUE); 1227+ h = bfd_link_hash_lookup (info->hash, RO_SDA_ANCHOR_NAME, false, false, true);
1046+ if (h != (struct bfd_link_hash_entry *) NULL 1228+ if (h != (struct bfd_link_hash_entry *) NULL
1047+ && h->type == bfd_link_hash_defined) 1229+ && h->type == bfd_link_hash_defined)
1048+ ro_small_data_pointer = (h->u.def.value 1230+ ro_small_data_pointer = (h->u.def.value
1049+ + h->u.def.section->output_section->vma 1231+ + h->u.def.section->output_section->vma
1050+ + h->u.def.section->output_offset); 1232+ + h->u.def.section->output_offset);
1051+ 1233+
1052+ h = bfd_link_hash_lookup (info->hash, RW_SDA_ANCHOR_NAME, FALSE, FALSE, TRUE); 1234+ h = bfd_link_hash_lookup (info->hash, RW_SDA_ANCHOR_NAME, false, false, true);
1053+ if (h != (struct bfd_link_hash_entry *) NULL 1235+ if (h != (struct bfd_link_hash_entry *) NULL
1054+ && h->type == bfd_link_hash_defined) 1236+ && h->type == bfd_link_hash_defined)
1055+ rw_small_data_pointer = (h->u.def.value 1237+ rw_small_data_pointer = (h->u.def.value
@@ -1125,7 +1307,7 @@ index 0000000000..a357388115
1125+ section, which means that the addend must be adjusted 1307+ section, which means that the addend must be adjusted
1126+ accordingly. */ 1308+ accordingly. */
1127+ 1309+
1128+static bfd_boolean 1310+static int
1129+microblaze_elf_relocate_section (bfd *output_bfd, 1311+microblaze_elf_relocate_section (bfd *output_bfd,
1130+ struct bfd_link_info *info, 1312+ struct bfd_link_info *info,
1131+ bfd *input_bfd, 1313+ bfd *input_bfd,
@@ -1141,7 +1323,7 @@ index 0000000000..a357388115
1141+ Elf_Internal_Rela *rel, *relend; 1323+ Elf_Internal_Rela *rel, *relend;
1142+ int endian = (bfd_little_endian (output_bfd)) ? 0 : 2; 1324+ int endian = (bfd_little_endian (output_bfd)) ? 0 : 2;
1143+ /* Assume success. */ 1325+ /* Assume success. */
1144+ bfd_boolean ret = TRUE; 1326+ bool ret = true;
1145+ asection *sreloc; 1327+ asection *sreloc;
1146+ bfd_vma *local_got_offsets; 1328+ bfd_vma *local_got_offsets;
1147+ unsigned int tls_type; 1329+ unsigned int tls_type;
@@ -1151,7 +1333,7 @@ index 0000000000..a357388115
1151+ 1333+
1152+ htab = elf64_mb_hash_table (info); 1334+ htab = elf64_mb_hash_table (info);
1153+ if (htab == NULL) 1335+ if (htab == NULL)
1154+ return FALSE; 1336+ return false;
1155+ 1337+
1156+ local_got_offsets = elf_local_got_offsets (input_bfd); 1338+ local_got_offsets = elf_local_got_offsets (input_bfd);
1157+ 1339+
@@ -1172,7 +1354,7 @@ index 0000000000..a357388115
1172+ const char *sym_name; 1354+ const char *sym_name;
1173+ bfd_reloc_status_type r = bfd_reloc_ok; 1355+ bfd_reloc_status_type r = bfd_reloc_ok;
1174+ const char *errmsg = NULL; 1356+ const char *errmsg = NULL;
1175+ bfd_boolean unresolved_reloc = FALSE; 1357+ bool unresolved_reloc = false;
1176+ 1358+
1177+ h = NULL; 1359+ h = NULL;
1178+ r_type = ELF64_R_TYPE (rel->r_info); 1360+ r_type = ELF64_R_TYPE (rel->r_info);
@@ -1180,10 +1362,11 @@ index 0000000000..a357388115
1180+ 1362+
1181+ if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max) 1363+ if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max)
1182+ { 1364+ {
1183+ (*_bfd_error_handler) (_("%s: unknown relocation type %d"), 1365+ /* xgettext:c-format */
1184+ bfd_get_filename (input_bfd), (int) r_type); 1366+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
1367+ input_bfd, (int) r_type);
1185+ bfd_set_error (bfd_error_bad_value); 1368+ bfd_set_error (bfd_error_bad_value);
1186+ ret = FALSE; 1369+ ret = false;
1187+ continue; 1370+ continue;
1188+ } 1371+ }
1189+ 1372+
@@ -1233,12 +1416,12 @@ index 0000000000..a357388115
1233+ else 1416+ else
1234+ { 1417+ {
1235+ bfd_vma relocation; 1418+ bfd_vma relocation;
1236+ bfd_boolean resolved_to_zero; 1419+ bool resolved_to_zero;
1237+ 1420+
1238+ /* This is a final link. */ 1421+ /* This is a final link. */
1239+ sym = NULL; 1422+ sym = NULL;
1240+ sec = NULL; 1423+ sec = NULL;
1241+ unresolved_reloc = FALSE; 1424+ unresolved_reloc = false;
1242+ 1425+
1243+ if (r_symndx < symtab_hdr->sh_info) 1426+ if (r_symndx < symtab_hdr->sh_info)
1244+ { 1427+ {
@@ -1256,8 +1439,8 @@ index 0000000000..a357388115
1256+ else 1439+ else
1257+ { 1440+ {
1258+ /* External symbol. */ 1441+ /* External symbol. */
1259+ bfd_boolean warned ATTRIBUTE_UNUSED; 1442+ bool warned ATTRIBUTE_UNUSED;
1260+ bfd_boolean ignored ATTRIBUTE_UNUSED; 1443+ bool ignored ATTRIBUTE_UNUSED;
1261+ 1444+
1262+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, 1445+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
1263+ r_symndx, symtab_hdr, sym_hashes, 1446+ r_symndx, symtab_hdr, sym_hashes,
@@ -1294,7 +1477,7 @@ index 0000000000..a357388115
1294+ microblaze_elf_final_sdp (info); 1477+ microblaze_elf_final_sdp (info);
1295+ if (ro_small_data_pointer == 0) 1478+ if (ro_small_data_pointer == 0)
1296+ { 1479+ {
1297+ ret = FALSE; 1480+ ret = false;
1298+ r = bfd_reloc_undefined; 1481+ r = bfd_reloc_undefined;
1299+ goto check_reloc; 1482+ goto check_reloc;
1300+ } 1483+ }
@@ -1319,7 +1502,7 @@ index 0000000000..a357388115
1319+ microblaze_elf_howto_table[(int) r_type]->name, 1502+ microblaze_elf_howto_table[(int) r_type]->name,
1320+ sec); 1503+ sec);
1321+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1504+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1322+ ret = FALSE; 1505+ ret = false;
1323+ continue; 1506+ continue;
1324+ } 1507+ }
1325+ } 1508+ }
@@ -1342,7 +1525,7 @@ index 0000000000..a357388115
1342+ microblaze_elf_final_sdp (info); 1525+ microblaze_elf_final_sdp (info);
1343+ if (rw_small_data_pointer == 0) 1526+ if (rw_small_data_pointer == 0)
1344+ { 1527+ {
1345+ ret = FALSE; 1528+ ret = false;
1346+ r = bfd_reloc_undefined; 1529+ r = bfd_reloc_undefined;
1347+ goto check_reloc; 1530+ goto check_reloc;
1348+ } 1531+ }
@@ -1367,7 +1550,7 @@ index 0000000000..a357388115
1367+ microblaze_elf_howto_table[(int) r_type]->name, 1550+ microblaze_elf_howto_table[(int) r_type]->name,
1368+ sec); 1551+ sec);
1369+ /*bfd_set_error (bfd_error_bad_value); ??? why? */ 1552+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1370+ ret = FALSE; 1553+ ret = false;
1371+ continue; 1554+ continue;
1372+ } 1555+ }
1373+ } 1556+ }
@@ -1378,8 +1561,20 @@ index 0000000000..a357388115
1378+ break; /* Do nothing. */ 1561+ break; /* Do nothing. */
1379+ 1562+
1380+ case (int) R_MICROBLAZE_GOTPC_64: 1563+ case (int) R_MICROBLAZE_GOTPC_64:
1381+ relocation = htab->sgotplt->output_section->vma 1564+ relocation = (htab->elf.sgotplt->output_section->vma
1382+ + htab->sgotplt->output_offset; 1565+ + htab->elf.sgotplt->output_offset);
1566+ relocation -= (input_section->output_section->vma
1567+ + input_section->output_offset
1568+ + offset + INST_WORD_SIZE);
1569+ relocation += addend;
1570+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1571+ contents + offset + endian);
1572+ bfd_put_16 (input_bfd, relocation & 0xffff,
1573+ contents + offset + endian + INST_WORD_SIZE);
1574+ break;
1575+
1576+ case (int) R_MICROBLAZE_TEXTPCREL_64:
1577+ relocation = input_section->output_section->vma;
1383+ relocation -= (input_section->output_section->vma 1578+ relocation -= (input_section->output_section->vma
1384+ + input_section->output_offset 1579+ + input_section->output_offset
1385+ + offset + INST_WORD_SIZE); 1580+ + offset + INST_WORD_SIZE);
@@ -1393,13 +1588,13 @@ index 0000000000..a357388115
1393+ case (int) R_MICROBLAZE_PLT_64: 1588+ case (int) R_MICROBLAZE_PLT_64:
1394+ { 1589+ {
1395+ bfd_vma immediate; 1590+ bfd_vma immediate;
1396+ if (htab->splt != NULL && h != NULL 1591+ if (htab->elf.splt != NULL && h != NULL
1397+ && h->plt.offset != (bfd_vma) -1) 1592+ && h->plt.offset != (bfd_vma) -1)
1398+ { 1593+ {
1399+ relocation = (htab->splt->output_section->vma 1594+ relocation = (htab->elf.splt->output_section->vma
1400+ + htab->splt->output_offset 1595+ + htab->elf.splt->output_offset
1401+ + h->plt.offset); 1596+ + h->plt.offset);
1402+ unresolved_reloc = FALSE; 1597+ unresolved_reloc = false;
1403+ immediate = relocation - (input_section->output_section->vma 1598+ immediate = relocation - (input_section->output_section->vma
1404+ + input_section->output_offset 1599+ + input_section->output_offset
1405+ + offset + INST_WORD_SIZE); 1600+ + offset + INST_WORD_SIZE);
@@ -1435,8 +1630,8 @@ index 0000000000..a357388115
1435+ unsigned long indx; 1630+ unsigned long indx;
1436+ bfd_vma static_value; 1631+ bfd_vma static_value;
1437+ 1632+
1438+ bfd_boolean need_relocs = FALSE; 1633+ bool need_relocs = false;
1439+ if (htab->sgot == NULL) 1634+ if (htab->elf.sgot == NULL)
1440+ abort (); 1635+ abort ();
1441+ 1636+
1442+ indx = 0; 1637+ indx = 0;
@@ -1452,8 +1647,9 @@ index 0000000000..a357388115
1452+ offp = &htab->tlsld_got.offset; 1647+ offp = &htab->tlsld_got.offset;
1453+ else if (h != NULL) 1648+ else if (h != NULL)
1454+ { 1649+ {
1455+ if (htab->sgotplt != NULL && h->got.offset != (bfd_vma) -1) 1650+ if (htab->elf.sgotplt != NULL
1456+ offp = &h->got.offset; 1651+ && h->got.offset != (bfd_vma) -1)
1652+ offp = &h->got.offset;
1457+ else 1653+ else
1458+ abort (); 1654+ abort ();
1459+ } 1655+ }
@@ -1476,7 +1672,7 @@ index 0000000000..a357388115
1476+ /* Symbol index to use for relocs */ 1672+ /* Symbol index to use for relocs */
1477+ if (h != NULL) 1673+ if (h != NULL)
1478+ { 1674+ {
1479+ bfd_boolean dyn = 1675+ bool dyn =
1480+ elf_hash_table (info)->dynamic_sections_created; 1676+ elf_hash_table (info)->dynamic_sections_created;
1481+ 1677+
1482+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 1678+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
@@ -1493,7 +1689,7 @@ index 0000000000..a357388115
1493+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT 1689+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1494+ && !resolved_to_zero) 1690+ && !resolved_to_zero)
1495+ || h->root.type != bfd_link_hash_undefweak)) 1691+ || h->root.type != bfd_link_hash_undefweak))
1496+ need_relocs = TRUE; 1692+ need_relocs = true;
1497+ 1693+
1498+ /* 2. Compute/Emit Static value of r-expression */ 1694+ /* 2. Compute/Emit Static value of r-expression */
1499+ static_value = relocation + addend; 1695+ static_value = relocation + addend;
@@ -1503,53 +1699,51 @@ index 0000000000..a357388115
1503+ { 1699+ {
1504+ bfd_vma got_offset; 1700+ bfd_vma got_offset;
1505+ 1701+
1506+ got_offset = (htab->sgot->output_section->vma 1702+ got_offset = (htab->elf.sgot->output_section->vma
1507+ + htab->sgot->output_offset 1703+ + htab->elf.sgot->output_offset
1508+ + off); 1704+ + off);
1509+ 1705+
1510+ /* Process module-id */ 1706+ /* Process module-id */
1511+ if (IS_TLS_LD(tls_type)) 1707+ if (IS_TLS_LD(tls_type))
1512+ { 1708+ {
1513+ if (! bfd_link_pic (info)) 1709+ if (! bfd_link_pic (info))
1514+ { 1710+ bfd_put_32 (output_bfd, 1,
1515+ bfd_put_32 (output_bfd, 1, htab->sgot->contents + off); 1711+ htab->elf.sgot->contents + off);
1516+ }
1517+ else 1712+ else
1518+ { 1713+ microblaze_elf_output_dynamic_relocation
1519+ microblaze_elf_output_dynamic_relocation (output_bfd, 1714+ (output_bfd,
1520+ htab->srelgot, htab->srelgot->reloc_count++, 1715+ htab->elf.srelgot,
1521+ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32, 1716+ htab->elf.srelgot->reloc_count++,
1522+ got_offset, 0); 1717+ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
1523+ } 1718+ got_offset, 0);
1524+ } 1719+ }
1525+ else if (IS_TLS_GD(tls_type)) 1720+ else if (IS_TLS_GD(tls_type))
1526+ { 1721+ {
1527+ if (! need_relocs) 1722+ if (! need_relocs)
1528+ { 1723+ bfd_put_32 (output_bfd, 1,
1529+ bfd_put_32 (output_bfd, 1, htab->sgot->contents + off); 1724+ htab->elf.sgot->contents + off);
1530+ } 1725+ else
1531+ else 1726+ microblaze_elf_output_dynamic_relocation
1532+ { 1727+ (output_bfd,
1533+ microblaze_elf_output_dynamic_relocation (output_bfd, 1728+ htab->elf.srelgot,
1534+ htab->srelgot, 1729+ htab->elf.srelgot->reloc_count++,
1535+ htab->srelgot->reloc_count++, 1730+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
1536+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32, 1731+ got_offset, indx ? 0 : static_value);
1537+ got_offset, indx ? 0 : static_value);
1538+ }
1539+ } 1732+ }
1540+ 1733+
1541+ /* Process Offset */ 1734+ /* Process Offset */
1542+ if (htab->srelgot == NULL) 1735+ if (htab->elf.srelgot == NULL)
1543+ abort (); 1736+ abort ();
1544+ 1737+
1545+ got_offset = (htab->sgot->output_section->vma 1738+ got_offset = (htab->elf.sgot->output_section->vma
1546+ + htab->sgot->output_offset 1739+ + htab->elf.sgot->output_offset
1547+ + off2); 1740+ + off2);
1548+ if (IS_TLS_LD(tls_type)) 1741+ if (IS_TLS_LD(tls_type))
1549+ { 1742+ {
1550+ /* For LD, offset should be 0 */ 1743+ /* For LD, offset should be 0 */
1551+ *offp |= 1; 1744+ *offp |= 1;
1552+ bfd_put_32 (output_bfd, 0, htab->sgot->contents + off2); 1745+ bfd_put_32 (output_bfd, 0,
1746+ htab->elf.sgot->contents + off2);
1553+ } 1747+ }
1554+ else if (IS_TLS_GD(tls_type)) 1748+ else if (IS_TLS_GD(tls_type))
1555+ { 1749+ {
@@ -1601,7 +1795,7 @@ index 0000000000..a357388115
1601+ bfd_put_16 (input_bfd, relocation & 0xffff, 1795+ bfd_put_16 (input_bfd, relocation & 0xffff,
1602+ contents + offset + endian + INST_WORD_SIZE); 1796+ contents + offset + endian + INST_WORD_SIZE);
1603+ 1797+
1604+ unresolved_reloc = FALSE; 1798+ unresolved_reloc = false;
1605+ break; 1799+ break;
1606+ } 1800+ }
1607+ 1801+
@@ -1617,7 +1811,8 @@ index 0000000000..a357388115
1617+ lo = immediate & 0x0000ffff; 1811+ lo = immediate & 0x0000ffff;
1618+ high = (immediate >> 16) & 0x0000ffff; 1812+ high = (immediate >> 16) & 0x0000ffff;
1619+ bfd_put_16 (input_bfd, high, contents + offset + endian); 1813+ bfd_put_16 (input_bfd, high, contents + offset + endian);
1620+ bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + endian); 1814+ bfd_put_16 (input_bfd, lo,
1815+ contents + offset + INST_WORD_SIZE + endian);
1621+ break; 1816+ break;
1622+ } 1817+ }
1623+ 1818+
@@ -1639,6 +1834,8 @@ index 0000000000..a357388115
1639+ bfd_put_16 (input_bfd, relocation & 0xffff, 1834+ bfd_put_16 (input_bfd, relocation & 0xffff,
1640+ contents + offset + endian + INST_WORD_SIZE); 1835+ contents + offset + endian + INST_WORD_SIZE);
1641+ break; 1836+ break;
1837+ case (int) R_MICROBLAZE_TEXTREL_64:
1838+ case (int) R_MICROBLAZE_TEXTREL_32_LO:
1642+ case (int) R_MICROBLAZE_64_PCREL : 1839+ case (int) R_MICROBLAZE_64_PCREL :
1643+ case (int) R_MICROBLAZE_64: 1840+ case (int) R_MICROBLAZE_64:
1644+ case (int) R_MICROBLAZE_32: 1841+ case (int) R_MICROBLAZE_32:
@@ -1649,7 +1846,7 @@ index 0000000000..a357388115
1649+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0) 1846+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
1650+ { 1847+ {
1651+ relocation += addend; 1848+ relocation += addend;
1652+ if (r_type == R_MICROBLAZE_32) 1849+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
1653+ bfd_put_32 (input_bfd, relocation, contents + offset); 1850+ bfd_put_32 (input_bfd, relocation, contents + offset);
1654+ else 1851+ else
1655+ { 1852+ {
@@ -1657,11 +1854,22 @@ index 0000000000..a357388115
1657+ relocation -= (input_section->output_section->vma 1854+ relocation -= (input_section->output_section->vma
1658+ + input_section->output_offset 1855+ + input_section->output_offset
1659+ + offset + INST_WORD_SIZE); 1856+ + offset + INST_WORD_SIZE);
1660+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 1857+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1661+ contents + offset + endian); 1858+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1662+ bfd_put_16 (input_bfd, relocation & 0xffff, 1859+ relocation -= input_section->output_section->vma;
1663+ contents + offset + endian + INST_WORD_SIZE); 1860+
1861+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1862+ bfd_put_16 (input_bfd, relocation & 0xffff,
1863+ contents + offset + endian);
1864+
1865+ else
1866+ {
1867+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1868+ contents + offset + endian);
1869+ bfd_put_16 (input_bfd, relocation & 0xffff,
1870+ contents + offset + endian + INST_WORD_SIZE);
1664+ } 1871+ }
1872+ }
1665+ break; 1873+ break;
1666+ } 1874+ }
1667+ 1875+
@@ -1686,7 +1894,7 @@ index 0000000000..a357388115
1686+ { 1894+ {
1687+ Elf_Internal_Rela outrel; 1895+ Elf_Internal_Rela outrel;
1688+ bfd_byte *loc; 1896+ bfd_byte *loc;
1689+ bfd_boolean skip; 1897+ bool skip;
1690+ 1898+
1691+ /* When generating a shared object, these relocations 1899+ /* When generating a shared object, these relocations
1692+ are copied into the output file to be resolved at run 1900+ are copied into the output file to be resolved at run
@@ -1694,15 +1902,15 @@ index 0000000000..a357388115
1694+ 1902+
1695+ BFD_ASSERT (sreloc != NULL); 1903+ BFD_ASSERT (sreloc != NULL);
1696+ 1904+
1697+ skip = FALSE; 1905+ skip = false;
1698+ 1906+
1699+ outrel.r_offset = 1907+ outrel.r_offset =
1700+ _bfd_elf_section_offset (output_bfd, info, input_section, 1908+ _bfd_elf_section_offset (output_bfd, info, input_section,
1701+ rel->r_offset); 1909+ rel->r_offset);
1702+ if (outrel.r_offset == (bfd_vma) -1) 1910+ if (outrel.r_offset == (bfd_vma) -1)
1703+ skip = TRUE; 1911+ skip = true;
1704+ else if (outrel.r_offset == (bfd_vma) -2) 1912+ else if (outrel.r_offset == (bfd_vma) -2)
1705+ skip = TRUE; 1913+ skip = true;
1706+ outrel.r_offset += (input_section->output_section->vma 1914+ outrel.r_offset += (input_section->output_section->vma
1707+ + input_section->output_offset); 1915+ + input_section->output_offset);
1708+ 1916+
@@ -1728,11 +1936,11 @@ index 0000000000..a357388115
1728+ else 1936+ else
1729+ { 1937+ {
1730+ BFD_FAIL (); 1938+ BFD_FAIL ();
1731+ (*_bfd_error_handler) 1939+ _bfd_error_handler
1732+ (_("%B: probably compiled without -fPIC?"), 1940+ (_("%pB: probably compiled without -fPIC?"),
1733+ input_bfd); 1941+ input_bfd);
1734+ bfd_set_error (bfd_error_bad_value); 1942+ bfd_set_error (bfd_error_bad_value);
1735+ return FALSE; 1943+ return false;
1736+ } 1944+ }
1737+ } 1945+ }
1738+ 1946+
@@ -1752,11 +1960,24 @@ index 0000000000..a357388115
1752+ relocation -= (input_section->output_section->vma 1960+ relocation -= (input_section->output_section->vma
1753+ + input_section->output_offset 1961+ + input_section->output_offset
1754+ + offset + INST_WORD_SIZE); 1962+ + offset + INST_WORD_SIZE);
1755+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 1963+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1756+ contents + offset + endian); 1964+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1757+ bfd_put_16 (input_bfd, relocation & 0xffff, 1965+ relocation -= input_section->output_section->vma;
1758+ contents + offset + endian + INST_WORD_SIZE); 1966+
1759+ } 1967+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1968+ {
1969+ bfd_put_16 (input_bfd, relocation & 0xffff,
1970+ contents + offset + endian);
1971+ }
1972+ else
1973+ {
1974+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1975+ contents + offset + endian);
1976+ bfd_put_16 (input_bfd, relocation & 0xffff,
1977+ contents + offset + endian
1978+ + INST_WORD_SIZE);
1979+ }
1980+ }
1760+ break; 1981+ break;
1761+ } 1982+ }
1762+ } 1983+ }
@@ -1799,7 +2020,7 @@ index 0000000000..a357388115
1799+ 2020+
1800+ case bfd_reloc_undefined: 2021+ case bfd_reloc_undefined:
1801+ (*info->callbacks->undefined_symbol) 2022+ (*info->callbacks->undefined_symbol)
1802+ (info, name, input_bfd, input_section, offset, TRUE); 2023+ (info, name, input_bfd, input_section, offset, true);
1803+ break; 2024+ break;
1804+ 2025+
1805+ case bfd_reloc_outofrange: 2026+ case bfd_reloc_outofrange:
@@ -1827,21 +2048,6 @@ index 0000000000..a357388115
1827+ 2048+
1828+ return ret; 2049+ return ret;
1829+} 2050+}
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+ 2051+
1846+/* Calculate fixup value for reference. */ 2052+/* Calculate fixup value for reference. */
1847+ 2053+
@@ -1896,11 +2102,11 @@ index 0000000000..a357388115
1896+ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE); 2102+ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE);
1897+} 2103+}
1898+ 2104+
1899+static bfd_boolean 2105+static bool
1900+microblaze_elf_relax_section (bfd *abfd, 2106+microblaze_elf_relax_section (bfd *abfd,
1901+ asection *sec, 2107+ asection *sec,
1902+ struct bfd_link_info *link_info, 2108+ struct bfd_link_info *link_info,
1903+ bfd_boolean *again) 2109+ bool *again)
1904+{ 2110+{
1905+ Elf_Internal_Shdr *symtab_hdr; 2111+ Elf_Internal_Shdr *symtab_hdr;
1906+ Elf_Internal_Rela *internal_relocs; 2112+ Elf_Internal_Rela *internal_relocs;
@@ -1921,14 +2127,14 @@ index 0000000000..a357388115
1921+ 2127+
1922+ /* We only do this once per section. We may be able to delete some code 2128+ /* We only do this once per section. We may be able to delete some code
1923+ by running multiple passes, but it is not worth it. */ 2129+ by running multiple passes, but it is not worth it. */
1924+ *again = FALSE; 2130+ *again = false;
1925+ 2131+
1926+ /* Only do this for a text section. */ 2132+ /* Only do this for a text section. */
1927+ if (bfd_link_relocatable (link_info) 2133+ if (bfd_link_relocatable (link_info)
1928+ || (sec->flags & SEC_RELOC) == 0 2134+ || (sec->flags & SEC_RELOC) == 0
1929+ || (sec->reloc_count == 0) 2135+ || (sec->reloc_count == 0)
1930+ || (sec->flags & SEC_CODE) == 0) 2136+ || (sec->flags & SEC_CODE) == 0)
1931+ return TRUE; 2137+ return true;
1932+ 2138+
1933+ BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0)); 2139+ BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0));
1934+ 2140+
@@ -1964,7 +2170,8 @@ index 0000000000..a357388115
1964+ { 2170+ {
1965+ bfd_vma symval; 2171+ bfd_vma symval;
1966+ if ((ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL) 2172+ if ((ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
1967+ && (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64 )) 2173+ && (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64 )
2174+&& (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_TEXTREL_64))
1968+ continue; /* Can't delete this reloc. */ 2175+ continue; /* Can't delete this reloc. */
1969+ 2176+
1970+ /* Get the section contents. */ 2177+ /* Get the section contents. */
@@ -2034,6 +2241,10 @@ index 0000000000..a357388115
2034+ + sec->output_section->vma 2241+ + sec->output_section->vma
2035+ + sec->output_offset); 2242+ + sec->output_offset);
2036+ } 2243+ }
2244+ else if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_TEXTREL_64)
2245+ {
2246+ symval = symval + irel->r_addend - (sec->output_section->vma);
2247+ }
2037+ else 2248+ else
2038+ symval += irel->r_addend; 2249+ symval += irel->r_addend;
2039+ 2250+
@@ -2055,9 +2266,13 @@ index 0000000000..a357388115
2055+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), 2266+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2056+ (int) R_MICROBLAZE_32_LO); 2267+ (int) R_MICROBLAZE_32_LO);
2057+ break; 2268+ break;
2269+ case R_MICROBLAZE_TEXTREL_64:
2270+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2271+ (int) R_MICROBLAZE_TEXTREL_32_LO);
2272+ break;
2058+ default: 2273+ default:
2059+ /* Cannot happen. */ 2274+ /* Cannot happen. */
2060+ BFD_ASSERT (FALSE); 2275+ BFD_ASSERT (false);
2061+ } 2276+ }
2062+ } 2277+ }
2063+ } /* Loop through all relocations. */ 2278+ } /* Loop through all relocations. */
@@ -2095,6 +2310,28 @@ index 0000000000..a357388115
2095+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); 2310+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
2096+ } 2311+ }
2097+ break; 2312+ break;
2313+ case R_MICROBLAZE_IMML_64:
2314+ {
2315+ /* This was a PC-relative instruction that was
2316+ completely resolved. */
2317+ int sfix, efix;
2318+ unsigned int val;
2319+ bfd_vma target_address;
2320+ target_address = irel->r_addend + irel->r_offset;
2321+ sfix = calc_fixup (irel->r_offset, 0, sec);
2322+ efix = calc_fixup (target_address, 0, sec);
2323+
2324+ /* Validate the in-band val. */
2325+ val = bfd_get_32 (abfd, contents + irel->r_offset);
2326+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2327+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2328+ }
2329+ irel->r_addend -= (efix - sfix);
2330+ /* Should use HOWTO. */
2331+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2332+ irel->r_addend);
2333+ }
2334+ break;
2098+ case R_MICROBLAZE_NONE: 2335+ case R_MICROBLAZE_NONE:
2099+ case R_MICROBLAZE_32_NONE: 2336+ case R_MICROBLAZE_32_NONE:
2100+ { 2337+ {
@@ -2149,9 +2386,9 @@ index 0000000000..a357388115
2149+ continue; 2386+ continue;
2150+ 2387+
2151+ /* We always cache the relocs. Perhaps, if info->keep_memory is 2388+ /* We always cache the relocs. Perhaps, if info->keep_memory is
2152+ FALSE, we should free them, if we are permitted to. */ 2389+ false, we should free them, if we are permitted to. */
2153+ 2390+
2154+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, TRUE); 2391+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, true);
2155+ if (irelocs == NULL) 2392+ if (irelocs == NULL)
2156+ goto error_return; 2393+ goto error_return;
2157+ 2394+
@@ -2177,7 +2414,7 @@ index 0000000000..a357388115
2177+ else 2414+ else
2178+ { 2415+ {
2179+ /* We always cache the section contents. 2416+ /* We always cache the section contents.
2180+ Perhaps, if info->keep_memory is FALSE, we 2417+ Perhaps, if info->keep_memory is false, we
2181+ should free them, if we are permitted to. */ 2418+ should free them, if we are permitted to. */
2182+ 2419+
2183+ if (o->rawsize == 0) 2420+ if (o->rawsize == 0)
@@ -2216,7 +2453,7 @@ index 0000000000..a357388115
2216+ else 2453+ else
2217+ { 2454+ {
2218+ /* We always cache the section contents. 2455+ /* We always cache the section contents.
2219+ Perhaps, if info->keep_memory is FALSE, we 2456+ Perhaps, if info->keep_memory is false, we
2220+ should free them, if we are permitted to. */ 2457+ should free them, if we are permitted to. */
2221+ if (o->rawsize == 0) 2458+ if (o->rawsize == 0)
2222+ o->rawsize = o->size; 2459+ o->rawsize = o->size;
@@ -2245,7 +2482,7 @@ index 0000000000..a357388115
2245+ else 2482+ else
2246+ { 2483+ {
2247+ /* We always cache the section contents. 2484+ /* We always cache the section contents.
2248+ Perhaps, if info->keep_memory is FALSE, we 2485+ Perhaps, if info->keep_memory is false, we
2249+ should free them, if we are permitted to. */ 2486+ should free them, if we are permitted to. */
2250+ 2487+
2251+ if (o->rawsize == 0) 2488+ if (o->rawsize == 0)
@@ -2267,7 +2504,8 @@ index 0000000000..a357388115
2267+ } 2504+ }
2268+ } 2505+ }
2269+ else if ((ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_PCREL_LO) 2506+ else if ((ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_PCREL_LO)
2270+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_LO)) 2507+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_LO)
2508+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_32_LO))
2271+ { 2509+ {
2272+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 2510+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2273+ 2511+
@@ -2285,7 +2523,7 @@ index 0000000000..a357388115
2285+ else 2523+ else
2286+ { 2524+ {
2287+ /* We always cache the section contents. 2525+ /* We always cache the section contents.
2288+ Perhaps, if info->keep_memory is FALSE, we 2526+ Perhaps, if info->keep_memory is false, we
2289+ should free them, if we are permitted to. */ 2527+ should free them, if we are permitted to. */
2290+ if (o->rawsize == 0) 2528+ if (o->rawsize == 0)
2291+ o->rawsize = o->size; 2529+ o->rawsize = o->size;
@@ -2311,7 +2549,8 @@ index 0000000000..a357388115
2311+ } 2549+ }
2312+ } 2550+ }
2313+ 2551+
2314+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64) 2552+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64
2553+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64))
2315+ { 2554+ {
2316+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 2555+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2317+ 2556+
@@ -2328,7 +2567,7 @@ index 0000000000..a357388115
2328+ else 2567+ else
2329+ { 2568+ {
2330+ /* We always cache the section contents. 2569+ /* We always cache the section contents.
2331+ Perhaps, if info->keep_memory is FALSE, we 2570+ Perhaps, if info->keep_memory is false, we
2332+ should free them, if we are permitted to. */ 2571+ should free them, if we are permitted to. */
2333+ 2572+
2334+ if (o->rawsize == 0) 2573+ if (o->rawsize == 0)
@@ -2373,7 +2612,7 @@ index 0000000000..a357388115
2373+ else 2612+ else
2374+ { 2613+ {
2375+ /* We always cache the section contents. 2614+ /* We always cache the section contents.
2376+ Perhaps, if info->keep_memory is FALSE, we 2615+ Perhaps, if info->keep_memory is false, we
2377+ should free them, if we are permitted to. */ 2616+ should free them, if we are permitted to. */
2378+ if (o->rawsize == 0) 2617+ if (o->rawsize == 0)
2379+ o->rawsize = o->size; 2618+ o->rawsize = o->size;
@@ -2457,11 +2696,8 @@ index 0000000000..a357388115
2457+ symtab_hdr->contents = (bfd_byte *) isymbuf; 2696+ symtab_hdr->contents = (bfd_byte *) isymbuf;
2458+ } 2697+ }
2459+ 2698+
2460+ if (free_relocs != NULL) 2699+ free (free_relocs);
2461+ { 2700+ free_relocs = NULL;
2462+ free (free_relocs);
2463+ free_relocs = NULL;
2464+ }
2465+ 2701+
2466+ if (free_contents != NULL) 2702+ if (free_contents != NULL)
2467+ { 2703+ {
@@ -2475,26 +2711,21 @@ index 0000000000..a357388115
2475+ 2711+
2476+ if (sec->relax_count == 0) 2712+ if (sec->relax_count == 0)
2477+ { 2713+ {
2478+ *again = FALSE; 2714+ *again = false;
2479+ free (sec->relax); 2715+ free (sec->relax);
2480+ sec->relax = NULL; 2716+ sec->relax = NULL;
2481+ } 2717+ }
2482+ else 2718+ else
2483+ *again = TRUE; 2719+ *again = true;
2484+ return TRUE; 2720+ return true;
2485+ 2721+
2486+ error_return: 2722+ error_return:
2487+ if (free_relocs != NULL) 2723+ free (free_relocs);
2488+ free (free_relocs); 2724+ free (free_contents);
2489+ if (free_contents != NULL) 2725+ free (sec->relax);
2490+ free (free_contents); 2726+ sec->relax = NULL;
2491+ if (sec->relax != NULL) 2727+ sec->relax_count = 0;
2492+ { 2728+ return false;
2493+ free (sec->relax);
2494+ sec->relax = NULL;
2495+ sec->relax_count = 0;
2496+ }
2497+ return FALSE;
2498+} 2729+}
2499+ 2730+
2500+/* Return the section that should be marked against GC for a given 2731+/* Return the section that should be marked against GC for a given
@@ -2518,17 +2749,6 @@ index 0000000000..a357388115
2518+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); 2749+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2519+} 2750+}
2520+ 2751+
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+
2532+/* PIC support. */ 2752+/* PIC support. */
2533+ 2753+
2534+#define PLT_ENTRY_SIZE 16 2754+#define PLT_ENTRY_SIZE 16
@@ -2542,37 +2762,7 @@ index 0000000000..a357388115
2542+/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up 2762+/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
2543+ shortcuts to them in our hash table. */ 2763+ shortcuts to them in our hash table. */
2544+ 2764+
2545+static bfd_boolean 2765+static bool
2546+create_got_section (bfd *dynobj, struct bfd_link_info *info)
2547+{
2548+ struct elf64_mb_link_hash_table *htab;
2549+
2550+ if (! _bfd_elf_create_got_section (dynobj, info))
2551+ return FALSE;
2552+ htab = elf64_mb_hash_table (info);
2553+ if (htab == NULL)
2554+ return FALSE;
2555+
2556+ htab->sgot = bfd_get_linker_section (dynobj, ".got");
2557+ htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
2558+ if (!htab->sgot || !htab->sgotplt)
2559+ return FALSE;
2560+
2561+ if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL)
2562+ htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got");
2563+ if (htab->srelgot == NULL
2564+ || ! bfd_set_section_flags (htab->srelgot, SEC_ALLOC
2565+ | SEC_LOAD
2566+ | SEC_HAS_CONTENTS
2567+ | SEC_IN_MEMORY
2568+ | SEC_LINKER_CREATED
2569+ | SEC_READONLY)
2570+ || ! bfd_set_section_alignment (htab->srelgot, 2))
2571+ return FALSE;
2572+ return TRUE;
2573+}
2574+
2575+static bfd_boolean
2576+update_local_sym_info (bfd *abfd, 2766+update_local_sym_info (bfd *abfd,
2577+ Elf_Internal_Shdr *symtab_hdr, 2767+ Elf_Internal_Shdr *symtab_hdr,
2578+ unsigned long r_symndx, 2768+ unsigned long r_symndx,
@@ -2588,7 +2778,7 @@ index 0000000000..a357388115
2588+ size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks)); 2778+ size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks));
2589+ local_got_refcounts = bfd_zalloc (abfd, size); 2779+ local_got_refcounts = bfd_zalloc (abfd, size);
2590+ if (local_got_refcounts == NULL) 2780+ if (local_got_refcounts == NULL)
2591+ return FALSE; 2781+ return false;
2592+ elf_local_got_refcounts (abfd) = local_got_refcounts; 2782+ elf_local_got_refcounts (abfd) = local_got_refcounts;
2593+ } 2783+ }
2594+ 2784+
@@ -2597,11 +2787,11 @@ index 0000000000..a357388115
2597+ local_got_tls_masks[r_symndx] |= tls_type; 2787+ local_got_tls_masks[r_symndx] |= tls_type;
2598+ local_got_refcounts[r_symndx] += 1; 2788+ local_got_refcounts[r_symndx] += 1;
2599+ 2789+
2600+ return TRUE; 2790+ return true;
2601+} 2791+}
2602+/* Look through the relocs for a section during the first phase. */ 2792+/* Look through the relocs for a section during the first phase. */
2603+ 2793+
2604+static bfd_boolean 2794+static bool
2605+microblaze_elf_check_relocs (bfd * abfd, 2795+microblaze_elf_check_relocs (bfd * abfd,
2606+ struct bfd_link_info * info, 2796+ struct bfd_link_info * info,
2607+ asection * sec, 2797+ asection * sec,
@@ -2616,11 +2806,11 @@ index 0000000000..a357388115
2616+ asection *sreloc = NULL; 2806+ asection *sreloc = NULL;
2617+ 2807+
2618+ if (bfd_link_relocatable (info)) 2808+ if (bfd_link_relocatable (info))
2619+ return TRUE; 2809+ return true;
2620+ 2810+
2621+ htab = elf64_mb_hash_table (info); 2811+ htab = elf64_mb_hash_table (info);
2622+ if (htab == NULL) 2812+ if (htab == NULL)
2623+ return FALSE; 2813+ return false;
2624+ 2814+
2625+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr; 2815+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
2626+ sym_hashes = elf_sym_hashes (abfd); 2816+ sym_hashes = elf_sym_hashes (abfd);
@@ -2656,14 +2846,14 @@ index 0000000000..a357388115
2656+ Reconstruct it for later use during GC. */ 2846+ Reconstruct it for later use during GC. */
2657+ case R_MICROBLAZE_GNU_VTINHERIT: 2847+ case R_MICROBLAZE_GNU_VTINHERIT:
2658+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) 2848+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
2659+ return FALSE; 2849+ return false;
2660+ break; 2850+ break;
2661+ 2851+
2662+ /* This relocation describes which C++ vtable entries are actually 2852+ /* This relocation describes which C++ vtable entries are actually
2663+ used. Record for later use during GC. */ 2853+ used. Record for later use during GC. */
2664+ case R_MICROBLAZE_GNU_VTENTRY: 2854+ case R_MICROBLAZE_GNU_VTENTRY:
2665+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) 2855+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
2666+ return FALSE; 2856+ return false;
2667+ break; 2857+ break;
2668+ 2858+
2669+ /* This relocation requires .plt entry. */ 2859+ /* This relocation requires .plt entry. */
@@ -2676,22 +2866,24 @@ index 0000000000..a357388115
2676+ break; 2866+ break;
2677+ 2867+
2678+ /* This relocation requires .got entry. */ 2868+ /* This relocation requires .got entry. */
2679+ case R_MICROBLAZE_TLSGD: 2869+ case R_MICROBLAZE_TLSGD:
2680+ tls_type |= (TLS_TLS | TLS_GD); 2870+ tls_type |= (TLS_TLS | TLS_GD);
2681+ goto dogottls; 2871+ goto dogottls;
2682+ case R_MICROBLAZE_TLSLD: 2872+ case R_MICROBLAZE_TLSLD:
2683+ tls_type |= (TLS_TLS | TLS_LD); 2873+ tls_type |= (TLS_TLS | TLS_LD);
2684+ dogottls: 2874+ /* Fall through. */
2685+ sec->has_tls_reloc = 1; 2875+ dogottls:
2686+ case R_MICROBLAZE_GOT_64: 2876+ sec->has_tls_reloc = 1;
2687+ if (htab->sgot == NULL) 2877+ /* Fall through. */
2688+ { 2878+ case R_MICROBLAZE_GOT_64:
2689+ if (htab->elf.dynobj == NULL) 2879+ if (htab->elf.sgot == NULL)
2690+ htab->elf.dynobj = abfd; 2880+ {
2691+ if (!create_got_section (htab->elf.dynobj, info)) 2881+ if (htab->elf.dynobj == NULL)
2692+ return FALSE; 2882+ htab->elf.dynobj = abfd;
2693+ } 2883+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2694+ if (h != NULL) 2884+ return false;
2885+ }
2886+ if (h != NULL)
2695+ { 2887+ {
2696+ h->got.refcount += 1; 2888+ h->got.refcount += 1;
2697+ elf64_mb_hash_entry (h)->tls_mask |= tls_type; 2889+ elf64_mb_hash_entry (h)->tls_mask |= tls_type;
@@ -2699,7 +2891,18 @@ index 0000000000..a357388115
2699+ else 2891+ else
2700+ { 2892+ {
2701+ if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) ) 2893+ if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) )
2702+ return FALSE; 2894+ return false;
2895+ }
2896+ break;
2897+
2898+ case R_MICROBLAZE_GOTOFF_64:
2899+ case R_MICROBLAZE_GOTOFF_32:
2900+ if (htab->elf.sgot == NULL)
2901+ {
2902+ if (htab->elf.dynobj == NULL)
2903+ htab->elf.dynobj = abfd;
2904+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2905+ return false;
2703+ } 2906+ }
2704+ break; 2907+ break;
2705+ 2908+
@@ -2748,14 +2951,14 @@ index 0000000000..a357388115
2748+ && (! info->symbolic 2951+ && (! info->symbolic
2749+ || h->root.type == bfd_link_hash_defweak 2952+ || h->root.type == bfd_link_hash_defweak
2750+ || !h->def_regular)))) 2953+ || !h->def_regular))))
2751+ || (!bfd_link_pic (info) 2954+ || (!bfd_link_pic (info)
2752+ && (sec->flags & SEC_ALLOC) != 0 2955+ && (sec->flags & SEC_ALLOC) != 0
2753+ && h != NULL 2956+ && h != NULL
2754+ && (h->root.type == bfd_link_hash_defweak 2957+ && (h->root.type == bfd_link_hash_defweak
2755+ || !h->def_regular))) 2958+ || !h->def_regular)))
2756+ { 2959+ {
2757+ struct elf64_mb_dyn_relocs *p; 2960+ struct elf_dyn_relocs *p;
2758+ struct elf64_mb_dyn_relocs **head; 2961+ struct elf_dyn_relocs **head;
2759+ 2962+
2760+ /* When creating a shared object, we must copy these 2963+ /* When creating a shared object, we must copy these
2761+ relocs into the output file. We create a reloc 2964+ relocs into the output file. We create a reloc
@@ -2772,7 +2975,7 @@ index 0000000000..a357388115
2772+ sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj, 2975+ sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj,
2773+ 2, abfd, 1); 2976+ 2, abfd, 1);
2774+ if (sreloc == NULL) 2977+ if (sreloc == NULL)
2775+ return FALSE; 2978+ return false;
2776+ } 2979+ }
2777+ 2980+
2778+ /* If this is a global symbol, we count the number of 2981+ /* If this is a global symbol, we count the number of
@@ -2789,27 +2992,27 @@ index 0000000000..a357388115
2789+ Elf_Internal_Sym *isym; 2992+ Elf_Internal_Sym *isym;
2790+ void *vpp; 2993+ void *vpp;
2791+ 2994+
2792+ isym = bfd_sym_from_r_symndx (&htab->sym_sec, 2995+ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
2793+ abfd, r_symndx); 2996+ abfd, r_symndx);
2794+ if (isym == NULL) 2997+ if (isym == NULL)
2795+ return FALSE; 2998+ return false;
2796+ 2999+
2797+ s = bfd_section_from_elf_index (abfd, isym->st_shndx); 3000+ s = bfd_section_from_elf_index (abfd, isym->st_shndx);
2798+ if (s == NULL) 3001+ if (s == NULL)
2799+ return FALSE; 3002+ return false;
2800+ 3003+
2801+ vpp = &elf_section_data (s)->local_dynrel; 3004+ vpp = &elf_section_data (s)->local_dynrel;
2802+ head = (struct elf64_mb_dyn_relocs **) vpp; 3005+ head = (struct elf_dyn_relocs **) vpp;
2803+ } 3006+ }
2804+ 3007+
2805+ p = *head; 3008+ p = *head;
2806+ if (p == NULL || p->sec != sec) 3009+ if (p == NULL || p->sec != sec)
2807+ { 3010+ {
2808+ size_t amt = sizeof *p; 3011+ size_t amt = sizeof *p;
2809+ p = ((struct elf64_mb_dyn_relocs *) 3012+ p = ((struct elf_dyn_relocs *)
2810+ bfd_alloc (htab->elf.dynobj, amt)); 3013+ bfd_alloc (htab->elf.dynobj, amt));
2811+ if (p == NULL) 3014+ if (p == NULL)
2812+ return FALSE; 3015+ return false;
2813+ p->next = *head; 3016+ p->next = *head;
2814+ *head = p; 3017+ *head = p;
2815+ p->sec = sec; 3018+ p->sec = sec;
@@ -2826,35 +3029,7 @@ index 0000000000..a357388115
2826+ } 3029+ }
2827+ } 3030+ }
2828+ 3031+
2829+ return TRUE; 3032+ return true;
2830+}
2831+
2832+static bfd_boolean
2833+microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
2834+{
2835+ struct elf64_mb_link_hash_table *htab;
2836+
2837+ htab = elf64_mb_hash_table (info);
2838+ if (htab == NULL)
2839+ return FALSE;
2840+
2841+ if (!htab->sgot && !create_got_section (dynobj, info))
2842+ return FALSE;
2843+
2844+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
2845+ return FALSE;
2846+
2847+ htab->splt = bfd_get_linker_section (dynobj, ".plt");
2848+ htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
2849+ htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
2850+ if (!bfd_link_pic (info))
2851+ htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
2852+
2853+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
2854+ || (!bfd_link_pic (info) && !htab->srelbss))
2855+ abort ();
2856+
2857+ return TRUE;
2858+} 3033+}
2859+ 3034+
2860+/* Copy the extra info we tack onto an elf_link_hash_entry. */ 3035+/* Copy the extra info we tack onto an elf_link_hash_entry. */
@@ -2869,46 +3044,12 @@ index 0000000000..a357388115
2869+ edir = (struct elf64_mb_link_hash_entry *) dir; 3044+ edir = (struct elf64_mb_link_hash_entry *) dir;
2870+ eind = (struct elf64_mb_link_hash_entry *) ind; 3045+ eind = (struct elf64_mb_link_hash_entry *) ind;
2871+ 3046+
2872+ if (eind->dyn_relocs != NULL)
2873+ {
2874+ if (edir->dyn_relocs != NULL)
2875+ {
2876+ struct elf64_mb_dyn_relocs **pp;
2877+ struct elf64_mb_dyn_relocs *p;
2878+
2879+ if (ind->root.type == bfd_link_hash_indirect)
2880+ abort ();
2881+
2882+ /* Add reloc counts against the weak sym to the strong sym
2883+ list. Merge any entries against the same section. */
2884+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
2885+ {
2886+ struct elf64_mb_dyn_relocs *q;
2887+
2888+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
2889+ if (q->sec == p->sec)
2890+ {
2891+ q->pc_count += p->pc_count;
2892+ q->count += p->count;
2893+ *pp = p->next;
2894+ break;
2895+ }
2896+ if (q == NULL)
2897+ pp = &p->next;
2898+ }
2899+ *pp = edir->dyn_relocs;
2900+ }
2901+
2902+ edir->dyn_relocs = eind->dyn_relocs;
2903+ eind->dyn_relocs = NULL;
2904+ }
2905+
2906+ edir->tls_mask |= eind->tls_mask; 3047+ edir->tls_mask |= eind->tls_mask;
2907+ 3048+
2908+ _bfd_elf_link_hash_copy_indirect (info, dir, ind); 3049+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
2909+} 3050+}
2910+ 3051+
2911+static bfd_boolean 3052+static bool
2912+microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info, 3053+microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
2913+ struct elf_link_hash_entry *h) 3054+ struct elf_link_hash_entry *h)
2914+{ 3055+{
@@ -2922,7 +3063,7 @@ index 0000000000..a357388115
2922+ 3063+
2923+ htab = elf64_mb_hash_table (info); 3064+ htab = elf64_mb_hash_table (info);
2924+ if (htab == NULL) 3065+ if (htab == NULL)
2925+ return FALSE; 3066+ return false;
2926+ 3067+
2927+ /* If this is a function, put it in the procedure linkage table. We 3068+ /* If this is a function, put it in the procedure linkage table. We
2928+ will fill in the contents of the procedure linkage table later, 3069+ will fill in the contents of the procedure linkage table later,
@@ -2944,7 +3085,7 @@ index 0000000000..a357388115
2944+ h->needs_plt = 0; 3085+ h->needs_plt = 0;
2945+ } 3086+ }
2946+ 3087+
2947+ return TRUE; 3088+ return true;
2948+ } 3089+ }
2949+ else 3090+ else
2950+ /* It's possible that we incorrectly decided a .plt reloc was 3091+ /* It's possible that we incorrectly decided a .plt reloc was
@@ -2963,7 +3104,7 @@ index 0000000000..a357388115
2963+ BFD_ASSERT (def->root.type == bfd_link_hash_defined); 3104+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
2964+ h->root.u.def.section = def->root.u.def.section; 3105+ h->root.u.def.section = def->root.u.def.section;
2965+ h->root.u.def.value = def->root.u.def.value; 3106+ h->root.u.def.value = def->root.u.def.value;
2966+ return TRUE; 3107+ return true;
2967+ } 3108+ }
2968+ 3109+
2969+ /* This is a reference to a symbol defined by a dynamic object which 3110+ /* This is a reference to a symbol defined by a dynamic object which
@@ -2974,34 +3115,26 @@ index 0000000000..a357388115
2974+ For such cases we need not do anything here; the relocations will 3115+ For such cases we need not do anything here; the relocations will
2975+ be handled correctly by relocate_section. */ 3116+ be handled correctly by relocate_section. */
2976+ if (bfd_link_pic (info)) 3117+ if (bfd_link_pic (info))
2977+ return TRUE; 3118+ return true;
2978+ 3119+
2979+ /* If there are no references to this symbol that do not use the 3120+ /* If there are no references to this symbol that do not use the
2980+ GOT, we don't need to generate a copy reloc. */ 3121+ GOT, we don't need to generate a copy reloc. */
2981+ if (!h->non_got_ref) 3122+ if (!h->non_got_ref)
2982+ return TRUE; 3123+ return true;
2983+ 3124+
2984+ /* If -z nocopyreloc was given, we won't generate them either. */ 3125+ /* If -z nocopyreloc was given, we won't generate them either. */
2985+ if (info->nocopyreloc) 3126+ if (info->nocopyreloc)
2986+ { 3127+ {
2987+ h->non_got_ref = 0; 3128+ h->non_got_ref = 0;
2988+ return TRUE; 3129+ return true;
2989+ }
2990+
2991+ eh = (struct elf64_mb_link_hash_entry *) h;
2992+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
2993+ {
2994+ s = p->sec->output_section;
2995+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
2996+ break;
2997+ } 3130+ }
2998+ 3131+
2999+ /* If we didn't find any dynamic relocs in read-only sections, then 3132+ /* If we don't find any dynamic relocs in read-only sections, then
3000+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ 3133+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
3001+ if (!_bfd_elf_readonly_dynrelocs (h)) 3134+ if (!_bfd_elf_readonly_dynrelocs (h))
3002+ { 3135+ {
3003+ h->non_got_ref = 0; 3136+ h->non_got_ref = 0;
3004+ return TRUE; 3137+ return true;
3005+ } 3138+ }
3006+ 3139+
3007+ /* We must allocate the symbol in our .dynbss section, which will 3140+ /* We must allocate the symbol in our .dynbss section, which will
@@ -3044,7 +3177,7 @@ index 0000000000..a357388115
3044+ if (power_of_two > s->alignment_power) 3177+ if (power_of_two > s->alignment_power)
3045+ { 3178+ {
3046+ if (!bfd_set_section_alignment (s, power_of_two)) 3179+ if (!bfd_set_section_alignment (s, power_of_two))
3047+ return FALSE; 3180+ return false;
3048+ } 3181+ }
3049+ 3182+
3050+ /* Define the symbol as being at this point in the section. */ 3183+ /* Define the symbol as being at this point in the section. */
@@ -3053,27 +3186,27 @@ index 0000000000..a357388115
3053+ 3186+
3054+ /* Increment the section size to make room for the symbol. */ 3187+ /* Increment the section size to make room for the symbol. */
3055+ s->size += h->size; 3188+ s->size += h->size;
3056+ return TRUE; 3189+ return true;
3057+} 3190+}
3058+ 3191+
3059+/* Allocate space in .plt, .got and associated reloc sections for 3192+/* Allocate space in .plt, .got and associated reloc sections for
3060+ dynamic relocs. */ 3193+ dynamic relocs. */
3061+ 3194+
3062+static bfd_boolean 3195+static bool
3063+allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) 3196+allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
3064+{ 3197+{
3065+ struct bfd_link_info *info; 3198+ struct bfd_link_info *info;
3066+ struct elf64_mb_link_hash_table *htab; 3199+ struct elf64_mb_link_hash_table *htab;
3067+ struct elf64_mb_link_hash_entry *eh; 3200+ struct elf64_mb_link_hash_entry *eh;
3068+ struct elf64_mb_dyn_relocs *p; 3201+ struct elf_dyn_relocs *p;
3069+ 3202+
3070+ if (h->root.type == bfd_link_hash_indirect) 3203+ if (h->root.type == bfd_link_hash_indirect)
3071+ return TRUE; 3204+ return true;
3072+ 3205+
3073+ info = (struct bfd_link_info *) dat; 3206+ info = (struct bfd_link_info *) dat;
3074+ htab = elf64_mb_hash_table (info); 3207+ htab = elf64_mb_hash_table (info);
3075+ if (htab == NULL) 3208+ if (htab == NULL)
3076+ return FALSE; 3209+ return false;
3077+ 3210+
3078+ if (htab->elf.dynamic_sections_created 3211+ if (htab->elf.dynamic_sections_created
3079+ && h->plt.refcount > 0) 3212+ && h->plt.refcount > 0)
@@ -3084,12 +3217,12 @@ index 0000000000..a357388115
3084+ && !h->forced_local) 3217+ && !h->forced_local)
3085+ { 3218+ {
3086+ if (! bfd_elf_link_record_dynamic_symbol (info, h)) 3219+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3087+ return FALSE; 3220+ return false;
3088+ } 3221+ }
3089+ 3222+
3090+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)) 3223+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
3091+ { 3224+ {
3092+ asection *s = htab->splt; 3225+ asection *s = htab->elf.splt;
3093+ 3226+
3094+ /* The first entry in .plt is reserved. */ 3227+ /* The first entry in .plt is reserved. */
3095+ if (s->size == 0) 3228+ if (s->size == 0)
@@ -3143,7 +3276,7 @@ index 0000000000..a357388115
3143+ && !h->forced_local) 3276+ && !h->forced_local)
3144+ { 3277+ {
3145+ if (! bfd_elf_link_record_dynamic_symbol (info, h)) 3278+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3146+ return FALSE; 3279+ return false;
3147+ } 3280+ }
3148+ 3281+
3149+ need = 0; 3282+ need = 0;
@@ -3184,7 +3317,7 @@ index 0000000000..a357388115
3184+ h->got.offset = (bfd_vma) -1; 3317+ h->got.offset = (bfd_vma) -1;
3185+ 3318+
3186+ if (h->dyn_relocs == NULL) 3319+ if (h->dyn_relocs == NULL)
3187+ return TRUE; 3320+ return true;
3188+ 3321+
3189+ /* In the shared -Bsymbolic case, discard space allocated for 3322+ /* In the shared -Bsymbolic case, discard space allocated for
3190+ dynamic pc-relative relocs against symbols which turn out to be 3323+ dynamic pc-relative relocs against symbols which turn out to be
@@ -3198,7 +3331,7 @@ index 0000000000..a357388115
3198+ && (h->forced_local 3331+ && (h->forced_local
3199+ || info->symbolic)) 3332+ || info->symbolic))
3200+ { 3333+ {
3201+ struct elf64_mb_dyn_relocs **pp; 3334+ struct elf_dyn_relocs **pp;
3202+ 3335+
3203+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) 3336+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
3204+ { 3337+ {
@@ -3232,7 +3365,7 @@ index 0000000000..a357388115
3232+ && !h->forced_local) 3365+ && !h->forced_local)
3233+ { 3366+ {
3234+ if (! bfd_elf_link_record_dynamic_symbol (info, h)) 3367+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3235+ return FALSE; 3368+ return false;
3236+ } 3369+ }
3237+ 3370+
3238+ /* If that succeeded, we know we'll be keeping all the 3371+ /* If that succeeded, we know we'll be keeping all the
@@ -3253,12 +3386,12 @@ index 0000000000..a357388115
3253+ sreloc->size += p->count * sizeof (Elf64_External_Rela); 3386+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
3254+ } 3387+ }
3255+ 3388+
3256+ return TRUE; 3389+ return true;
3257+} 3390+}
3258+ 3391+
3259+/* Set the sizes of the dynamic sections. */ 3392+/* Set the sizes of the dynamic sections. */
3260+ 3393+
3261+static bfd_boolean 3394+static bool
3262+microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, 3395+microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
3263+ struct bfd_link_info *info) 3396+ struct bfd_link_info *info)
3264+{ 3397+{
@@ -3269,7 +3402,7 @@ index 0000000000..a357388115
3269+ 3402+
3270+ htab = elf64_mb_hash_table (info); 3403+ htab = elf64_mb_hash_table (info);
3271+ if (htab == NULL) 3404+ if (htab == NULL)
3272+ return FALSE; 3405+ return false;
3273+ 3406+
3274+ dynobj = htab->elf.dynobj; 3407+ dynobj = htab->elf.dynobj;
3275+ BFD_ASSERT (dynobj != NULL); 3408+ BFD_ASSERT (dynobj != NULL);
@@ -3290,9 +3423,9 @@ index 0000000000..a357388115
3290+ 3423+
3291+ for (s = ibfd->sections; s != NULL; s = s->next) 3424+ for (s = ibfd->sections; s != NULL; s = s->next)
3292+ { 3425+ {
3293+ struct elf64_mb_dyn_relocs *p; 3426+ struct elf_dyn_relocs *p;
3294+ 3427+
3295+ for (p = ((struct elf64_mb_dyn_relocs *) 3428+ for (p = ((struct elf_dyn_relocs *)
3296+ elf_section_data (s)->local_dynrel); 3429+ elf_section_data (s)->local_dynrel);
3297+ p != NULL; 3430+ p != NULL;
3298+ p = p->next) 3431+ p = p->next)
@@ -3385,7 +3518,7 @@ index 0000000000..a357388115
3385+ for (s = dynobj->sections; s != NULL; s = s->next) 3518+ for (s = dynobj->sections; s != NULL; s = s->next)
3386+ { 3519+ {
3387+ const char *name; 3520+ const char *name;
3388+ bfd_boolean strip = FALSE; 3521+ bool strip = false;
3389+ 3522+
3390+ if ((s->flags & SEC_LINKER_CREATED) == 0) 3523+ if ((s->flags & SEC_LINKER_CREATED) == 0)
3391+ continue; 3524+ continue;
@@ -3394,7 +3527,7 @@ index 0000000000..a357388115
3394+ of the dynobj section names depend upon the input files. */ 3527+ of the dynobj section names depend upon the input files. */
3395+ name = bfd_section_name (s); 3528+ name = bfd_section_name (s);
3396+ 3529+
3397+ if (strncmp (name, ".rela", 5) == 0) 3530+ if (startswith (name, ".rela"))
3398+ { 3531+ {
3399+ if (s->size == 0) 3532+ if (s->size == 0)
3400+ { 3533+ {
@@ -3407,7 +3540,7 @@ index 0000000000..a357388115
3407+ adjust_dynamic_symbol is called, and it is that 3540+ adjust_dynamic_symbol is called, and it is that
3408+ function which decides whether anything needs to go 3541+ function which decides whether anything needs to go
3409+ into these sections. */ 3542+ into these sections. */
3410+ strip = TRUE; 3543+ strip = true;
3411+ } 3544+ }
3412+ else 3545+ else
3413+ { 3546+ {
@@ -3427,67 +3560,31 @@ index 0000000000..a357388115
3427+ } 3560+ }
3428+ 3561+
3429+ if (strip) 3562+ if (strip)
3430+ { 3563+ {
3431+ s->flags |= SEC_EXCLUDE; 3564+ s->flags |= SEC_EXCLUDE;
3432+ continue; 3565+ continue;
3433+ } 3566+ }
3434+ 3567+
3435+ /* Allocate memory for the section contents. */ 3568+ /* Allocate memory for the section contents. */
3436+ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. 3569+ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
3437+ Unused entries should be reclaimed before the section's contents 3570+ Unused entries should be reclaimed before the section's contents
3438+ are written out, but at the moment this does not happen. Thus in 3571+ are written out, but at the moment this does not happen. Thus in
3439+ order to prevent writing out garbage, we initialise the section's 3572+ order to prevent writing out garbage, we initialise the section's
3440+ contents to zero. */ 3573+ contents to zero. */
3441+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); 3574+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
3442+ if (s->contents == NULL && s->size != 0) 3575+ if (s->contents == NULL && s->size != 0)
3443+ return FALSE; 3576+ return false;
3444+ } 3577+ }
3445+ 3578+
3446+ if (elf_hash_table (info)->dynamic_sections_created) 3579+ /* ??? Force DF_BIND_NOW? */
3447+ { 3580+ info->flags |= DF_BIND_NOW;
3448+ /* Add some entries to the .dynamic section. We fill in the 3581+ return _bfd_elf_add_dynamic_tags (output_bfd, info, true);
3449+ values later, in microblaze_elf_finish_dynamic_sections, but we
3450+ must add the entries now so that we get the correct size for
3451+ the .dynamic section. The DT_DEBUG entry is filled in by the
3452+ dynamic linker and used by the debugger. */
3453+#define add_dynamic_entry(TAG, VAL) \
3454+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
3455+
3456+ if (bfd_link_executable (info))
3457+ {
3458+ if (!add_dynamic_entry (DT_DEBUG, 0))
3459+ return FALSE;
3460+ }
3461+
3462+ if (!add_dynamic_entry (DT_RELA, 0)
3463+ || !add_dynamic_entry (DT_RELASZ, 0)
3464+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
3465+ return FALSE;
3466+
3467+ if (htab->splt->size != 0)
3468+ {
3469+ if (!add_dynamic_entry (DT_PLTGOT, 0)
3470+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
3471+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
3472+ || !add_dynamic_entry (DT_JMPREL, 0)
3473+ || !add_dynamic_entry (DT_BIND_NOW, 1))
3474+ return FALSE;
3475+ }
3476+
3477+ if (info->flags & DF_TEXTREL)
3478+ {
3479+ if (!add_dynamic_entry (DT_TEXTREL, 0))
3480+ return FALSE;
3481+ }
3482+ }
3483+#undef add_dynamic_entry
3484+ return TRUE;
3485+} 3582+}
3486+ 3583+
3487+/* Finish up dynamic symbol handling. We set the contents of various 3584+/* Finish up dynamic symbol handling. We set the contents of various
3488+ dynamic sections here. */ 3585+ dynamic sections here. */
3489+ 3586+
3490+static bfd_boolean 3587+static bool
3491+microblaze_elf_finish_dynamic_symbol (bfd *output_bfd, 3588+microblaze_elf_finish_dynamic_symbol (bfd *output_bfd,
3492+ struct bfd_link_info *info, 3589+ struct bfd_link_info *info,
3493+ struct elf_link_hash_entry *h, 3590+ struct elf_link_hash_entry *h,
@@ -3498,7 +3595,7 @@ index 0000000000..a357388115
3498+ 3595+
3499+ htab = elf64_mb_hash_table (info); 3596+ htab = elf64_mb_hash_table (info);
3500+ if (htab == NULL) 3597+ if (htab == NULL)
3501+ return FALSE; 3598+ return false;
3502+ 3599+
3503+ if (h->plt.offset != (bfd_vma) -1) 3600+ if (h->plt.offset != (bfd_vma) -1)
3504+ { 3601+ {
@@ -3515,9 +3612,9 @@ index 0000000000..a357388115
3515+ it up. */ 3612+ it up. */
3516+ BFD_ASSERT (h->dynindx != -1); 3613+ BFD_ASSERT (h->dynindx != -1);
3517+ 3614+
3518+ splt = htab->splt; 3615+ splt = htab->elf.splt;
3519+ srela = htab->srelplt; 3616+ srela = htab->elf.srelplt;
3520+ sgotplt = htab->sgotplt; 3617+ sgotplt = htab->elf.sgotplt;
3521+ BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL); 3618+ BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL);
3522+ 3619+
3523+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */ 3620+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */
@@ -3593,16 +3690,23 @@ index 0000000000..a357388115
3593+ if (bfd_link_pic (info) 3690+ if (bfd_link_pic (info)
3594+ && ((info->symbolic && h->def_regular) 3691+ && ((info->symbolic && h->def_regular)
3595+ || h->dynindx == -1)) 3692+ || h->dynindx == -1))
3596+ { 3693+ {
3597+ asection *sec = h->root.u.def.section; 3694+ asection *sec = h->root.u.def.section;
3598+ microblaze_elf_output_dynamic_relocation (output_bfd, 3695+ bfd_vma value;
3599+ srela, srela->reloc_count++, 3696+
3600+ /* symindex= */ 0, 3697+ value = h->root.u.def.value;
3601+ R_MICROBLAZE_REL, offset, 3698+ if (sec->output_section != NULL)
3602+ h->root.u.def.value 3699+ /* PR 21180: If the output section is NULL, then the symbol is no
3603+ + sec->output_section->vma 3700+ longer needed, and in theory the GOT entry is redundant. But
3604+ + sec->output_offset); 3701+ it is too late to change our minds now... */
3605+ } 3702+ value += sec->output_section->vma + sec->output_offset;
3703+
3704+ microblaze_elf_output_dynamic_relocation (output_bfd,
3705+ srela, srela->reloc_count++,
3706+ /* symindex= */ 0,
3707+ R_MICROBLAZE_REL, offset,
3708+ value);
3709+ }
3606+ else 3710+ else
3607+ { 3711+ {
3608+ microblaze_elf_output_dynamic_relocation (output_bfd, 3712+ microblaze_elf_output_dynamic_relocation (output_bfd,
@@ -3626,16 +3730,17 @@ index 0000000000..a357388115
3626+ 3730+
3627+ BFD_ASSERT (h->dynindx != -1); 3731+ BFD_ASSERT (h->dynindx != -1);
3628+ 3732+
3629+ s = bfd_get_linker_section (htab->elf.dynobj, ".rela.bss");
3630+ BFD_ASSERT (s != NULL);
3631+
3632+ rela.r_offset = (h->root.u.def.value 3733+ rela.r_offset = (h->root.u.def.value
3633+ + h->root.u.def.section->output_section->vma 3734+ + h->root.u.def.section->output_section->vma
3634+ + h->root.u.def.section->output_offset); 3735+ + h->root.u.def.section->output_offset);
3635+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_COPY); 3736+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_COPY);
3636+ rela.r_addend = 0; 3737+ rela.r_addend = 0;
3637+ loc = s->contents + s->reloc_count++ * sizeof (Elf64_External_Rela); 3738+ if (h->root.u.def.section == htab->elf.sdynrelro)
3638+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); 3739+ s = htab->elf.sreldynrelro;
3740+ else
3741+ s = htab->elf.srelbss;
3742+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
3743+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
3639+ } 3744+ }
3640+ 3745+
3641+ /* Mark some specially defined symbols as absolute. */ 3746+ /* Mark some specially defined symbols as absolute. */
@@ -3644,13 +3749,13 @@ index 0000000000..a357388115
3644+ || h == htab->elf.hplt) 3749+ || h == htab->elf.hplt)
3645+ sym->st_shndx = SHN_ABS; 3750+ sym->st_shndx = SHN_ABS;
3646+ 3751+
3647+ return TRUE; 3752+ return true;
3648+} 3753+}
3649+ 3754+
3650+ 3755+
3651+/* Finish up the dynamic sections. */ 3756+/* Finish up the dynamic sections. */
3652+ 3757+
3653+static bfd_boolean 3758+static bool
3654+microblaze_elf_finish_dynamic_sections (bfd *output_bfd, 3759+microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
3655+ struct bfd_link_info *info) 3760+ struct bfd_link_info *info)
3656+{ 3761+{
@@ -3660,7 +3765,7 @@ index 0000000000..a357388115
3660+ 3765+
3661+ htab = elf64_mb_hash_table (info); 3766+ htab = elf64_mb_hash_table (info);
3662+ if (htab == NULL) 3767+ if (htab == NULL)
3663+ return FALSE; 3768+ return false;
3664+ 3769+
3665+ dynobj = htab->elf.dynobj; 3770+ dynobj = htab->elf.dynobj;
3666+ 3771+
@@ -3671,57 +3776,63 @@ index 0000000000..a357388115
3671+ asection *splt; 3776+ asection *splt;
3672+ Elf64_External_Dyn *dyncon, *dynconend; 3777+ Elf64_External_Dyn *dyncon, *dynconend;
3673+ 3778+
3674+ splt = bfd_get_linker_section (dynobj, ".plt"); 3779+ dyncon = (Elf32_External_Dyn *) sdyn->contents;
3675+ BFD_ASSERT (splt != NULL && sdyn != NULL); 3780+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
3676+
3677+ dyncon = (Elf64_External_Dyn *) sdyn->contents;
3678+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
3679+ for (; dyncon < dynconend; dyncon++) 3781+ for (; dyncon < dynconend; dyncon++)
3680+ { 3782+ {
3681+ Elf_Internal_Dyn dyn; 3783+ Elf_Internal_Dyn dyn;
3682+ const char *name; 3784+ asection *s;
3683+ bfd_boolean size; 3785+ bool size;
3684+ 3786+
3685+ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); 3787+ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
3686+ 3788+
3687+ switch (dyn.d_tag) 3789+ switch (dyn.d_tag)
3688+ { 3790+ {
3689+ case DT_PLTGOT: name = ".got.plt"; size = FALSE; break; 3791+ case DT_PLTGOT:
3690+ case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; 3792+ s = htab->elf.sgotplt;
3691+ case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; 3793+ size = false;
3692+ case DT_RELA: name = ".rela.dyn"; size = FALSE; break; 3794+ break;
3693+ case DT_RELASZ: name = ".rela.dyn"; size = TRUE; break;
3694+ default: name = NULL; size = FALSE; break;
3695+ }
3696+ 3795+
3697+ if (name != NULL) 3796+ case DT_PLTRELSZ:
3698+ { 3797+ s = htab->elf.srelplt;
3699+ asection *s; 3798+ size = true;
3799+ break;
3700+ 3800+
3701+ s = bfd_get_section_by_name (output_bfd, name); 3801+ case DT_JMPREL:
3702+ if (s == NULL) 3802+ s = htab->elf.srelplt;
3703+ dyn.d_un.d_val = 0; 3803+ size = false;
3704+ else 3804+ break;
3705+ { 3805+
3706+ if (! size) 3806+ default:
3707+ dyn.d_un.d_ptr = s->vma; 3807+ continue;
3708+ else 3808+ }
3709+ dyn.d_un.d_val = s->size; 3809+
3710+ } 3810+ if (s == NULL)
3711+ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); 3811+ dyn.d_un.d_val = 0;
3712+ } 3812+ else
3713+ } 3813+ {
3814+ if (!size)
3815+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
3816+ else
3817+ dyn.d_un.d_val = s->size;
3818+ }
3819+ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
3820+ }
3821+
3822+ splt = htab->elf.splt;
3823+ BFD_ASSERT (splt != NULL && sdyn != NULL);
3714+ 3824+
3715+ /* Clear the first entry in the procedure linkage table, 3825+ /* Clear the first entry in the procedure linkage table,
3716+ and put a nop in the last four bytes. */ 3826+ and put a nop in the last four bytes. */
3717+ if (splt->size > 0) 3827+ if (splt->size > 0)
3718+ { 3828+ {
3719+ memset (splt->contents, 0, PLT_ENTRY_SIZE); 3829+ memset (splt->contents, 0, PLT_ENTRY_SIZE);
3720+ bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */, 3830+ bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */,
3721+ splt->contents + splt->size - 4); 3831+ splt->contents + splt->size - 4);
3722+ }
3723+ 3832+
3724+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; 3833+ if (splt->output_section != bfd_abs_section_ptr)
3834+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
3835+ }
3725+ } 3836+ }
3726+ 3837+
3727+ /* Set the first entry in the global offset table to the address of 3838+ /* Set the first entry in the global offset table to the address of
@@ -3741,13 +3852,13 @@ index 0000000000..a357388115
3741+ if (htab->elf.sgot && htab->elf.sgot->size > 0) 3852+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
3742+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4; 3853+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
3743+ 3854+
3744+ return TRUE; 3855+ return true;
3745+} 3856+}
3746+ 3857+
3747+/* Hook called by the linker routine which adds symbols from an object 3858+/* Hook called by the linker routine which adds symbols from an object
3748+ file. We use it to put .comm items in .sbss, and not .bss. */ 3859+ file. We use it to put .comm items in .sbss, and not .bss. */
3749+ 3860+
3750+static bfd_boolean 3861+static bool
3751+microblaze_elf_add_symbol_hook (bfd *abfd, 3862+microblaze_elf_add_symbol_hook (bfd *abfd,
3752+ struct bfd_link_info *info, 3863+ struct bfd_link_info *info,
3753+ Elf_Internal_Sym *sym, 3864+ Elf_Internal_Sym *sym,
@@ -3764,13 +3875,13 @@ index 0000000000..a357388115
3764+ put into .sbss. */ 3875+ put into .sbss. */
3765+ *secp = bfd_make_section_old_way (abfd, ".sbss"); 3876+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3766+ if (*secp == NULL 3877+ if (*secp == NULL
3767+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON)) 3878+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON | SEC_SMALL_DATA))
3768+ return FALSE; 3879+ return false;
3769+ 3880+
3770+ *valp = sym->st_size; 3881+ *valp = sym->st_size;
3771+ } 3882+ }
3772+ 3883+
3773+ return TRUE; 3884+ return true;
3774+} 3885+}
3775+ 3886+
3776+#define TARGET_LITTLE_SYM microblaze_elf64_le_vec 3887+#define TARGET_LITTLE_SYM microblaze_elf64_le_vec
@@ -3791,34 +3902,78 @@ index 0000000000..a357388115
3791+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name 3902+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3792+#define elf_backend_relocate_section microblaze_elf_relocate_section 3903+#define elf_backend_relocate_section microblaze_elf_relocate_section
3793+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section 3904+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3794+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data 3905+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
3795+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup 3906+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3796+ 3907+
3797+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook 3908+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3798+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook 3909+#define elf_backend_check_relocs microblaze_elf_check_relocs
3799+#define elf_backend_check_relocs microblaze_elf_check_relocs 3910+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3800+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol 3911+#define bfd_elf32_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
3802+#define elf_backend_can_gc_sections 1 3912+#define elf_backend_can_gc_sections 1
3803+#define elf_backend_can_refcount 1 3913+#define elf_backend_can_refcount 1
3804+#define elf_backend_want_got_plt 1 3914+#define elf_backend_want_got_plt 1
3805+#define elf_backend_plt_readonly 1 3915+#define elf_backend_plt_readonly 1
3806+#define elf_backend_got_header_size 12 3916+#define elf_backend_got_header_size 12
3807+#define elf_backend_rela_normal 1 3917+#define elf_backend_want_dynrelro 1
3808+ 3918+#define elf_backend_rela_normal 1
3809+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol 3919+#define elf_backend_dtrel_excludes_plt 1
3810+#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections 3920+
3811+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections 3921+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
3812+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol 3922+#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
3813+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 3923+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
3924+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
3925+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
3814+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 3926+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
3815+ 3927+
3816+#include "elf64-target.h" 3928+#include "elf64-target.h"
3929diff --git a/bfd/libbfd.h b/bfd/libbfd.h
3930index 4153b94564d..2caaf27bcd7 100644
3931--- a/bfd/libbfd.h
3932+++ b/bfd/libbfd.h
3933@@ -2990,7 +2990,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
3934 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
3935 "BFD_RELOC_MICROBLAZE_32_NONE",
3936 "BFD_RELOC_MICROBLAZE_64_NONE",
3937+ "BFD_RELOC_MICROBLAZE_64",
3938 "BFD_RELOC_MICROBLAZE_64_GOTPC",
3939+ "BFD_RELOC_MICROBLAZE_64_GPC",
3940 "BFD_RELOC_MICROBLAZE_64_GOT",
3941 "BFD_RELOC_MICROBLAZE_64_PLT",
3942 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
3943diff --git a/bfd/reloc.c b/bfd/reloc.c
3944index 3a08f7a8a42..288a5026d27 100644
3945--- a/bfd/reloc.c
3946+++ b/bfd/reloc.c
3947@@ -6904,12 +6904,24 @@ ENUMDOC
3948 done here - only used for relaxing
3949 ENUM
3950 BFD_RELOC_MICROBLAZE_64_NONE
3951+ENUMDOC
3952+ This is a 32 bit reloc that stores the 32 bit pc relative
3953+ value in two words (with an imml instruction). No relocation is
3954+ done here - only used for relaxing
3955+ENUM
3956+ BFD_RELOC_MICROBLAZE_64
3957 ENUMDOC
3958 This is a 64 bit reloc that stores the 32 bit pc relative
3959 value in two words (with an imm instruction). No relocation is
3960 done here - only used for relaxing
3961 ENUM
3962 BFD_RELOC_MICROBLAZE_64_GOTPC
3963+ENUMDOC
3964+ This is a 64 bit reloc that stores the 32 bit pc relative
3965+ value in two words (with an imml instruction). No relocation is
3966+ done here - only used for relaxing
3967+ENUM
3968+ BFD_RELOC_MICROBLAZE_64_GPC
3969 ENUMDOC
3970 This is a 64 bit reloc that stores the 32 bit pc relative
3971 value in two words (with an imm instruction). The relocation is
3817diff --git a/bfd/targets.c b/bfd/targets.c 3972diff --git a/bfd/targets.c b/bfd/targets.c
3818index 0732c5e429..1ec226b2f4 100644 3973index 89b49e721b4..22543016ffb 100644
3819--- a/bfd/targets.c 3974--- a/bfd/targets.c
3820+++ b/bfd/targets.c 3975+++ b/bfd/targets.c
3821@@ -782,6 +782,8 @@ extern const bfd_target mep_elf32_le_vec; 3976@@ -791,6 +791,8 @@ extern const bfd_target mep_elf32_le_vec;
3822 extern const bfd_target metag_elf32_vec; 3977 extern const bfd_target metag_elf32_vec;
3823 extern const bfd_target microblaze_elf32_vec; 3978 extern const bfd_target microblaze_elf32_vec;
3824 extern const bfd_target microblaze_elf32_le_vec; 3979 extern const bfd_target microblaze_elf32_le_vec;
@@ -3827,7 +3982,7 @@ index 0732c5e429..1ec226b2f4 100644
3827 extern const bfd_target mips_ecoff_be_vec; 3982 extern const bfd_target mips_ecoff_be_vec;
3828 extern const bfd_target mips_ecoff_le_vec; 3983 extern const bfd_target mips_ecoff_le_vec;
3829 extern const bfd_target mips_ecoff_bele_vec; 3984 extern const bfd_target mips_ecoff_bele_vec;
3830@@ -1150,6 +1152,10 @@ static const bfd_target * const _bfd_target_vector[] = 3985@@ -1156,6 +1158,10 @@ static const bfd_target * const _bfd_target_vector[] =
3831 3986
3832 &metag_elf32_vec, 3987 &metag_elf32_vec,
3833 3988
@@ -3839,7 +3994,7 @@ index 0732c5e429..1ec226b2f4 100644
3839 3994
3840 &mips_ecoff_be_vec, 3995 &mips_ecoff_be_vec,
3841diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 3996diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
3842index 5810a74a5f..ffbb843d33 100644 3997index 98d0c259246..378fb882f13 100644
3843--- a/gas/config/tc-microblaze.c 3998--- a/gas/config/tc-microblaze.c
3844+++ b/gas/config/tc-microblaze.c 3999+++ b/gas/config/tc-microblaze.c
3845@@ -35,10 +35,13 @@ 4000@@ -35,10 +35,13 @@
@@ -3855,8 +4010,45 @@ index 5810a74a5f..ffbb843d33 100644
3855+#define OPTION_M64 (OPTION_MD_BASE + 4) 4010+#define OPTION_M64 (OPTION_MD_BASE + 4)
3856 4011
3857 void microblaze_generate_symbol (char *sym); 4012 void microblaze_generate_symbol (char *sym);
3858 static bfd_boolean check_spl_reg (unsigned *); 4013 static bool check_spl_reg (unsigned *);
3859@@ -773,6 +776,74 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) 4014@@ -91,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
4015 #define TLSTPREL_OFFSET 16
4016 #define TEXT_OFFSET 17
4017 #define TEXT_PC_OFFSET 18
4018+#define DEFINED_64_OFFSET 19
4019
4020 /* Initialize the relax table. */
4021 const relax_typeS md_relax_table[] =
4022@@ -113,7 +117,9 @@ const relax_typeS md_relax_table[] =
4023 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
4024 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
4025 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
4026- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
4027+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
4028+// { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
4029+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */
4030 };
4031
4032 static htab_t opcode_hash_control; /* Opcode mnemonics. */
4033@@ -393,7 +399,8 @@ const pseudo_typeS md_pseudo_table[] =
4034 {"data32", cons, 4}, /* Same as word. */
4035 {"ent", s_func, 0}, /* Treat ent as function entry point. */
4036 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
4037- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
4038+ {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
4039+ {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
4040 {"weakext", microblaze_s_weakext, 0},
4041 {"rodata", microblaze_s_rdata, 0},
4042 {"sdata2", microblaze_s_rdata, 1},
4043@@ -402,6 +409,7 @@ const pseudo_typeS md_pseudo_table[] =
4044 {"sbss", microblaze_s_bss, 1},
4045 {"text", microblaze_s_text, 0},
4046 {"word", cons, 4},
4047+ {"dword", cons, 8},
4048 {"frame", s_ignore, 0},
4049 {"mask", s_ignore, 0}, /* Emitted by gcc. */
4050 {NULL, NULL, 0}
4051@@ -773,6 +781,74 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
3860 return new_pointer; 4052 return new_pointer;
3861 } 4053 }
3862 4054
@@ -3931,7 +4123,24 @@ index 5810a74a5f..ffbb843d33 100644
3931 static char * 4123 static char *
3932 check_got (int * got_type, int * got_len) 4124 check_got (int * got_type, int * got_len)
3933 { 4125 {
3934@@ -920,6 +991,7 @@ md_assemble (char * str) 4126@@ -827,7 +903,7 @@ check_got (int * got_type, int * got_len)
4127 extern bfd_reloc_code_real_type
4128 parse_cons_expression_microblaze (expressionS *exp, int size)
4129 {
4130- if (size == 4)
4131+ if (size == 4 || (microblaze_arch_size == 64 && size == 8))
4132 {
4133 /* Handle @GOTOFF et.al. */
4134 char *save, *gotfree_copy;
4135@@ -859,6 +935,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
4136
4137 static const char * str_microblaze_ro_anchor = "RO";
4138 static const char * str_microblaze_rw_anchor = "RW";
4139+static const char * str_microblaze_64 = "64";
4140
4141 static bool
4142 check_spl_reg (unsigned * reg)
4143@@ -920,6 +997,7 @@ md_assemble (char * str)
3935 unsigned int immed, immed2, temp; 4144 unsigned int immed, immed2, temp;
3936 expressionS exp; 4145 expressionS exp;
3937 char name[20]; 4146 char name[20];
@@ -3939,7 +4148,41 @@ index 5810a74a5f..ffbb843d33 100644
3939 4148
3940 /* Drop leading whitespace. */ 4149 /* Drop leading whitespace. */
3941 while (ISSPACE (* str)) 4150 while (ISSPACE (* str))
3942@@ -1129,7 +1201,7 @@ md_assemble (char * str) 4151@@ -1106,6 +1184,33 @@ md_assemble (char * str)
4152 inst |= (immed << IMM_LOW) & IMM_MASK;
4153 }
4154 }
4155+#if 0 //revisit
4156+ else if (streq (name, "lli") || streq (name, "sli"))
4157+ {
4158+ temp = immed & 0xFFFFFFFFFFFF8000;
4159+ if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
4160+ {
4161+ /* Needs an immediate inst. */
4162+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4163+ if (opcode1 == NULL)
4164+ {
4165+ as_bad (_("unknown opcode \"%s\""), "imml");
4166+ return;
4167+ }
4168+
4169+ inst1 = opcode1->bit_sequence;
4170+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4171+ output[0] = INST_BYTE0 (inst1);
4172+ output[1] = INST_BYTE1 (inst1);
4173+ output[2] = INST_BYTE2 (inst1);
4174+ output[3] = INST_BYTE3 (inst1);
4175+ output = frag_more (isize);
4176+ }
4177+ inst |= (reg1 << RD_LOW) & RD_MASK;
4178+ inst |= (reg2 << RA_LOW) & RA_MASK;
4179+ inst |= (immed << IMM_LOW) & IMM_MASK;
4180+ }
4181+#endif
4182 else
4183 {
4184 temp = immed & 0xFFFF8000;
4185@@ -1135,7 +1240,7 @@ md_assemble (char * str)
3943 } 4186 }
3944 break; 4187 break;
3945 4188
@@ -3948,7 +4191,7 @@ index 5810a74a5f..ffbb843d33 100644
3948 if (strcmp (op_end, "")) 4191 if (strcmp (op_end, ""))
3949 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */ 4192 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
3950 else 4193 else
3951@@ -1163,16 +1235,22 @@ md_assemble (char * str) 4194@@ -1169,16 +1274,22 @@ md_assemble (char * str)
3952 immed = exp.X_add_number; 4195 immed = exp.X_add_number;
3953 } 4196 }
3954 4197
@@ -3974,7 +4217,7 @@ index 5810a74a5f..ffbb843d33 100644
3974 if (strcmp (op_end, "")) 4217 if (strcmp (op_end, ""))
3975 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */ 4218 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
3976 else 4219 else
3977@@ -1196,7 +1274,7 @@ md_assemble (char * str) 4220@@ -1202,7 +1313,7 @@ md_assemble (char * str)
3978 4221
3979 /* Width immediate value. */ 4222 /* Width immediate value. */
3980 if (strcmp (op_end, "")) 4223 if (strcmp (op_end, ""))
@@ -3983,7 +4226,7 @@ index 5810a74a5f..ffbb843d33 100644
3983 else 4226 else
3984 as_fatal (_("Error in statement syntax")); 4227 as_fatal (_("Error in statement syntax"));
3985 if (exp.X_op != O_constant) 4228 if (exp.X_op != O_constant)
3986@@ -1208,6 +1286,8 @@ md_assemble (char * str) 4229@@ -1214,6 +1325,8 @@ md_assemble (char * str)
3987 immed = exp.X_add_number; 4230 immed = exp.X_add_number;
3988 if (opcode->instr == bsefi && immed > 31) 4231 if (opcode->instr == bsefi && immed > 31)
3989 as_fatal (_("Width value must be less than 32")); 4232 as_fatal (_("Width value must be less than 32"));
@@ -3992,7 +4235,7 @@ index 5810a74a5f..ffbb843d33 100644
3992 4235
3993 /* Shift immediate value. */ 4236 /* Shift immediate value. */
3994 if (strcmp (op_end, "")) 4237 if (strcmp (op_end, ""))
3995@@ -1215,32 +1295,40 @@ md_assemble (char * str) 4238@@ -1221,32 +1334,40 @@ md_assemble (char * str)
3996 else 4239 else
3997 as_fatal (_("Error in statement syntax")); 4240 as_fatal (_("Error in statement syntax"));
3998 if (exp.X_op != O_constant) 4241 if (exp.X_op != O_constant)
@@ -4044,7 +4287,7 @@ index 5810a74a5f..ffbb843d33 100644
4044 break; 4287 break;
4045 case INST_TYPE_R1_R2: 4288 case INST_TYPE_R1_R2:
4046 if (strcmp (op_end, "")) 4289 if (strcmp (op_end, ""))
4047@@ -1808,6 +1896,142 @@ md_assemble (char * str) 4290@@ -1820,6 +1941,143 @@ md_assemble (char * str)
4048 } 4291 }
4049 inst |= (immed << IMM_MBAR); 4292 inst |= (immed << IMM_MBAR);
4050 break; 4293 break;
@@ -4078,6 +4321,7 @@ index 5810a74a5f..ffbb843d33 100644
4078+ if (exp.X_op != O_constant) 4321+ if (exp.X_op != O_constant)
4079+ { 4322+ {
4080+ char *opc = NULL; 4323+ char *opc = NULL;
4324+ //char *opc = str_microblaze_64;
4081+ relax_substateT subtype; 4325+ relax_substateT subtype;
4082+ 4326+
4083+ if (exp.X_md != 0) 4327+ if (exp.X_md != 0)
@@ -4091,7 +4335,7 @@ index 5810a74a5f..ffbb843d33 100644
4091+ subtype, /* PC-relative or not. */ 4335+ subtype, /* PC-relative or not. */
4092+ exp.X_add_symbol, 4336+ exp.X_add_symbol,
4093+ exp.X_add_number, 4337+ exp.X_add_number,
4094+ opc); 4338+ (char *) opc);
4095+ immedl = 0L; 4339+ immedl = 0L;
4096+ } 4340+ }
4097+ else 4341+ else
@@ -4099,7 +4343,7 @@ index 5810a74a5f..ffbb843d33 100644
4099+ output = frag_more (isize); 4343+ output = frag_more (isize);
4100+ immedl = exp.X_add_number; 4344+ immedl = exp.X_add_number;
4101+ 4345+
4102+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 4346+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4103+ if (opcode1 == NULL) 4347+ if (opcode1 == NULL)
4104+ { 4348+ {
4105+ as_bad (_("unknown opcode \"%s\""), "imml"); 4349+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -4129,7 +4373,7 @@ index 5810a74a5f..ffbb843d33 100644
4129+ reg1 = 0; 4373+ reg1 = 0;
4130+ } 4374+ }
4131+ if (strcmp (op_end, "")) 4375+ if (strcmp (op_end, ""))
4132+ op_end = parse_imml (op_end + 1, & exp, MIN_IMM, MAX_IMM); 4376+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
4133+ else 4377+ else
4134+ as_fatal (_("Error in statement syntax")); 4378+ as_fatal (_("Error in statement syntax"));
4135+ 4379+
@@ -4139,7 +4383,8 @@ index 5810a74a5f..ffbb843d33 100644
4139+ 4383+
4140+ if (exp.X_op != O_constant) 4384+ if (exp.X_op != O_constant)
4141+ { 4385+ {
4142+ char *opc = NULL; 4386+ //char *opc = NULL;
4387+ char *opc = str_microblaze_64;
4143+ relax_substateT subtype; 4388+ relax_substateT subtype;
4144+ 4389+
4145+ if (exp.X_md != 0) 4390+ if (exp.X_md != 0)
@@ -4153,15 +4398,14 @@ index 5810a74a5f..ffbb843d33 100644
4153+ subtype, /* PC-relative or not. */ 4398+ subtype, /* PC-relative or not. */
4154+ exp.X_add_symbol, 4399+ exp.X_add_symbol,
4155+ exp.X_add_number, 4400+ exp.X_add_number,
4156+ opc); 4401+ (char *) opc);
4157+ immedl = 0L; 4402+ immedl = 0L;
4158+ } 4403+ }
4159+ else 4404+ else
4160+ { 4405+ {
4161+ output = frag_more (isize); 4406+ output = frag_more (isize);
4162+ immedl = exp.X_add_number; 4407+ immedl = exp.X_add_number;
4163+ 4408+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4164+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
4165+ if (opcode1 == NULL) 4409+ if (opcode1 == NULL)
4166+ { 4410+ {
4167+ as_bad (_("unknown opcode \"%s\""), "imml"); 4411+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -4187,7 +4431,7 @@ index 5810a74a5f..ffbb843d33 100644
4187 4431
4188 default: 4432 default:
4189 as_fatal (_("unimplemented opcode \"%s\""), name); 4433 as_fatal (_("unimplemented opcode \"%s\""), name);
4190@@ -1915,6 +2139,7 @@ struct option md_longopts[] = 4434@@ -1927,6 +2185,7 @@ struct option md_longopts[] =
4191 {"EL", no_argument, NULL, OPTION_EL}, 4435 {"EL", no_argument, NULL, OPTION_EL},
4192 {"mlittle-endian", no_argument, NULL, OPTION_LITTLE}, 4436 {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
4193 {"mbig-endian", no_argument, NULL, OPTION_BIG}, 4437 {"mbig-endian", no_argument, NULL, OPTION_BIG},
@@ -4195,7 +4439,190 @@ index 5810a74a5f..ffbb843d33 100644
4195 { NULL, no_argument, NULL, 0} 4439 { NULL, no_argument, NULL, 0}
4196 }; 4440 };
4197 4441
4198@@ -2565,6 +2790,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 4442@@ -1971,13 +2230,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
4443 fragP->fr_fix += INST_WORD_SIZE * 2;
4444 fragP->fr_var = 0;
4445 break;
4446+ case DEFINED_64_OFFSET:
4447+ if (fragP->fr_symbol == GOT_symbol)
4448+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
4449+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
4450+ else
4451+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
4452+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
4453+ fragP->fr_fix += INST_WORD_SIZE * 2;
4454+ fragP->fr_var = 0;
4455+ break;
4456 case DEFINED_ABS_SEGMENT:
4457 if (fragP->fr_symbol == GOT_symbol)
4458 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
4459 fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
4460 else
4461 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
4462- fragP->fr_offset, false, BFD_RELOC_64);
4463+ fragP->fr_offset, true, BFD_RELOC_64);
4464 fragP->fr_fix += INST_WORD_SIZE * 2;
4465 fragP->fr_var = 0;
4466 break;
4467@@ -2198,23 +2467,38 @@ md_apply_fix (fixS * fixP,
4468 case BFD_RELOC_64_PCREL:
4469 case BFD_RELOC_64:
4470 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
4471+ case BFD_RELOC_MICROBLAZE_64:
4472 /* Add an imm instruction. First save the current instruction. */
4473 for (i = 0; i < INST_WORD_SIZE; i++)
4474 buf[i + INST_WORD_SIZE] = buf[i];
4475+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4476+ {
4477+ /* Generate the imm instruction. */
4478+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4479+ if (opcode1 == NULL)
4480+ {
4481+ as_bad (_("unknown opcode \"%s\""), "imml");
4482+ return;
4483+ }
4484
4485- /* Generate the imm instruction. */
4486- opcode1
4487- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4488- if (opcode1 == NULL)
4489- {
4490- as_bad (_("unknown opcode \"%s\""), "imm");
4491- return;
4492- }
4493-
4494- inst1 = opcode1->bit_sequence;
4495- if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4496- inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
4497-
4498+ inst1 = opcode1->bit_sequence;
4499+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4500+ inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4501+ }
4502+ else
4503+ {
4504+ /* Generate the imm instruction. */
4505+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4506+ if (opcode1 == NULL)
4507+ {
4508+ as_bad (_("unknown opcode \"%s\""), "imm");
4509+ return;
4510+ }
4511+
4512+ inst1 = opcode1->bit_sequence;
4513+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4514+ inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
4515+ }
4516 buf[0] = INST_BYTE0 (inst1);
4517 buf[1] = INST_BYTE1 (inst1);
4518 buf[2] = INST_BYTE2 (inst1);
4519@@ -2243,6 +2527,7 @@ md_apply_fix (fixS * fixP,
4520 /* Fall through. */
4521
4522 case BFD_RELOC_MICROBLAZE_64_GOTPC:
4523+ case BFD_RELOC_MICROBLAZE_64_GPC:
4524 case BFD_RELOC_MICROBLAZE_64_GOT:
4525 case BFD_RELOC_MICROBLAZE_64_PLT:
4526 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
4527@@ -2250,13 +2535,17 @@ md_apply_fix (fixS * fixP,
4528 /* Add an imm instruction. First save the current instruction. */
4529 for (i = 0; i < INST_WORD_SIZE; i++)
4530 buf[i + INST_WORD_SIZE] = buf[i];
4531-
4532 /* Generate the imm instruction. */
4533- opcode1
4534- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4535+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
4536+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4537+ else
4538+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4539 if (opcode1 == NULL)
4540 {
4541- as_bad (_("unknown opcode \"%s\""), "imm");
4542+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
4543+ as_bad (_("unknown opcode \"%s\""), "imml");
4544+ else
4545+ as_bad (_("unknown opcode \"%s\""), "imm");
4546 return;
4547 }
4548
4549@@ -2280,6 +2569,8 @@ md_apply_fix (fixS * fixP,
4550 moves code around due to relaxing. */
4551 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
4552 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
4553+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4554+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
4555 else if (fixP->fx_r_type == BFD_RELOC_32)
4556 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
4557 else
4558@@ -2323,6 +2614,32 @@ md_estimate_size_before_relax (fragS * fragP,
4559 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
4560 abort ();
4561 }
4562+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
4563+ && !S_IS_WEAK (fragP->fr_symbol))
4564+ {
4565+ if (fragP->fr_opcode != NULL) {
4566+ if(streq (fragP->fr_opcode, str_microblaze_64))
4567+ {
4568+ /* Used as an absolute value. */
4569+ fragP->fr_subtype = DEFINED_64_OFFSET;
4570+ /* Variable part does not change. */
4571+ fragP->fr_var = INST_WORD_SIZE;
4572+ }
4573+ else
4574+ {
4575+ fragP->fr_subtype = DEFINED_PC_OFFSET;
4576+ /* Don't know now whether we need an imm instruction. */
4577+ fragP->fr_var = INST_WORD_SIZE;
4578+ }
4579+ }
4580+ else
4581+ {
4582+ fragP->fr_subtype = DEFINED_PC_OFFSET;
4583+ /* Don't know now whether we need an imm instruction. */
4584+ fragP->fr_var = INST_WORD_SIZE;
4585+ }
4586+ }
4587+ #if 0
4588 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
4589 !S_IS_WEAK (fragP->fr_symbol))
4590 {
4591@@ -2330,6 +2647,7 @@ md_estimate_size_before_relax (fragS * fragP,
4592 /* Don't know now whether we need an imm instruction. */
4593 fragP->fr_var = INST_WORD_SIZE;
4594 }
4595+#endif
4596 else if (S_IS_DEFINED (fragP->fr_symbol)
4597 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
4598 {
4599@@ -2432,6 +2750,7 @@ md_estimate_size_before_relax (fragS * fragP,
4600 case TLSLD_OFFSET:
4601 case TLSTPREL_OFFSET:
4602 case TLSDTPREL_OFFSET:
4603+ case DEFINED_64_OFFSET:
4604 fragP->fr_var = INST_WORD_SIZE*2;
4605 break;
4606 case DEFINED_RO_SEGMENT:
4607@@ -2485,7 +2804,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
4608 else
4609 {
4610 /* The case where we are going to resolve things... */
4611- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
4612+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4613 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
4614 else
4615 return fixp->fx_where + fixp->fx_frag->fr_address;
4616@@ -2518,6 +2837,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
4617 case BFD_RELOC_MICROBLAZE_32_RWSDA:
4618 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
4619 case BFD_RELOC_MICROBLAZE_64_GOTPC:
4620+ case BFD_RELOC_MICROBLAZE_64_GPC:
4621+ case BFD_RELOC_MICROBLAZE_64:
4622 case BFD_RELOC_MICROBLAZE_64_GOT:
4623 case BFD_RELOC_MICROBLAZE_64_PLT:
4624 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
4625@@ -2578,6 +2899,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
4199 return rel; 4626 return rel;
4200 } 4627 }
4201 4628
@@ -4214,7 +4641,7 @@ index 5810a74a5f..ffbb843d33 100644
4214 int 4641 int
4215 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 4642 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4216 { 4643 {
4217@@ -2578,6 +2815,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 4644@@ -2591,6 +2924,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4218 case OPTION_LITTLE: 4645 case OPTION_LITTLE:
4219 target_big_endian = 0; 4646 target_big_endian = 0;
4220 break; 4647 break;
@@ -4225,7 +4652,7 @@ index 5810a74a5f..ffbb843d33 100644
4225 default: 4652 default:
4226 return 0; 4653 return 0;
4227 } 4654 }
4228@@ -2593,6 +2834,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED) 4655@@ -2606,6 +2943,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
4229 fprintf (stream, _(" MicroBlaze specific assembler options:\n")); 4656 fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
4230 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu")); 4657 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
4231 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu")); 4658 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
@@ -4233,8 +4660,20 @@ index 5810a74a5f..ffbb843d33 100644
4233 } 4660 }
4234 4661
4235 4662
4663@@ -2643,7 +2981,10 @@ cons_fix_new_microblaze (fragS * frag,
4664 r = BFD_RELOC_32;
4665 break;
4666 case 8:
4667- r = BFD_RELOC_64;
4668+ if (microblaze_arch_size == 64)
4669+ r = BFD_RELOC_32;
4670+ else
4671+ r = BFD_RELOC_64;
4672 break;
4673 default:
4674 as_bad (_("unsupported BFD relocation size %u"), size);
4236diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h 4675diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
4237index 01cb3e894f..7435a70ef5 100644 4676index c6d33f873c4..34aa1174ed2 100644
4238--- a/gas/config/tc-microblaze.h 4677--- a/gas/config/tc-microblaze.h
4239+++ b/gas/config/tc-microblaze.h 4678+++ b/gas/config/tc-microblaze.h
4240@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[]; 4679@@ -78,7 +78,9 @@ extern const struct relax_type md_relax_table[];
@@ -4249,31 +4688,44 @@ index 01cb3e894f..7435a70ef5 100644
4249 #define ELF_TC_SPECIAL_SECTIONS \ 4688 #define ELF_TC_SPECIAL_SECTIONS \
4250 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ 4689 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
4251diff --git a/include/elf/common.h b/include/elf/common.h 4690diff --git a/include/elf/common.h b/include/elf/common.h
4252index 4d94c4fd5b..f709a01816 100644 4691index 0cca28673dd..a650d624e3c 100644
4253--- a/include/elf/common.h 4692--- a/include/elf/common.h
4254+++ b/include/elf/common.h 4693+++ b/include/elf/common.h
4255@@ -340,6 +340,7 @@ 4694@@ -354,6 +354,7 @@
4256 #define EM_RISCV 243 /* RISC-V */ 4695 #define EM_65816 257 /* WDC 65816/65C816 */
4257 #define EM_LANAI 244 /* Lanai 32-bit processor. */ 4696 #define EM_LOONGARCH 258 /* LoongArch */
4258 #define EM_BPF 247 /* Linux BPF – in-kernel virtual machine. */ 4697 #define EM_KF32 259 /* ChipON KungFu32 */
4259+#define EM_MB_64 248 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ 4698+#define EM_MB_64 260 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
4260 #define EM_NFP 250 /* Netronome Flow Processor. */ 4699
4261 #define EM_CSKY 252 /* C-SKY processor family. */ 4700 /* If it is necessary to assign new unofficial EM_* values, please pick large
4701 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
4702diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
4703index 936ef484289..1f958724e5f 100644
4704--- a/include/elf/microblaze.h
4705+++ b/include/elf/microblaze.h
4706@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
4707 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
4708 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
4709 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
4710+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
4711+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
4712
4713 END_RELOC_NUMBERS (R_MICROBLAZE_max)
4262 4714
4263diff --git a/ld/Makefile.am b/ld/Makefile.am 4715diff --git a/ld/Makefile.am b/ld/Makefile.am
4264index 02c4fc1639..d063e2d32c 100644 4716index f8e99325361..8d263078750 100644
4265--- a/ld/Makefile.am 4717--- a/ld/Makefile.am
4266+++ b/ld/Makefile.am 4718+++ b/ld/Makefile.am
4267@@ -416,6 +416,8 @@ ALL_64_EMULATION_SOURCES = \ 4719@@ -410,6 +410,8 @@ ALL_64_EMULATION_SOURCES = \
4268 eelf32ltsmipn32.c \ 4720 eelf32ltsmipn32.c \
4269 eelf32ltsmipn32_fbsd.c \ 4721 eelf32ltsmipn32_fbsd.c \
4270 eelf32mipswindiss.c \ 4722 eelf32mipswindiss.c \
4271+ eelf64microblazeel.c \ 4723+ eelf64microblazeel.c \
4272+ eelf64microblaze.c \ 4724+ eelf64microblaze.c \
4273 eelf64_aix.c \ 4725 eelf32lriscv.c \
4274 eelf64bpf.c \ 4726 eelf32lriscv_ilp32f.c \
4275 eelf64_ia64.c \ 4727 eelf32lriscv_ilp32.c \
4276@@ -898,6 +900,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) 4728@@ -902,6 +904,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4277 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@ 4729 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4278 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@ 4730 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4279 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@ 4731 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
@@ -4283,19 +4735,19 @@ index 02c4fc1639..d063e2d32c 100644
4283 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@ 4735 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@ 4736 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4285diff --git a/ld/Makefile.in b/ld/Makefile.in 4737diff --git a/ld/Makefile.in b/ld/Makefile.in
4286index 2fe12e14f6..797212859f 100644 4738index ef2e99e08da..f7e845b9274 100644
4287--- a/ld/Makefile.in 4739--- a/ld/Makefile.in
4288+++ b/ld/Makefile.in 4740+++ b/ld/Makefile.in
4289@@ -898,6 +898,8 @@ ALL_64_EMULATION_SOURCES = \ 4741@@ -899,6 +899,8 @@ ALL_64_EMULATION_SOURCES = \
4290 eelf32ltsmipn32.c \ 4742 eelf32ltsmipn32.c \
4291 eelf32ltsmipn32_fbsd.c \ 4743 eelf32ltsmipn32_fbsd.c \
4292 eelf32mipswindiss.c \ 4744 eelf32mipswindiss.c \
4293+ eelf64microblazeel.c \ 4745+ eelf64microblazeel.c \
4294+ eelf64microblaze.c \ 4746+ eelf64microblaze.c \
4295 eelf64_aix.c \ 4747 eelf32lriscv.c \
4296 eelf64bpf.c \ 4748 eelf32lriscv_ilp32f.c \
4297 eelf64_ia64.c \ 4749 eelf32lriscv_ilp32.c \
4298@@ -1338,6 +1340,8 @@ distclean-compile: 4750@@ -1398,6 +1400,8 @@ distclean-compile:
4299 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@ 4751 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@
4300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@ 4752 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@
4301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Po@am__quote@ 4753 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Po@am__quote@
@@ -4304,7 +4756,7 @@ index 2fe12e14f6..797212859f 100644
4304 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@ 4756 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@
4305 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@ 4757 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@
4306 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Po@am__quote@ 4758 @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) 4759@@ -2560,6 +2564,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4308 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@ 4760 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4309 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@ 4761 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4310 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@ 4762 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
@@ -4314,10 +4766,10 @@ index 2fe12e14f6..797212859f 100644
4314 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@ 4766 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64bpf.Pc@am__quote@
4315 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@ 4767 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4316diff --git a/ld/configure.tgt b/ld/configure.tgt 4768diff --git a/ld/configure.tgt b/ld/configure.tgt
4317index 87c7d9a4ca..801d27c9e3 100644 4769index 6205d7c9872..3e97dbb311c 100644
4318--- a/ld/configure.tgt 4770--- a/ld/configure.tgt
4319+++ b/ld/configure.tgt 4771+++ b/ld/configure.tgt
4320@@ -469,6 +469,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux" 4772@@ -468,6 +468,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux"
4321 microblazeel*) targ_emul=elf32microblazeel 4773 microblazeel*) targ_emul=elf32microblazeel
4322 targ_extra_emuls=elf32microblaze 4774 targ_extra_emuls=elf32microblaze
4323 ;; 4775 ;;
@@ -4329,7 +4781,7 @@ index 87c7d9a4ca..801d27c9e3 100644
4329 ;; 4781 ;;
4330diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh 4782diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
4331new file mode 100644 4783new file mode 100644
4332index 0000000000..9c7b0eb708 4784index 00000000000..9c7b0eb7080
4333--- /dev/null 4785--- /dev/null
4334+++ b/ld/emulparams/elf64microblaze.sh 4786+++ b/ld/emulparams/elf64microblaze.sh
4335@@ -0,0 +1,23 @@ 4787@@ -0,0 +1,23 @@
@@ -4358,7 +4810,7 @@ index 0000000000..9c7b0eb708
4358+#GENERATE_SHLIB_SCRIPT=yes 4810+#GENERATE_SHLIB_SCRIPT=yes
4359diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh 4811diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
4360new file mode 100644 4812new file mode 100644
4361index 0000000000..9c7b0eb708 4813index 00000000000..9c7b0eb7080
4362--- /dev/null 4814--- /dev/null
4363+++ b/ld/emulparams/elf64microblazeel.sh 4815+++ b/ld/emulparams/elf64microblazeel.sh
4364@@ -0,0 +1,23 @@ 4816@@ -0,0 +1,23 @@
@@ -4386,7 +4838,7 @@ index 0000000000..9c7b0eb708
4386+TEMPLATE_NAME=elf32 4838+TEMPLATE_NAME=elf32
4387+#GENERATE_SHLIB_SCRIPT=yes 4839+#GENERATE_SHLIB_SCRIPT=yes
4388diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 4840diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
4389index 315c6e9350..f643f2600d 100644 4841index 1fe8da2e51b..fc15d210fe0 100644
4390--- a/opcodes/microblaze-dis.c 4842--- a/opcodes/microblaze-dis.c
4391+++ b/opcodes/microblaze-dis.c 4843+++ b/opcodes/microblaze-dis.c
4392@@ -33,6 +33,7 @@ 4844@@ -33,6 +33,7 @@
@@ -4476,7 +4928,7 @@ index 315c6e9350..f643f2600d 100644
4476 /* For tuqula instruction */ 4928 /* For tuqula instruction */
4477 case INST_TYPE_RD: 4929 case INST_TYPE_RD:
4478diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 4930diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
4479index f61f4ef66d..61eaa39b3e 100644 4931index 6fcded04b49..4a1545d8920 100644
4480--- a/opcodes/microblaze-opc.h 4932--- a/opcodes/microblaze-opc.h
4481+++ b/opcodes/microblaze-opc.h 4933+++ b/opcodes/microblaze-opc.h
4482@@ -40,7 +40,7 @@ 4934@@ -40,7 +40,7 @@
@@ -4528,17 +4980,17 @@ index f61f4ef66d..61eaa39b3e 100644
4528-#define MAX_OPCODES 301 4980-#define MAX_OPCODES 301
4529+#define MAX_OPCODES 412 4981+#define MAX_OPCODES 412
4530 4982
4531 struct op_code_struct 4983 const struct op_code_struct
4532 { 4984 {
4533@@ -125,6 +132,7 @@ struct op_code_struct 4985@@ -125,6 +132,7 @@ const struct op_code_struct
4534 /* More info about output format here. */ 4986 /* More info about output format here. */
4535 } opcodes[MAX_OPCODES] = 4987 } microblaze_opcodes[MAX_OPCODES] =
4536 { 4988 {
4537+ /* 32-bit instructions */ 4989+ /* 32-bit instructions */
4538 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst }, 4990 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
4539 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst }, 4991 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
4540 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst }, 4992 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
4541@@ -161,11 +169,11 @@ struct op_code_struct 4993@@ -161,11 +169,11 @@ const struct op_code_struct
4542 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst }, 4994 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
4543 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst }, 4995 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
4544 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst }, 4996 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
@@ -4555,7 +5007,7 @@ index f61f4ef66d..61eaa39b3e 100644
4555 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst }, 5007 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
4556 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst }, 5008 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
4557 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst }, 5009 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
4558@@ -425,6 +433,129 @@ struct op_code_struct 5010@@ -425,6 +433,129 @@ const struct op_code_struct
4559 {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */ 5011 {"suspend", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBB020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 24. */
4560 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst }, 5012 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
4561 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst }, 5013 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
@@ -4664,8 +5116,8 @@ index f61f4ef66d..61eaa39b3e 100644
4664+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst }, 5116+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
4665+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst }, 5117+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
4666+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst }, 5118+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
4667+ {"lli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */ 5119+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
4668+ {"sli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */ 5120+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
4669+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */ 5121+ {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
4670+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, 5122+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
4671+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst }, 5123+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
@@ -4704,7 +5156,7 @@ index f61f4ef66d..61eaa39b3e 100644
4704 #endif /* MICROBLAZE_OPC */ 5156 #endif /* MICROBLAZE_OPC */
4705 5157
4706diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 5158diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
4707index fa921c90c9..1dcd3dca3d 100644 5159index 78a2ac44960..70e351f6f4e 100644
4708--- a/opcodes/microblaze-opcm.h 5160--- a/opcodes/microblaze-opcm.h
4709+++ b/opcodes/microblaze-opcm.h 5161+++ b/opcodes/microblaze-opcm.h
4710@@ -25,6 +25,7 @@ 5162@@ -25,6 +25,7 @@
@@ -4715,6 +5167,17 @@ index fa921c90c9..1dcd3dca3d 100644
4715 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu, 5167 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
4716 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 5168 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
4717 mulh, mulhu, mulhsu,swapb,swaph, 5169 mulh, mulhu, mulhsu,swapb,swaph,
5170@@ -39,8 +40,8 @@ enum microblaze_instr
5171 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
5172 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
5173 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
5174- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
5175- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5176+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
5177+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5178 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
5179 fint, fsqrt,
5180 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
4718@@ -58,6 +59,18 @@ enum microblaze_instr 5181@@ -58,6 +59,18 @@ enum microblaze_instr
4719 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd, 5182 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
4720 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd, 5183 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch
deleted file mode 100644
index 7b87f40f..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0015-MB-X-initial-commit.patch
+++ /dev/null
@@ -1,684 +0,0 @@
1From 550150a8f97738902539ad774fbd0c977ab3a427 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 16:31:26 +0530
4Subject: [PATCH 15/52] MB-X initial commit code cleanup is needed.
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-opcm.h
10---
11 bfd/bfd-in2.h | 10 +++
12 bfd/elf32-microblaze.c | 59 +++++++++++++-
13 bfd/elf64-microblaze.c | 61 ++++++++++++++-
14 bfd/libbfd.h | 2 +
15 bfd/reloc.c | 12 +++
16 gas/config/tc-microblaze.c | 154 ++++++++++++++++++++++++++++++-------
17 include/elf/microblaze.h | 2 +
18 opcodes/microblaze-opc.h | 4 +-
19 opcodes/microblaze-opcm.h | 4 +-
20 9 files changed, 275 insertions(+), 33 deletions(-)
21
22diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
23index 1bd19a2b63..a335182ba1 100644
24--- a/bfd/bfd-in2.h
25+++ b/bfd/bfd-in2.h
26@@ -5438,11 +5438,21 @@ value in two words (with an imm instruction). No relocation is
27 done here - only used for relaxing */
28 BFD_RELOC_MICROBLAZE_64_NONE,
29
30+/* This is a 64 bit reloc that stores the 32 bit pc relative
31+ * +value in two words (with an imml instruction). No relocation is
32+ * +done here - only used for relaxing */
33+ BFD_RELOC_MICROBLAZE_64,
34+
35 /* This is a 64 bit reloc that stores the 32 bit pc relative
36 value in two words (with an imm instruction). The relocation is
37 PC-relative GOT offset */
38 BFD_RELOC_MICROBLAZE_64_GOTPC,
39
40+/* This is a 64 bit reloc that stores the 32 bit pc relative
41+value in two words (with an imml instruction). The relocation is
42+PC-relative GOT offset */
43+ BFD_RELOC_MICROBLAZE_64_GPC,
44+
45 /* This is a 64 bit reloc that stores the 32 bit pc relative
46 value in two words (with an imm instruction). The relocation is
47 GOT offset */
48diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
49index c22130fd8c..14bb6de052 100644
50--- a/bfd/elf32-microblaze.c
51+++ b/bfd/elf32-microblaze.c
52@@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
53 0x0000ffff, /* Dest Mask. */
54 TRUE), /* PC relative offset? */
55
56+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
57+ 0, /* Rightshift. */
58+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
59+ 16, /* Bitsize. */
60+ TRUE, /* PC_relative. */
61+ 0, /* Bitpos. */
62+ complain_overflow_dont, /* Complain on overflow. */
63+ bfd_elf_generic_reloc,/* Special Function. */
64+ "R_MICROBLAZE_IMML_64", /* Name. */
65+ FALSE, /* Partial Inplace. */
66+ 0, /* Source Mask. */
67+ 0x0000ffff, /* Dest Mask. */
68+ FALSE), /* PC relative offset? */
69+
70 /* A 64 bit relocation. Table entry not really used. */
71 HOWTO (R_MICROBLAZE_64, /* Type. */
72 0, /* Rightshift. */
73@@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
74 0x0000ffff, /* Dest Mask. */
75 TRUE), /* PC relative offset? */
76
77+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
78+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
79+ 0, /* Rightshift. */
80+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
81+ 16, /* Bitsize. */
82+ TRUE, /* PC_relative. */
83+ 0, /* Bitpos. */
84+ complain_overflow_dont, /* Complain on overflow. */
85+ bfd_elf_generic_reloc, /* Special Function. */
86+ "R_MICROBLAZE_GPC_64", /* Name. */
87+ FALSE, /* Partial Inplace. */
88+ 0, /* Source Mask. */
89+ 0x0000ffff, /* Dest Mask. */
90+ TRUE), /* PC relative offset? */
91+
92 /* A 64 bit GOT relocation. Table-entry not really used. */
93 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
94 0, /* Rightshift. */
95@@ -619,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
96 case BFD_RELOC_VTABLE_ENTRY:
97 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
98 break;
99+ case BFD_RELOC_MICROBLAZE_64:
100+ microblaze_reloc = R_MICROBLAZE_IMML_64;
101+ break;
102 case BFD_RELOC_MICROBLAZE_64_GOTPC:
103 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
104 break;
105+ case BFD_RELOC_MICROBLAZE_64_GPC:
106+ microblaze_reloc = R_MICROBLAZE_GPC_64;
107+ break;
108 case BFD_RELOC_MICROBLAZE_64_GOT:
109 microblaze_reloc = R_MICROBLAZE_GOT_64;
110 break;
111@@ -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 {
120@@ -1929,6 +1964,28 @@ microblaze_elf_relax_section (bfd *abfd,
121 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
122 }
123 break;
124+ case R_MICROBLAZE_IMML_64:
125+ {
126+ /* This was a PC-relative instruction that was
127+ completely resolved. */
128+ int sfix, efix;
129+ unsigned int val;
130+ bfd_vma target_address;
131+ target_address = irel->r_addend + irel->r_offset;
132+ sfix = calc_fixup (irel->r_offset, 0, sec);
133+ efix = calc_fixup (target_address, 0, sec);
134+
135+ /* Validate the in-band val. */
136+ val = bfd_get_32 (abfd, contents + irel->r_offset);
137+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
138+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
139+ }
140+ irel->r_addend -= (efix - sfix);
141+ /* Should use HOWTO. */
142+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
143+ irel->r_addend);
144+ }
145+ break;
146 case R_MICROBLAZE_NONE:
147 case R_MICROBLAZE_32_NONE:
148 {
149diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
150index a357388115..6b1f47d00d 100644
151--- a/bfd/elf64-microblaze.c
152+++ b/bfd/elf64-microblaze.c
153@@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
154 0x0000ffff, /* Dest Mask. */
155 TRUE), /* PC relative offset? */
156
157+ /* A 64 bit relocation. Table entry not really used. */
158+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
159+ 0, /* Rightshift. */
160+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
161+ 64, /* Bitsize. */
162+ TRUE, /* PC_relative. */
163+ 0, /* Bitpos. */
164+ complain_overflow_dont, /* Complain on overflow. */
165+ bfd_elf_generic_reloc,/* Special Function. */
166+ "R_MICROBLAZE_IMML_64", /* Name. */
167+ FALSE, /* Partial Inplace. */
168+ 0, /* Source Mask. */
169+ 0x0000ffff, /* Dest Mask. */
170+ TRUE), /* PC relative offset? */
171+
172 /* A 64 bit relocation. Table entry not really used. */
173 HOWTO (R_MICROBLAZE_64, /* Type. */
174 0, /* Rightshift. */
175@@ -265,6 +280,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
176 0x0000ffff, /* Dest Mask. */
177 TRUE), /* PC relative offset? */
178
179+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
180+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
181+ 0, /* Rightshift. */
182+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
183+ 16, /* Bitsize. */
184+ TRUE, /* PC_relative. */
185+ 0, /* Bitpos. */
186+ complain_overflow_dont, /* Complain on overflow. */
187+ bfd_elf_generic_reloc, /* Special Function. */
188+ "R_MICROBLAZE_GPC_64", /* Name. */
189+ FALSE, /* Partial Inplace. */
190+ 0, /* Source Mask. */
191+ 0x0000ffff, /* Dest Mask. */
192+ TRUE), /* PC relative offset? */
193+
194 /* A 64 bit GOT relocation. Table-entry not really used. */
195 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
196 0, /* Rightshift. */
197@@ -589,9 +619,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
198 case BFD_RELOC_VTABLE_ENTRY:
199 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
200 break;
201+ case BFD_RELOC_MICROBLAZE_64:
202+ microblaze_reloc = R_MICROBLAZE_IMML_64;
203+ break;
204 case BFD_RELOC_MICROBLAZE_64_GOTPC:
205 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
206 break;
207+ case BFD_RELOC_MICROBLAZE_64_GPC:
208+ microblaze_reloc = R_MICROBLAZE_GPC_64;
209+ break;
210 case BFD_RELOC_MICROBLAZE_64_GOT:
211 microblaze_reloc = R_MICROBLAZE_GOT_64;
212 break;
213@@ -1172,6 +1208,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
214 break; /* Do nothing. */
215
216 case (int) R_MICROBLAZE_GOTPC_64:
217+ case (int) R_MICROBLAZE_GPC_64:
218 relocation = htab->sgotplt->output_section->vma
219 + htab->sgotplt->output_offset;
220 relocation -= (input_section->output_section->vma
221@@ -1443,7 +1480,7 @@ microblaze_elf_relocate_section (bfd *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,
231 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
232 }
233 break;
234+ case R_MICROBLAZE_IMML_64:
235+ {
236+ /* This was a PC-relative instruction that was
237+ completely resolved. */
238+ int sfix, efix;
239+ unsigned int val;
240+ bfd_vma target_address;
241+ target_address = irel->r_addend + irel->r_offset;
242+ sfix = calc_fixup (irel->r_offset, 0, sec);
243+ efix = calc_fixup (target_address, 0, sec);
244+
245+ /* Validate the in-band val. */
246+ val = bfd_get_32 (abfd, contents + irel->r_offset);
247+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
248+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
249+ }
250+ irel->r_addend -= (efix - sfix);
251+ /* Should use HOWTO. */
252+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
253+ irel->r_addend);
254+ }
255+ break;
256 case R_MICROBLAZE_NONE:
257 case R_MICROBLAZE_32_NONE:
258 {
259diff --git a/bfd/libbfd.h b/bfd/libbfd.h
260index c1551b9240..b4aace6a70 100644
261--- a/bfd/libbfd.h
262+++ b/bfd/libbfd.h
263@@ -2969,7 +2969,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
264 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
265 "BFD_RELOC_MICROBLAZE_32_NONE",
266 "BFD_RELOC_MICROBLAZE_64_NONE",
267+ "BFD_RELOC_MICROBLAZE_64",
268 "BFD_RELOC_MICROBLAZE_64_GOTPC",
269+ "BFD_RELOC_MICROBLAZE_64_GPC",
270 "BFD_RELOC_MICROBLAZE_64_GOT",
271 "BFD_RELOC_MICROBLAZE_64_PLT",
272 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
273diff --git a/bfd/reloc.c b/bfd/reloc.c
274index 9b39b41941..0e8a24e9cb 100644
275--- a/bfd/reloc.c
276+++ b/bfd/reloc.c
277@@ -6866,12 +6866,24 @@ ENUMDOC
278 done here - only used for relaxing
279 ENUM
280 BFD_RELOC_MICROBLAZE_64_NONE
281+ENUMDOC
282+ This is a 32 bit reloc that stores the 32 bit pc relative
283+ value in two words (with an imml instruction). No relocation is
284+ done here - only used for relaxing
285+ENUM
286+ BFD_RELOC_MICROBLAZE_64
287 ENUMDOC
288 This is a 64 bit reloc that stores the 32 bit pc relative
289 value in two words (with an imm instruction). No relocation is
290 done here - only used for relaxing
291 ENUM
292 BFD_RELOC_MICROBLAZE_64_GOTPC
293+ENUMDOC
294+ This is a 64 bit reloc that stores the 32 bit pc relative
295+ value in two words (with an imml instruction). No relocation is
296+ done here - only used for relaxing
297+ENUM
298+ BFD_RELOC_MICROBLAZE_64_GPC
299 ENUMDOC
300 This is a 64 bit reloc that stores the 32 bit pc relative
301 value in two words (with an imm instruction). The relocation is
302diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
303index ffbb843d33..33eda2a4da 100644
304--- a/gas/config/tc-microblaze.c
305+++ b/gas/config/tc-microblaze.c
306@@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
307 #define TLSTPREL_OFFSET 16
308 #define TEXT_OFFSET 17
309 #define TEXT_PC_OFFSET 18
310+#define DEFINED_64_OFFSET 19
311
312 /* Initialize the relax table. */
313 const relax_typeS md_relax_table[] =
314@@ -116,7 +117,9 @@ const relax_typeS md_relax_table[] =
315 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
316 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
317 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
318- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
319+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
320+// { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
321+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */
322 };
323
324 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
325@@ -396,7 +399,8 @@ const pseudo_typeS md_pseudo_table[] =
326 {"data32", cons, 4}, /* Same as word. */
327 {"ent", s_func, 0}, /* Treat ent as function entry point. */
328 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
329- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
330+ {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
331+ {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
332 {"weakext", microblaze_s_weakext, 0},
333 {"rodata", microblaze_s_rdata, 0},
334 {"sdata2", microblaze_s_rdata, 1},
335@@ -405,6 +409,7 @@ const pseudo_typeS md_pseudo_table[] =
336 {"sbss", microblaze_s_bss, 1},
337 {"text", microblaze_s_text, 0},
338 {"word", cons, 4},
339+ {"dword", cons, 8},
340 {"frame", s_ignore, 0},
341 {"mask", s_ignore, 0}, /* Emitted by gcc. */
342 {NULL, NULL, 0}
343@@ -898,7 +903,7 @@ check_got (int * got_type, int * got_len)
344 extern bfd_reloc_code_real_type
345 parse_cons_expression_microblaze (expressionS *exp, int size)
346 {
347- if (size == 4)
348+ if (size == 4 || (microblaze_arch_size == 64 && size == 8))
349 {
350 /* Handle @GOTOFF et.al. */
351 char *save, *gotfree_copy;
352@@ -930,6 +935,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
353
354 static const char * str_microblaze_ro_anchor = "RO";
355 static const char * str_microblaze_rw_anchor = "RW";
356+static const char * str_microblaze_64 = "64";
357
358 static bfd_boolean
359 check_spl_reg (unsigned * reg)
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)
395 if (exp.X_op != O_constant)
396 {
397 char *opc = NULL;
398+ //char *opc = str_microblaze_64;
399 relax_substateT subtype;
400
401 if (exp.X_md != 0)
402@@ -1939,7 +1973,7 @@ md_assemble (char * str)
403 subtype, /* PC-relative or not. */
404 exp.X_add_symbol,
405 exp.X_add_number,
406- opc);
407+ (char *) opc);
408 immedl = 0L;
409 }
410 else
411@@ -1977,7 +2011,7 @@ md_assemble (char * str)
412 reg1 = 0;
413 }
414 if (strcmp (op_end, ""))
415- op_end = parse_imml (op_end + 1, & exp, MIN_IMM, MAX_IMM);
416+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
417 else
418 as_fatal (_("Error in statement syntax"));
419
420@@ -1987,7 +2021,8 @@ md_assemble (char * str)
421
422 if (exp.X_op != O_constant)
423 {
424- char *opc = NULL;
425+ //char *opc = NULL;
426+ char *opc = str_microblaze_64;
427 relax_substateT subtype;
428
429 if (exp.X_md != 0)
430@@ -2001,14 +2036,13 @@ md_assemble (char * str)
431 subtype, /* PC-relative or not. */
432 exp.X_add_symbol,
433 exp.X_add_number,
434- opc);
435+ (char *) opc);
436 immedl = 0L;
437 }
438 else
439 {
440 output = frag_more (isize);
441 immedl = exp.X_add_number;
442-
443 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
444 if (opcode1 == NULL)
445 {
446@@ -2184,13 +2218,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
447 fragP->fr_fix += INST_WORD_SIZE * 2;
448 fragP->fr_var = 0;
449 break;
450+ case DEFINED_64_OFFSET:
451+ if (fragP->fr_symbol == GOT_symbol)
452+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
453+ fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GPC);
454+ else
455+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
456+ fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64);
457+ fragP->fr_fix += INST_WORD_SIZE * 2;
458+ fragP->fr_var = 0;
459+ break;
460 case DEFINED_ABS_SEGMENT:
461 if (fragP->fr_symbol == GOT_symbol)
462 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
463 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC);
464 else
465 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
466- fragP->fr_offset, FALSE, BFD_RELOC_64);
467+ fragP->fr_offset, TRUE, BFD_RELOC_64);
468 fragP->fr_fix += INST_WORD_SIZE * 2;
469 fragP->fr_var = 0;
470 break;
471@@ -2412,22 +2456,38 @@ md_apply_fix (fixS * fixP,
472 case BFD_RELOC_64_PCREL:
473 case BFD_RELOC_64:
474 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
475+ case BFD_RELOC_MICROBLAZE_64:
476 /* Add an imm instruction. First save the current instruction. */
477 for (i = 0; i < INST_WORD_SIZE; i++)
478 buf[i + INST_WORD_SIZE] = buf[i];
479+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
480+ {
481+ /* Generate the imm instruction. */
482+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
483+ if (opcode1 == NULL)
484+ {
485+ as_bad (_("unknown opcode \"%s\""), "imml");
486+ return;
487+ }
488
489- /* Generate the imm instruction. */
490- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
491- if (opcode1 == NULL)
492- {
493- as_bad (_("unknown opcode \"%s\""), "imm");
494- return;
495- }
496-
497- inst1 = opcode1->bit_sequence;
498- if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
499- inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
500-
501+ inst1 = opcode1->bit_sequence;
502+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
503+ inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
504+ }
505+ else
506+ {
507+ /* Generate the imm instruction. */
508+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
509+ if (opcode1 == NULL)
510+ {
511+ as_bad (_("unknown opcode \"%s\""), "imm");
512+ return;
513+ }
514+
515+ inst1 = opcode1->bit_sequence;
516+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
517+ inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
518+ }
519 buf[0] = INST_BYTE0 (inst1);
520 buf[1] = INST_BYTE1 (inst1);
521 buf[2] = INST_BYTE2 (inst1);
522@@ -2456,6 +2516,7 @@ md_apply_fix (fixS * fixP,
523 /* Fall through. */
524
525 case BFD_RELOC_MICROBLAZE_64_GOTPC:
526+ case BFD_RELOC_MICROBLAZE_64_GPC:
527 case BFD_RELOC_MICROBLAZE_64_GOT:
528 case BFD_RELOC_MICROBLAZE_64_PLT:
529 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
530@@ -2463,12 +2524,16 @@ md_apply_fix (fixS * fixP,
531 /* Add an imm instruction. First save the current instruction. */
532 for (i = 0; i < INST_WORD_SIZE; i++)
533 buf[i + INST_WORD_SIZE] = buf[i];
534-
535- /* Generate the imm instruction. */
536- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
537+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
538+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
539+ else
540+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
541 if (opcode1 == NULL)
542 {
543- as_bad (_("unknown opcode \"%s\""), "imm");
544+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
545+ as_bad (_("unknown opcode \"%s\""), "imml");
546+ else
547+ as_bad (_("unknown opcode \"%s\""), "imm");
548 return;
549 }
550
551@@ -2492,6 +2557,8 @@ md_apply_fix (fixS * fixP,
552 moves code around due to relaxing. */
553 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
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;
557 else if (fixP->fx_r_type == BFD_RELOC_32)
558 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
559 else
560@@ -2535,6 +2602,32 @@ md_estimate_size_before_relax (fragS * fragP,
561 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
562 abort ();
563 }
564+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
565+ && !S_IS_WEAK (fragP->fr_symbol))
566+ {
567+ if (fragP->fr_opcode != NULL) {
568+ if(streq (fragP->fr_opcode, str_microblaze_64))
569+ {
570+ /* Used as an absolute value. */
571+ fragP->fr_subtype = DEFINED_64_OFFSET;
572+ /* Variable part does not change. */
573+ fragP->fr_var = INST_WORD_SIZE;
574+ }
575+ else
576+ {
577+ fragP->fr_subtype = DEFINED_PC_OFFSET;
578+ /* Don't know now whether we need an imm instruction. */
579+ fragP->fr_var = INST_WORD_SIZE;
580+ }
581+ }
582+ else
583+ {
584+ fragP->fr_subtype = DEFINED_PC_OFFSET;
585+ /* Don't know now whether we need an imm instruction. */
586+ fragP->fr_var = INST_WORD_SIZE;
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;
596 }
597+#endif
598 else if (S_IS_DEFINED (fragP->fr_symbol)
599 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
600 {
601@@ -2644,6 +2738,7 @@ md_estimate_size_before_relax (fragS * fragP,
602 case TLSLD_OFFSET:
603 case TLSTPREL_OFFSET:
604 case TLSDTPREL_OFFSET:
605+ case DEFINED_64_OFFSET:
606 fragP->fr_var = INST_WORD_SIZE*2;
607 break;
608 case DEFINED_RO_SEGMENT:
609@@ -2697,7 +2792,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
610 else
611 {
612 /* The case where we are going to resolve things... */
613- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
614+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
615 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
616 else
617 return fixp->fx_where + fixp->fx_frag->fr_address;
618@@ -2730,6 +2825,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
619 case BFD_RELOC_MICROBLAZE_32_RWSDA:
620 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
621 case BFD_RELOC_MICROBLAZE_64_GOTPC:
622+ case BFD_RELOC_MICROBLAZE_64_GPC:
623+ case BFD_RELOC_MICROBLAZE_64:
624 case BFD_RELOC_MICROBLAZE_64_GOT:
625 case BFD_RELOC_MICROBLAZE_64_PLT:
626 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
627@@ -2872,7 +2969,10 @@ cons_fix_new_microblaze (fragS * frag,
628 r = BFD_RELOC_32;
629 break;
630 case 8:
631- r = BFD_RELOC_64;
632+ if (microblaze_arch_size == 64)
633+ r = BFD_RELOC_32;
634+ else
635+ r = BFD_RELOC_64;
636 break;
637 default:
638 as_bad (_("unsupported BFD relocation size %u"), size);
639diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
640index 3978a3dc01..938841b240 100644
641--- a/include/elf/microblaze.h
642+++ b/include/elf/microblaze.h
643@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
644 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
645 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
646 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
647+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
648+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
649
650 END_RELOC_NUMBERS (R_MICROBLAZE_max)
651
652diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
653index 61eaa39b3e..f2139a6839 100644
654--- a/opcodes/microblaze-opc.h
655+++ b/opcodes/microblaze-opc.h
656@@ -538,8 +538,8 @@ struct op_code_struct
657 {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
658 {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
659 {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
660- {"lli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
661- {"sli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
662+ {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */
663+ {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */
664 {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */
665 {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, 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 },
667diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
668index 1dcd3dca3d..fcf259a362 100644
669--- a/opcodes/microblaze-opcm.h
670+++ b/opcodes/microblaze-opcm.h
671@@ -40,8 +40,8 @@ enum microblaze_instr
672 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
673 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
674 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
675- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
676- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
677+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
678+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
679 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
680 fint, fsqrt,
681 tget, tcget, tnget, tncget, tput, tcput, tnput, tncput,
682--
6832.17.1
684
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
index 6a3e34c4..0d472331 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0016-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0015-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
@@ -1,7 +1,7 @@
1From 5b9a1079eefbfbe23992f231ad69af488040e302 Mon Sep 17 00:00:00 2001 1From e3d5306efa998ff6e72a6b0ca92d1b9bfadf8156 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 16/52] [Patch,Microblaze] : negl instruction is overriding 4Subject: [PATCH 15/38] [Patch,Microblaze] : negl instruction is overriding
5 rsubl,fixed it by changing the instruction order... 5 rsubl,fixed it by changing the instruction order...
6 6
7--- 7---
@@ -9,10 +9,10 @@ Subject: [PATCH 16/52] [Patch,Microblaze] : negl instruction is overriding
9 1 file changed, 2 insertions(+), 2 deletions(-) 9 1 file changed, 2 insertions(+), 2 deletions(-)
10 10
11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
12index f2139a6839..f970941209 100644 12index 4a1545d8920..b1635f41529 100644
13--- a/opcodes/microblaze-opc.h 13--- a/opcodes/microblaze-opc.h
14+++ b/opcodes/microblaze-opc.h 14+++ b/opcodes/microblaze-opc.h
15@@ -275,9 +275,7 @@ struct op_code_struct 15@@ -275,9 +275,7 @@ const struct op_code_struct
16 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */ 16 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
17 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */ 17 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
18 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */ 18 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
@@ -22,7 +22,7 @@ index f2139a6839..f970941209 100644
22 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, 22 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
23 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, 23 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
24 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst }, 24 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
25@@ -555,6 +553,8 @@ struct op_code_struct 25@@ -555,6 +553,8 @@ const struct op_code_struct
26 {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst }, 26 {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
27 {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst }, 27 {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
28 {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst }, 28 {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Added-relocations-for-MB-X.patch
index 3e0773b0..c42ad41f 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Added-relocations-for-MB-X.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Added-relocations-for-MB-X.patch
@@ -1,11 +1,14 @@
1From 442430f1010a9e16821e68ca2842579538ff564b Mon Sep 17 00:00:00 2001 1From f3d027568966b3c5ff8404656e6aa875c71926a1 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 17/52] Added relocations for MB-X 4Subject: [PATCH 16/38] Added relocations for MB-X
5 5
6Conflicts: 6Conflicts:
7 bfd/bfd-in2.h 7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c 8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
9--- 12---
10 bfd/bfd-in2.h | 9 +++- 13 bfd/bfd-in2.h | 9 +++-
11 bfd/libbfd.h | 4 +- 14 bfd/libbfd.h | 4 +-
@@ -14,10 +17,10 @@ Conflicts:
14 4 files changed, 61 insertions(+), 68 deletions(-) 17 4 files changed, 61 insertions(+), 68 deletions(-)
15 18
16diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 19diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
17index a335182ba1..57ea4f6132 100644 20index 2a1d7563643..568bfafee7c 100644
18--- a/bfd/bfd-in2.h 21--- a/bfd/bfd-in2.h
19+++ b/bfd/bfd-in2.h 22+++ b/bfd/bfd-in2.h
20@@ -5436,13 +5436,18 @@ done here - only used for relaxing */ 23@@ -5431,13 +5431,18 @@ done here - only used for relaxing */
21 /* This is a 64 bit reloc that stores the 32 bit pc relative 24 /* This is a 64 bit reloc that stores the 32 bit pc relative
22 value in two words (with an imm instruction). No relocation is 25 value in two words (with an imm instruction). No relocation is
23 done here - only used for relaxing */ 26 done here - only used for relaxing */
@@ -39,10 +42,10 @@ index a335182ba1..57ea4f6132 100644
39 value in two words (with an imm instruction). The relocation is 42 value in two words (with an imm instruction). The relocation is
40 PC-relative GOT offset */ 43 PC-relative GOT offset */
41diff --git a/bfd/libbfd.h b/bfd/libbfd.h 44diff --git a/bfd/libbfd.h b/bfd/libbfd.h
42index b4aace6a70..b4b7ee29a3 100644 45index 2caaf27bcd7..4a21358f5e0 100644
43--- a/bfd/libbfd.h 46--- a/bfd/libbfd.h
44+++ b/bfd/libbfd.h 47+++ b/bfd/libbfd.h
45@@ -2969,14 +2969,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 48@@ -2990,14 +2990,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
46 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", 49 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
47 "BFD_RELOC_MICROBLAZE_32_NONE", 50 "BFD_RELOC_MICROBLAZE_32_NONE",
48 "BFD_RELOC_MICROBLAZE_64_NONE", 51 "BFD_RELOC_MICROBLAZE_64_NONE",
@@ -60,10 +63,10 @@ index b4aace6a70..b4b7ee29a3 100644
60 "BFD_RELOC_MICROBLAZE_64_TLSGD", 63 "BFD_RELOC_MICROBLAZE_64_TLSGD",
61 "BFD_RELOC_MICROBLAZE_64_TLSLD", 64 "BFD_RELOC_MICROBLAZE_64_TLSLD",
62diff --git a/bfd/reloc.c b/bfd/reloc.c 65diff --git a/bfd/reloc.c b/bfd/reloc.c
63index 0e8a24e9cb..b5c97da3ff 100644 66index 288a5026d27..472a06a188d 100644
64--- a/bfd/reloc.c 67--- a/bfd/reloc.c
65+++ b/bfd/reloc.c 68+++ b/bfd/reloc.c
66@@ -6866,24 +6866,12 @@ ENUMDOC 69@@ -6904,24 +6904,12 @@ ENUMDOC
67 done here - only used for relaxing 70 done here - only used for relaxing
68 ENUM 71 ENUM
69 BFD_RELOC_MICROBLAZE_64_NONE 72 BFD_RELOC_MICROBLAZE_64_NONE
@@ -88,7 +91,7 @@ index 0e8a24e9cb..b5c97da3ff 100644
88 ENUMDOC 91 ENUMDOC
89 This is a 64 bit reloc that stores the 32 bit pc relative 92 This is a 64 bit reloc that stores the 32 bit pc relative
90 value in two words (with an imm instruction). The relocation is 93 value in two words (with an imm instruction). The relocation is
91@@ -6969,6 +6957,20 @@ ENUMDOC 94@@ -7007,6 +6995,20 @@ ENUMDOC
92 value in two words (with an imm instruction). The relocation is 95 value in two words (with an imm instruction). The relocation is
93 relative offset from start of TEXT. 96 relative offset from start of TEXT.
94 97
@@ -110,7 +113,7 @@ index 0e8a24e9cb..b5c97da3ff 100644
110 BFD_RELOC_AARCH64_RELOC_START 113 BFD_RELOC_AARCH64_RELOC_START
111 ENUMDOC 114 ENUMDOC
112diff --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
113index 33eda2a4da..5e11a77e70 100644 116index 378fb882f13..685a6e93f2b 100644
114--- a/gas/config/tc-microblaze.c 117--- a/gas/config/tc-microblaze.c
115+++ b/gas/config/tc-microblaze.c 118+++ b/gas/config/tc-microblaze.c
116@@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; 119@@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
@@ -130,8 +133,8 @@ index 33eda2a4da..5e11a77e70 100644
130+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */ 133+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
131 }; 134 };
132 135
133 static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ 136 static htab_t opcode_hash_control; /* Opcode mnemonics. */
134@@ -1180,33 +1182,6 @@ md_assemble (char * str) 137@@ -1184,33 +1186,6 @@ md_assemble (char * str)
135 inst |= (immed << IMM_LOW) & IMM_MASK; 138 inst |= (immed << IMM_LOW) & IMM_MASK;
136 } 139 }
137 } 140 }
@@ -142,7 +145,7 @@ index 33eda2a4da..5e11a77e70 100644
142- if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000)) 145- if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
143- { 146- {
144- /* Needs an immediate inst. */ 147- /* Needs an immediate inst. */
145- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 148- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
146- if (opcode1 == NULL) 149- if (opcode1 == NULL)
147- { 150- {
148- as_bad (_("unknown opcode \"%s\""), "imml"); 151- as_bad (_("unknown opcode \"%s\""), "imml");
@@ -165,7 +168,7 @@ index 33eda2a4da..5e11a77e70 100644
165 else 168 else
166 { 169 {
167 temp = immed & 0xFFFF8000; 170 temp = immed & 0xFFFF8000;
168@@ -1958,8 +1933,8 @@ md_assemble (char * str) 171@@ -1970,8 +1945,8 @@ md_assemble (char * str)
169 172
170 if (exp.X_op != O_constant) 173 if (exp.X_op != O_constant)
171 { 174 {
@@ -176,7 +179,7 @@ index 33eda2a4da..5e11a77e70 100644
176 relax_substateT subtype; 179 relax_substateT subtype;
177 180
178 if (exp.X_md != 0) 181 if (exp.X_md != 0)
179@@ -2218,13 +2193,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 182@@ -2230,13 +2205,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
180 fragP->fr_fix += INST_WORD_SIZE * 2; 183 fragP->fr_fix += INST_WORD_SIZE * 2;
181 fragP->fr_var = 0; 184 fragP->fr_var = 0;
182 break; 185 break;
@@ -189,25 +192,25 @@ index 33eda2a4da..5e11a77e70 100644
189 case DEFINED_64_OFFSET: 192 case DEFINED_64_OFFSET:
190 if (fragP->fr_symbol == GOT_symbol) 193 if (fragP->fr_symbol == GOT_symbol)
191 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, 194 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
192- fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GPC); 195- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
193+ fragP->fr_offset, FALSE, BFD_RELOC_MICROBLAZE_64_GPC); 196+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64_GPC);
194 else 197 else
195 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, 198 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
196- fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64); 199- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
197+ fragP->fr_offset, FALSE, BFD_RELOC_MICROBLAZE_64); 200+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64);
198 fragP->fr_fix += INST_WORD_SIZE * 2; 201 fragP->fr_fix += INST_WORD_SIZE * 2;
199 fragP->fr_var = 0; 202 fragP->fr_var = 0;
200 break; 203 break;
201@@ -2234,7 +2215,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, 204@@ -2246,7 +2227,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
202 fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC); 205 fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
203 else 206 else
204 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, 207 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
205- fragP->fr_offset, TRUE, BFD_RELOC_64); 208- fragP->fr_offset, true, BFD_RELOC_64);
206+ fragP->fr_offset, FALSE, BFD_RELOC_64); 209+ fragP->fr_offset, false, BFD_RELOC_64);
207 fragP->fr_fix += INST_WORD_SIZE * 2; 210 fragP->fr_fix += INST_WORD_SIZE * 2;
208 fragP->fr_var = 0; 211 fragP->fr_var = 0;
209 break; 212 break;
210@@ -2453,14 +2434,17 @@ md_apply_fix (fixS * fixP, 213@@ -2464,14 +2445,17 @@ md_apply_fix (fixS * fixP,
211 } 214 }
212 } 215 }
213 break; 216 break;
@@ -225,8 +228,8 @@ index 33eda2a4da..5e11a77e70 100644
225+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 228+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
226 { 229 {
227 /* Generate the imm instruction. */ 230 /* Generate the imm instruction. */
228 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 231 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
229@@ -2473,6 +2457,10 @@ md_apply_fix (fixS * fixP, 232@@ -2484,6 +2468,10 @@ md_apply_fix (fixS * fixP,
230 inst1 = opcode1->bit_sequence; 233 inst1 = opcode1->bit_sequence;
231 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 234 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
232 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; 235 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
@@ -237,7 +240,7 @@ index 33eda2a4da..5e11a77e70 100644
237 } 240 }
238 else 241 else
239 { 242 {
240@@ -2483,7 +2471,7 @@ md_apply_fix (fixS * fixP, 243@@ -2494,7 +2482,7 @@ md_apply_fix (fixS * fixP,
241 as_bad (_("unknown opcode \"%s\""), "imm"); 244 as_bad (_("unknown opcode \"%s\""), "imm");
242 return; 245 return;
243 } 246 }
@@ -246,8 +249,8 @@ index 33eda2a4da..5e11a77e70 100644
246 inst1 = opcode1->bit_sequence; 249 inst1 = opcode1->bit_sequence;
247 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 250 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
248 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 251 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
249@@ -2530,7 +2518,7 @@ md_apply_fix (fixS * fixP, 252@@ -2542,7 +2530,7 @@ md_apply_fix (fixS * fixP,
250 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 253 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
251 if (opcode1 == NULL) 254 if (opcode1 == NULL)
252 { 255 {
253- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) 256- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
@@ -255,7 +258,7 @@ index 33eda2a4da..5e11a77e70 100644
255 as_bad (_("unknown opcode \"%s\""), "imml"); 258 as_bad (_("unknown opcode \"%s\""), "imml");
256 else 259 else
257 as_bad (_("unknown opcode \"%s\""), "imm"); 260 as_bad (_("unknown opcode \"%s\""), "imm");
258@@ -2557,8 +2545,6 @@ md_apply_fix (fixS * fixP, 261@@ -2569,8 +2557,6 @@ md_apply_fix (fixS * fixP,
259 moves code around due to relaxing. */ 262 moves code around due to relaxing. */
260 if (fixP->fx_r_type == BFD_RELOC_64_PCREL) 263 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
261 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 264 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
@@ -264,7 +267,7 @@ index 33eda2a4da..5e11a77e70 100644
264 else if (fixP->fx_r_type == BFD_RELOC_32) 267 else if (fixP->fx_r_type == BFD_RELOC_32)
265 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 268 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
266 else 269 else
267@@ -2609,33 +2595,24 @@ md_estimate_size_before_relax (fragS * fragP, 270@@ -2621,33 +2607,24 @@ md_estimate_size_before_relax (fragS * fragP,
268 if(streq (fragP->fr_opcode, str_microblaze_64)) 271 if(streq (fragP->fr_opcode, str_microblaze_64))
269 { 272 {
270 /* Used as an absolute value. */ 273 /* Used as an absolute value. */
@@ -302,7 +305,7 @@ index 33eda2a4da..5e11a77e70 100644
302 else if (S_IS_DEFINED (fragP->fr_symbol) 305 else if (S_IS_DEFINED (fragP->fr_symbol)
303 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0)) 306 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
304 { 307 {
305@@ -2665,6 +2642,13 @@ md_estimate_size_before_relax (fragS * fragP, 308@@ -2677,6 +2654,13 @@ md_estimate_size_before_relax (fragS * fragP,
306 /* Variable part does not change. */ 309 /* Variable part does not change. */
307 fragP->fr_var = INST_WORD_SIZE*2; 310 fragP->fr_var = INST_WORD_SIZE*2;
308 } 311 }
@@ -316,7 +319,7 @@ index 33eda2a4da..5e11a77e70 100644
316 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor)) 319 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
317 { 320 {
318 /* It is accessed using the small data read only anchor. */ 321 /* It is accessed using the small data read only anchor. */
319@@ -2739,6 +2723,7 @@ md_estimate_size_before_relax (fragS * fragP, 322@@ -2751,6 +2735,7 @@ md_estimate_size_before_relax (fragS * fragP,
320 case TLSTPREL_OFFSET: 323 case TLSTPREL_OFFSET:
321 case TLSDTPREL_OFFSET: 324 case TLSDTPREL_OFFSET:
322 case DEFINED_64_OFFSET: 325 case DEFINED_64_OFFSET:
@@ -324,7 +327,7 @@ index 33eda2a4da..5e11a77e70 100644
324 fragP->fr_var = INST_WORD_SIZE*2; 327 fragP->fr_var = INST_WORD_SIZE*2;
325 break; 328 break;
326 case DEFINED_RO_SEGMENT: 329 case DEFINED_RO_SEGMENT:
327@@ -2792,7 +2777,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) 330@@ -2804,7 +2789,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
328 else 331 else
329 { 332 {
330 /* The case where we are going to resolve things... */ 333 /* The case where we are going to resolve things... */
@@ -333,7 +336,7 @@ index 33eda2a4da..5e11a77e70 100644
333 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; 336 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
334 else 337 else
335 return fixp->fx_where + fixp->fx_frag->fr_address; 338 return fixp->fx_where + fixp->fx_frag->fr_address;
336@@ -2827,6 +2812,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 339@@ -2839,6 +2824,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
337 case BFD_RELOC_MICROBLAZE_64_GOTPC: 340 case BFD_RELOC_MICROBLAZE_64_GOTPC:
338 case BFD_RELOC_MICROBLAZE_64_GPC: 341 case BFD_RELOC_MICROBLAZE_64_GPC:
339 case BFD_RELOC_MICROBLAZE_64: 342 case BFD_RELOC_MICROBLAZE_64:
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-MB-x-relocation-issues.patch
index 315d0445..a14b7159 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixed-MB-x-relocation-issues.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-MB-x-relocation-issues.patch
@@ -1,72 +1,53 @@
1From 5b1793fe6dfb16755f584821023145bdfc4b55d7 Mon Sep 17 00:00:00 2001 1From 835389f0f82b69f923aad7148717c48372a28828 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 18/52] -Fixed MB-x relocation issues -Added imml for required 4Subject: [PATCH 17/38] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions 5 MB-x instructions
6 6
7Conflicts:
8 bfd/elf64-microblaze.c
9 gas/config/tc-microblaze.c
7--- 10---
8 bfd/elf64-microblaze.c | 68 ++++++++++++++--- 11 bfd/elf64-microblaze.c | 48 ++++++++++--
9 gas/config/tc-microblaze.c | 152 +++++++++++++++++++++++++++---------- 12 gas/config/tc-microblaze.c | 155 ++++++++++++++++++++++++++-----------
10 gas/tc.h | 2 +- 13 gas/tc.h | 2 +-
11 3 files changed, 167 insertions(+), 55 deletions(-) 14 3 files changed, 152 insertions(+), 53 deletions(-)
12 15
13diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 16diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
14index 6b1f47d00d..6676d9f93d 100644 17index 46c4aba46f1..010ee1d15b4 100644
15--- a/bfd/elf64-microblaze.c 18--- a/bfd/elf64-microblaze.c
16+++ b/bfd/elf64-microblaze.c 19+++ b/bfd/elf64-microblaze.c
17@@ -1488,8 +1488,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, 20@@ -1511,6 +1511,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
18 relocation -= (input_section->output_section->vma 21 bfd_put_16 (input_bfd, relocation & 0xffff,
19 + input_section->output_offset 22 contents + offset + endian);
20 + offset + INST_WORD_SIZE); 23
21- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 24+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
22+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 25+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
23+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 26+ {
24+ { 27+ insn &= ~0x00ffffff;
25+ insn &= ~0x00ffffff; 28+ insn |= (relocation >> 16) & 0xffffff;
26+ insn |= (relocation >> 16) & 0xffffff; 29+ bfd_put_32 (input_bfd, insn,
27+ bfd_put_32 (input_bfd, insn, 30+ contents + offset + endian);
28 contents + offset + endian); 31+ }
29+ } 32 else
30+ else 33 {
31+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 34 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
32+ contents + offset + endian); 35@@ -1618,6 +1626,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
33 bfd_put_16 (input_bfd, relocation & 0xffff, 36 bfd_put_16 (input_bfd, relocation & 0xffff,
34 contents + offset + endian + INST_WORD_SIZE); 37 contents + offset + endian);
35 } 38 }
36@@ -1580,11 +1589,28 @@ microblaze_elf_relocate_section (bfd *output_bfd,
37 else
38 {
39 if (r_type == R_MICROBLAZE_64_PCREL)
40- relocation -= (input_section->output_section->vma
41- + input_section->output_offset
42- + offset + INST_WORD_SIZE);
43- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
44+ {
45+ if (!input_section->output_section->vma &&
46+ !input_section->output_offset && !offset)
47+ relocation -= (input_section->output_section->vma
48+ + input_section->output_offset
49+ + offset);
50+ else
51+ relocation -= (input_section->output_section->vma
52+ + input_section->output_offset
53+ + offset + INST_WORD_SIZE);
54+ }
55+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 39+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
56+ if (insn == 0xb2000000 || insn == 0xb2ffffff) 40+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
57+ { 41+ {
58+ insn &= ~0x00ffffff; 42+ insn &= ~0x00ffffff;
59+ insn |= (relocation >> 16) & 0xffffff; 43+ insn |= (relocation >> 16) & 0xffffff;
60+ bfd_put_32 (input_bfd, insn, 44+ bfd_put_32 (input_bfd, insn,
61 contents + offset + endian); 45+ contents + offset + endian);
62+ } 46+ }
63+ else 47 else
64+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, 48 {
65+ contents + offset + endian); 49 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
66 bfd_put_16 (input_bfd, relocation & 0xffff, 50@@ -1727,9 +1743,19 @@ static void
67 contents + offset + endian + INST_WORD_SIZE);
68 }
69@@ -1703,9 +1729,19 @@ static void
70 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 51 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
71 { 52 {
72 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 53 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
@@ -89,7 +70,7 @@ index 6b1f47d00d..6676d9f93d 100644
89 } 70 }
90 71
91 /* Read-modify-write into the bfd, an immediate value into appropriate fields of 72 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
92@@ -1717,10 +1753,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 73@@ -1741,10 +1767,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
93 unsigned long instr_lo; 74 unsigned long instr_lo;
94 75
95 instr_hi = bfd_get_32 (abfd, bfd_addr); 76 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -113,7 +94,7 @@ index 6b1f47d00d..6676d9f93d 100644
113 instr_lo &= ~0x0000ffff; 94 instr_lo &= ~0x0000ffff;
114 instr_lo |= (val & 0x0000ffff); 95 instr_lo |= (val & 0x0000ffff);
115diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 96diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
116index 5e11a77e70..48f306ef41 100644 97index 685a6e93f2b..9b311ed1450 100644
117--- a/gas/config/tc-microblaze.c 98--- a/gas/config/tc-microblaze.c
118+++ b/gas/config/tc-microblaze.c 99+++ b/gas/config/tc-microblaze.c
119@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 100@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
@@ -155,7 +136,7 @@ index 5e11a77e70..48f306ef41 100644
155 opc = str_microblaze_ro_anchor; 136 opc = str_microblaze_ro_anchor;
156 else if (reg2 == REG_RWSDP) 137 else if (reg2 == REG_RWSDP)
157 opc = str_microblaze_rw_anchor; 138 opc = str_microblaze_rw_anchor;
158@@ -1182,31 +1183,55 @@ md_assemble (char * str) 139@@ -1186,33 +1187,57 @@ md_assemble (char * str)
159 inst |= (immed << IMM_LOW) & IMM_MASK; 140 inst |= (immed << IMM_LOW) & IMM_MASK;
160 } 141 }
161 } 142 }
@@ -170,8 +151,10 @@ index 5e11a77e70..48f306ef41 100644
170+ if (temp != 0 && temp != 0xFFFFFF8000) 151+ if (temp != 0 && temp != 0xFFFFFF8000)
171+ { 152+ {
172 /* Needs an immediate inst. */ 153 /* Needs an immediate inst. */
173- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 154 opcode1
174+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 155 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
156- "imm");
157+ "imml");
175 if (opcode1 == NULL) 158 if (opcode1 == NULL)
176 { 159 {
177- as_bad (_("unknown opcode \"%s\""), "imm"); 160- as_bad (_("unknown opcode \"%s\""), "imm");
@@ -203,7 +186,7 @@ index 5e11a77e70..48f306ef41 100644
203+ if ((temp != 0) && (temp != 0xFFFF8000)) 186+ if ((temp != 0) && (temp != 0xFFFF8000))
204+ { 187+ {
205+ /* Needs an immediate inst. */ 188+ /* Needs an immediate inst. */
206+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 189+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
207+ if (opcode1 == NULL) 190+ if (opcode1 == NULL)
208+ { 191+ {
209+ as_bad (_("unknown opcode \"%s\""), "imm"); 192+ as_bad (_("unknown opcode \"%s\""), "imm");
@@ -225,7 +208,7 @@ index 5e11a77e70..48f306ef41 100644
225 break; 208 break;
226 209
227 case INST_TYPE_RD_R1_IMMS: 210 case INST_TYPE_RD_R1_IMMS:
228@@ -1832,12 +1857,20 @@ md_assemble (char * str) 211@@ -1842,12 +1867,20 @@ md_assemble (char * str)
229 case INST_TYPE_IMM: 212 case INST_TYPE_IMM:
230 if (streq (name, "imm")) 213 if (streq (name, "imm"))
231 as_fatal (_("An IMM instruction should not be present in the .s file")); 214 as_fatal (_("An IMM instruction should not be present in the .s file"));
@@ -249,10 +232,22 @@ index 5e11a77e70..48f306ef41 100644
249 relax_substateT subtype; 232 relax_substateT subtype;
250 233
251 if (exp.X_md != 0) 234 if (exp.X_md != 0)
252@@ -1860,27 +1893,54 @@ md_assemble (char * str) 235@@ -1870,29 +1903,53 @@ md_assemble (char * str)
253 immed = exp.X_add_number; 236 immed = exp.X_add_number;
254 } 237 }
255 238
239-
240- temp = immed & 0xFFFF8000;
241- if ((temp != 0) && (temp != 0xFFFF8000))
242- {
243- /* Needs an immediate inst. */
244- opcode1
245- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
246- "imm");
247- if (opcode1 == NULL)
248- {
249- as_bad (_("unknown opcode \"%s\""), "imm");
250- return;
256+ if (microblaze_arch_size == 64 && (streq (name, "breai") || 251+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
257+ streq (name, "breaid") || 252+ streq (name, "breaid") ||
258+ streq (name, "brai") || streq (name, "braid"))) 253+ streq (name, "brai") || streq (name, "braid")))
@@ -261,22 +256,12 @@ index 5e11a77e70..48f306ef41 100644
261+ if (temp != 0) 256+ if (temp != 0)
262+ { 257+ {
263+ /* Needs an immediate inst. */ 258+ /* Needs an immediate inst. */
264+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 259+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
265+ if (opcode1 == NULL) 260+ if (opcode1 == NULL)
266+ { 261+ {
267+ as_bad (_("unknown opcode \"%s\""), "imml"); 262+ as_bad (_("unknown opcode \"%s\""), "imml");
268+ return; 263+ return;
269+ } 264+ }
270
271- temp = immed & 0xFFFF8000;
272- if ((temp != 0) && (temp != 0xFFFF8000))
273- {
274- /* Needs an immediate inst. */
275- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
276- if (opcode1 == NULL)
277- {
278- as_bad (_("unknown opcode \"%s\""), "imm");
279- return;
280+ inst1 = opcode1->bit_sequence; 265+ inst1 = opcode1->bit_sequence;
281+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; 266+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
282+ output[0] = INST_BYTE0 (inst1); 267+ output[0] = INST_BYTE0 (inst1);
@@ -293,7 +278,7 @@ index 5e11a77e70..48f306ef41 100644
293+ if ((temp != 0) && (temp != 0xFFFF8000)) 278+ if ((temp != 0) && (temp != 0xFFFF8000))
294+ { 279+ {
295+ /* Needs an immediate inst. */ 280+ /* Needs an immediate inst. */
296+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 281+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
297+ if (opcode1 == NULL) 282+ if (opcode1 == NULL)
298+ { 283+ {
299+ as_bad (_("unknown opcode \"%s\""), "imm"); 284+ as_bad (_("unknown opcode \"%s\""), "imm");
@@ -322,7 +307,7 @@ index 5e11a77e70..48f306ef41 100644
322 break; 307 break;
323 308
324 case INST_TYPE_NONE: 309 case INST_TYPE_NONE:
325@@ -2456,7 +2516,7 @@ md_apply_fix (fixS * fixP, 310@@ -2467,7 +2524,7 @@ md_apply_fix (fixS * fixP,
326 311
327 inst1 = opcode1->bit_sequence; 312 inst1 = opcode1->bit_sequence;
328 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 313 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
@@ -331,7 +316,7 @@ index 5e11a77e70..48f306ef41 100644
331 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 316 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
332 fixP->fx_r_type = BFD_RELOC_64; 317 fixP->fx_r_type = BFD_RELOC_64;
333 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 318 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
334@@ -2624,7 +2684,14 @@ md_estimate_size_before_relax (fragS * fragP, 319@@ -2636,7 +2693,14 @@ md_estimate_size_before_relax (fragS * fragP,
335 } 320 }
336 else 321 else
337 { 322 {
@@ -347,7 +332,7 @@ index 5e11a77e70..48f306ef41 100644
347 fragP->fr_var = INST_WORD_SIZE*2; 332 fragP->fr_var = INST_WORD_SIZE*2;
348 } 333 }
349 break; 334 break;
350@@ -2901,6 +2968,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 335@@ -2913,6 +2977,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
351 case OPTION_M64: 336 case OPTION_M64:
352 //if (arg != NULL && strcmp (arg, "64") == 0) 337 //if (arg != NULL && strcmp (arg, "64") == 0)
353 microblaze_arch_size = 64; 338 microblaze_arch_size = 64;
@@ -356,7 +341,7 @@ index 5e11a77e70..48f306ef41 100644
356 default: 341 default:
357 return 0; 342 return 0;
358diff --git a/gas/tc.h b/gas/tc.h 343diff --git a/gas/tc.h b/gas/tc.h
359index da1738d67a..5bdfe5c347 100644 344index c9722307dea..f1fa7495e29 100644
360--- a/gas/tc.h 345--- a/gas/tc.h
361+++ b/gas/tc.h 346+++ b/gas/tc.h
362@@ -22,7 +22,7 @@ 347@@ -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/0018-Fixing-the-branch-related-issues.patch
index 027b8e83..5b76c492 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixing-the-branch-related-issues.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Fixing-the-branch-related-issues.patch
@@ -1,7 +1,7 @@
1From 33081da0bb8820f3c695d8f865582436b16002bf Mon Sep 17 00:00:00 2001 1From 2ebffe31b57e7fe73ea8dbd60f3330da1f780243 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 17:06:58 +0530 3Date: Sun, 30 Sep 2018 17:06:58 +0530
4Subject: [PATCH 19/52] Fixing the branch related issues 4Subject: [PATCH 18/38] Fixing the branch related issues
5 5
6Conflicts: 6Conflicts:
7 bfd/elf64-microblaze.c 7 bfd/elf64-microblaze.c
@@ -10,10 +10,10 @@ Conflicts:
10 1 file changed, 3 insertions(+) 10 1 file changed, 3 insertions(+)
11 11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index 6676d9f93d..d7b7d9f5e7 100644 13index 010ee1d15b4..f68fc344c1a 100644
14--- a/bfd/elf64-microblaze.c 14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c 15+++ b/bfd/elf64-microblaze.c
16@@ -2545,6 +2545,9 @@ microblaze_elf_check_relocs (bfd * abfd, 16@@ -2521,6 +2521,9 @@ microblaze_elf_check_relocs (bfd * abfd,
17 while (h->root.type == bfd_link_hash_indirect 17 while (h->root.type == bfd_link_hash_indirect
18 || h->root.type == bfd_link_hash_warning) 18 || h->root.type == bfd_link_hash_warning)
19 h = (struct elf_link_hash_entry *) h->root.u.i.link; 19 h = (struct elf_link_hash_entry *) h->root.u.i.link;
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-address-computation-issues-with-64bit-address.patch
index d9de811d..0a5ff410 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-address-computation-issues-with-64bit-address.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0019-Fixed-address-computation-issues-with-64bit-address.patch
@@ -1,12 +1,15 @@
1From 22b1b41a7873fa117642cad6b150f465eb9b60cb Mon Sep 17 00:00:00 2001 1From 46c4a8876203a8799dd4c7fb8b8ae1501e17b672 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/52] - Fixed address computation issues with 64bit address - 4Subject: [PATCH 19/38] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue 5 Fixed imml dissassamble issue
6 6
7Conflicts: 7Conflicts:
8 gas/config/tc-microblaze.c 8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c 9 opcodes/microblaze-dis.c
10
11Conflicts:
12 bfd/elf64-microblaze.c
10--- 13---
11 bfd/bfd-in2.h | 5 +++ 14 bfd/bfd-in2.h | 5 +++
12 bfd/elf64-microblaze.c | 14 ++++---- 15 bfd/elf64-microblaze.c | 14 ++++----
@@ -15,10 +18,10 @@ Conflicts:
15 4 files changed, 79 insertions(+), 16 deletions(-) 18 4 files changed, 79 insertions(+), 16 deletions(-)
16 19
17diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h 20diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
18index 57ea4f6132..05fbeb9b3a 100644 21index 568bfafee7c..03794ea1ecf 100644
19--- a/bfd/bfd-in2.h 22--- a/bfd/bfd-in2.h
20+++ b/bfd/bfd-in2.h 23+++ b/bfd/bfd-in2.h
21@@ -5443,6 +5443,11 @@ done here - only used for relaxing */ 24@@ -5438,6 +5438,11 @@ done here - only used for relaxing */
22 * +done here - only used for relaxing */ 25 * +done here - only used for relaxing */
23 BFD_RELOC_MICROBLAZE_64, 26 BFD_RELOC_MICROBLAZE_64,
24 27
@@ -31,29 +34,29 @@ index 57ea4f6132..05fbeb9b3a 100644
31 * +value in two words (with an imm instruction). No relocation is 34 * +value in two words (with an imm instruction). No relocation is
32 * +done here - only used for relaxing */ 35 * +done here - only used for relaxing */
33diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 36diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
34index d7b7d9f5e7..f42d7f429b 100644 37index f68fc344c1a..2ae1f2b118a 100644
35--- a/bfd/elf64-microblaze.c 38--- a/bfd/elf64-microblaze.c
36+++ b/bfd/elf64-microblaze.c 39+++ b/bfd/elf64-microblaze.c
37@@ -121,15 +121,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] = 40@@ -119,15 +119,15 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
38 0, /* Rightshift. */ 41 0, /* Rightshift. */
39 4, /* Size (0 = byte, 1 = short, 2 = long). */ 42 4, /* Size (0 = byte, 1 = short, 2 = long). */
40 64, /* Bitsize. */ 43 64, /* Bitsize. */
41- TRUE, /* PC_relative. */ 44- true, /* PC_relative. */
42+ FALSE, /* PC_relative. */ 45+ false, /* PC_relative. */
43 0, /* Bitpos. */ 46 0, /* Bitpos. */
44 complain_overflow_dont, /* Complain on overflow. */ 47 complain_overflow_dont, /* Complain on overflow. */
45 bfd_elf_generic_reloc,/* Special Function. */ 48 bfd_elf_generic_reloc,/* Special Function. */
46 "R_MICROBLAZE_IMML_64", /* Name. */ 49 "R_MICROBLAZE_IMML_64", /* Name. */
47 FALSE, /* Partial Inplace. */ 50 false, /* Partial Inplace. */
48 0, /* Source Mask. */ 51 0, /* Source Mask. */
49- 0x0000ffff, /* Dest Mask. */ 52- 0x0000ffff, /* Dest Mask. */
50- TRUE), /* PC relative offset? */ 53- true), /* PC relative offset? */
51+ 0xffffffffffffff, /* Dest Mask. */ 54+ 0xffffffffffffff, /* Dest Mask. */
52+ FALSE), /* PC relative offset? */ 55+ false), /* PC relative offset? */
53 56
54 /* A 64 bit relocation. Table entry not really used. */ 57 /* A 64 bit relocation. Table entry not really used. */
55 HOWTO (R_MICROBLAZE_64, /* Type. */ 58 HOWTO (R_MICROBLAZE_64, /* Type. */
56@@ -585,9 +585,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 59@@ -614,9 +614,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
57 case BFD_RELOC_32: 60 case BFD_RELOC_32:
58 microblaze_reloc = R_MICROBLAZE_32; 61 microblaze_reloc = R_MICROBLAZE_32;
59 break; 62 break;
@@ -65,7 +68,7 @@ index d7b7d9f5e7..f42d7f429b 100644
65 break; 68 break;
66 case BFD_RELOC_32_PCREL: 69 case BFD_RELOC_32_PCREL:
67 microblaze_reloc = R_MICROBLAZE_32_PCREL; 70 microblaze_reloc = R_MICROBLAZE_32_PCREL;
68@@ -619,7 +619,7 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 71@@ -648,7 +648,7 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
69 case BFD_RELOC_VTABLE_ENTRY: 72 case BFD_RELOC_VTABLE_ENTRY:
70 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; 73 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
71 break; 74 break;
@@ -74,7 +77,7 @@ index d7b7d9f5e7..f42d7f429b 100644
74 microblaze_reloc = R_MICROBLAZE_IMML_64; 77 microblaze_reloc = R_MICROBLAZE_IMML_64;
75 break; 78 break;
76 case BFD_RELOC_MICROBLAZE_64_GOTPC: 79 case BFD_RELOC_MICROBLAZE_64_GOTPC:
77@@ -1982,7 +1982,7 @@ microblaze_elf_relax_section (bfd *abfd, 80@@ -2005,7 +2005,7 @@ microblaze_elf_relax_section (bfd *abfd,
78 efix = calc_fixup (target_address, 0, sec); 81 efix = calc_fixup (target_address, 0, sec);
79 82
80 /* Validate the in-band val. */ 83 /* Validate the in-band val. */
@@ -84,7 +87,7 @@ index d7b7d9f5e7..f42d7f429b 100644
84 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); 87 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
85 } 88 }
86diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 89diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
87index 48f306ef41..bfb3104720 100644 90index 9b311ed1450..542c68a0857 100644
88--- a/gas/config/tc-microblaze.c 91--- a/gas/config/tc-microblaze.c
89+++ b/gas/config/tc-microblaze.c 92+++ b/gas/config/tc-microblaze.c
90@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] = 93@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] =
@@ -95,7 +98,7 @@ index 48f306ef41..bfb3104720 100644
95 {"weakext", microblaze_s_weakext, 0}, 98 {"weakext", microblaze_s_weakext, 0},
96 {"rodata", microblaze_s_rdata, 0}, 99 {"rodata", microblaze_s_rdata, 0},
97 {"sdata2", microblaze_s_rdata, 1}, 100 {"sdata2", microblaze_s_rdata, 1},
98@@ -2475,18 +2474,74 @@ md_apply_fix (fixS * fixP, 101@@ -2483,18 +2482,74 @@ md_apply_fix (fixS * fixP,
99 case BFD_RELOC_RVA: 102 case BFD_RELOC_RVA:
100 case BFD_RELOC_32_PCREL: 103 case BFD_RELOC_32_PCREL:
101 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 104 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
@@ -174,7 +177,7 @@ index 48f306ef41..bfb3104720 100644
174 buf[3] |= ((val >> 24) & 0xff); 177 buf[3] |= ((val >> 24) & 0xff);
175 buf[2] |= ((val >> 16) & 0xff); 178 buf[2] |= ((val >> 16) & 0xff);
176 buf[1] |= ((val >> 8) & 0xff); 179 buf[1] |= ((val >> 8) & 0xff);
177@@ -2607,6 +2662,8 @@ md_apply_fix (fixS * fixP, 180@@ -2616,6 +2671,8 @@ md_apply_fix (fixS * fixP,
178 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; 181 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
179 else if (fixP->fx_r_type == BFD_RELOC_32) 182 else if (fixP->fx_r_type == BFD_RELOC_32)
180 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; 183 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
@@ -183,7 +186,7 @@ index 48f306ef41..bfb3104720 100644
183 else 186 else
184 fixP->fx_r_type = BFD_RELOC_NONE; 187 fixP->fx_r_type = BFD_RELOC_NONE;
185 fixP->fx_addsy = section_symbol (absolute_section); 188 fixP->fx_addsy = section_symbol (absolute_section);
186@@ -2878,6 +2935,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) 189@@ -2887,6 +2944,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
187 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: 190 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
188 case BFD_RELOC_MICROBLAZE_64_GOTPC: 191 case BFD_RELOC_MICROBLAZE_64_GOTPC:
189 case BFD_RELOC_MICROBLAZE_64_GPC: 192 case BFD_RELOC_MICROBLAZE_64_GPC:
@@ -191,7 +194,7 @@ index 48f306ef41..bfb3104720 100644
191 case BFD_RELOC_MICROBLAZE_64: 194 case BFD_RELOC_MICROBLAZE_64:
192 case BFD_RELOC_MICROBLAZE_64_PCREL: 195 case BFD_RELOC_MICROBLAZE_64_PCREL:
193 case BFD_RELOC_MICROBLAZE_64_GOT: 196 case BFD_RELOC_MICROBLAZE_64_GOT:
194@@ -3023,10 +3081,10 @@ cons_fix_new_microblaze (fragS * frag, 197@@ -3032,10 +3090,10 @@ cons_fix_new_microblaze (fragS * frag,
195 r = BFD_RELOC_32; 198 r = BFD_RELOC_32;
196 break; 199 break;
197 case 8: 200 case 8:
@@ -206,7 +209,7 @@ index 48f306ef41..bfb3104720 100644
206 default: 209 default:
207 as_bad (_("unsupported BFD relocation size %u"), size); 210 as_bad (_("unsupported BFD relocation size %u"), size);
208diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 211diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
209index f643f2600d..1dc11a2653 100644 212index fc15d210fe0..143a0a9d59e 100644
210--- a/opcodes/microblaze-dis.c 213--- a/opcodes/microblaze-dis.c
211+++ b/opcodes/microblaze-dis.c 214+++ b/opcodes/microblaze-dis.c
212@@ -77,7 +77,7 @@ static char * 215@@ -77,7 +77,7 @@ static char *
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/0020-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
index 908f7572..43627c29 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0021-Adding-new-relocation-to-support-64bit-rodata.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
@@ -1,7 +1,8 @@
1From 9880b06269a176c0b5c4f0ecb9e3784f630a76be Mon Sep 17 00:00:00 2001 1From e49fe1aee519af464c873425212914c56fa683bc Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sat, 13 Oct 2018 21:17:01 +0530 3Date: Tue, 2 Nov 2021 17:28:24 +0530
4Subject: [PATCH 21/52] Adding new relocation to support 64bit rodata 4Subject: [PATCH 20/38] [Patch,MicroBlaze : Adding new relocation to support
5 64bit rodata.
5 6
6--- 7---
7 bfd/elf64-microblaze.c | 11 +++++++-- 8 bfd/elf64-microblaze.c | 11 +++++++--
@@ -9,10 +10,10 @@ Subject: [PATCH 21/52] Adding new relocation to support 64bit rodata
9 2 files changed, 54 insertions(+), 6 deletions(-) 10 2 files changed, 54 insertions(+), 6 deletions(-)
10 11
11diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
12index f42d7f429b..ddcb5baf74 100644 13index 2ae1f2b118a..55c01b44d29 100644
13--- a/bfd/elf64-microblaze.c 14--- a/bfd/elf64-microblaze.c
14+++ b/bfd/elf64-microblaze.c 15+++ b/bfd/elf64-microblaze.c
15@@ -1473,6 +1473,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 16@@ -1488,6 +1488,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
16 case (int) R_MICROBLAZE_64_PCREL : 17 case (int) R_MICROBLAZE_64_PCREL :
17 case (int) R_MICROBLAZE_64: 18 case (int) R_MICROBLAZE_64:
18 case (int) R_MICROBLAZE_32: 19 case (int) R_MICROBLAZE_32:
@@ -20,7 +21,7 @@ index f42d7f429b..ddcb5baf74 100644
20 { 21 {
21 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols 22 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
22 from removed linkonce sections, or sections discarded by 23 from removed linkonce sections, or sections discarded by
23@@ -1482,6 +1483,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 24@@ -1497,6 +1498,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
24 relocation += addend; 25 relocation += addend;
25 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) 26 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
26 bfd_put_32 (input_bfd, relocation, contents + offset); 27 bfd_put_32 (input_bfd, relocation, contents + offset);
@@ -29,7 +30,7 @@ index f42d7f429b..ddcb5baf74 100644
29 else 30 else
30 { 31 {
31 if (r_type == R_MICROBLAZE_64_PCREL) 32 if (r_type == R_MICROBLAZE_64_PCREL)
32@@ -1560,7 +1563,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 33@@ -1585,7 +1588,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
33 } 34 }
34 else 35 else
35 { 36 {
@@ -38,7 +39,7 @@ index f42d7f429b..ddcb5baf74 100644
38 { 39 {
39 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); 40 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
40 outrel.r_addend = relocation + addend; 41 outrel.r_addend = relocation + addend;
41@@ -1586,6 +1589,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, 42@@ -1611,6 +1614,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
42 relocation += addend; 43 relocation += addend;
43 if (r_type == R_MICROBLAZE_32) 44 if (r_type == R_MICROBLAZE_32)
44 bfd_put_32 (input_bfd, relocation, contents + offset); 45 bfd_put_32 (input_bfd, relocation, contents + offset);
@@ -47,7 +48,7 @@ index f42d7f429b..ddcb5baf74 100644
47 else 48 else
48 { 49 {
49 if (r_type == R_MICROBLAZE_64_PCREL) 50 if (r_type == R_MICROBLAZE_64_PCREL)
50@@ -2098,7 +2103,8 @@ microblaze_elf_relax_section (bfd *abfd, 51@@ -2121,7 +2126,8 @@ microblaze_elf_relax_section (bfd *abfd,
51 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, 52 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
52 irelscan->r_addend); 53 irelscan->r_addend);
53 } 54 }
@@ -57,7 +58,7 @@ index f42d7f429b..ddcb5baf74 100644
57 { 58 {
58 isym = isymbuf + ELF64_R_SYM (irelscan->r_info); 59 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
59 60
60@@ -2606,6 +2612,7 @@ microblaze_elf_check_relocs (bfd * abfd, 61@@ -2595,6 +2601,7 @@ microblaze_elf_check_relocs (bfd * abfd,
61 case R_MICROBLAZE_64: 62 case R_MICROBLAZE_64:
62 case R_MICROBLAZE_64_PCREL: 63 case R_MICROBLAZE_64_PCREL:
63 case R_MICROBLAZE_32: 64 case R_MICROBLAZE_32:
@@ -66,7 +67,7 @@ index f42d7f429b..ddcb5baf74 100644
66 if (h != NULL && !bfd_link_pic (info)) 67 if (h != NULL && !bfd_link_pic (info))
67 { 68 {
68diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 69diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
69index bfb3104720..532a26eaa5 100644 70index 542c68a0857..6902a1518a6 100644
70--- a/gas/config/tc-microblaze.c 71--- a/gas/config/tc-microblaze.c
71+++ b/gas/config/tc-microblaze.c 72+++ b/gas/config/tc-microblaze.c
72@@ -1119,6 +1119,13 @@ md_assemble (char * str) 73@@ -1119,6 +1119,13 @@ md_assemble (char * str)
@@ -83,7 +84,7 @@ index bfb3104720..532a26eaa5 100644
83 else if (reg2 == REG_ROSDP) 84 else if (reg2 == REG_ROSDP)
84 opc = str_microblaze_ro_anchor; 85 opc = str_microblaze_ro_anchor;
85 else if (reg2 == REG_RWSDP) 86 else if (reg2 == REG_RWSDP)
86@@ -1182,7 +1189,10 @@ md_assemble (char * str) 87@@ -1186,7 +1193,10 @@ md_assemble (char * str)
87 inst |= (immed << IMM_LOW) & IMM_MASK; 88 inst |= (immed << IMM_LOW) & IMM_MASK;
88 } 89 }
89 } 90 }
@@ -95,7 +96,7 @@ index bfb3104720..532a26eaa5 100644
95 { 96 {
96 temp = immed & 0xFFFFFF8000; 97 temp = immed & 0xFFFFFF8000;
97 if (temp != 0 && temp != 0xFFFFFF8000) 98 if (temp != 0 && temp != 0xFFFFFF8000)
98@@ -1794,6 +1804,11 @@ md_assemble (char * str) 99@@ -1802,6 +1812,11 @@ md_assemble (char * str)
99 100
100 if (exp.X_md != 0) 101 if (exp.X_md != 0)
101 subtype = get_imm_otype(exp.X_md); 102 subtype = get_imm_otype(exp.X_md);
@@ -107,7 +108,7 @@ index bfb3104720..532a26eaa5 100644
107 else 108 else
108 subtype = opcode->inst_offset_type; 109 subtype = opcode->inst_offset_type;
109 110
110@@ -1811,6 +1826,31 @@ md_assemble (char * str) 111@@ -1819,6 +1834,31 @@ md_assemble (char * str)
111 output = frag_more (isize); 112 output = frag_more (isize);
112 immed = exp.X_add_number; 113 immed = exp.X_add_number;
113 } 114 }
@@ -117,7 +118,7 @@ index bfb3104720..532a26eaa5 100644
117+ if (temp != 0 && temp != 0xFFFFFF8000) 118+ if (temp != 0 && temp != 0xFFFFFF8000)
118+ { 119+ {
119+ /* Needs an immediate inst. */ 120+ /* Needs an immediate inst. */
120+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 121+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
121+ if (opcode1 == NULL) 122+ if (opcode1 == NULL)
122+ { 123+ {
123+ as_bad (_("unknown opcode \"%s\""), "imml"); 124+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -139,7 +140,7 @@ index bfb3104720..532a26eaa5 100644
139 140
140 temp = immed & 0xFFFF8000; 141 temp = immed & 0xFFFF8000;
141 if ((temp != 0) && (temp != 0xFFFF8000)) 142 if ((temp != 0) && (temp != 0xFFFF8000))
142@@ -1834,6 +1874,7 @@ md_assemble (char * str) 143@@ -1844,6 +1884,7 @@ md_assemble (char * str)
143 144
144 inst |= (reg1 << RD_LOW) & RD_MASK; 145 inst |= (reg1 << RD_LOW) & RD_MASK;
145 inst |= (immed << IMM_LOW) & IMM_MASK; 146 inst |= (immed << IMM_LOW) & IMM_MASK;
@@ -147,7 +148,7 @@ index bfb3104720..532a26eaa5 100644
147 break; 148 break;
148 149
149 case INST_TYPE_R2: 150 case INST_TYPE_R2:
150@@ -3081,10 +3122,10 @@ cons_fix_new_microblaze (fragS * frag, 151@@ -3090,10 +3131,10 @@ cons_fix_new_microblaze (fragS * frag,
151 r = BFD_RELOC_32; 152 r = BFD_RELOC_32;
152 break; 153 break;
153 case 8: 154 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/0021-fixing-the-.bss-relocation-issue.patch
index 6c144b8a..bf238389 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-.bss-relocation-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0021-fixing-the-.bss-relocation-issue.patch
@@ -1,35 +1,51 @@
1From e7b6ab1b28fc3ca13ed25687d5e851795ed6e1a3 Mon Sep 17 00:00:00 2001 1From 1131a31133a45553259b3fdb930daae468709bda 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/52] fixing the .bss relocation issue 4Subject: [PATCH 21/38] fixing the .bss relocation issue
5 5
6Conflicts:
7 bfd/elf64-microblaze.c
6--- 8---
7 bfd/elf64-microblaze.c | 18 ++++++++++++------ 9 bfd/elf64-microblaze.c | 32 +++++++++++++++++++-------------
8 1 file changed, 12 insertions(+), 6 deletions(-) 10 1 file changed, 19 insertions(+), 13 deletions(-)
9 11
10diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
11index ddcb5baf74..861420789b 100644 13index 55c01b44d29..6fb88959357 100644
12--- a/bfd/elf64-microblaze.c 14--- a/bfd/elf64-microblaze.c
13+++ b/bfd/elf64-microblaze.c 15+++ b/bfd/elf64-microblaze.c
14@@ -1492,7 +1492,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 16@@ -1514,14 +1514,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
15 + input_section->output_offset 17 bfd_put_16 (input_bfd, relocation & 0xffff,
16 + offset + INST_WORD_SIZE); 18 contents + offset + endian);
17 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 19
18- if (insn == 0xb2000000 || insn == 0xb2ffffff) 20- unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
21- if (insn == 0xb2000000 || insn == 0xb2ffffff)
22- {
23- insn &= ~0x00ffffff;
24- insn |= (relocation >> 16) & 0xffffff;
25- bfd_put_32 (input_bfd, insn,
26- contents + offset + endian);
27- }
28+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
19+ if ((insn & 0xff000000) == 0xb2000000) 29+ if ((insn & 0xff000000) == 0xb2000000)
30+ {
31+ insn &= ~0x00ffffff;
32+ insn |= (relocation >> 16) & 0xffffff;
33+ bfd_put_32 (input_bfd, insn,
34+ contents + offset + endian);
35+ }
36 else
20 { 37 {
21 insn &= ~0x00ffffff; 38 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
22 insn |= (relocation >> 16) & 0xffffff; 39@@ -1632,7 +1632,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
23@@ -1606,7 +1606,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, 40 contents + offset + endian);
24 + offset + INST_WORD_SIZE);
25 } 41 }
26 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); 42 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
27- if (insn == 0xb2000000 || insn == 0xb2ffffff) 43- if (insn == 0xb2000000 || insn == 0xb2ffffff)
28+ if ((insn & 0xff000000) == 0xb2000000) 44+ if ((insn & 0xff000000) == 0xb2000000)
29 { 45 {
30 insn &= ~0x00ffffff; 46 insn &= ~0x00ffffff;
31 insn |= (relocation >> 16) & 0xffffff; 47 insn |= (relocation >> 16) & 0xffffff;
32@@ -1735,7 +1735,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 48@@ -1749,7 +1749,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
33 { 49 {
34 unsigned long instr = bfd_get_32 (abfd, bfd_addr); 50 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
35 51
@@ -38,7 +54,7 @@ index ddcb5baf74..861420789b 100644
38 { 54 {
39 instr &= ~0x00ffffff; 55 instr &= ~0x00ffffff;
40 instr |= (val & 0xffffff); 56 instr |= (val & 0xffffff);
41@@ -1758,7 +1758,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) 57@@ -1772,7 +1772,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
42 unsigned long instr_lo; 58 unsigned long instr_lo;
43 59
44 instr_hi = bfd_get_32 (abfd, bfd_addr); 60 instr_hi = bfd_get_32 (abfd, bfd_addr);
@@ -47,7 +63,7 @@ index ddcb5baf74..861420789b 100644
47 { 63 {
48 instr_hi &= ~0x00ffffff; 64 instr_hi &= ~0x00ffffff;
49 instr_hi |= (val >> 16) & 0xffffff; 65 instr_hi |= (val >> 16) & 0xffffff;
50@@ -2251,7 +2251,10 @@ microblaze_elf_relax_section (bfd *abfd, 66@@ -2276,7 +2276,10 @@ microblaze_elf_relax_section (bfd *abfd,
51 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 67 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
52 + irelscan->r_offset 68 + irelscan->r_offset
53 + INST_WORD_SIZE); 69 + INST_WORD_SIZE);
@@ -59,7 +75,7 @@ index ddcb5baf74..861420789b 100644
59 immediate |= (instr_lo & 0x0000ffff); 75 immediate |= (instr_lo & 0x0000ffff);
60 offset = calc_fixup (irelscan->r_addend, 0, sec); 76 offset = calc_fixup (irelscan->r_addend, 0, sec);
61 immediate -= offset; 77 immediate -= offset;
62@@ -2295,7 +2298,10 @@ microblaze_elf_relax_section (bfd *abfd, 78@@ -2320,7 +2323,10 @@ microblaze_elf_relax_section (bfd *abfd,
63 unsigned long instr_lo = bfd_get_32 (abfd, ocontents 79 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
64 + irelscan->r_offset 80 + irelscan->r_offset
65 + INST_WORD_SIZE); 81 + 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/0022-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
index 98f05ac8..71098800 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/0022-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
@@ -1,7 +1,7 @@
1From 9b9f53c95e5b1fbccd4de2dd579c6cfae34c191d Mon Sep 17 00:00:00 2001 1From 70b208a66994ba60e36ca3eaa7c525e130b145af 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/52] Fixed the bug in the R_MICROBLAZE_64_NONE relocation. 4Subject: [PATCH 22/38] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
5 It was adjusting only lower 16bits. 5 It was adjusting only lower 16bits.
6 6
7--- 7---
@@ -10,10 +10,10 @@ Subject: [PATCH 23/52] 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 14bb6de052..d77710b1f3 100644 13index 2f2e1ef7f41..2a976ecbe1d 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@@ -2015,8 +2015,8 @@ microblaze_elf_relax_section (bfd *abfd,
17 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec); 17 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
18 efix = calc_fixup (target_address, 0, sec); 18 efix = calc_fixup (target_address, 0, sec);
19 irel->r_addend -= (efix - sfix); 19 irel->r_addend -= (efix - sfix);
@@ -25,10 +25,10 @@ index 14bb6de052..d77710b1f3 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 861420789b..338f16eeee 100644 28index 6fb88959357..4d41ddbd953 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@@ -2030,8 +2030,8 @@ microblaze_elf_relax_section (bfd *abfd, 31@@ -2053,8 +2053,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/0023-Revert-ld-Remove-unused-expression-state.patch
index 25d0d7eb..945bad59 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Revert-ld-Remove-unused-expression-state.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Revert-ld-Remove-unused-expression-state.patch
@@ -1,30 +1,36 @@
1From 70fcc4fe0635bdc871bc2ec1087173e3f93cab86 Mon Sep 17 00:00:00 2001 1From 877ba3fffc2a542580ac95a091f3883d30b7797a 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/52] Revert "ld: Remove unused expression state" 4Subject: [PATCH 23/38] Revert "ld: Remove unused expression state" --defsym
5 symbol=expression Create a global symbol in the output file, containing the
6 absolute address given by expression.
5 7
6This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb. 8This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb.
7 9
8Conflicts: 10Conflicts:
9 ld/ChangeLog 11 ld/ChangeLog
12
13Conflicts:
14 ld/ldexp.c
15 ld/ldexp.h
10--- 16---
11 ld/ldexp.c | 8 +++++--- 17 ld/ldexp.c | 8 +++++---
12 ld/ldexp.h | 1 + 18 ld/ldexp.h | 1 +
13 2 files changed, 6 insertions(+), 3 deletions(-) 19 2 files changed, 6 insertions(+), 3 deletions(-)
14 20
15diff --git a/ld/ldexp.c b/ld/ldexp.c 21diff --git a/ld/ldexp.c b/ld/ldexp.c
16index b4e7c41209..dd3b058110 100644 22index 02c76f8b33c..ec6450965c3 100644
17--- a/ld/ldexp.c 23--- a/ld/ldexp.c
18+++ b/ld/ldexp.c 24+++ b/ld/ldexp.c
19@@ -1360,6 +1360,7 @@ static etree_type * 25@@ -1364,6 +1364,7 @@ static etree_type *
20 exp_assop (const char *dst, 26 exp_assop (const char *dst,
21 etree_type *src, 27 etree_type *src,
22 enum node_tree_enum class, 28 enum node_tree_enum class,
23+ bfd_boolean defsym, 29+ bool defsym,
24 bfd_boolean hidden) 30 bool hidden)
25 { 31 {
26 etree_type *n; 32 etree_type *n;
27@@ -1371,6 +1372,7 @@ exp_assop (const char *dst, 33@@ -1375,6 +1376,7 @@ exp_assop (const char *dst,
28 n->assign.type.node_class = class; 34 n->assign.type.node_class = class;
29 n->assign.src = src; 35 n->assign.src = src;
30 n->assign.dst = dst; 36 n->assign.dst = dst;
@@ -32,43 +38,43 @@ index b4e7c41209..dd3b058110 100644
32 n->assign.hidden = hidden; 38 n->assign.hidden = hidden;
33 return n; 39 return n;
34 } 40 }
35@@ -1380,7 +1382,7 @@ exp_assop (const char *dst, 41@@ -1384,7 +1386,7 @@ exp_assop (const char *dst,
36 etree_type * 42 etree_type *
37 exp_assign (const char *dst, etree_type *src, bfd_boolean hidden) 43 exp_assign (const char *dst, etree_type *src, bool hidden)
38 { 44 {
39- return exp_assop (dst, src, etree_assign, hidden); 45- return exp_assop (dst, src, etree_assign, hidden);
40+ return exp_assop (dst, src, etree_assign, FALSE, hidden); 46+ return exp_assop (dst, src, etree_assign, false, hidden);
41 } 47 }
42 48
43 /* Handle --defsym command-line option. */ 49 /* Handle --defsym command-line option. */
44@@ -1388,7 +1390,7 @@ exp_assign (const char *dst, etree_type *src, bfd_boolean hidden) 50@@ -1392,7 +1394,7 @@ exp_assign (const char *dst, etree_type *src, bool hidden)
45 etree_type * 51 etree_type *
46 exp_defsym (const char *dst, etree_type *src) 52 exp_defsym (const char *dst, etree_type *src)
47 { 53 {
48- return exp_assop (dst, src, etree_assign, FALSE); 54- return exp_assop (dst, src, etree_assign, false);
49+ return exp_assop (dst, src, etree_assign, TRUE, FALSE); 55+ return exp_assop (dst, src, etree_assign, true, false);
50 } 56 }
51 57
52 /* Handle PROVIDE. */ 58 /* Handle PROVIDE. */
53@@ -1396,7 +1398,7 @@ exp_defsym (const char *dst, etree_type *src) 59@@ -1400,7 +1402,7 @@ exp_defsym (const char *dst, etree_type *src)
54 etree_type * 60 etree_type *
55 exp_provide (const char *dst, etree_type *src, bfd_boolean hidden) 61 exp_provide (const char *dst, etree_type *src, bool hidden)
56 { 62 {
57- return exp_assop (dst, src, etree_provide, hidden); 63- return exp_assop (dst, src, etree_provide, hidden);
58+ return exp_assop (dst, src, etree_provide, FALSE, hidden); 64+ return exp_assop (dst, src, etree_provide, false, hidden);
59 } 65 }
60 66
61 /* Handle ASSERT. */ 67 /* Handle ASSERT. */
62diff --git a/ld/ldexp.h b/ld/ldexp.h 68diff --git a/ld/ldexp.h b/ld/ldexp.h
63index 717e839bd4..852ac6c588 100644 69index ebe82f6088f..96ac1a8e558 100644
64--- a/ld/ldexp.h 70--- a/ld/ldexp.h
65+++ b/ld/ldexp.h 71+++ b/ld/ldexp.h
66@@ -66,6 +66,7 @@ typedef union etree_union { 72@@ -66,6 +66,7 @@ typedef union etree_union {
67 node_type type; 73 node_type type;
68 const char *dst; 74 const char *dst;
69 union etree_union *src; 75 union etree_union *src;
70+ bfd_boolean defsym; 76+ bool defsym;
71 bfd_boolean hidden; 77 bool hidden;
72 } assign; 78 } assign;
73 struct { 79 struct {
74-- 80--
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-fixing-the-long-long-long-mingw-toolchain-issue.patch
index 9d1b1794..37783b08 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0025-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0024-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -1,7 +1,7 @@
1From 49fdaa5a4f0ed7e20b82ccb8d0db53075777abe9 Mon Sep 17 00:00:00 2001 1From b5d57f6b3d8826400a4e106e08c9387dc3defb11 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 25/52] fixing the long & long long mingw toolchain issue 4Subject: [PATCH 24/38] 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,7 +9,7 @@ Subject: [PATCH 25/52] 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 532a26eaa5..b00b759893 100644 12index 6902a1518a6..52058d94f98 100644
13--- a/gas/config/tc-microblaze.c 13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c 14+++ b/gas/config/tc-microblaze.c
15@@ -783,7 +783,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) 15@@ -783,7 +783,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
@@ -38,7 +38,7 @@ index 532a26eaa5..b00b759893 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 f970941209..77d74c17f3 100644 41index b1635f41529..fff7520ae81 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/0026-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Added-support-to-new-arithmetic-single-register-inst.patch
index 6379a5c4..d0c23c91 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Added-support-to-new-arithmetic-single-register-inst.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -1,39 +1,43 @@
1From b29e6a15c9f65837dbb560aa6c41c49e591915e9 Mon Sep 17 00:00:00 2001 1From e6c2ad33d4a668107e4828feb174ee08053e8c7e 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 26/52] Added support to new arithmetic single register 4Subject: [PATCH 25/38] Added support to new arithmetic single register
5 instructions 5 instructions
6 6
7Conflicts: 7Conflicts:
8 opcodes/microblaze-dis.c 8 opcodes/microblaze-dis.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12 opcodes/microblaze-dis.c
9--- 13---
10 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++- 14 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
11 opcodes/microblaze-dis.c | 13 +++- 15 opcodes/microblaze-dis.c | 11 +++
12 opcodes/microblaze-opc.h | 43 ++++++++++- 16 opcodes/microblaze-opc.h | 43 ++++++++++-
13 opcodes/microblaze-opcm.h | 5 +- 17 opcodes/microblaze-opcm.h | 5 +-
14 4 files changed, 201 insertions(+), 7 deletions(-) 18 4 files changed, 200 insertions(+), 6 deletions(-)
15 19
16diff --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
17index b00b759893..eca060b262 100644 21index 52058d94f98..1a543c328f2 100644
18--- a/gas/config/tc-microblaze.c 22--- a/gas/config/tc-microblaze.c
19+++ b/gas/config/tc-microblaze.c 23+++ b/gas/config/tc-microblaze.c
20@@ -423,12 +423,33 @@ void 24@@ -423,12 +423,33 @@ void
21 md_begin (void) 25 md_begin (void)
22 { 26 {
23 struct op_code_struct * opcode; 27 const struct op_code_struct * opcode;
24+ const char *prev_name = ""; 28+ const char *prev_name = "";
25 29
26 opcode_hash_control = hash_new (); 30 opcode_hash_control = str_htab_create ();
27 31
28 /* Insert unique names into hash table. */ 32 /* Insert unique names into hash table. */
29- for (opcode = opcodes; opcode->name; opcode ++) 33- for (opcode = microblaze_opcodes; opcode->name; opcode ++)
30- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); 34- str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
31+ for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++) 35+ for (opcode = (struct microblaze_opcodes *)microblaze_opcodes; opcode->name; opcode ++)
32+ { 36+ {
33+ if (strcmp (prev_name, opcode->name)) 37+ if (strcmp (prev_name, opcode->name))
34+ { 38+ {
35+ prev_name = (char *) opcode->name; 39+ prev_name = (char *) opcode->name;
36+ hash_insert (opcode_hash_control, opcode->name, (char *) opcode); 40+ str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
37+ } 41+ }
38+ } 42+ }
39+} 43+}
@@ -153,7 +157,7 @@ index b00b759893..eca060b262 100644
153 inst = opcode->bit_sequence; 157 inst = opcode->bit_sequence;
154 isize = 4; 158 isize = 4;
155 159
156@@ -1480,6 +1574,51 @@ md_assemble (char * str) 160@@ -1486,6 +1580,51 @@ md_assemble (char * str)
157 inst |= (immed << IMM_LOW) & IMM15_MASK; 161 inst |= (immed << IMM_LOW) & IMM15_MASK;
158 break; 162 break;
159 163
@@ -206,10 +210,10 @@ index b00b759893..eca060b262 100644
206 if (strcmp (op_end, "")) 210 if (strcmp (op_end, ""))
207 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */ 211 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
208diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c 212diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
209index 1dc11a2653..90d2328659 100644 213index 143a0a9d59e..d945d144c44 100644
210--- a/opcodes/microblaze-dis.c 214--- a/opcodes/microblaze-dis.c
211+++ b/opcodes/microblaze-dis.c 215+++ b/opcodes/microblaze-dis.c
212@@ -130,9 +130,17 @@ get_field_imm15 (struct string_buf *buf, long instr) 216@@ -130,6 +130,14 @@ get_field_imm15 (struct string_buf *buf, long instr)
213 return p; 217 return p;
214 } 218 }
215 219
@@ -223,11 +227,7 @@ index 1dc11a2653..90d2328659 100644
223+ 227+
224 static char * 228 static char *
225 get_field_special (struct string_buf *buf, long instr, 229 get_field_special (struct string_buf *buf, long instr,
226- struct op_code_struct *op) 230 const struct op_code_struct *op)
227+ struct op_code_struct *op)
228 {
229 char *p = strbuf (buf);
230 char *spr;
231@@ -456,6 +464,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) 231@@ -456,6 +464,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
232 /* For mbar 16 or sleep insn. */ 232 /* For mbar 16 or sleep insn. */
233 case INST_TYPE_NONE: 233 case INST_TYPE_NONE:
@@ -239,7 +239,7 @@ index 1dc11a2653..90d2328659 100644
239 case INST_TYPE_RD_R1_IMMW_IMMS: 239 case INST_TYPE_RD_R1_IMMW_IMMS:
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)); 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));
241diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 241diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
242index 77d74c17f3..c1b453c95e 100644 242index fff7520ae81..c25383f2de9 100644
243--- a/opcodes/microblaze-opc.h 243--- a/opcodes/microblaze-opc.h
244+++ b/opcodes/microblaze-opc.h 244+++ b/opcodes/microblaze-opc.h
245@@ -69,6 +69,7 @@ 245@@ -69,6 +69,7 @@
@@ -299,9 +299,9 @@ index 77d74c17f3..c1b453c95e 100644
299-#define MAX_OPCODES 412 299-#define MAX_OPCODES 412
300+#define MAX_OPCODES 424 300+#define MAX_OPCODES 424
301 301
302 struct op_code_struct 302 const struct op_code_struct
303 { 303 {
304@@ -444,13 +473,21 @@ struct op_code_struct 304@@ -444,13 +473,21 @@ const struct op_code_struct
305 {"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 },
306 {"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 },
307 {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */ 307 {"addli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x20000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
@@ -323,7 +323,7 @@ index 77d74c17f3..c1b453c95e 100644
323 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst }, 323 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
324 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst }, 324 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
325 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst }, 325 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
326@@ -501,9 +538,13 @@ struct op_code_struct 326@@ -501,9 +538,13 @@ const struct op_code_struct
327 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst }, 327 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
328 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst }, 328 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
329 {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */ 329 {"orli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA0000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
@@ -338,7 +338,7 @@ index 77d74c17f3..c1b453c95e 100644
338 {"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 },
339 {"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 },
340diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h 340diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
341index fcf259a362..eca247c63b 100644 341index 70e351f6f4e..cf7512d6a87 100644
342--- a/opcodes/microblaze-opcm.h 342--- a/opcodes/microblaze-opcm.h
343+++ b/opcodes/microblaze-opcm.h 343+++ b/opcodes/microblaze-opcm.h
344@@ -61,7 +61,9 @@ enum microblaze_instr 344@@ -61,7 +61,9 @@ enum microblaze_instr
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
index e3826d6f..cdf2854c 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
@@ -1,16 +1,18 @@
1From 653712c23456574468c426aebbeb5ee8dae7237e Mon Sep 17 00:00:00 2001 1From 65677ff251b88389b3de4837f57215dc088dd716 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 27/52] [Patch,MicroBlaze] : double imml generation for 64 bit 4Subject: [PATCH 26/38] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values. 5 values.
6 6
7Conflicts:
8 gas/config/tc-microblaze.c
7--- 9---
8 gas/config/tc-microblaze.c | 322 ++++++++++++++++++++++++++++++------- 10 gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++-------
9 opcodes/microblaze-opc.h | 4 +- 11 opcodes/microblaze-opc.h | 4 +-
10 2 files changed, 263 insertions(+), 63 deletions(-) 12 2 files changed, 262 insertions(+), 63 deletions(-)
11 13
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c 14diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index eca060b262..aef54ad83f 100644 15index 1a543c328f2..18dd8524949 100644
14--- a/gas/config/tc-microblaze.c 16--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c 17+++ b/gas/config/tc-microblaze.c
16@@ -1008,7 +1008,7 @@ md_assemble (char * str) 18@@ -1008,7 +1008,7 @@ md_assemble (char * str)
@@ -35,7 +37,7 @@ index eca060b262..aef54ad83f 100644
35 else 37 else
36 as_fatal (_("Error in statement syntax")); 38 as_fatal (_("Error in statement syntax"));
37 39
38@@ -1288,24 +1293,51 @@ md_assemble (char * str) 40@@ -1292,26 +1297,51 @@ md_assemble (char * str)
39 || streq (name, "lwi") || streq (name, "sbi") 41 || streq (name, "lwi") || streq (name, "sbi")
40 || streq (name, "shi") || streq (name, "swi")))) 42 || streq (name, "shi") || streq (name, "swi"))))
41 { 43 {
@@ -45,61 +47,56 @@ index eca060b262..aef54ad83f 100644
45+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000) 47+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
46 { 48 {
47 /* Needs an immediate inst. */ 49 /* Needs an immediate inst. */
48- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 50- opcode1
51- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
52- "imml");
49- if (opcode1 == NULL) 53- if (opcode1 == NULL)
50+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) 54+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
51+ { 55+ {
52+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 56+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
53+ if (opcode1 == NULL) 57+ if (opcode1 == NULL)
58 {
59 as_bad (_("unknown opcode \"%s\""), "imml");
60 return;
61 }
62 inst1 = opcode1->bit_sequence;
63- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
64+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
65 output[0] = INST_BYTE0 (inst1);
66 output[1] = INST_BYTE1 (inst1);
67 output[2] = INST_BYTE2 (inst1);
68 output[3] = INST_BYTE3 (inst1);
69 output = frag_more (isize);
70 }
71+ else
72+ {
73+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
74+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
75+ if (opcode1 == NULL || opcode2 == NULL)
54+ { 76+ {
55+ as_bad (_("unknown opcode \"%s\""), "imml"); 77+ as_bad (_("unknown opcode \"%s\""), "imml");
56+ return; 78+ return;
57+ } 79+ }
58+ inst1 = opcode1->bit_sequence; 80+ inst1 = opcode2->bit_sequence;
59+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 81+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
60+ output[0] = INST_BYTE0 (inst1); 82+ output[0] = INST_BYTE0 (inst1);
61+ output[1] = INST_BYTE1 (inst1); 83+ output[1] = INST_BYTE1 (inst1);
62+ output[2] = INST_BYTE2 (inst1); 84+ output[2] = INST_BYTE2 (inst1);
63+ output[3] = INST_BYTE3 (inst1); 85+ output[3] = INST_BYTE3 (inst1);
64+ output = frag_more (isize); 86+ output = frag_more (isize);
65+ } 87+ inst1 = opcode1->bit_sequence;
66+ else 88+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
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;
77+ output[0] = INST_BYTE0 (inst1); 89+ output[0] = INST_BYTE0 (inst1);
78+ output[1] = INST_BYTE1 (inst1); 90+ output[1] = INST_BYTE1 (inst1);
79+ output[2] = INST_BYTE2 (inst1); 91+ output[2] = INST_BYTE2 (inst1);
80+ output[3] = INST_BYTE3 (inst1); 92+ output[3] = INST_BYTE3 (inst1);
81+ output = frag_more (isize); 93+ output = frag_more (isize);
82 inst1 = opcode1->bit_sequence; 94+ }
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 }
91+ } 95+ }
92 inst |= (reg1 << RD_LOW) & RD_MASK; 96 inst |= (reg1 << RD_LOW) & RD_MASK;
93 inst |= (reg2 << RA_LOW) & RA_MASK; 97 inst |= (reg2 << RA_LOW) & RA_MASK;
94 inst |= (immed << IMM_LOW) & IMM_MASK; 98 inst |= (immed << IMM_LOW) & IMM_MASK;
95@@ -1316,14 +1348,13 @@ md_assemble (char * str) 99@@ -1328,8 +1358,7 @@ md_assemble (char * str)
96 if ((temp != 0) && (temp != 0xFFFF8000))
97 {
98 /* Needs an immediate inst. */
99- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
100+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
101 if (opcode1 == NULL)
102 {
103 as_bad (_("unknown opcode \"%s\""), "imm"); 100 as_bad (_("unknown opcode \"%s\""), "imm");
104 return; 101 return;
105 } 102 }
@@ -109,7 +106,7 @@ index eca060b262..aef54ad83f 100644
109 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK; 106 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
110 output[0] = INST_BYTE0 (inst1); 107 output[0] = INST_BYTE0 (inst1);
111 output[1] = INST_BYTE1 (inst1); 108 output[1] = INST_BYTE1 (inst1);
112@@ -1564,7 +1595,7 @@ md_assemble (char * str) 109@@ -1570,7 +1599,7 @@ md_assemble (char * str)
113 as_fatal (_("Cannot use special register with this instruction")); 110 as_fatal (_("Cannot use special register with this instruction"));
114 111
115 if (exp.X_op != O_constant) 112 if (exp.X_op != O_constant)
@@ -118,18 +115,15 @@ index eca060b262..aef54ad83f 100644
118 else 115 else
119 { 116 {
120 output = frag_more (isize); 117 output = frag_more (isize);
121@@ -1898,8 +1929,9 @@ md_assemble (char * str) 118@@ -1904,6 +1933,7 @@ md_assemble (char * str)
122 temp = immed & 0xFFFF8000; 119 temp = immed & 0xFFFF8000;
123 if ((temp != 0) && (temp != 0xFFFF8000)) 120 if ((temp != 0) && (temp != 0xFFFF8000))
124 { 121 {
125+ 122+
126 /* Needs an immediate inst. */ 123 /* Needs an immediate inst. */
127- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 124 opcode1
128+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 125 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
129 if (opcode1 == NULL) 126@@ -1936,7 +1966,12 @@ md_assemble (char * str)
130 {
131 as_bad (_("unknown opcode \"%s\""), "imm");
132@@ -1928,7 +1960,12 @@ md_assemble (char * str)
133 reg1 = 0; 127 reg1 = 0;
134 } 128 }
135 if (strcmp (op_end, "")) 129 if (strcmp (op_end, ""))
@@ -142,7 +136,7 @@ index eca060b262..aef54ad83f 100644
142 else 136 else
143 as_fatal (_("Error in statement syntax")); 137 as_fatal (_("Error in statement syntax"));
144 138
145@@ -1967,30 +2004,55 @@ md_assemble (char * str) 139@@ -1975,30 +2010,55 @@ md_assemble (char * str)
146 } 140 }
147 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai")) 141 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
148 { 142 {
@@ -152,10 +146,10 @@ index eca060b262..aef54ad83f 100644
152+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000) 146+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
153 { 147 {
154 /* Needs an immediate inst. */ 148 /* Needs an immediate inst. */
155- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 149- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
156+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) 150+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
157+ { 151+ {
158+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 152+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
159 if (opcode1 == NULL) 153 if (opcode1 == NULL)
160 { 154 {
161 as_bad (_("unknown opcode \"%s\""), "imml"); 155 as_bad (_("unknown opcode \"%s\""), "imml");
@@ -171,8 +165,8 @@ index eca060b262..aef54ad83f 100644
171 output = frag_more (isize); 165 output = frag_more (isize);
172 } 166 }
173+ else { 167+ else {
174+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 168+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
175+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 169+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
176+ if (opcode1 == NULL || opcode2 == NULL) 170+ if (opcode1 == NULL || opcode2 == NULL)
177+ { 171+ {
178+ as_bad (_("unknown opcode \"%s\""), "imml"); 172+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -203,7 +197,7 @@ index eca060b262..aef54ad83f 100644
203 temp = immed & 0xFFFF8000; 197 temp = immed & 0xFFFF8000;
204 if ((temp != 0) && (temp != 0xFFFF8000)) 198 if ((temp != 0) && (temp != 0xFFFF8000))
205 { 199 {
206@@ -2076,25 +2138,50 @@ md_assemble (char * str) 200@@ -2086,24 +2146,50 @@ md_assemble (char * str)
207 streq (name, "breaid") || 201 streq (name, "breaid") ||
208 streq (name, "brai") || streq (name, "braid"))) 202 streq (name, "brai") || streq (name, "braid")))
209 { 203 {
@@ -212,28 +206,27 @@ index eca060b262..aef54ad83f 100644
212 if (temp != 0) 206 if (temp != 0)
213 { 207 {
214 /* Needs an immediate inst. */ 208 /* Needs an immediate inst. */
215- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 209- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
216+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) 210+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
217+ { 211+ {
218+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 212+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
219 if (opcode1 == NULL) 213 if (opcode1 == NULL)
220 { 214 {
221 as_bad (_("unknown opcode \"%s\""), "imml"); 215 as_bad (_("unknown opcode \"%s\""), "imml");
222 return; 216 return;
223 } 217 }
224-
225 inst1 = opcode1->bit_sequence; 218 inst1 = opcode1->bit_sequence;
226- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; 219- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
227+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 220+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
228+ output[0] = INST_BYTE0 (inst1); 221 output[0] = INST_BYTE0 (inst1);
229+ output[1] = INST_BYTE1 (inst1); 222 output[1] = INST_BYTE1 (inst1);
230+ output[2] = INST_BYTE2 (inst1); 223 output[2] = INST_BYTE2 (inst1);
231+ output[3] = INST_BYTE3 (inst1); 224 output[3] = INST_BYTE3 (inst1);
232+ output = frag_more (isize); 225 output = frag_more (isize);
233+ } 226 }
234+ else { 227+ else {
235+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 228+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
236+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 229+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
237+ if (opcode1 == NULL || opcode2 == NULL) 230+ if (opcode1 == NULL || opcode2 == NULL)
238+ { 231+ {
239+ as_bad (_("unknown opcode \"%s\""), "imml"); 232+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -248,22 +241,22 @@ index eca060b262..aef54ad83f 100644
248+ output = frag_more (isize); 241+ output = frag_more (isize);
249+ inst1 = opcode1->bit_sequence; 242+ inst1 = opcode1->bit_sequence;
250+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 243+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
251 output[0] = INST_BYTE0 (inst1); 244+ output[0] = INST_BYTE0 (inst1);
252 output[1] = INST_BYTE1 (inst1); 245+ output[1] = INST_BYTE1 (inst1);
253 output[2] = INST_BYTE2 (inst1); 246+ output[2] = INST_BYTE2 (inst1);
254 output[3] = INST_BYTE3 (inst1); 247+ output[3] = INST_BYTE3 (inst1);
255 output = frag_more (isize); 248+ output = frag_more (isize);
256 } 249+ }
257+ } 250+ }
258 inst |= (immed << IMM_LOW) & IMM_MASK; 251 inst |= (immed << IMM_LOW) & IMM_MASK;
259 } 252 }
260 else 253 else
261@@ -2194,21 +2281,45 @@ md_assemble (char * str) 254@@ -2203,21 +2289,45 @@ md_assemble (char * str)
262 { 255 {
263 output = frag_more (isize); 256 output = frag_more (isize);
264 immedl = exp.X_add_number; 257 immedl = exp.X_add_number;
265- 258-
266- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 259- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
267- if (opcode1 == NULL) 260- if (opcode1 == NULL)
268- { 261- {
269- as_bad (_("unknown opcode \"%s\""), "imml"); 262- as_bad (_("unknown opcode \"%s\""), "imml");
@@ -277,14 +270,14 @@ index eca060b262..aef54ad83f 100644
277- output[2] = INST_BYTE2 (inst1); 270- output[2] = INST_BYTE2 (inst1);
278- output[3] = INST_BYTE3 (inst1); 271- output[3] = INST_BYTE3 (inst1);
279- output = frag_more (isize); 272- output = frag_more (isize);
280+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887) 273+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
281+ {
282+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml");
283+ if (opcode1 == NULL)
284+ { 274+ {
275+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
276+ if (opcode1 == NULL)
277+ {
285+ as_bad (_("unknown opcode \"%s\""), "imml"); 278+ as_bad (_("unknown opcode \"%s\""), "imml");
286+ return; 279+ return;
287+ } 280+ }
288+ inst1 = opcode1->bit_sequence; 281+ inst1 = opcode1->bit_sequence;
289+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 282+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
290+ output[0] = INST_BYTE0 (inst1); 283+ output[0] = INST_BYTE0 (inst1);
@@ -294,8 +287,8 @@ index eca060b262..aef54ad83f 100644
294+ output = frag_more (isize); 287+ output = frag_more (isize);
295+ } 288+ }
296+ else { 289+ else {
297+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 290+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
298+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 291+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
299+ if (opcode2 == NULL || opcode1 == NULL) 292+ if (opcode2 == NULL || opcode1 == NULL)
300+ { 293+ {
301+ as_bad (_("unknown opcode \"%s\""), "imml"); 294+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -319,11 +312,11 @@ index eca060b262..aef54ad83f 100644
319 } 312 }
320 313
321 inst |= (reg1 << RD_LOW) & RD_MASK; 314 inst |= (reg1 << RD_LOW) & RD_MASK;
322@@ -2257,21 +2368,46 @@ md_assemble (char * str) 315@@ -2266,21 +2376,46 @@ md_assemble (char * str)
323 { 316 {
324 output = frag_more (isize); 317 output = frag_more (isize);
325 immedl = exp.X_add_number; 318 immedl = exp.X_add_number;
326- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 319- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
327- if (opcode1 == NULL) 320- if (opcode1 == NULL)
328- { 321- {
329- as_bad (_("unknown opcode \"%s\""), "imml"); 322- as_bad (_("unknown opcode \"%s\""), "imml");
@@ -332,7 +325,7 @@ index eca060b262..aef54ad83f 100644
332- 325-
333+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887) 326+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
334+ { 327+ {
335+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 328+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
336+ if (opcode1 == NULL) 329+ if (opcode1 == NULL)
337+ { 330+ {
338+ as_bad (_("unknown opcode \"%s\""), "imml"); 331+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -347,8 +340,8 @@ index eca060b262..aef54ad83f 100644
347+ output = frag_more (isize); 340+ output = frag_more (isize);
348+ } 341+ }
349+ else { 342+ else {
350+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 343+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
351+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 344+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
352+ if (opcode2 == NULL || opcode1 == NULL) 345+ if (opcode2 == NULL || opcode1 == NULL)
353+ { 346+ {
354+ as_bad (_("unknown opcode \"%s\""), "imml"); 347+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -374,7 +367,7 @@ index eca060b262..aef54ad83f 100644
374 367
375 inst |= (reg1 << RA_LOW) & RA_MASK; 368 inst |= (reg1 << RA_LOW) & RA_MASK;
376 inst |= (immedl << IMM_LOW) & IMM_MASK; 369 inst |= (immedl << IMM_LOW) & IMM_MASK;
377@@ -2551,8 +2687,8 @@ md_apply_fix (fixS * fixP, 370@@ -2560,8 +2695,8 @@ md_apply_fix (fixS * fixP,
378 /* Note: use offsetT because it is signed, valueT is unsigned. */ 371 /* Note: use offsetT because it is signed, valueT is unsigned. */
379 offsetT val = (offsetT) * valp; 372 offsetT val = (offsetT) * valp;
380 int i; 373 int i;
@@ -385,7 +378,7 @@ index eca060b262..aef54ad83f 100644
385 378
386 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>"); 379 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
387 380
388@@ -2735,30 +2871,75 @@ md_apply_fix (fixS * fixP, 381@@ -2743,30 +2878,75 @@ md_apply_fix (fixS * fixP,
389 case BFD_RELOC_MICROBLAZE_64_TEXTREL: 382 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
390 case BFD_RELOC_MICROBLAZE_64: 383 case BFD_RELOC_MICROBLAZE_64:
391 case BFD_RELOC_MICROBLAZE_64_PCREL: 384 case BFD_RELOC_MICROBLAZE_64_PCREL:
@@ -396,12 +389,13 @@ index eca060b262..aef54ad83f 100644
396 || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 389 || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
397 { 390 {
398 /* Generate the imm instruction. */ 391 /* Generate the imm instruction. */
392- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
399+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887) 393+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
400+ { 394+ {
401+ /* Add an imm instruction. First save the current instruction. */ 395+ /* Add an imm instruction. First save the current instruction. */
402+ for (i = 0; i < INST_WORD_SIZE; i++) 396+ for (i = 0; i < INST_WORD_SIZE; i++)
403+ buf[i + INST_WORD_SIZE] = buf[i]; 397+ buf[i + INST_WORD_SIZE] = buf[i];
404 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 398+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
405 if (opcode1 == NULL) 399 if (opcode1 == NULL)
406- { 400- {
407- as_bad (_("unknown opcode \"%s\""), "imml"); 401- as_bad (_("unknown opcode \"%s\""), "imml");
@@ -416,9 +410,11 @@ index eca060b262..aef54ad83f 100644
416 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 410 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
417- inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK; 411- inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
418+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 412+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
419+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 413 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
414- fixP->fx_r_type = BFD_RELOC_64;
420+ fixP->fx_r_type = BFD_RELOC_64; 415+ fixP->fx_r_type = BFD_RELOC_64;
421+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 416 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
417- fixP->fx_r_type = BFD_RELOC_64_PCREL;
422+ fixP->fx_r_type = BFD_RELOC_64_PCREL; 418+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
423+ buf[0] = INST_BYTE0 (inst1); 419+ buf[0] = INST_BYTE0 (inst1);
424+ buf[1] = INST_BYTE1 (inst1); 420+ buf[1] = INST_BYTE1 (inst1);
@@ -430,8 +426,8 @@ index eca060b262..aef54ad83f 100644
430+ for (i = 0; i < INST_WORD_SIZE; i++) 426+ for (i = 0; i < INST_WORD_SIZE; i++)
431+ buf[i + INST_WORD_SIZE + 4] = buf[i]; 427+ buf[i + INST_WORD_SIZE + 4] = buf[i];
432+ 428+
433+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 429+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
434+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 430+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
435+ if (opcode1 == NULL || opcode2 ==NULL) 431+ if (opcode1 == NULL || opcode2 ==NULL)
436+ { 432+ {
437+ as_bad (_("unknown opcode \"%s\""), "imml"); 433+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -447,11 +443,9 @@ index eca060b262..aef54ad83f 100644
447+ inst2 = opcode1->bit_sequence; 443+ inst2 = opcode1->bit_sequence;
448+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 444+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
449+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; 445+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
450 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) 446+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
451- fixP->fx_r_type = BFD_RELOC_64;
452+ fixP->fx_r_type = BFD_RELOC_64; 447+ fixP->fx_r_type = BFD_RELOC_64;
453 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) 448+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
454- fixP->fx_r_type = BFD_RELOC_64_PCREL;
455+ fixP->fx_r_type = BFD_RELOC_64_PCREL; 449+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
456+ buf[0] = INST_BYTE0 (inst1); 450+ buf[0] = INST_BYTE0 (inst1);
457+ buf[1] = INST_BYTE1 (inst1); 451+ buf[1] = INST_BYTE1 (inst1);
@@ -469,9 +463,9 @@ index eca060b262..aef54ad83f 100644
469+ for (i = 0; i < INST_WORD_SIZE; i++) 463+ for (i = 0; i < INST_WORD_SIZE; i++)
470+ buf[i + INST_WORD_SIZE] = buf[i]; 464+ buf[i + INST_WORD_SIZE] = buf[i];
471 /* Generate the imm instruction. */ 465 /* Generate the imm instruction. */
472 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 466 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
473 if (opcode1 == NULL) 467 if (opcode1 == NULL)
474@@ -2770,12 +2951,11 @@ md_apply_fix (fixS * fixP, 468@@ -2778,12 +2958,11 @@ md_apply_fix (fixS * fixP,
475 inst1 = opcode1->bit_sequence; 469 inst1 = opcode1->bit_sequence;
476 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 470 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
477 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; 471 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
@@ -485,24 +479,24 @@ index eca060b262..aef54ad83f 100644
485 /* Add the value only if the symbol is defined. */ 479 /* Add the value only if the symbol is defined. */
486 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) 480 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
487 { 481 {
488@@ -2807,21 +2987,41 @@ md_apply_fix (fixS * fixP, 482@@ -2816,21 +2995,41 @@ md_apply_fix (fixS * fixP,
489 /* Add an imm instruction. First save the current instruction. */
490 for (i = 0; i < INST_WORD_SIZE; i++) 483 for (i = 0; i < INST_WORD_SIZE; i++)
491 buf[i + INST_WORD_SIZE] = buf[i]; 484 buf[i + INST_WORD_SIZE] = buf[i];
485 /* Generate the imm instruction. */
492- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) 486- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
493- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 487- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
494+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) { 488+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) {
495+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887) 489+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
496+ { 490+ {
497+ for (i = 0; i < INST_WORD_SIZE; i++) 491+ for (i = 0; i < INST_WORD_SIZE; i++)
498+ buf[i + INST_WORD_SIZE] = buf[i]; 492+ buf[i + INST_WORD_SIZE] = buf[i];
499+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 493+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
500+ } 494+ }
501+ else { 495+ else {
502+ for (i = 0; i < INST_WORD_SIZE; i++) 496+ for (i = 0; i < INST_WORD_SIZE; i++)
503+ buf[i + INST_WORD_SIZE + 4] = buf[i]; 497+ buf[i + INST_WORD_SIZE + 4] = buf[i];
504+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 498+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
505+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 499+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
506+ inst2 = opcode2->bit_sequence; 500+ inst2 = opcode2->bit_sequence;
507+ 501+
508+ /* We can fixup call to a defined non-global address 502+ /* We can fixup call to a defined non-global address
@@ -514,7 +508,7 @@ index eca060b262..aef54ad83f 100644
514+ } 508+ }
515+ } 509+ }
516 else 510 else
517 opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); 511 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
518 if (opcode1 == NULL) 512 if (opcode1 == NULL)
519 { 513 {
520+ for (i = 0; i < INST_WORD_SIZE; i++) 514+ for (i = 0; i < INST_WORD_SIZE; i++)
@@ -532,7 +526,7 @@ index eca060b262..aef54ad83f 100644
532 within the same section only. */ 526 within the same section only. */
533 buf[0] = INST_BYTE0 (inst1); 527 buf[0] = INST_BYTE0 (inst1);
534diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h 528diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
535index c1b453c95e..ba0b3f8b62 100644 529index c25383f2de9..6f9a5a60dab 100644
536--- a/opcodes/microblaze-opc.h 530--- a/opcodes/microblaze-opc.h
537+++ b/opcodes/microblaze-opc.h 531+++ b/opcodes/microblaze-opc.h
538@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; 532@@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr";
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
index e8c55106..02940730 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
@@ -1,18 +1,18 @@
1From 2c051a6d5326e34cb4a3170073cda17e7269055d Mon Sep 17 00:00:00 2001 1From 6b6b0332aa2dcb4fa86911031cafd1cc5442b17f Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 22 Jan 2020 16:31:12 +0530 3Date: Wed, 3 Nov 2021 12:13:32 +0530
4Subject: [PATCH 28/52] Fixed bug in generation of IMML instruction for the new 4Subject: [PATCH 27/38] Fixed bug in generation of IMML instruction for the
5 MB-64 instructions with single register.
6 5
6new MB-64 instructions with single register.
7--- 7---
8 gas/config/tc-microblaze.c | 50 +++++++++++++++++++++++++++++++++++--- 8 gas/config/tc-microblaze.c | 50 +++++++++++++++++++++++++++++++++++---
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 aef54ad83f..647cfb6869 100644 12index 18dd8524949..68f19c965ef 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@@ -1639,12 +1639,56 @@ md_assemble (char * str) 15@@ -1643,12 +1643,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);
@@ -29,7 +29,7 @@ index aef54ad83f..647cfb6869 100644
29+ /* Needs an immediate inst. */ 29+ /* Needs an immediate inst. */
30+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) 30+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
31+ { 31+ {
32+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 32+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
33+ if (opcode1 == NULL) 33+ if (opcode1 == NULL)
34+ { 34+ {
35+ as_bad (_("unknown opcode \"%s\""), "imml"); 35+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -44,8 +44,8 @@ index aef54ad83f..647cfb6869 100644
44+ output = frag_more (isize); 44+ output = frag_more (isize);
45+ } 45+ }
46+ else { 46+ else {
47+ opcode2 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 47+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
48+ opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); 48+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
49+ if (opcode1 == NULL || opcode2 == NULL) 49+ if (opcode1 == NULL || opcode2 == NULL)
50+ { 50+ {
51+ as_bad (_("unknown opcode \"%s\""), "imml"); 51+ as_bad (_("unknown opcode \"%s\""), "imml");
@@ -70,7 +70,7 @@ index aef54ad83f..647cfb6869 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@@ -2138,8 +2182,8 @@ md_assemble (char * str) 73@@ -2146,8 +2190,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 {
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/0028-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
index abfcdabc..d738e930 100644
--- 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/0028-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
@@ -1,7 +1,7 @@
1From 77751e719ba1470f3dc869ae309485adb02819b6 Mon Sep 17 00:00:00 2001 1From 851a3d7218539c1a886edd92c57efe36b85e29be Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530 3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH 29/52] [Patch,MicroBlaze m64] : This patch will remove imml 0 4Subject: [PATCH 28/38] [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 5 and imml -1 instructions when the offset is less than 16 bit for Type A
6 branch EA instructions. 6 branch EA instructions.
7 7
@@ -10,10 +10,10 @@ Subject: [PATCH 29/52] [Patch,MicroBlaze m64] : This patch will remove imml 0
10 1 file changed, 2 insertions(+), 4 deletions(-) 10 1 file changed, 2 insertions(+), 4 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 647cfb6869..e565b2a99d 100644 13index 68f19c965ef..805d250b6ac 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@@ -2150,9 +2150,7 @@ md_assemble (char * str) 16@@ -2158,9 +2158,7 @@ md_assemble (char * str)
17 if (exp.X_op != O_constant) 17 if (exp.X_op != O_constant)
18 { 18 {
19 char *opc; 19 char *opc;
@@ -24,7 +24,7 @@ index 647cfb6869..e565b2a99d 100644
24 opc = str_microblaze_64; 24 opc = str_microblaze_64;
25 else 25 else
26 opc = NULL; 26 opc = NULL;
27@@ -2916,7 +2914,7 @@ md_apply_fix (fixS * fixP, 27@@ -2923,7 +2921,7 @@ md_apply_fix (fixS * fixP,
28 case BFD_RELOC_MICROBLAZE_64: 28 case BFD_RELOC_MICROBLAZE_64:
29 case BFD_RELOC_MICROBLAZE_64_PCREL: 29 case BFD_RELOC_MICROBLAZE_64_PCREL:
30 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64 30 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
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/0029-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
index b8f8b8bd..f220f611 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
@@ -1,7 +1,7 @@
1From 2a43e06f14cac633d87f5b213a6bacd16085967f Mon Sep 17 00:00:00 2001 1From aa1705bc097efd5003e5d818e1e2d12ff5fc0c94 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Jun 2020 21:20:26 +0530 3Date: Wed, 17 Jun 2020 21:20:26 +0530
4Subject: [PATCH 30/52] [Patch,MicroBlaze] : improper address mapping of 4Subject: [PATCH 29/38] [Patch,MicroBlaze] : improper address mapping of
5 PROVIDE directive symbols[DTOR_END] are causing runtime loops and we don't 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 6 need to override PROVIDE symbols if symbols are defined in libraries and
7 linker so I am disabling override for PROVIDE symbols. 7 linker so I am disabling override for PROVIDE symbols.
@@ -11,7 +11,7 @@ Subject: [PATCH 30/52] [Patch,MicroBlaze] : improper address mapping of
11 1 file changed, 9 insertions(+), 3 deletions(-) 11 1 file changed, 9 insertions(+), 3 deletions(-)
12 12
13diff --git a/ld/ldlang.c b/ld/ldlang.c 13diff --git a/ld/ldlang.c b/ld/ldlang.c
14index 9977195074..a2c44cf719 100644 14index 37b64c89ee1..5b179daf8f1 100644
15--- a/ld/ldlang.c 15--- a/ld/ldlang.c
16+++ b/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) 17@@ -3657,10 +3657,16 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0056-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch
index b69b5a32..85f63b41 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0056-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0030-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch
@@ -1,8 +1,8 @@
1From 9897f7ce32daafc2d9438820162df363f4b53274 Mon Sep 17 00:00:00 2001 1From 34c213ce7e7ef7e1f8fd91b686da655df43efca2 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilinx.com> 2From: Nagaraju Mekala <nmekala@xilinx.com>
3Date: Tue, 20 Apr 2021 21:22:06 +0530 3Date: Tue, 20 Apr 2021 21:22:06 +0530
4Subject: [PATCH 56] [Patch, microblaze]:Changing the long to long long as in 4Subject: [PATCH 30/38] [Patch, microblaze]:Changing the long to long long as
5 Windows long is 32-bit but we need the variable to be 64-bit 5 in Windows long is 32-bit but we need the variable to be 64-bit
6 6
7Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 7Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
8--- 8---
@@ -10,10 +10,10 @@ Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
10 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
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 df7088d6c3..34222cc866 100644 13index 805d250b6ac..84f60c029c1 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@@ -1033,7 +1033,7 @@ md_assemble (char * str) 16@@ -1017,7 +1017,7 @@ md_assemble (char * str)
17 unsigned reg2; 17 unsigned reg2;
18 unsigned reg3; 18 unsigned reg3;
19 unsigned isize; 19 unsigned isize;
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-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 83b293f3..c96b5757 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0031-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 c45a69deeb210ebdb80cf055cef9e62bd0bda053 Mon Sep 17 00:00:00 2001 1From 2a8a925c35909543738ccacafcdc7000525a27c6 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Jul 2020 12:38:11 -0500 3Date: Mon, 8 Nov 2021 21:57:13 +0530
4Subject: [PATCH 31/52] gas: revert moving of md_pseudo_table from const 4Subject: [PATCH 31/38] 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,7 +18,7 @@ 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 e565b2a99d..c6ca913f8b 100644 21index 84f60c029c1..dfcd0ab1569 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@@ -385,6 +385,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) 24@@ -385,6 +385,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
@@ -57,7 +57,7 @@ index e565b2a99d..c6ca913f8b 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@@ -3448,7 +3459,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED) 60@@ -3456,7 +3467,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 e565b2a99d..c6ca913f8b 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 5bdfe5c347..da1738d67a 100644 69index f1fa7495e29..c9722307dea 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/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0032-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
index 8891a77f..83e5a42b 100644
--- 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
@@ -1,7 +1,7 @@
1From 7b285c827edbc34cf79d4ed0f46cdfd4916b687c Mon Sep 17 00:00:00 2001 1From 231121a6d5ff51bcf578c06288181db5f800d66f Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 30 Nov 2020 16:17:36 -0800 3Date: Mon, 8 Nov 2021 22:01:23 +0530
4Subject: [PATCH 32/52] ld/emulparams/elf64microblaze: Fix emulation generation 4Subject: [PATCH 32/38] ld/emulparams/elf64microblaze: Fix emulation generation
5 5
6Compilation fails when building ld-new with: 6Compilation fails when building ld-new with:
7 7
@@ -17,7 +17,7 @@ Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
17 2 files changed, 2 insertions(+), 2 deletions(-) 17 2 files changed, 2 insertions(+), 2 deletions(-)
18 18
19diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh 19diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
20index 9c7b0eb708..7b4c7c411b 100644 20index 9c7b0eb7080..7b4c7c411bd 100644
21--- a/ld/emulparams/elf64microblaze.sh 21--- a/ld/emulparams/elf64microblaze.sh
22+++ b/ld/emulparams/elf64microblaze.sh 22+++ b/ld/emulparams/elf64microblaze.sh
23@@ -19,5 +19,5 @@ NOP=0x80000000 23@@ -19,5 +19,5 @@ NOP=0x80000000
@@ -28,7 +28,7 @@ index 9c7b0eb708..7b4c7c411b 100644
28+TEMPLATE_NAME=elf 28+TEMPLATE_NAME=elf
29 #GENERATE_SHLIB_SCRIPT=yes 29 #GENERATE_SHLIB_SCRIPT=yes
30diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh 30diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
31index 9c7b0eb708..7b4c7c411b 100644 31index 9c7b0eb7080..7b4c7c411bd 100644
32--- a/ld/emulparams/elf64microblazeel.sh 32--- a/ld/emulparams/elf64microblazeel.sh
33+++ b/ld/emulparams/elf64microblazeel.sh 33+++ b/ld/emulparams/elf64microblazeel.sh
34@@ -19,5 +19,5 @@ NOP=0x80000000 34@@ -19,5 +19,5 @@ NOP=0x80000000
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
deleted file mode 100644
index b296e1b1..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
+++ /dev/null
@@ -1,435 +0,0 @@
1From 3f506a7c6a8f7b746102276f3c41a7b11bd7ac3c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 23 Jan 2017 19:07:44 +0530
4Subject: [PATCH 33/52] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux
6
7gdbserver needs to initialise the microblaze registers
8
9other archs use this step to run a *_arch_setup() to carry out all
10architecture specific setup - may need to add in future
11
12 * add linux-ptrace.o to gdbserver configure
13 * Update breakpoint opcode
14 * fix segfault on connecting gdbserver
15 * add microblaze_linux_memory_remove_breakpoint
16 * add set_solib_svr4_fetch_link_map_offsets
17 * add set_gdbarch_fetch_tls_load_module_address
18 * Force reading of r0 as 0, prevent stores
19
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22---
23 gdb/configure.host | 3 +
24 gdb/microblaze-linux-tdep.c | 29 ++++-
25 gdb/microblaze-tdep.c | 35 +++++-
26 gdb/microblaze-tdep.h | 4 +-
27 gdb/regformats/reg-microblaze.dat | 41 +++++++
28 gdbserver/linux-microblaze-low.c | 189 ++++++++++++++++++++++++++++++
29 6 files changed, 298 insertions(+), 3 deletions(-)
30 create mode 100644 gdb/regformats/reg-microblaze.dat
31 create mode 100644 gdbserver/linux-microblaze-low.c
32
33diff --git a/gdb/configure.host b/gdb/configure.host
34index ce52823729..cf1a08e8b2 100644
35--- a/gdb/configure.host
36+++ b/gdb/configure.host
37@@ -65,6 +65,7 @@ hppa*) gdb_host_cpu=pa ;;
38 i[34567]86*) gdb_host_cpu=i386 ;;
39 m68*) gdb_host_cpu=m68k ;;
40 mips*) gdb_host_cpu=mips ;;
41+microblaze*) gdb_host_cpu=microblaze ;;
42 powerpc* | rs6000) gdb_host_cpu=powerpc ;;
43 sparcv9 | sparc64) gdb_host_cpu=sparc ;;
44 s390*) gdb_host_cpu=s390 ;;
45@@ -133,6 +134,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
46 mips*-*-freebsd*) gdb_host=fbsd ;;
47 mips64*-*-openbsd*) gdb_host=obsd64 ;;
48
49+microblaze*-*linux*) gdb_host=linux ;;
50+
51 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
52 gdb_host=aix ;;
53 powerpc*-*-freebsd*) gdb_host=fbsd ;;
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
192new file mode 100644
193index 0000000000..bd8a438442
194--- /dev/null
195+++ b/gdb/regformats/reg-microblaze.dat
196@@ -0,0 +1,41 @@
197+name:microblaze
198+expedite:r1,pc
199+32:r0
200+32:r1
201+32:r2
202+32:r3
203+32:r4
204+32:r5
205+32:r6
206+32:r7
207+32:r8
208+32:r9
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
239new file mode 100644
240index 0000000000..cba5d6fc58
241--- /dev/null
242+++ b/gdbserver/linux-microblaze-low.c
243@@ -0,0 +1,189 @@
244+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
245+ GDB.
246+ Copyright (C) 1995-2013 Free Software Foundation, Inc.
247+
248+ This file is part of GDB.
249+
250+ This program is free software; you can redistribute it and/or modify
251+ it under the terms of the GNU General Public License as published by
252+ the Free Software Foundation; either version 3 of the License, or
253+ (at your option) any later version.
254+
255+ This program is distributed in the hope that it will be useful,
256+ but WITHOUT ANY WARRANTY; without even the implied warranty of
257+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
258+ GNU General Public License for more details.
259+
260+ You should have received a copy of the GNU General Public License
261+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
262+
263+#include "server.h"
264+#include "linux-low.h"
265+
266+#include <asm/ptrace.h>
267+#include <sys/procfs.h>
268+#include <sys/ptrace.h>
269+
270+#include "gdb_proc_service.h"
271+
272+static int microblaze_regmap[] =
273+ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3),
274+ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7),
275+ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11),
276+ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15),
277+ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19),
278+ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23),
279+ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27),
280+ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31),
281+ PT_PC, PT_MSR, PT_EAR, PT_ESR,
282+ PT_FSR
283+ };
284+
285+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
286+
287+/* Defined in auto-generated file microblaze-linux.c. */
288+void init_registers_microblaze (void);
289+
290+static int
291+microblaze_cannot_store_register (int regno)
292+{
293+ if (microblaze_regmap[regno] == -1 || regno == 0)
294+ return 1;
295+
296+ return 0;
297+}
298+
299+static int
300+microblaze_cannot_fetch_register (int regno)
301+{
302+ return 0;
303+}
304+
305+static CORE_ADDR
306+microblaze_get_pc (struct regcache *regcache)
307+{
308+ unsigned long pc;
309+
310+ collect_register_by_name (regcache, "pc", &pc);
311+ return (CORE_ADDR) pc;
312+}
313+
314+static void
315+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
316+{
317+ unsigned long newpc = pc;
318+
319+ supply_register_by_name (regcache, "pc", &newpc);
320+}
321+
322+/* dbtrap insn */
323+/* brki r16, 0x18; */
324+static const unsigned long microblaze_breakpoint = 0xba0c0018;
325+#define microblaze_breakpoint_len 4
326+
327+static int
328+microblaze_breakpoint_at (CORE_ADDR where)
329+{
330+ unsigned long insn;
331+
332+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
333+ if (insn == microblaze_breakpoint)
334+ return 1;
335+ /* If necessary, recognize more trap instructions here. GDB only uses the
336+ one. */
337+ return 0;
338+}
339+
340+static CORE_ADDR
341+microblaze_reinsert_addr (struct regcache *regcache)
342+{
343+ unsigned long pc;
344+ collect_register_by_name (regcache, "r15", &pc);
345+ return pc;
346+}
347+
348+#ifdef HAVE_PTRACE_GETREGS
349+
350+static void
351+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
352+{
353+ int size = register_size (regno);
354+
355+ memset (buf, 0, sizeof (long));
356+
357+ if (size < sizeof (long))
358+ collect_register (regcache, regno, buf + sizeof (long) - size);
359+ else
360+ collect_register (regcache, regno, buf);
361+}
362+
363+static void
364+microblaze_supply_ptrace_register (struct regcache *regcache,
365+ int regno, const char *buf)
366+{
367+ int size = register_size (regno);
368+
369+ if (regno == 0) {
370+ unsigned long regbuf_0 = 0;
371+ /* clobbering r0 so that it is always 0 as enforced by hardware */
372+ supply_register (regcache, regno, (const char*)&regbuf_0);
373+ } else {
374+ if (size < sizeof (long))
375+ supply_register (regcache, regno, buf + sizeof (long) - size);
376+ else
377+ supply_register (regcache, regno, buf);
378+ }
379+}
380+
381+/* Provide only a fill function for the general register set. ps_lgetregs
382+ will use this for NPTL support. */
383+
384+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
385+{
386+ int i;
387+
388+ for (i = 0; i < 32; i++)
389+ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
390+}
391+
392+static void
393+microblaze_store_gregset (struct regcache *regcache, const void *buf)
394+{
395+ int i;
396+
397+ for (i = 0; i < 32; i++)
398+ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
399+}
400+
401+#endif /* HAVE_PTRACE_GETREGS */
402+
403+struct regset_info target_regsets[] = {
404+#ifdef HAVE_PTRACE_GETREGS
405+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
406+ { 0, 0, 0, -1, -1, NULL, NULL },
407+#endif /* HAVE_PTRACE_GETREGS */
408+ { 0, 0, 0, -1, -1, NULL, NULL }
409+};
410+
411+struct linux_target_ops the_low_target = {
412+ init_registers_microblaze,
413+ microblaze_num_regs,
414+ microblaze_regmap,
415+ NULL,
416+ microblaze_cannot_fetch_register,
417+ microblaze_cannot_store_register,
418+ NULL, /* fetch_register */
419+ microblaze_get_pc,
420+ microblaze_set_pc,
421+ (const unsigned char *) &microblaze_breakpoint,
422+ microblaze_breakpoint_len,
423+ microblaze_reinsert_addr,
424+ 0,
425+ microblaze_breakpoint_at,
426+ NULL,
427+ NULL,
428+ NULL,
429+ NULL,
430+ microblaze_collect_ptrace_register,
431+ microblaze_supply_ptrace_register,
432+};
433--
4342.17.1
435
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver.patch
new file mode 100644
index 00000000..402566be
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver.patch
@@ -0,0 +1,1580 @@
1From bf7c7531e54e2f1b995e7ba52213c1df585d7fcc Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 23 Jan 2017 19:07:44 +0530
4Subject: [PATCH 33/38] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux
6
7gdbserver needs to initialise the microblaze registers
8
9other archs use this step to run a *_arch_setup() to carry out all
10architecture specific setup - may need to add in future
11
12 * add linux-ptrace.o to gdbserver configure
13 * Update breakpoint opcode
14 * fix segfault on connecting gdbserver
15 * add microblaze_linux_memory_remove_breakpoint
16 * add set_solib_svr4_fetch_link_map_offsets
17 * add set_gdbarch_fetch_tls_load_module_address
18 * Force reading of r0 as 0, prevent stores
19
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22
23Conflicts:
24 gdb/gdbserver/Makefile.in
25 gdb/gdbserver/configure.srv
26---
27 gdb/configure.host | 3 +
28 gdb/features/microblaze-linux.xml | 12 +
29 gdb/gdbserver/Makefile.in | 712 +++++++++++++++++++++++++++
30 gdb/gdbserver/configure.srv | 398 +++++++++++++++
31 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++
32 gdb/microblaze-linux-tdep.c | 29 +-
33 gdb/microblaze-tdep.c | 35 +-
34 gdb/microblaze-tdep.h | 4 +-
35 gdb/regformats/reg-microblaze.dat | 41 ++
36 9 files changed, 1420 insertions(+), 3 deletions(-)
37 create mode 100644 gdb/features/microblaze-linux.xml
38 create mode 100644 gdb/gdbserver/Makefile.in
39 create mode 100644 gdb/gdbserver/configure.srv
40 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
41 create mode 100644 gdb/regformats/reg-microblaze.dat
42
43diff --git a/gdb/configure.host b/gdb/configure.host
44index e94a19b0332..4d73af78bc3 100644
45--- a/gdb/configure.host
46+++ b/gdb/configure.host
47@@ -66,6 +66,7 @@ hppa*) gdb_host_cpu=pa ;;
48 i[34567]86*) gdb_host_cpu=i386 ;;
49 m68*) gdb_host_cpu=m68k ;;
50 mips*) gdb_host_cpu=mips ;;
51+microblaze*) gdb_host_cpu=microblaze ;;
52 powerpc* | rs6000) gdb_host_cpu=powerpc ;;
53 sparcv9 | sparc64) gdb_host_cpu=sparc ;;
54 s390*) gdb_host_cpu=s390 ;;
55@@ -136,6 +137,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
56 mips*-*-freebsd*) gdb_host=fbsd ;;
57 mips64*-*-openbsd*) gdb_host=obsd64 ;;
58
59+microblaze*-*linux*) gdb_host=linux ;;
60+
61 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
62 gdb_host=aix ;;
63 powerpc*-*-freebsd*) gdb_host=fbsd ;;
64diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
65new file mode 100644
66index 00000000000..8983e66eb3d
67--- /dev/null
68+++ b/gdb/features/microblaze-linux.xml
69@@ -0,0 +1,12 @@
70+<?xml version="1.0"?>
71+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
72+
73+ Copying and distribution of this file, with or without modification,
74+ are permitted in any medium without royalty provided the copyright
75+ notice and this notice are preserved. -->
76+
77+<!DOCTYPE target SYSTEM "gdb-target.dtd">
78+<target>
79+ <osabi>GNU/Linux</osabi>
80+ <xi:include href="microblaze-core.xml"/>
81+</target>
82diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
83new file mode 100644
84index 00000000000..fb4762a22d5
85--- /dev/null
86+++ b/gdb/gdbserver/Makefile.in
87@@ -0,0 +1,712 @@
88+# Copyright (C) 1989-2020 Free Software Foundation, Inc.
89+
90+# This file is part of GDB.
91+
92+# This program is free software; you can redistribute it and/or modify
93+# it under the terms of the GNU General Public License as published by
94+# the Free Software Foundation; either version 3 of the License, or
95+# (at your option) any later version.
96+#
97+# This program is distributed in the hope that it will be useful,
98+# but WITHOUT ANY WARRANTY; without even the implied warranty of
99+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
100+# GNU General Public License for more details.
101+#
102+# You should have received a copy of the GNU General Public License
103+# along with this program. If not, see <http://www.gnu.org/licenses/>.
104+
105+# Please keep lists in this file sorted alphabetically, with one item per line.
106+# See gdb/Makefile.in for guidelines on ordering files and directories.
107+
108+prefix = @prefix@
109+exec_prefix = @exec_prefix@
110+
111+host_alias = @host_noncanonical@
112+target_alias = @target_noncanonical@
113+program_transform_name = @program_transform_name@
114+bindir = @bindir@
115+libdir = @libdir@
116+tooldir = $(libdir)/$(target_alias)
117+
118+datarootdir = @datarootdir@
119+datadir = @datadir@
120+mandir = @mandir@
121+man1dir = $(mandir)/man1
122+man2dir = $(mandir)/man2
123+man3dir = $(mandir)/man3
124+man4dir = $(mandir)/man4
125+man5dir = $(mandir)/man5
126+man6dir = $(mandir)/man6
127+man7dir = $(mandir)/man7
128+man8dir = $(mandir)/man8
129+man9dir = $(mandir)/man9
130+infodir = @infodir@
131+htmldir = $(prefix)/html
132+includedir = @includedir@
133+CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
134+
135+SHELL = @SHELL@
136+EXEEXT = @EXEEXT@
137+
138+INSTALL = @INSTALL@
139+INSTALL_PROGRAM = @INSTALL_PROGRAM@
140+INSTALL_DATA = @INSTALL_DATA@
141+RANLIB = @RANLIB@
142+
143+CC = @CC@
144+CXX = @CXX@
145+CXX_DIALECT = @CXX_DIALECT@
146+AR = @AR@
147+AR_FLAGS = rc
148+
149+# Dependency tracking information.
150+DEPMODE = @CCDEPMODE@
151+DEPDIR = @DEPDIR@
152+depcomp = $(SHELL) $(srcdir)/../../depcomp
153+
154+# Directory containing source files. Don't clean up the spacing,
155+# this exact string is matched for by the "configure" script.
156+srcdir = @srcdir@
157+abs_top_srcdir = @abs_top_srcdir@
158+abs_srcdir = @abs_srcdir@
159+VPATH = @srcdir@
160+
161+include $(srcdir)/../silent-rules.mk
162+
163+# Note that these are overridden by GNU make-specific code below if
164+# GNU make is used. The overrides implement dependency tracking.
165+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
166+COMPILE.post = -c -o $@
167+COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
168+POSTCOMPILE = @true
169+
170+# It is also possible that you will need to add -I/usr/include/sys to the
171+# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
172+# is where it should be according to Posix).
173+
174+# Set this up with gcc if you have gnu ld and the loader will print out
175+# line numbers for undefinded refs.
176+#CC_LD = g++ -static
177+CC_LD = $(CXX) $(CXX_DIALECT)
178+
179+# Where is the "include" directory? Traditionally ../include or ./include
180+INCLUDE_DIR = ${srcdir}/../../include
181+INCLUDE_DEP = $$(INCLUDE_DIR)
182+
183+LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
184+LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a
185+
186+# Where is ust? These will be empty if ust was not available.
187+ustlibs = @ustlibs@
188+ustinc = @ustinc@
189+
190+# gnulib
191+GNULIB_BUILDDIR = build-gnulib-gdbserver
192+LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
193+INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
194+
195+# Generated headers in the gnulib directory. These must be listed
196+# so that they are generated before other files are compiled.
197+GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
198+
199+# All the includes used for CFLAGS and for lint.
200+# -I. for config files.
201+# -I${srcdir} for our headers.
202+# -I$(srcdir)/../regformats for regdef.h.
203+#
204+# We do not include ../target or ../nat in here because headers
205+# in those directories should be included with the subdirectory.
206+# e.g.: "target/wait.h".
207+#
208+INCLUDE_CFLAGS = -I. -I${srcdir} \
209+ -I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
210+ $(INCGNU)
211+
212+# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
213+# from the config/ directory.
214+GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
215+#PROFILE_CFLAGS = -pg
216+
217+WARN_CFLAGS = @WARN_CFLAGS@
218+WERROR_CFLAGS = @WERROR_CFLAGS@
219+
220+WARN_CFLAGS_NO_FORMAT = `echo " $(WARN_CFLAGS) " \
221+ | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"`
222+
223+# These are specifically reserved for setting from the command line
224+# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
225+CFLAGS = @CFLAGS@
226+CXXFLAGS = @CXXFLAGS@
227+CPPFLAGS = @CPPFLAGS@
228+
229+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
230+PTHREAD_LIBS = @PTHREAD_LIBS@
231+
232+# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
233+INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
234+ ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
235+INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
236+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
237+
238+# LDFLAGS is specifically reserved for setting from the command line
239+# when running make.
240+LDFLAGS = @LDFLAGS@
241+INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
242+
243+# All source files that go into linking GDB remote server.
244+
245+SFILES = \
246+ $(srcdir)/debug.c \
247+ $(srcdir)/dll.c \
248+ $(srcdir)/gdbreplay.c \
249+ $(srcdir)/hostio.c \
250+ $(srcdir)/hostio-errno.c \
251+ $(srcdir)/i387-fp.c \
252+ $(srcdir)/inferiors.c \
253+ $(srcdir)/linux-aarch64-low.c \
254+ $(srcdir)/linux-arm-low.c \
255+ $(srcdir)/linux-bfin-low.c \
256+ $(srcdir)/linux-cris-low.c \
257+ $(srcdir)/linux-crisv32-low.c \
258+ $(srcdir)/linux-ia64-low.c \
259+ $(srcdir)/linux-low.c \
260+ $(srcdir)/linux-m32r-low.c \
261+ $(srcdir)/linux-m68k-low.c \
262+ $(srcdir)/linux-microblaze-low.c \
263+ $(srcdir)/linux-mips-low.c \
264+ $(srcdir)/linux-nios2-low.c \
265+ $(srcdir)/linux-ppc-low.c \
266+ $(srcdir)/linux-s390-low.c \
267+ $(srcdir)/linux-sh-low.c \
268+ $(srcdir)/linux-sparc-low.c \
269+ $(srcdir)/linux-tile-low.c \
270+ $(srcdir)/linux-x86-low.c \
271+ $(srcdir)/linux-xtensa-low.c \
272+ $(srcdir)/mem-break.c \
273+ $(srcdir)/proc-service.c \
274+ $(srcdir)/proc-service.list \
275+ $(srcdir)/regcache.c \
276+ $(srcdir)/remote-utils.c \
277+ $(srcdir)/server.c \
278+ $(srcdir)/symbol.c \
279+ $(srcdir)/target.c \
280+ $(srcdir)/thread-db.c \
281+ $(srcdir)/utils.c \
282+ $(srcdir)/win32-arm-low.c \
283+ $(srcdir)/win32-i386-low.c \
284+ $(srcdir)/win32-low.c \
285+ $(srcdir)/wincecompat.c \
286+ $(srcdir)/x86-low.c \
287+ $(srcdir)/arch/arm.c \
288+ $(srcdir)/arch/arm-get-next-pcs.c \
289+ $(srcdir)/arch/arm-linux.c \
290+ $(srcdir)/arch/ppc-linux-common.c \
291+ $(srcdir)/../alloc.c \
292+ $(srcdir)/gdbsupport/btrace-common.c \
293+ $(srcdir)/gdbsupport/buffer.c \
294+ $(srcdir)/gdbsupport/cleanups.c \
295+ $(srcdir)/gdbsupport/common-debug.c \
296+ $(srcdir)/gdbsupport/common-exceptions.c \
297+ $(srcdir)/gdbsupport/common-inferior.c \
298+ $(srcdir)/gdbsupport/common-regcache.c \
299+ $(srcdir)/gdbsupport/common-utils.c \
300+ $(srcdir)/gdbsupport/errors.c \
301+ $(srcdir)/gdbsupport/environ.c \
302+ $(srcdir)/gdbsupport/fileio.c \
303+ $(srcdir)/gdbsupport/filestuff.c \
304+ $(srcdir)/gdbsupport/job-control.c \
305+ $(srcdir)/gdbsupport/gdb-dlfcn.c \
306+ $(srcdir)/gdbsupport/gdb_tilde_expand.c \
307+ $(srcdir)/gdbsupport/gdb_vecs.c \
308+ $(srcdir)/gdbsupport/netstuff.c \
309+ $(srcdir)/gdbsupport/new-op.c \
310+ $(srcdir)/gdbsupport/pathstuff.c \
311+ $(srcdir)/gdbsupport/print-utils.c \
312+ $(srcdir)/gdbsupport/ptid.c \
313+ $(srcdir)/gdbsupport/rsp-low.c \
314+ $(srcdir)/gdbsupport/safe-strerror.c \
315+ $(srcdir)/gdbsupport/tdesc.c \
316+ $(srcdir)/gdbsupport/xml-utils.c \
317+ $(srcdir)/nat/aarch64-sve-linux-ptrace.c \
318+ $(srcdir)/nat/linux-btrace.c \
319+ $(srcdir)/nat/linux-namespaces.c \
320+ $(srcdir)/nat/linux-osdata.c \
321+ $(srcdir)/nat/linux-personality.c \
322+ $(srcdir)/nat/microblaze-linux.c \
323+ $(srcdir)/nat/mips-linux-watch.c \
324+ $(srcdir)/nat/ppc-linux.c \
325+ $(srcdir)/nat/fork-inferior.c \
326+ $(srcdir)/target/waitstatus.c
327+
328+DEPFILES = @GDBSERVER_DEPFILES@
329+
330+LIBOBJS = @LIBOBJS@
331+
332+SOURCES = $(SFILES)
333+TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
334+
335+OBS = \
336+ alloc.o \
337+ ax.o \
338+ gdbsupport/agent.o \
339+ gdbsupport/btrace-common.o \
340+ gdbsupport/buffer.o \
341+ gdbsupport/cleanups.o \
342+ gdbsupport/common-debug.o \
343+ gdbsupport/common-exceptions.o \
344+ gdbsupport/common-inferior.o \
345+ gdbsupport/job-control.o \
346+ gdbsupport/common-regcache.o \
347+ gdbsupport/common-utils.o \
348+ gdbsupport/errors.o \
349+ gdbsupport/environ.o \
350+ gdbsupport/fileio.o \
351+ gdbsupport/filestuff.o \
352+ gdbsupport/format.o \
353+ gdbsupport/gdb-dlfcn.o \
354+ gdbsupport/gdb_tilde_expand.o \
355+ gdbsupport/gdb_vecs.o \
356+ gdbsupport/netstuff.o \
357+ gdbsupport/new-op.o \
358+ gdbsupport/pathstuff.o \
359+ gdbsupport/print-utils.o \
360+ gdbsupport/ptid.o \
361+ gdbsupport/rsp-low.o \
362+ gdbsupport/safe-strerror.o \
363+ gdbsupport/signals.o \
364+ gdbsupport/signals-state-save-restore.o \
365+ gdbsupport/tdesc.o \
366+ gdbsupport/xml-utils.o \
367+ debug.o \
368+ dll.o \
369+ event-loop.o \
370+ hostio.o \
371+ inferiors.o \
372+ mem-break.o \
373+ notif.o \
374+ regcache.o \
375+ remote-utils.o \
376+ server.o \
377+ symbol.o \
378+ target.o \
379+ tdesc.o \
380+ tracepoint.o \
381+ utils.o \
382+ version.o \
383+ waitstatus.o \
384+ $(DEPFILES) \
385+ $(LIBOBJS) \
386+ $(XML_BUILTIN)
387+
388+GDBREPLAY_OBS = \
389+ gdbsupport/cleanups.o \
390+ gdbsupport/common-exceptions.o \
391+ gdbsupport/common-utils.o \
392+ gdbsupport/rsp-low.o \
393+ gdbsupport/errors.o \
394+ gdbsupport/netstuff.o \
395+ gdbsupport/print-utils.o \
396+ gdbsupport/safe-strerror.o \
397+ gdbreplay.o \
398+ utils.o \
399+ version.o
400+
401+GDBSERVER_LIBS = @GDBSERVER_LIBS@ $(PTHREAD_LIBS)
402+XM_CLIBS = @LIBS@
403+CDEPS = $(srcdir)/proc-service.list
404+
405+# XML files to compile in to gdbserver, if any.
406+XML_DIR = $(srcdir)/../features
407+XML_FILES = @srv_xmlfiles@
408+XML_BUILTIN = @srv_xmlbuiltin@
409+
410+IPA_DEPFILES = @IPA_DEPFILES@
411+extra_libraries = @extra_libraries@
412+
413+SUBDIRS = $(GNULIB_BUILDDIR) $(LIBIBERTY_BUILDDIR)
414+CLEANDIRS = $(SUBDIRS)
415+
416+# List of subdirectories in the build tree that must exist.
417+# This is used to force build failures in existing trees when
418+# a new directory is added.
419+# The format here is for the `case' shell command.
420+REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR) | $(LIBIBERTY_BUILDDIR)
421+
422+FLAGS_TO_PASS = \
423+ "prefix=$(prefix)" \
424+ "exec_prefix=$(exec_prefix)" \
425+ "infodir=$(infodir)" \
426+ "datarootdir=$(datarootdir)" \
427+ "docdir=$(docdir)" \
428+ "htmldir=$(htmldir)" \
429+ "pdfdir=$(pdfdir)" \
430+ "libdir=$(libdir)" \
431+ "mandir=$(mandir)" \
432+ "datadir=$(datadir)" \
433+ "includedir=$(includedir)" \
434+ "against=$(against)" \
435+ "DESTDIR=$(DESTDIR)" \
436+ "AR=$(AR)" \
437+ "AR_FLAGS=$(AR_FLAGS)" \
438+ "CC=$(CC)" \
439+ "CFLAGS=$(CFLAGS)" \
440+ "CXX=$(CXX)" \
441+ "CXXFLAGS=$(CXXFLAGS)" \
442+ "DLLTOOL=$(DLLTOOL)" \
443+ "LDFLAGS=$(LDFLAGS)" \
444+ "RANLIB=$(RANLIB)" \
445+ "MAKEINFO=$(MAKEINFO)" \
446+ "MAKEHTML=$(MAKEHTML)" \
447+ "MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
448+ "INSTALL=$(INSTALL)" \
449+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
450+ "INSTALL_DATA=$(INSTALL_DATA)" \
451+ "RUNTEST=$(RUNTEST)" \
452+ "RUNTESTFLAGS=$(RUNTESTFLAGS)"
453+
454+# All generated files which can be included by another file.
455+generated_files = config.h $(GNULIB_H)
456+
457+all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT) $(extra_libraries)
458+ @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
459+
460+# Traditionally "install" depends on "all". But it may be useful
461+# not to; for example, if the user has made some trivial change to a
462+# source file and doesn't care about rebuilding or just wants to save the
463+# time it takes for make to check that all is up to date.
464+# install-only is intended to address that need.
465+install: all
466+ @$(MAKE) $(FLAGS_TO_PASS) install-only
467+
468+install-only:
469+ n=`echo gdbserver | sed '$(program_transform_name)'`; \
470+ if [ x$$n = x ]; then n=gdbserver; else true; fi; \
471+ if [ x"$(IPA_DEPFILES)" != x ]; then \
472+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
473+ $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
474+ fi; \
475+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
476+ $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
477+ # Note that we run install and not install-only, as the latter
478+ # is not part of GNU standards and in particular not provided
479+ # in libiberty.
480+ @$(MAKE) $(FLAGS_TO_PASS) DO=install "DODIRS=$(SUBDIRS)" subdir_do
481+
482+uninstall: force
483+ n=`echo gdbserver | sed '$(program_transform_name)'`; \
484+ if [ x$$n = x ]; then n=gdbserver; else true; fi; \
485+ rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
486+ @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
487+
488+installcheck:
489+check:
490+info dvi pdf:
491+install-info:
492+install-pdf:
493+html:
494+install-html:
495+clean-info: force
496+ @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
497+
498+gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY)
499+ $(SILENCE) rm -f gdbserver$(EXEEXT)
500+ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
501+ -o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \
502+ $(GDBSERVER_LIBS) $(XM_CLIBS)
503+
504+$(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib
505+all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
506+ @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS="$(SUBDIRS)" subdir_do
507+.PHONY: all-lib
508+
509+gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY)
510+ $(SILENCE) rm -f gdbreplay$(EXEEXT)
511+ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
512+ -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) $(LIBGNU) \
513+ $(LIBIBERTY)
514+
515+IPA_OBJS = \
516+ alloc-ipa.o \
517+ ax-ipa.o \
518+ gdbsupport/common-utils-ipa.o \
519+ gdbsupport/errors-ipa.o \
520+ gdbsupport/format-ipa.o \
521+ gdbsupport/print-utils-ipa.o \
522+ gdbsupport/rsp-low-ipa.o \
523+ gdbsupport/safe-strerror-ipa.o \
524+ gdbsupport/tdesc-ipa.o \
525+ regcache-ipa.o \
526+ remote-utils-ipa.o \
527+ tdesc-ipa.o \
528+ tracepoint-ipa.o \
529+ utils-ipa.o \
530+ ${IPA_DEPFILES}
531+
532+IPA_LIB = libinproctrace.so
533+
534+$(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
535+ $(SILENCE) rm -f $(IPA_LIB)
536+ $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
537+ -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
538+ -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
539+
540+# Put the proper machine-specific files first, so M-. on a machine
541+# specific routine gets the one for the correct machine.
542+# The xyzzy stuff below deals with empty DEPFILES
543+TAGS: ${TAGFILES}
544+ etags `find ${srcdir}/../config -name $(DEPRECATED_TM_FILE) -print` \
545+ `find ${srcdir}/../config -name ${XM_FILE} -print` \
546+ `find ${srcdir}/../config -name ${NAT_FILE} -print` \
547+ `for i in yzzy ${DEPFILES}; do \
548+ if [ x$$i != xyzzy ]; then \
549+ echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \
550+ fi; \
551+ done` \
552+ ${TAGFILES}
553+tags: TAGS
554+
555+clean:
556+ rm -f *.o ${ADD_FILES} *~
557+ rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log
558+ rm -f $(IPA_LIB)
559+ rm -f *-generated.c
560+ rm -f stamp-xml
561+ rm -f $(DEPDIR)/*.Po
562+ for i in $(CONFIG_SRC_SUBDIR); do \
563+ rm -f $$i/*.o; \
564+ rm -f $$i/$(DEPDIR)/*; \
565+ done
566+ @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
567+
568+maintainer-clean realclean distclean: clean
569+ @$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
570+ rm -rf $(GNULIB_BUILDDIR)
571+ rm -f Makefile config.status config.h stamp-h config.log
572+ rm -f Makefile
573+ for i in $(CONFIG_SRC_SUBDIR); do \
574+ rmdir $$i/$(DEPDIR); \
575+ done
576+
577+subdir_do: force
578+ @for i in $(DODIRS); do \
579+ case $$i in \
580+ $(REQUIRED_SUBDIRS)) \
581+ if [ ! -f ./$$i/Makefile ] ; then \
582+ echo "Missing $$i/Makefile" >&2 ; \
583+ exit 1 ; \
584+ fi ;; \
585+ esac ; \
586+ if [ -f ./$$i/Makefile ] ; then \
587+ if (cd ./$$i; \
588+ $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
589+ else exit 1 ; fi ; \
590+ else true ; fi ; \
591+ done
592+
593+config.h: stamp-h ; @true
594+stamp-h: config.in config.status
595+ $(SHELL) ./config.status config.h
596+
597+Makefile: Makefile.in config.status
598+ $(SHELL) ./config.status $@
599+
600+$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../../gnulib/Makefile.in config.status
601+ @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
602+ CONFIG_COMMANDS="depfiles" \
603+ CONFIG_HEADERS= \
604+ CONFIG_LINKS= \
605+ $(SHELL) config.status
606+
607+config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
608+ $(SHELL) ./config.status --recheck
609+
610+# automatic rebuilding in automake-generated Makefiles requires
611+# this rule in the toplevel Makefile, which, with GNU make, causes
612+# the desired updates through the implicit regeneration of the Makefile
613+# and all of its prerequisites.
614+am--refresh:
615+ @:
616+
617+force:
618+
619+version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
620+ $(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/.. \
621+ $(host_alias) $(target_alias) $@
622+
623+xml-builtin-generated.c: stamp-xml; @true
624+stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
625+ $(SILENCE) rm -f xml-builtin.tmp
626+ $(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
627+ xml-builtin.tmp $(XML_FILES)
628+ $(SILENCE) $(SHELL) $(srcdir)/../../move-if-change xml-builtin.tmp xml-builtin-generated.c
629+ $(SILENCE) echo stamp > stamp-xml
630+
631+.PRECIOUS: xml-builtin.c
632+
633+# GNU Make has an annoying habit of putting *all* the Makefile variables
634+# into the environment, unless you include this target as a circumvention.
635+# Rumor is that this will be fixed (and this target can be removed)
636+# in GNU Make 4.0.
637+.NOEXPORT:
638+
639+# GNU Make 3.63 has a different problem: it keeps tacking command line
640+# overrides onto the definition of $(MAKE). This variable setting
641+# will remove them.
642+MAKEOVERRIDES =
643+
644+regdat_sh = $(srcdir)/../regformats/regdat.sh
645+
646+UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
647+
648+# Undo gnulib replacements for the IPA shared library build.
649+# The gnulib headers are still needed, but gnulib is not linked
650+# into the IPA lib so replacement apis don't work.
651+UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r
652+
653+# Note, we only build the IPA if -fvisibility=hidden is supported in
654+# the first place.
655+IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
656+ $(UNDO_GNULIB_CFLAGS) \
657+ -fPIC -DIN_PROCESS_AGENT \
658+ -fvisibility=hidden
659+
660+IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(COMPILE.post)
661+
662+# Rules for special cases.
663+
664+ax-ipa.o: ax.c
665+ $(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
666+ $(POSTCOMPILE)
667+
668+ax.o: ax.c
669+ $(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
670+ $(POSTCOMPILE)
671+
672+alloc-ipa.o: ../alloc.c
673+ $(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
674+ $(POSTCOMPILE)
675+
676+# Rules for objects that go in the in-process agent.
677+
678+arch/%-ipa.o: ../arch/%.c
679+ $(IPAGENT_COMPILE) $<
680+ $(POSTCOMPILE)
681+
682+gdbsupport/%-ipa.o: ../gdbsupport/%.c
683+ $(IPAGENT_COMPILE) $<
684+ $(POSTCOMPILE)
685+
686+%-ipa.o: %-generated.c
687+ $(IPAGENT_COMPILE) $<
688+ $(POSTCOMPILE)
689+
690+%-ipa.o: %.c
691+ $(IPAGENT_COMPILE) $<
692+ $(POSTCOMPILE)
693+
694+# Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one.
695+# Therefore, this one needs to be before "%.o: %.c" for it to be considered for
696+# files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c.
697+#
698+# Later versions of GNU Make choose the rule with the shortest stem, so it would
699+# work in any order.
700+
701+%-ipa.o: %-ipa.c
702+ $(IPAGENT_COMPILE) $<
703+ $(POSTCOMPILE)
704+
705+# Rules for objects that go in the gdbserver binary.
706+
707+arch/%.o: ../arch/%.c
708+ $(COMPILE) $<
709+ $(POSTCOMPILE)
710+
711+gdbsupport/%.o: ../gdbsupport/%.c
712+ $(COMPILE) $<
713+ $(POSTCOMPILE)
714+
715+%.o: %-generated.c
716+ $(COMPILE) $<
717+ $(POSTCOMPILE)
718+
719+%.o: %.c
720+ $(COMPILE) $<
721+ $(POSTCOMPILE)
722+
723+%.o: ../nat/%.c
724+ $(COMPILE) $<
725+ $(POSTCOMPILE)
726+
727+%.o: ../target/%.c
728+ $(COMPILE) $<
729+ $(POSTCOMPILE)
730+
731+%.o: ../%.c
732+ $(COMPILE) $<
733+ $(POSTCOMPILE)
734+
735+# Rules for register format descriptions. Suffix destination files with
736+# -generated to identify and clean them easily.
737+
738+%-generated.c: ../regformats/%.dat | $(regdat_sh)
739+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
740+
741+%-generated.c: ../regformats/arm/%.dat | $(regdat_sh)
742+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
743+
744+%-generated.c: ../regformats/i386/%.dat | $(regdat_sh)
745+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
746+
747+%-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
748+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
749+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
750+ $(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
751+
752+#
753+# Dependency tracking.
754+#
755+
756+ifeq ($(DEPMODE),depmode=gcc3)
757+# Note that we put the dependencies into a .Tpo file, then move them
758+# into place if the compile succeeds. We need this because gcc does
759+# not atomically write the dependency output file.
760+override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
761+ -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo
762+override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \
763+ $(@D)/$(DEPDIR)/$(basename $(@F)).Po
764+else
765+override COMPILE.pre = source='$<' object='$@' libtool=no \
766+ DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \
767+ $(CXX) -x c++ $(CXX_DIALECT)
768+# depcomp handles atomicity for us, so we don't need a postcompile
769+# step.
770+override POSTCOMPILE =
771+endif
772+
773+# A list of all the objects we might care about in this build, for
774+# dependency tracking.
775+all_object_files = $(OBS) $(GDBREPLAY_OBS) $(IPA_OBJS)
776+
777+# Ensure that generated files are created early. Use order-only
778+# dependencies if available. They require GNU make 3.80 or newer,
779+# and the .VARIABLES variable was introduced at the same time.
780+ifdef .VARIABLES
781+$(all_object_files): | $(generated_files)
782+else
783+$(all_object_files) : $(generated_files)
784+endif
785+
786+# All the .deps files to include.
787+all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
788+ $(dir $(dep))/$(DEPDIR)/$(notdir $(dep)))
789+
790+# Dependencies.
791+-include $(all_deps_files)
792+
793+# Disable implicit make rules.
794+include $(srcdir)/../disable-implicit-rules.mk
795+
796+# Do not delete intermediate files (e.g. *-generated.c).
797+.SECONDARY:
798+
799+# This is the end of "Makefile.in".
800diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
801new file mode 100644
802index 00000000000..e0d2b2fe04a
803--- /dev/null
804+++ b/gdb/gdbserver/configure.srv
805@@ -0,0 +1,398 @@
806+# Mappings from configuration triplets to gdbserver build options.
807+# This is invoked from the autoconf-generated configure script, to
808+# produce the appropriate Makefile substitutions.
809+
810+# This file sets the following shell variables:
811+# srv_regobj The register protocol appropriate for this target.
812+# srv_tgtobj Any other target-specific modules appropriate
813+# for this target.
814+# srv_hostio_err The object implementing the hostio_last_error
815+# target method.
816+# srv_xmlfiles All XML files which should be available for
817+# gdbserver in this configuration.
818+# ipa_obj Any other target-specific modules appropriate
819+# for this target's in-process agent.
820+#
821+# In addition, on GNU/Linux the following shell variables will be set:
822+# srv_linux_regsets Set to "yes" if ptrace(PTRACE_GETREGS) and friends
823+# may be available on this platform; unset otherwise.
824+# They will only be used if <sys/ptrace.h> defines
825+# PTRACE_GETREGS.
826+# srv_linux_usrregs Set to "yes" if we can get at registers via
827+# PTRACE_PEEKUSR / PTRACE_POKEUSR.
828+
829+# Default hostio_last_error implementation
830+srv_hostio_err_objs="hostio-errno.o"
831+
832+ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o"
833+
834+# Linux object files. This is so we don't have to repeat
835+# these files over and over again.
836+srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-waitpid.o linux-personality.o linux-namespaces.o fork-child.o fork-inferior.o"
837+
838+# Input is taken from the "${target}" variable.
839+
840+case "${target}" in
841+ aarch64*-*-linux*) srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
842+ srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
843+ srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o"
844+ srv_tgtobj="${srv_tgtobj} arch/aarch32.o"
845+ srv_tgtobj="${srv_tgtobj} arch/arm.o"
846+ srv_tgtobj="$srv_tgtobj aarch64-linux.o"
847+ srv_tgtobj="$srv_tgtobj arch/aarch64-insn.o"
848+ srv_tgtobj="$srv_tgtobj arch/aarch64.o"
849+ srv_tgtobj="$srv_tgtobj linux-aarch64-tdesc.o"
850+ srv_tgtobj="$srv_tgtobj aarch64-sve-linux-ptrace.o"
851+ srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
852+ srv_linux_regsets=yes
853+ srv_linux_thread_db=yes
854+ ipa_obj="linux-aarch64-ipa.o"
855+ ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o"
856+ ipa_obj="${ipa_obj} arch/aarch64-ipa.o"
857+ ;;
858+ arm*-*-linux*) srv_tgtobj="$srv_linux_obj linux-arm-low.o"
859+ srv_tgtobj="$srv_tgtobj linux-arm-tdesc.o"
860+ srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
861+ srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o"
862+ srv_tgtobj="${srv_tgtobj} arch/aarch32.o"
863+ srv_tgtobj="${srv_tgtobj} arch/arm.o"
864+ srv_tgtobj="${srv_tgtobj} arch/arm-linux.o"
865+ srv_tgtobj="${srv_tgtobj} arch/arm-get-next-pcs.o"
866+ srv_linux_usrregs=yes
867+ srv_linux_regsets=yes
868+ srv_linux_thread_db=yes
869+ ;;
870+ arm*-*-mingw32ce*) srv_regobj=reg-arm.o
871+ srv_tgtobj="win32-low.o win32-arm-low.o"
872+ srv_tgtobj="${srv_tgtobj} wincecompat.o"
873+ # hostio_last_error implementation is in win32-low.c
874+ srv_hostio_err_objs=""
875+ srv_mingw=yes
876+ srv_mingwce=yes
877+ ;;
878+ bfin-*-*linux*) srv_regobj=reg-bfin.o
879+ srv_tgtobj="$srv_linux_obj linux-bfin-low.o"
880+ srv_linux_usrregs=yes
881+ srv_linux_thread_db=yes
882+ ;;
883+ crisv32-*-linux*) srv_regobj=reg-crisv32.o
884+ srv_tgtobj="$srv_linux_obj linux-crisv32-low.o"
885+ srv_linux_regsets=yes
886+ srv_linux_thread_db=yes
887+ ;;
888+ cris-*-linux*) srv_regobj=reg-cris.o
889+ srv_tgtobj="$srv_linux_obj linux-cris-low.o"
890+ srv_linux_usrregs=yes
891+ srv_linux_thread_db=yes
892+ ;;
893+ i[34567]86-*-cygwin*) srv_regobj=""
894+ srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
895+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
896+ ;;
897+ i[34567]86-*-linux*) srv_tgtobj="${srv_tgtobj} arch/i386.o"
898+ srv_tgtobj="${srv_tgtobj} $srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
899+ srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
900+ srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
901+ srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
902+ srv_linux_usrregs=yes
903+ srv_linux_regsets=yes
904+ srv_linux_thread_db=yes
905+ srv_linux_btrace=yes
906+ ipa_obj="linux-i386-ipa.o linux-x86-tdesc-ipa.o"
907+ ipa_obj="${ipa_obj} arch/i386-ipa.o"
908+ ;;
909+ i[34567]86-*-lynxos*) srv_regobj=""
910+ srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
911+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
912+ srv_lynxos=yes
913+ ;;
914+ i[34567]86-*-mingw32ce*)
915+ srv_regobj=""
916+ srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
917+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
918+ srv_tgtobj="${srv_tgtobj} wincecompat.o"
919+ # hostio_last_error implementation is in win32-low.c
920+ srv_hostio_err_objs=""
921+ srv_mingw=yes
922+ srv_mingwce=yes
923+ ;;
924+ i[34567]86-*-mingw*) srv_regobj=""
925+ srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
926+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
927+ srv_mingw=yes
928+ ;;
929+ i[34567]86-*-nto*) srv_regobj=""
930+ srv_tgtobj="nto-low.o nto-x86-low.o arch/i386.o"
931+ srv_qnx="yes"
932+ ;;
933+ ia64-*-linux*) srv_regobj=reg-ia64.o
934+ srv_tgtobj="$srv_linux_obj linux-ia64-low.o"
935+ srv_linux_usrregs=yes
936+ ;;
937+ m32r*-*-linux*) srv_regobj=reg-m32r.o
938+ srv_tgtobj="$srv_linux_obj linux-m32r-low.o"
939+ srv_linux_usrregs=yes
940+ srv_linux_thread_db=yes
941+ ;;
942+ m68*-*-linux*) if test "$gdb_cv_m68k_is_coldfire" = yes; then
943+ srv_regobj=reg-cf.o
944+ else
945+ srv_regobj=reg-m68k.o
946+ fi
947+ srv_tgtobj="$srv_linux_obj linux-m68k-low.o"
948+ srv_linux_usrregs=yes
949+ srv_linux_regsets=yes
950+ srv_linux_thread_db=yes
951+ ;;
952+ m68*-*-uclinux*) if test "$gdb_cv_m68k_is_coldfire" = yes; then
953+ srv_regobj=reg-cf.o
954+ else
955+ srv_regobj=reg-m68k.o
956+ fi
957+ srv_tgtobj="$srv_linux_obj linux-m68k-low.o"
958+ srv_linux_usrregs=yes
959+ srv_linux_regsets=yes
960+ srv_linux_thread_db=yes
961+ ;;
962+ mips*-*-linux*) srv_regobj="mips-linux.o"
963+ srv_regobj="${srv_regobj} mips-dsp-linux.o"
964+ srv_regobj="${srv_regobj} mips64-linux.o"
965+ srv_regobj="${srv_regobj} mips64-dsp-linux.o"
966+ srv_tgtobj="$srv_linux_obj linux-mips-low.o"
967+ srv_tgtobj="${srv_tgtobj} mips-linux-watch.o"
968+ srv_xmlfiles="mips-linux.xml"
969+ srv_xmlfiles="${srv_xmlfiles} mips-dsp-linux.xml"
970+ srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
971+ srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
972+ srv_xmlfiles="${srv_xmlfiles} mips-fpu.xml"
973+ srv_xmlfiles="${srv_xmlfiles} mips-dsp.xml"
974+ srv_xmlfiles="${srv_xmlfiles} mips64-linux.xml"
975+ srv_xmlfiles="${srv_xmlfiles} mips64-dsp-linux.xml"
976+ srv_xmlfiles="${srv_xmlfiles} mips64-cpu.xml"
977+ srv_xmlfiles="${srv_xmlfiles} mips64-cp0.xml"
978+ srv_xmlfiles="${srv_xmlfiles} mips64-fpu.xml"
979+ srv_xmlfiles="${srv_xmlfiles} mips64-dsp.xml"
980+ srv_linux_regsets=yes
981+ srv_linux_usrregs=yes
982+ srv_linux_thread_db=yes
983+ ;;
984+ nios2*-*-linux*) srv_regobj="nios2-linux.o"
985+ srv_tgtobj="$srv_linux_obj linux-nios2-low.o"
986+ srv_xmlfiles="nios2-linux.xml"
987+ srv_xmlfiles="${srv_xmlfiles} nios2-cpu.xml"
988+ srv_linux_regsets=yes
989+ srv_linux_usrregs=yes
990+ srv_linux_thread_db=yes
991+ ;;
992+ microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
993+ srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
994+ srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
995+ srv_xmlfiles="microblaze-linux.xml"
996+ srv_linux_regsets=yes
997+ srv_linux_usrregs=yes
998+ srv_linux_thread_db=yes
999+ ;;
1000+ powerpc*-*-linux*) srv_regobj="powerpc-32l.o"
1001+ srv_regobj="${srv_regobj} powerpc-altivec32l.o"
1002+ srv_regobj="${srv_regobj} powerpc-vsx32l.o"
1003+ srv_regobj="${srv_regobj} powerpc-isa205-32l.o"
1004+ srv_regobj="${srv_regobj} powerpc-isa205-altivec32l.o"
1005+ srv_regobj="${srv_regobj} powerpc-isa205-vsx32l.o"
1006+ srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx32l.o"
1007+ srv_regobj="${srv_regobj} powerpc-isa207-vsx32l.o"
1008+ srv_regobj="${srv_regobj} powerpc-isa207-htm-vsx32l.o"
1009+ srv_regobj="${srv_regobj} powerpc-e500l.o"
1010+ srv_regobj="${srv_regobj} powerpc-64l.o"
1011+ srv_regobj="${srv_regobj} powerpc-altivec64l.o"
1012+ srv_regobj="${srv_regobj} powerpc-vsx64l.o"
1013+ srv_regobj="${srv_regobj} powerpc-isa205-64l.o"
1014+ srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
1015+ srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
1016+ srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx64l.o"
1017+ srv_regobj="${srv_regobj} powerpc-isa207-vsx64l.o"
1018+ srv_regobj="${srv_regobj} powerpc-isa207-htm-vsx64l.o"
1019+ srv_tgtobj="$srv_linux_obj linux-ppc-low.o ppc-linux.o"
1020+ srv_tgtobj="${srv_tgtobj} arch/ppc-linux-common.o"
1021+ srv_xmlfiles="rs6000/powerpc-32l.xml"
1022+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
1023+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx32l.xml"
1024+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-32l.xml"
1025+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec32l.xml"
1026+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx32l.xml"
1027+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml"
1028+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-vsx32l.xml"
1029+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-htm-vsx32l.xml"
1030+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml"
1031+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-vsx.xml"
1032+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
1033+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux.xml"
1034+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
1035+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu-isa205.xml"
1036+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-dscr.xml"
1037+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-ppr.xml"
1038+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-tar.xml"
1039+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-ebb.xml"
1040+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux-pmu.xml"
1041+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-spr.xml"
1042+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-core.xml"
1043+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-fpu.xml"
1044+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-altivec.xml"
1045+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-vsx.xml"
1046+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-ppr.xml"
1047+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-dscr.xml"
1048+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-tar.xml"
1049+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-e500l.xml"
1050+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml"
1051+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml"
1052+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec64l.xml"
1053+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx64l.xml"
1054+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-64l.xml"
1055+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec64l.xml"
1056+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx64l.xml"
1057+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml"
1058+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-vsx64l.xml"
1059+ srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-htm-vsx64l.xml"
1060+ srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml"
1061+ srv_xmlfiles="${srv_xmlfiles} rs6000/power64-linux.xml"
1062+ srv_xmlfiles="${srv_xmlfiles} rs6000/power64-htm-core.xml"
1063+ srv_linux_usrregs=yes
1064+ srv_linux_regsets=yes
1065+ srv_linux_thread_db=yes
1066+ ipa_obj="${ipa_ppc_linux_regobj} linux-ppc-ipa.o"
1067+ ;;
1068+ powerpc-*-lynxos*) srv_regobj="powerpc-32.o"
1069+ srv_tgtobj="lynx-low.o lynx-ppc-low.o"
1070+ srv_xmlfiles="rs6000/powerpc-32.xml"
1071+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
1072+ srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
1073+ srv_lynxos=yes
1074+ ;;
1075+ s390*-*-linux*) srv_regobj="s390-linux32.o"
1076+ srv_regobj="${srv_regobj} s390-linux32v1.o"
1077+ srv_regobj="${srv_regobj} s390-linux32v2.o"
1078+ srv_regobj="${srv_regobj} s390-linux64.o"
1079+ srv_regobj="${srv_regobj} s390-linux64v1.o"
1080+ srv_regobj="${srv_regobj} s390-linux64v2.o"
1081+ srv_regobj="${srv_regobj} s390-te-linux64.o"
1082+ srv_regobj="${srv_regobj} s390-vx-linux64.o"
1083+ srv_regobj="${srv_regobj} s390-tevx-linux64.o"
1084+ srv_regobj="${srv_regobj} s390-gs-linux64.o"
1085+ srv_regobj="${srv_regobj} s390x-linux64.o"
1086+ srv_regobj="${srv_regobj} s390x-linux64v1.o"
1087+ srv_regobj="${srv_regobj} s390x-linux64v2.o"
1088+ srv_regobj="${srv_regobj} s390x-te-linux64.o"
1089+ srv_regobj="${srv_regobj} s390x-vx-linux64.o"
1090+ srv_regobj="${srv_regobj} s390x-tevx-linux64.o"
1091+ srv_regobj="${srv_regobj} s390x-gs-linux64.o"
1092+ srv_tgtobj="$srv_linux_obj linux-s390-low.o"
1093+ srv_xmlfiles="s390-linux32.xml"
1094+ srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
1095+ srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
1096+ srv_xmlfiles="${srv_xmlfiles} s390-linux64.xml"
1097+ srv_xmlfiles="${srv_xmlfiles} s390-linux64v1.xml"
1098+ srv_xmlfiles="${srv_xmlfiles} s390-linux64v2.xml"
1099+ srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml"
1100+ srv_xmlfiles="${srv_xmlfiles} s390-vx-linux64.xml"
1101+ srv_xmlfiles="${srv_xmlfiles} s390-tevx-linux64.xml"
1102+ srv_xmlfiles="${srv_xmlfiles} s390-gs-linux64.xml"
1103+ srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
1104+ srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml"
1105+ srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml"
1106+ srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml"
1107+ srv_xmlfiles="${srv_xmlfiles} s390x-vx-linux64.xml"
1108+ srv_xmlfiles="${srv_xmlfiles} s390x-tevx-linux64.xml"
1109+ srv_xmlfiles="${srv_xmlfiles} s390x-gs-linux64.xml"
1110+ srv_xmlfiles="${srv_xmlfiles} s390-core32.xml"
1111+ srv_xmlfiles="${srv_xmlfiles} s390-core64.xml"
1112+ srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml"
1113+ srv_xmlfiles="${srv_xmlfiles} s390-acr.xml"
1114+ srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml"
1115+ srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml"
1116+ srv_xmlfiles="${srv_xmlfiles} s390-vx.xml"
1117+ srv_xmlfiles="${srv_xmlfiles} s390-gs.xml"
1118+ srv_xmlfiles="${srv_xmlfiles} s390-gsbc.xml"
1119+ srv_linux_usrregs=yes
1120+ srv_linux_regsets=yes
1121+ srv_linux_thread_db=yes
1122+ ipa_obj="linux-s390-ipa.o"
1123+ ipa_obj="${ipa_obj} s390-linux32-ipa.o"
1124+ ipa_obj="${ipa_obj} s390-linux32v1-ipa.o"
1125+ ipa_obj="${ipa_obj} s390-linux32v2-ipa.o"
1126+ ipa_obj="${ipa_obj} s390-linux64-ipa.o"
1127+ ipa_obj="${ipa_obj} s390-linux64v1-ipa.o"
1128+ ipa_obj="${ipa_obj} s390-linux64v2-ipa.o"
1129+ ipa_obj="${ipa_obj} s390-vx-linux64-ipa.o"
1130+ ipa_obj="${ipa_obj} s390-te-linux64-ipa.o"
1131+ ipa_obj="${ipa_obj} s390-tevx-linux64-ipa.o"
1132+ ipa_obj="${ipa_obj} s390-gs-linux64-ipa.o"
1133+ ipa_obj="${ipa_obj} s390x-linux64-ipa.o"
1134+ ipa_obj="${ipa_obj} s390x-linux64v1-ipa.o"
1135+ ipa_obj="${ipa_obj} s390x-linux64v2-ipa.o"
1136+ ipa_obj="${ipa_obj} s390x-vx-linux64-ipa.o"
1137+ ipa_obj="${ipa_obj} s390x-te-linux64-ipa.o"
1138+ ipa_obj="${ipa_obj} s390x-tevx-linux64-ipa.o"
1139+ ipa_obj="${ipa_obj} s390x-gs-linux64-ipa.o"
1140+ ;;
1141+ sh*-*-linux*) srv_regobj=reg-sh.o
1142+ srv_tgtobj="$srv_linux_obj linux-sh-low.o"
1143+ srv_linux_usrregs=yes
1144+ srv_linux_regsets=yes
1145+ srv_linux_thread_db=yes
1146+ ;;
1147+ sparc*-*-linux*) srv_regobj=reg-sparc64.o
1148+ srv_tgtobj="$srv_linux_obj linux-sparc-low.o"
1149+ srv_linux_regsets=yes
1150+ srv_linux_thread_db=yes
1151+ ;;
1152+ tic6x-*-uclinux) if $development; then
1153+ srv_regobj="tic6x-c64xp-linux.o"
1154+ srv_regobj="${srv_regobj} tic6x-c64x-linux.o"
1155+ srv_regobj="${srv_regobj} tic6x-c62x-linux.o"
1156+ else
1157+ srv_regobj=""
1158+ fi
1159+ srv_tgtobj="$srv_linux_obj linux-tic6x-low.o"
1160+ srv_tgtobj="${srv_tgtobj} arch/tic6x.o"
1161+ srv_linux_regsets=yes
1162+ srv_linux_usrregs=yes
1163+ srv_linux_thread_db=yes
1164+ ;;
1165+ x86_64-*-linux*) srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o"
1166+ srv_tgtobj="${srv_tgtobj} x86-dregs.o i387-fp.o"
1167+ srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o"
1168+ srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
1169+ srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
1170+ srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
1171+ srv_tgtobj="${srv_tgtobj} amd64-linux-siginfo.o"
1172+ srv_linux_usrregs=yes # This is for i386 progs.
1173+ srv_linux_regsets=yes
1174+ srv_linux_thread_db=yes
1175+ srv_linux_btrace=yes
1176+ ipa_obj="linux-amd64-ipa.o linux-x86-tdesc-ipa.o"
1177+ ipa_obj="${ipa_obj} arch/amd64-ipa.o"
1178+ ;;
1179+ x86_64-*-mingw*) srv_regobj=""
1180+ srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
1181+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
1182+ srv_mingw=yes
1183+ ;;
1184+ x86_64-*-cygwin*) srv_regobj=""
1185+ srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
1186+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
1187+ ;;
1188+
1189+ xtensa*-*-linux*) srv_regobj=reg-xtensa.o
1190+ srv_tgtobj="$srv_linux_obj linux-xtensa-low.o"
1191+ srv_linux_regsets=yes
1192+ srv_linux_thread_db=yes
1193+ ;;
1194+ tilegx-*-linux*) srv_regobj=reg-tilegx.o
1195+ srv_regobj="${srv_regobj} reg-tilegx32.o"
1196+ srv_tgtobj="$srv_linux_obj linux-tile-low.o"
1197+ srv_linux_regsets=yes
1198+ srv_linux_thread_db=yes
1199+ ;;
1200+ *) echo "Error: target not supported by gdbserver."
1201+ exit 1
1202+ ;;
1203+esac
1204diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
1205new file mode 100644
1206index 00000000000..cba5d6fc585
1207--- /dev/null
1208+++ b/gdb/gdbserver/linux-microblaze-low.c
1209@@ -0,0 +1,189 @@
1210+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
1211+ GDB.
1212+ Copyright (C) 1995-2013 Free Software Foundation, Inc.
1213+
1214+ This file is part of GDB.
1215+
1216+ This program is free software; you can redistribute it and/or modify
1217+ it under the terms of the GNU General Public License as published by
1218+ the Free Software Foundation; either version 3 of the License, or
1219+ (at your option) any later version.
1220+
1221+ This program is distributed in the hope that it will be useful,
1222+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1223+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1224+ GNU General Public License for more details.
1225+
1226+ You should have received a copy of the GNU General Public License
1227+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
1228+
1229+#include "server.h"
1230+#include "linux-low.h"
1231+
1232+#include <asm/ptrace.h>
1233+#include <sys/procfs.h>
1234+#include <sys/ptrace.h>
1235+
1236+#include "gdb_proc_service.h"
1237+
1238+static int microblaze_regmap[] =
1239+ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3),
1240+ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7),
1241+ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11),
1242+ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15),
1243+ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19),
1244+ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23),
1245+ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27),
1246+ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31),
1247+ PT_PC, PT_MSR, PT_EAR, PT_ESR,
1248+ PT_FSR
1249+ };
1250+
1251+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
1252+
1253+/* Defined in auto-generated file microblaze-linux.c. */
1254+void init_registers_microblaze (void);
1255+
1256+static int
1257+microblaze_cannot_store_register (int regno)
1258+{
1259+ if (microblaze_regmap[regno] == -1 || regno == 0)
1260+ return 1;
1261+
1262+ return 0;
1263+}
1264+
1265+static int
1266+microblaze_cannot_fetch_register (int regno)
1267+{
1268+ return 0;
1269+}
1270+
1271+static CORE_ADDR
1272+microblaze_get_pc (struct regcache *regcache)
1273+{
1274+ unsigned long pc;
1275+
1276+ collect_register_by_name (regcache, "pc", &pc);
1277+ return (CORE_ADDR) pc;
1278+}
1279+
1280+static void
1281+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
1282+{
1283+ unsigned long newpc = pc;
1284+
1285+ supply_register_by_name (regcache, "pc", &newpc);
1286+}
1287+
1288+/* dbtrap insn */
1289+/* brki r16, 0x18; */
1290+static const unsigned long microblaze_breakpoint = 0xba0c0018;
1291+#define microblaze_breakpoint_len 4
1292+
1293+static int
1294+microblaze_breakpoint_at (CORE_ADDR where)
1295+{
1296+ unsigned long insn;
1297+
1298+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
1299+ if (insn == microblaze_breakpoint)
1300+ return 1;
1301+ /* If necessary, recognize more trap instructions here. GDB only uses the
1302+ one. */
1303+ return 0;
1304+}
1305+
1306+static CORE_ADDR
1307+microblaze_reinsert_addr (struct regcache *regcache)
1308+{
1309+ unsigned long pc;
1310+ collect_register_by_name (regcache, "r15", &pc);
1311+ return pc;
1312+}
1313+
1314+#ifdef HAVE_PTRACE_GETREGS
1315+
1316+static void
1317+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
1318+{
1319+ int size = register_size (regno);
1320+
1321+ memset (buf, 0, sizeof (long));
1322+
1323+ if (size < sizeof (long))
1324+ collect_register (regcache, regno, buf + sizeof (long) - size);
1325+ else
1326+ collect_register (regcache, regno, buf);
1327+}
1328+
1329+static void
1330+microblaze_supply_ptrace_register (struct regcache *regcache,
1331+ int regno, const char *buf)
1332+{
1333+ int size = register_size (regno);
1334+
1335+ if (regno == 0) {
1336+ unsigned long regbuf_0 = 0;
1337+ /* clobbering r0 so that it is always 0 as enforced by hardware */
1338+ supply_register (regcache, regno, (const char*)&regbuf_0);
1339+ } else {
1340+ if (size < sizeof (long))
1341+ supply_register (regcache, regno, buf + sizeof (long) - size);
1342+ else
1343+ supply_register (regcache, regno, buf);
1344+ }
1345+}
1346+
1347+/* Provide only a fill function for the general register set. ps_lgetregs
1348+ will use this for NPTL support. */
1349+
1350+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
1351+{
1352+ int i;
1353+
1354+ for (i = 0; i < 32; i++)
1355+ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
1356+}
1357+
1358+static void
1359+microblaze_store_gregset (struct regcache *regcache, const void *buf)
1360+{
1361+ int i;
1362+
1363+ for (i = 0; i < 32; i++)
1364+ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
1365+}
1366+
1367+#endif /* HAVE_PTRACE_GETREGS */
1368+
1369+struct regset_info target_regsets[] = {
1370+#ifdef HAVE_PTRACE_GETREGS
1371+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
1372+ { 0, 0, 0, -1, -1, NULL, NULL },
1373+#endif /* HAVE_PTRACE_GETREGS */
1374+ { 0, 0, 0, -1, -1, NULL, NULL }
1375+};
1376+
1377+struct linux_target_ops the_low_target = {
1378+ init_registers_microblaze,
1379+ microblaze_num_regs,
1380+ microblaze_regmap,
1381+ NULL,
1382+ microblaze_cannot_fetch_register,
1383+ microblaze_cannot_store_register,
1384+ NULL, /* fetch_register */
1385+ microblaze_get_pc,
1386+ microblaze_set_pc,
1387+ (const unsigned char *) &microblaze_breakpoint,
1388+ microblaze_breakpoint_len,
1389+ microblaze_reinsert_addr,
1390+ 0,
1391+ microblaze_breakpoint_at,
1392+ NULL,
1393+ NULL,
1394+ NULL,
1395+ NULL,
1396+ microblaze_collect_ptrace_register,
1397+ microblaze_supply_ptrace_register,
1398+};
1399diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
1400index 17cdc2516d4..7d488d12b52 100644
1401--- a/gdb/microblaze-linux-tdep.c
1402+++ b/gdb/microblaze-linux-tdep.c
1403@@ -37,6 +37,22 @@
1404 #include "tramp-frame.h"
1405 #include "linux-tdep.h"
1406
1407+static int microblaze_debug_flag = 0;
1408+
1409+static void
1410+microblaze_debug (const char *fmt, ...)
1411+{
1412+ if (microblaze_debug_flag)
1413+ {
1414+ va_list args;
1415+
1416+ va_start (args, fmt);
1417+ printf_unfiltered ("MICROBLAZE LINUX: ");
1418+ vprintf_unfiltered (fmt, args);
1419+ va_end (args);
1420+ }
1421+}
1422+
1423 static int
1424 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1425 struct bp_target_info *bp_tgt)
1426@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1427 /* Determine appropriate breakpoint contents and size for this address. */
1428 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
1429
1430+ /* Make sure we see the memory breakpoints. */
1431+ scoped_restore restore_memory
1432+ = make_scoped_restore_show_memory_breakpoints (1);
1433+
1434 val = target_read_memory (addr, old_contents, bplen);
1435
1436 /* If our breakpoint is no longer at the address, this means that the
1437 program modified the code on us, so it is wrong to put back the
1438 old value. */
1439 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
1440- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
1441+ {
1442+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
1443+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
1444+ }
1445
1446 return val;
1447 }
1448@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1449 /* Trampolines. */
1450 tramp_frame_prepend_unwinder (gdbarch,
1451 &microblaze_linux_sighandler_tramp_frame);
1452+
1453+ /* Enable TLS support. */
1454+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
1455+ svr4_fetch_objfile_link_map);
1456 }
1457
1458 void _initialize_microblaze_linux_tdep ();
1459diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
1460index 0c3316dece1..2d6eb8ce94e 100644
1461--- a/gdb/microblaze-tdep.c
1462+++ b/gdb/microblaze-tdep.c
1463@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
1464 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
1465
1466 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
1467-
1468+static int
1469+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1470+ struct bp_target_info *bp_tgt)
1471+{
1472+ CORE_ADDR addr = bp_tgt->placed_address;
1473+ const unsigned char *bp;
1474+ int val;
1475+ int bplen;
1476+ gdb_byte old_contents[BREAKPOINT_MAX];
1477+
1478+ /* Determine appropriate breakpoint contents and size for this address. */
1479+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
1480+ if (bp == NULL)
1481+ error (_("Software breakpoints not implemented for this target."));
1482+
1483+ /* Make sure we see the memory breakpoints. */
1484+ scoped_restore restore_memory
1485+ = make_scoped_restore_show_memory_breakpoints (1);
1486+
1487+ val = target_read_memory (addr, old_contents, bplen);
1488+
1489+ /* If our breakpoint is no longer at the address, this means that the
1490+ program modified the code on us, so it is wrong to put back the
1491+ old value. */
1492+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
1493+ {
1494+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
1495+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
1496+ }
1497+
1498+ return val;
1499+}
1500
1501 /* Allocate and initialize a frame cache. */
1502
1503@@ -729,6 +760,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1504 microblaze_breakpoint::kind_from_pc);
1505 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1506 microblaze_breakpoint::bp_from_kind);
1507+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1508
1509 set_gdbarch_frame_args_skip (gdbarch, 8);
1510
1511@@ -769,4 +801,5 @@ When non-zero, microblaze specific debugging is enabled."),
1512 NULL,
1513 &setdebuglist, &showdebuglist);
1514
1515+
1516 }
1517diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1518index 08af0d191c5..8a429cbf001 100644
1519--- a/gdb/microblaze-tdep.h
1520+++ b/gdb/microblaze-tdep.h
1521@@ -117,6 +117,8 @@ struct microblaze_frame_cache
1522
1523 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1524 Only used for native debugging. */
1525-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
1526+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
1527+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
1528+
1529
1530 #endif /* microblaze-tdep.h */
1531diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
1532new file mode 100644
1533index 00000000000..bd8a4384424
1534--- /dev/null
1535+++ b/gdb/regformats/reg-microblaze.dat
1536@@ -0,0 +1,41 @@
1537+name:microblaze
1538+expedite:r1,pc
1539+32:r0
1540+32:r1
1541+32:r2
1542+32:r3
1543+32:r4
1544+32:r5
1545+32:r6
1546+32:r7
1547+32:r8
1548+32:r9
1549+32:r10
1550+32:r11
1551+32:r12
1552+32:r13
1553+32:r14
1554+32:r15
1555+32:r16
1556+32:r17
1557+32:r18
1558+32:r19
1559+32:r20
1560+32:r21
1561+32:r22
1562+32:r23
1563+32:r24
1564+32:r25
1565+32:r26
1566+32:r27
1567+32:r28
1568+32:r29
1569+32:r30
1570+32:r31
1571+32:pc
1572+32:msr
1573+32:ear
1574+32:esr
1575+32:fsr
1576+32:slr
1577+32:shr
1578--
15792.17.1
1580
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support.patch
index 3d5f7ae2..876fc5c8 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support-Added-support-f.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Initial-port-of-core-reading-support.patch
@@ -1,30 +1,34 @@
1From bcb8a5479a617eea7b4da869bee5e00d4b750c73 Mon Sep 17 00:00:00 2001 1From 9b17875cc7584d41953d9a6f46558482e691881b Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 24 Jan 2017 14:55:56 +0530 3Date: Tue, 24 Jan 2017 14:55:56 +0530
4Subject: [PATCH 34/52] Initial port of core reading support Added support for 4Subject: [PATCH 34/38] 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
11Conflicts:
12 gdb/microblaze-linux-tdep.c
13 gdb/microblaze-tdep.c
10--- 14---
11 bfd/elf32-microblaze.c | 84 ++++++++++++++++++++++++++++++++++ 15 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
12 gdb/configure.tgt | 2 +- 16 gdb/configure.tgt | 2 +-
13 gdb/microblaze-linux-tdep.c | 57 +++++++++++++++++++++++ 17 gdb/microblaze-linux-tdep.c | 17 +++++++-
14 gdb/microblaze-tdep.c | 90 +++++++++++++++++++++++++++++++++++++ 18 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++
15 gdb/microblaze-tdep.h | 27 +++++++++++ 19 gdb/microblaze-tdep.h | 27 ++++++++++++
16 5 files changed, 259 insertions(+), 1 deletion(-) 20 5 files changed, 176 insertions(+), 2 deletions(-)
17 21
18diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 22diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
19index d77710b1f3..7a27e50111 100644 23index 2a976ecbe1d..713f5e8e506 100644
20--- a/bfd/elf32-microblaze.c 24--- a/bfd/elf32-microblaze.c
21+++ b/bfd/elf32-microblaze.c 25+++ b/bfd/elf32-microblaze.c
22@@ -767,6 +767,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 26@@ -765,6 +765,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
23 return _bfd_elf_is_local_label_name (abfd, name); 27 return _bfd_elf_is_local_label_name (abfd, name);
24 } 28 }
25 29
26+/* Support for core dump NOTE sections. */ 30+/* Support for core dump NOTE sections. */
27+static bfd_boolean 31+static bool
28+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) 32+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
29+{ 33+{
30+ int offset; 34+ int offset;
@@ -33,7 +37,7 @@ index d77710b1f3..7a27e50111 100644
33+ switch (note->descsz) 37+ switch (note->descsz)
34+ { 38+ {
35+ default: 39+ default:
36+ return FALSE; 40+ return false;
37+ 41+
38+ case 228: /* Linux/MicroBlaze */ 42+ case 228: /* Linux/MicroBlaze */
39+ /* pr_cursig */ 43+ /* pr_cursig */
@@ -54,13 +58,13 @@ index d77710b1f3..7a27e50111 100644
54+ size, note->descpos + offset); 58+ size, note->descpos + offset);
55+} 59+}
56+ 60+
57+static bfd_boolean 61+static bool
58+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) 62+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
59+{ 63+{
60+ switch (note->descsz) 64+ switch (note->descsz)
61+ { 65+ {
62+ default: 66+ default:
63+ return FALSE; 67+ return false;
64+ 68+
65+ case 128: /* Linux/MicroBlaze elf_prpsinfo */ 69+ case 128: /* Linux/MicroBlaze elf_prpsinfo */
66+ elf_tdata (abfd)->core->program 70+ elf_tdata (abfd)->core->program
@@ -81,7 +85,7 @@ index d77710b1f3..7a27e50111 100644
81+ command[n - 1] = '\0'; 85+ command[n - 1] = '\0';
82+ } 86+ }
83+ 87+
84+ return TRUE; 88+ return true;
85+} 89+}
86+ 90+
87+/* The microblaze linker (like many others) needs to keep track of 91+/* The microblaze linker (like many others) needs to keep track of
@@ -107,7 +111,7 @@ index d77710b1f3..7a27e50111 100644
107 /* ELF linker hash entry. */ 111 /* ELF linker hash entry. */
108 112
109 struct elf32_mb_link_hash_entry 113 struct elf32_mb_link_hash_entry
110@@ -3576,4 +3657,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 114@@ -3572,4 +3653,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
111 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 115 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
112 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 116 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
113 117
@@ -116,10 +120,10 @@ index d77710b1f3..7a27e50111 100644
116+ 120+
117 #include "elf32-target.h" 121 #include "elf32-target.h"
118diff --git a/gdb/configure.tgt b/gdb/configure.tgt 122diff --git a/gdb/configure.tgt b/gdb/configure.tgt
119index d66f01bb9f..2938fddfe8 100644 123index a928c0227a0..95095e98706 100644
120--- a/gdb/configure.tgt 124--- a/gdb/configure.tgt
121+++ b/gdb/configure.tgt 125+++ b/gdb/configure.tgt
122@@ -389,7 +389,7 @@ mep-*-*) 126@@ -399,7 +399,7 @@ mep-*-*)
123 127
124 microblaze*-linux-*|microblaze*-*-linux*) 128 microblaze*-linux-*|microblaze*-*-linux*)
125 # Target: Xilinx MicroBlaze running Linux 129 # Target: Xilinx MicroBlaze running Linux
@@ -129,65 +133,36 @@ index d66f01bb9f..2938fddfe8 100644
129 gdb_sim=../sim/microblaze/libsim.a 133 gdb_sim=../sim/microblaze/libsim.a
130 ;; 134 ;;
131diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 135diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
132index fb8241884b..2725ce1789 100644 136index 7d488d12b52..6ea43dd0d3c 100644
133--- a/gdb/microblaze-linux-tdep.c 137--- a/gdb/microblaze-linux-tdep.c
134+++ b/gdb/microblaze-linux-tdep.c 138+++ b/gdb/microblaze-linux-tdep.c
135@@ -135,11 +135,54 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame = 139@@ -36,6 +36,7 @@
140 #include "frame-unwind.h"
141 #include "tramp-frame.h"
142 #include "linux-tdep.h"
143+#include "glibc-tdep.h"
144
145 static int microblaze_debug_flag = 0;
146
147@@ -135,13 +136,16 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
136 microblaze_linux_sighandler_cache_init 148 microblaze_linux_sighandler_cache_init
137 }; 149 };
138 150
139+const struct microblaze_gregset microblaze_linux_core_gregset; 151-
140+
141+static void
142+microblaze_linux_supply_core_gregset (const struct regset *regset,
143+ struct regcache *regcache,
144+ int regnum, const void *gregs, size_t len)
145+{
146+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
147+ regnum, gregs);
148+}
149+
150+static void
151+microblaze_linux_collect_core_gregset (const struct regset *regset,
152+ const struct regcache *regcache,
153+ int regnum, void *gregs, size_t len)
154+{
155+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
156+ regnum, gregs);
157+}
158+
159+static void
160+microblaze_linux_supply_core_fpregset (const struct regset *regset,
161+ struct regcache *regcache,
162+ int regnum, const void *fpregs, size_t len)
163+{
164+ /* FIXME. */
165+ microblaze_supply_fpregset (regcache, regnum, fpregs);
166+}
167+
168+static void
169+microblaze_linux_collect_core_fpregset (const struct regset *regset,
170+ const struct regcache *regcache,
171+ int regnum, void *fpregs, size_t len)
172+{
173+ /* FIXME. */
174+ microblaze_collect_fpregset (regcache, regnum, fpregs);
175+}
176
177 static void 152 static void
178 microblaze_linux_init_abi (struct gdbarch_info info, 153 microblaze_linux_init_abi (struct gdbarch_info info,
179 struct gdbarch *gdbarch) 154 struct gdbarch *gdbarch)
180 { 155 {
181+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 156+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
182+ 157+
183+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
184+ microblaze_linux_collect_core_gregset);
185+ tdep->sizeof_gregset = 200; 158+ tdep->sizeof_gregset = 200;
186+ 159 linux_init_abi (info, gdbarch, 0);
187 linux_init_abi (info, gdbarch);
188 160
161+
189 set_gdbarch_memory_remove_breakpoint (gdbarch, 162 set_gdbarch_memory_remove_breakpoint (gdbarch,
190@@ -153,6 +196,20 @@ microblaze_linux_init_abi (struct gdbarch_info info, 163 microblaze_linux_memory_remove_breakpoint);
164
165@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
191 tramp_frame_prepend_unwinder (gdbarch, 166 tramp_frame_prepend_unwinder (gdbarch,
192 &microblaze_linux_sighandler_tramp_frame); 167 &microblaze_linux_sighandler_tramp_frame);
193 168
@@ -202,109 +177,50 @@ index fb8241884b..2725ce1789 100644
202+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); 177+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
203+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); 178+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
204+ 179+
205+ set_gdbarch_regset_from_core_section (gdbarch,
206+ microblaze_regset_from_core_section);
207+
208 /* Enable TLS support. */ 180 /* Enable TLS support. */
209 set_gdbarch_fetch_tls_load_module_address (gdbarch, 181 set_gdbarch_fetch_tls_load_module_address (gdbarch,
210 svr4_fetch_objfile_link_map); 182 svr4_fetch_objfile_link_map);
211diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 183diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
212index 443adfb364..1b5cf38e45 100644 184index 2d6eb8ce94e..ceeee26007f 100644
213--- a/gdb/microblaze-tdep.c 185--- a/gdb/microblaze-tdep.c
214+++ b/gdb/microblaze-tdep.c 186+++ b/gdb/microblaze-tdep.c
215@@ -137,6 +137,14 @@ microblaze_fetch_instruction (CORE_ADDR pc) 187@@ -678,6 +678,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
216 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT; 188 tdesc_microblaze_with_stack_protect);
217
218 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
219+static CORE_ADDR
220+microblaze_store_arguments (struct regcache *regcache, int nargs,
221+ struct value **args, CORE_ADDR sp,
222+ int struct_return, CORE_ADDR struct_addr)
223+{
224+ error (_("store_arguments not implemented"));
225+ return sp;
226+}
227 static int
228 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
229 struct bp_target_info *bp_tgt)
230@@ -541,6 +549,12 @@ microblaze_frame_base_address (struct frame_info *next_frame,
231 return cache->base;
232 }
233
234+static const struct frame_unwind *
235+microblaze_frame_sniffer (struct frame_info *next_frame)
236+{
237+ return &microblaze_frame_unwind;
238+}
239+
240 static const struct frame_base microblaze_frame_base =
241 {
242 &microblaze_frame_unwind,
243@@ -677,6 +691,71 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
244 tdesc_microblaze_with_stack_protect);
245 } 189 }
246 190
247+void 191+void
248+microblaze_supply_gregset (const struct microblaze_gregset *gregset, 192+microblaze_supply_gregset (const struct regset *regset,
249+ struct regcache *regcache, 193+ struct regcache *regcache,
250+ int regnum, const void *gregs) 194+ int regnum, const void *gregs)
251+{ 195+{
252+ unsigned int *regs = gregs; 196+ const unsigned int *regs = (const unsigned int *)gregs;
253+ if (regnum >= 0) 197+ if (regnum >= 0)
254+ regcache_raw_supply (regcache, regnum, regs + regnum); 198+ regcache->raw_supply (regnum, regs + regnum);
255+ 199+
256+ if (regnum == -1) { 200+ if (regnum == -1) {
257+ int i; 201+ int i;
258+ 202+
259+ for (i = 0; i < 50; i++) { 203+ for (i = 0; i < 50; i++) {
260+ regcache_raw_supply (regcache, i, regs + i); 204+ regcache->raw_supply (i, regs + i);
261+ } 205+ }
262+ } 206+ }
263+} 207+}
264+ 208+
265+ 209+
266+void
267+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
268+ const struct regcache *regcache,
269+ int regnum, void *gregs)
270+{
271+ /* FIXME. */
272+}
273+
274+void
275+microblaze_supply_fpregset (struct regcache *regcache,
276+ int regnum, const void *fpregs)
277+{
278+ /* FIXME. */
279+}
280+
281+void
282+microblaze_collect_fpregset (const struct regcache *regcache,
283+ int regnum, void *fpregs)
284+{
285+ /* FIXME. */
286+}
287+
288+
289+/* Return the appropriate register set for the core section identified 210+/* Return the appropriate register set for the core section identified
290+ by SECT_NAME and SECT_SIZE. */ 211+ by SECT_NAME and SECT_SIZE. */
291+ 212+
292+const struct regset * 213+static void
293+microblaze_regset_from_core_section (struct gdbarch *gdbarch, 214+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
294+ const char *sect_name, size_t sect_size) 215+ iterate_over_regset_sections_cb *cb,
216+ void *cb_data,
217+ const struct regcache *regcache)
295+{ 218+{
296+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 219+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
297+ 220+
298+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name); 221+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
299+
300+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
301+ return tdep->gregset;
302+
303+ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
304+ return tdep->fpregset;
305+ 222+
306+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n"); 223+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
307+ return NULL;
308+} 224+}
309+ 225+
310+ 226+
@@ -312,7 +228,7 @@ index 443adfb364..1b5cf38e45 100644
312 static struct gdbarch * 228 static struct gdbarch *
313 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 229 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
314 { 230 {
315@@ -733,6 +812,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 231@@ -731,6 +768,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
316 tdep = XCNEW (struct gdbarch_tdep); 232 tdep = XCNEW (struct gdbarch_tdep);
317 gdbarch = gdbarch_alloc (&info, tdep); 233 gdbarch = gdbarch_alloc (&info, tdep);
318 234
@@ -323,22 +239,22 @@ index 443adfb364..1b5cf38e45 100644
323 set_gdbarch_long_double_bit (gdbarch, 128); 239 set_gdbarch_long_double_bit (gdbarch, 128);
324 240
325 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 241 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
326@@ -781,6 +864,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 242@@ -779,6 +820,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
327 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 243 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
328 if (tdesc_data != NULL) 244 if (tdesc_data != NULL)
329 tdesc_use_registers (gdbarch, tdesc, tdesc_data); 245 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
330+ //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); 246+ //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
331+ 247+
332+ /* If we have register sets, enable the generic core file support. */ 248+ /* If we have register sets, enable the generic core file support. */
333+ if (tdep->gregset) { 249+ if (tdep->gregset) {
334+ set_gdbarch_regset_from_core_section (gdbarch, 250+ set_gdbarch_iterate_over_regset_sections (gdbarch,
335+ microblaze_regset_from_core_section); 251+ microblaze_iterate_over_regset_sections);
336+ } 252+ }
337 253
338 return gdbarch; 254 return gdbarch;
339 } 255 }
340diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 256diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
341index db0772643d..de66a05cab 100644 257index 8a429cbf001..e91991b8dba 100644
342--- a/gdb/microblaze-tdep.h 258--- a/gdb/microblaze-tdep.h
343+++ b/gdb/microblaze-tdep.h 259+++ b/gdb/microblaze-tdep.h
344@@ -22,8 +22,22 @@ 260@@ -22,8 +22,22 @@
@@ -368,10 +284,10 @@ index db0772643d..de66a05cab 100644
368 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18} 284 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
369 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba} 285 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
370 286
371+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset, 287+extern void microblaze_supply_gregset (const struct regset *regset,
372+ struct regcache *regcache, 288+ struct regcache *regcache,
373+ int regnum, const void *gregs); 289+ int regnum, const void *gregs);
374+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset, 290+extern void microblaze_collect_gregset (const struct regset *regset,
375+ const struct regcache *regcache, 291+ const struct regcache *regcache,
376+ int regnum, void *gregs); 292+ int regnum, void *gregs);
377+extern void microblaze_supply_fpregset (struct regcache *regcache, 293+extern void microblaze_supply_fpregset (struct regcache *regcache,
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0035-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 4c26f259..9326e2c0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0035-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,18 +1,21 @@
1From bc2b702d7f73a231bd67c60465137fe37f67479a Mon Sep 17 00:00:00 2001 1From 59fd18d5155ffe8924ed24283def8ef434067909 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com> 2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000 3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 35/52] Fix debug message when register is unavailable 4Subject: [PATCH 35/38] 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
8Conflicts:
9 gdb/frame.c
7--- 10---
8 gdb/frame.c | 13 ++++++++++--- 11 gdb/frame.c | 9 ++++++++-
9 1 file changed, 10 insertions(+), 3 deletions(-) 12 1 file changed, 8 insertions(+), 1 deletion(-)
10 13
11diff --git a/gdb/frame.c b/gdb/frame.c 14diff --git a/gdb/frame.c b/gdb/frame.c
12index ff27b9f00e..bf931b370c 100644 15index 3f2d2700541..d557a093f63 100644
13--- a/gdb/frame.c 16--- a/gdb/frame.c
14+++ b/gdb/frame.c 17+++ b/gdb/frame.c
15@@ -1263,12 +1263,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) 18@@ -1261,12 +1261,19 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
16 else 19 else
17 { 20 {
18 int i; 21 int i;
@@ -22,17 +25,15 @@ index ff27b9f00e..bf931b370c 100644
22+ buf = value_contents (value); 25+ buf = value_contents (value);
23+ } 26+ }
24 27
25 fprintf_unfiltered (gdb_stdlog, " bytes="); 28 fprintf_unfiltered (&debug_file, " bytes=");
26 fprintf_unfiltered (gdb_stdlog, "["); 29 fprintf_unfiltered (&debug_file, "[");
27- for (i = 0; i < register_size (gdbarch, regnum); i++)
28- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
29+ if (buf != NULL) { 30+ if (buf != NULL) {
30+ for (i = 0; i < register_size (gdbarch, regnum); i++) 31 for (i = 0; i < register_size (gdbarch, regnum); i++)
31+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); 32 fprintf_unfiltered (&debug_file, "%02x", buf[i]);
32+ } else { 33+ } else {
33+ fprintf_unfiltered (gdb_stdlog, "unavailable"); 34+ fprintf_unfiltered (&debug_file, "unavailable");
34+ } 35+ }
35 fprintf_unfiltered (gdb_stdlog, "]"); 36 fprintf_unfiltered (&debug_file, "]");
36 } 37 }
37 } 38 }
38-- 39--
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
index dede70e8..350dd8c0 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0038-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0036-microblaze-Add-build_gdbserver-yes-to-top-level-conf.patch
@@ -1,7 +1,7 @@
1From 463a2d331ab68484913a2957614e852eac793583 Mon Sep 17 00:00:00 2001 1From 112d69b1bcebf14e37049a9795ce7128e98c1a23 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com> 2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 16 Dec 2013 16:37:32 +1000 3Date: Mon, 16 Dec 2013 16:37:32 +1000
4Subject: [PATCH 38/52] microblaze: Add build_gdbserver=yes to top level 4Subject: [PATCH 36/38] microblaze: Add build_gdbserver=yes to top level
5 configure.tgt 5 configure.tgt
6 6
7For Microblaze linux toolchains, set the build_gdbserver=yes 7For Microblaze linux toolchains, set the build_gdbserver=yes
@@ -16,10 +16,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
16 1 file changed, 1 insertion(+) 16 1 file changed, 1 insertion(+)
17 17
18diff --git a/gdb/configure.tgt b/gdb/configure.tgt 18diff --git a/gdb/configure.tgt b/gdb/configure.tgt
19index 2938fddfe8..ac2d35a991 100644 19index 95095e98706..47497ac3d39 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@@ -407,6 +407,7 @@ microblaze*-*-*)
23 # Target: Xilinx MicroBlaze running standalone 23 # Target: Xilinx MicroBlaze running standalone
24 gdb_target_obs="microblaze-tdep.o" 24 gdb_target_obs="microblaze-tdep.o"
25 gdb_sim=../sim/microblaze/libsim.a 25 gdb_sim=../sim/microblaze/libsim.a
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch
deleted file mode 100644
index 81f55f76..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0036-revert-master-rebase-changes-to-gdbserver.patch
+++ /dev/null
@@ -1,31 +0,0 @@
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/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0037-Fixing-the-issues-related-to-GDB-7.12.patch
index e08f16df..14ebbb63 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0037-Fixing-the-issues-related-to-GDB-7.12.patch
@@ -1,157 +1,56 @@
1From 976a0e2664559cc194eee8040280cd29e2672d26 Mon Sep 17 00:00:00 2001 1From 3d14409964a92753c3176b6af84ba4c80011237f Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 17 Feb 2017 14:09:40 +0530 3Date: Fri, 17 Feb 2017 14:09:40 +0530
4Subject: [PATCH 40/52] Fixing the issues related to GDB-7.12 added all the 4Subject: [PATCH 37/38] Fixing the issues related to GDB-7.12
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
7 5
6added all the required function which are new in 7.12 and removed
7few deprecated functions from 7.6
8
9Conflicts:
10 gdb/config/microblaze/linux.mh
8--- 11---
9 gdb/config/microblaze/linux.mh | 4 +- 12 gdb/config/microblaze/linux.mh | 11 ++++
10 gdb/microblaze-linux-tdep.c | 68 ++++++++++++++++++++-- 13 gdb/gdbserver/configure.srv | 3 +-
11 gdb/microblaze-tdep.h | 1 + 14 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
12 gdbserver/configure.srv | 3 +- 15 gdb/microblaze-tdep.h | 1 +
13 gdbserver/linux-microblaze-low.c | 97 +++++++++++++++++++++++++++----- 16 4 files changed, 97 insertions(+), 15 deletions(-)
14 5 files changed, 153 insertions(+), 20 deletions(-) 17 create mode 100644 gdb/config/microblaze/linux.mh
15 18
16diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh 19diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
17index a4eaf540e1..74a53b854a 100644 20new file mode 100644
18--- a/gdb/config/microblaze/linux.mh 21index 00000000000..74a53b854a4
22--- /dev/null
19+++ b/gdb/config/microblaze/linux.mh 23+++ b/gdb/config/microblaze/linux.mh
20@@ -1,9 +1,11 @@ 24@@ -0,0 +1,11 @@
21 # Host: Microblaze, running Linux 25+# Host: Microblaze, running Linux
22 26+
23+#linux-nat.o linux-waitpid.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o 27+#linux-nat.o linux-waitpid.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
24 NAT_FILE= config/nm-linux.h 28+NAT_FILE= config/nm-linux.h
25 NATDEPFILES= inf-ptrace.o fork-child.o \ 29+NATDEPFILES= inf-ptrace.o fork-child.o \
26 microblaze-linux-nat.o proc-service.o linux-thread-db.o \ 30+ microblaze-linux-nat.o proc-service.o linux-thread-db.o \
27- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
28+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \ 31+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \
29+ linux-waitpid.o linux-personality.o linux-namespaces.o 32+ linux-waitpid.o linux-personality.o linux-namespaces.o
30 NAT_CDEPS = $(srcdir)/proc-service.list 33+NAT_CDEPS = $(srcdir)/proc-service.list
31 34+
32 LOADLIBES = -ldl $(RDYNAMIC) 35+LOADLIBES = -ldl $(RDYNAMIC)
33diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 36diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
34index 2725ce1789..a2e858d10f 100644 37index e0d2b2fe04a..26db2dd2461 100644
35--- a/gdb/microblaze-linux-tdep.c 38--- a/gdb/gdbserver/configure.srv
36+++ b/gdb/microblaze-linux-tdep.c 39+++ b/gdb/gdbserver/configure.srv
37@@ -29,13 +29,76 @@ 40@@ -185,8 +185,7 @@ case "${target}" in
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 41 srv_linux_thread_db=yes
143 ;; 42 ;;
144 microblaze*-*-linux*) srv_regobj=microblaze-linux.o 43 microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
145- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o " 44- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
146- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o" 45- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
147+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o " 46+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
47 srv_xmlfiles="microblaze-linux.xml"
148 srv_linux_regsets=yes 48 srv_linux_regsets=yes
149 srv_linux_usrregs=yes 49 srv_linux_usrregs=yes
150 srv_linux_thread_db=yes 50diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
151diff --git a/gdbserver/linux-microblaze-low.c b/gdbserver/linux-microblaze-low.c 51index cba5d6fc585..a2733f3c21c 100644
152index cba5d6fc58..a2733f3c21 100644 52--- a/gdb/gdbserver/linux-microblaze-low.c
153--- a/gdbserver/linux-microblaze-low.c 53+++ b/gdb/gdbserver/linux-microblaze-low.c
154+++ b/gdbserver/linux-microblaze-low.c
155@@ -39,10 +39,11 @@ static int microblaze_regmap[] = 54@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
156 PT_FSR 55 PT_FSR
157 }; 56 };
@@ -304,6 +203,18 @@ index cba5d6fc58..a2733f3c21 100644
304+{ 203+{
305+ init_registers_microblaze (); 204+ init_registers_microblaze ();
306+} 205+}
206diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
207index e91991b8dba..872a3931f20 100644
208--- a/gdb/microblaze-tdep.h
209+++ b/gdb/microblaze-tdep.h
210@@ -24,6 +24,7 @@
211 /* Microblaze architecture-specific information. */
212 struct microblaze_gregset
213 {
214+ microblaze_gregset() {}
215 unsigned int gregs[32];
216 unsigned int fpregs[32];
217 unsigned int pregs[16];
307-- 218--
3082.17.1 2192.17.1
309 220
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
deleted file mode 100644
index 24ae7a8c..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0037-revert-master-rebase-changes-to-gdbserver-previous-c.patch
+++ /dev/null
@@ -1,36 +0,0 @@
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/0038-Patch-MB-MB-binutils-Upstream-port-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0038-Patch-MB-MB-binutils-Upstream-port-issues.patch
new file mode 100644
index 00000000..1fb73946
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0038-Patch-MB-MB-binutils-Upstream-port-issues.patch
@@ -0,0 +1,556 @@
1From 5e492aae0baf2ed8593c2fb2df03c54fbb180e57 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 28 Nov 2021 17:17:15 +0530
4Subject: [PATCH 38/38] [Patch,MB]: MB binutils Upstream port issues.
5
6---
7 bfd/elf64-microblaze.c | 266 ++++++++++++++++++++++++++++---------
8 gas/config/tc-microblaze.c | 2 +-
9 opcodes/microblaze-dis.c | 12 +-
10 opcodes/microblaze-opc.h | 2 +-
11 4 files changed, 208 insertions(+), 74 deletions(-)
12
13diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
14index 4d41ddbd953..210b84b2a50 100644
15--- a/bfd/elf64-microblaze.c
16+++ b/bfd/elf64-microblaze.c
17@@ -767,12 +767,35 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
18 return _bfd_elf_is_local_label_name (abfd, name);
19 }
20
21+/* The microblaze linker (like many others) needs to keep track of
22+ the number of relocs that it decides to copy as dynamic relocs in
23+ check_relocs for each symbol. This is so that it can later discard
24+ them if they are found to be unnecessary. We store the information
25+ in a field extending the regular ELF linker hash table. */
26+
27+struct elf64_mb_dyn_relocs
28+{
29+ struct elf64_mb_dyn_relocs *next;
30+
31+ /* The input section of the reloc. */
32+ asection *sec;
33+
34+ /* Total number of relocs copied for the input section. */
35+ bfd_size_type count;
36+
37+ /* Number of pc-relative relocs copied for the input section. */
38+ bfd_size_type pc_count;
39+};
40+
41 /* ELF linker hash entry. */
42
43 struct elf64_mb_link_hash_entry
44 {
45 struct elf_link_hash_entry elf;
46
47+ /* Track dynamic relocs copied for this symbol. */
48+ struct elf64_mb_dyn_relocs *dyn_relocs;
49+
50 /* TLS Reference Types for the symbol; Updated by check_relocs */
51 #define TLS_GD 1 /* GD reloc. */
52 #define TLS_LD 2 /* LD reloc. */
53@@ -796,6 +819,18 @@ struct elf64_mb_link_hash_table
54 {
55 struct elf_link_hash_table elf;
56
57+ /* Short-cuts to get to dynamic linker sections. */
58+ asection *sgot;
59+ asection *sgotplt;
60+ asection *srelgot;
61+ asection *splt;
62+ asection *srelplt;
63+ asection *sdynbss;
64+ asection *srelbss;
65+
66+ /* Small local sym to section mapping cache. */
67+ struct sym_cache sym_sec;
68+
69 /* TLS Local Dynamic GOT Entry */
70 union {
71 bfd_signed_vma refcount;
72@@ -1335,8 +1370,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
73 /* Need to generate relocs ? */
74 if ((bfd_link_pic (info) || indx != 0)
75 && (h == NULL
76- || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
77- && !resolved_to_zero)
78+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
79 || h->root.type != bfd_link_hash_undefweak))
80 need_relocs = true;
81
82@@ -1523,13 +1557,11 @@ microblaze_elf_relocate_section (bfd *output_bfd,
83 contents + offset + endian);
84 }
85 else
86- {
87- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
88- contents + offset + endian);
89- bfd_put_16 (input_bfd, relocation & 0xffff,
90- contents + offset + endian + INST_WORD_SIZE);
91+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
92+ contents + offset + endian);
93+ bfd_put_16 (input_bfd, relocation & 0xffff,
94+ contents + offset + endian + INST_WORD_SIZE);
95 }
96- }
97 break;
98 }
99
100@@ -1619,9 +1651,16 @@ microblaze_elf_relocate_section (bfd *output_bfd,
101 else
102 {
103 if (r_type == R_MICROBLAZE_64_PCREL)
104+ {
105+ if (!input_section->output_section->vma &&
106+ !input_section->output_offset && !offset)
107+ relocation -= (input_section->output_section->vma
108+ + input_section->output_offset
109+ + offset);
110+ else
111 relocation -= (input_section->output_section->vma
112- + input_section->output_offset
113- + offset + INST_WORD_SIZE);
114+ + input_section->output_offset + offset + INST_WORD_SIZE);
115+ }
116 else if (r_type == R_MICROBLAZE_TEXTREL_64
117 || r_type == R_MICROBLAZE_TEXTREL_32_LO)
118 relocation -= input_section->output_section->vma;
119@@ -1640,14 +1679,11 @@ microblaze_elf_relocate_section (bfd *output_bfd,
120 contents + offset + endian);
121 }
122 else
123- {
124- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
125- contents + offset + endian);
126- bfd_put_16 (input_bfd, relocation & 0xffff,
127- contents + offset + endian
128- + INST_WORD_SIZE);
129- }
130- }
131+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
132+ contents + offset + endian);
133+ bfd_put_16 (input_bfd, relocation & 0xffff,
134+ contents + offset + endian + INST_WORD_SIZE);
135+ }
136 break;
137 }
138 }
139@@ -1718,6 +1754,21 @@ microblaze_elf_relocate_section (bfd *output_bfd,
140
141 return ret;
142 }
143+
144+/* Merge backend specific data from an object file to the output
145+ object file when linking.
146+
147+ Note: We only use this hook to catch endian mismatches. */
148+static bool
149+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
150+{
151+ /* Check if we have the same endianess. */
152+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
153+ return false;
154+
155+ return true;
156+}
157+
158
159 /* Calculate fixup value for reference. */
160
161@@ -2391,8 +2442,11 @@ microblaze_elf_relax_section (bfd *abfd,
162 symtab_hdr->contents = (bfd_byte *) isymbuf;
163 }
164
165- free (free_relocs);
166- free_relocs = NULL;
167+ if (free_relocs != NULL)
168+ {
169+ free (free_relocs);
170+ free_relocs = NULL;
171+ }
172
173 if (free_contents != NULL)
174 {
175@@ -2415,11 +2469,16 @@ microblaze_elf_relax_section (bfd *abfd,
176 return true;
177
178 error_return:
179- free (free_relocs);
180- free (free_contents);
181- free (sec->relax);
182- sec->relax = NULL;
183- sec->relax_count = 0;
184+ if (free_relocs != NULL)
185+ free (free_relocs);
186+ if (free_contents != NULL)
187+ free (free_contents);
188+ if (sec->relax != NULL)
189+ {
190+ free (sec->relax);
191+ sec->relax = NULL;
192+ sec->relax_count = 0;
193+ }
194 return false;
195 }
196
197@@ -2444,6 +2503,17 @@ microblaze_elf_gc_mark_hook (asection *sec,
198 return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
199 }
200
201+/* Update the got entry reference counts for the section being removed. */
202+
203+static bool
204+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
205+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
206+ asection * sec ATTRIBUTE_UNUSED,
207+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
208+{
209+ return true;
210+}
211+
212 /* PIC support. */
213
214 #define PLT_ENTRY_SIZE 16
215@@ -2650,14 +2720,14 @@ microblaze_elf_check_relocs (bfd * abfd,
216 && (! info->symbolic
217 || h->root.type == bfd_link_hash_defweak
218 || !h->def_regular))))
219- || (!bfd_link_pic (info)
220- && (sec->flags & SEC_ALLOC) != 0
221- && h != NULL
222- && (h->root.type == bfd_link_hash_defweak
223- || !h->def_regular)))
224- {
225- struct elf_dyn_relocs *p;
226- struct elf_dyn_relocs **head;
227+ || (!bfd_link_pic (info)
228+ && (sec->flags & SEC_ALLOC) != 0
229+ && h != NULL
230+ && (h->root.type == bfd_link_hash_defweak
231+ || !h->def_regular)))
232+ {
233+ struct elf64_mb_dyn_relocs *p;
234+ struct elf64_mb_dyn_relocs **head;
235
236 /* When creating a shared object, we must copy these
237 relocs into the output file. We create a reloc
238@@ -2701,14 +2771,14 @@ microblaze_elf_check_relocs (bfd * abfd,
239 return false;
240
241 vpp = &elf_section_data (s)->local_dynrel;
242- head = (struct elf_dyn_relocs **) vpp;
243+ head = (struct elf64_mb_dyn_relocs **) vpp;
244 }
245
246 p = *head;
247 if (p == NULL || p->sec != sec)
248 {
249 size_t amt = sizeof *p;
250- p = ((struct elf_dyn_relocs *)
251+ p = ((struct elf64_mb_dyn_relocs *)
252 bfd_alloc (htab->elf.dynobj, amt));
253 if (p == NULL)
254 return false;
255@@ -2731,6 +2801,34 @@ microblaze_elf_check_relocs (bfd * abfd,
256 return true;
257 }
258
259+static bool
260+microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
261+{
262+ struct elf64_mb_link_hash_table *htab;
263+
264+ htab = elf64_mb_hash_table (info);
265+ if (htab == NULL)
266+ return false;
267+
268+ if (!htab->sgot && !_bfd_elf_create_got_section (dynobj, info))
269+ return false;
270+
271+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
272+ return false;
273+
274+ htab->splt = bfd_get_linker_section (dynobj, ".plt");
275+ htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
276+ htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
277+ if (!bfd_link_pic (info))
278+ htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
279+
280+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
281+ || (!bfd_link_pic (info) && !htab->srelbss))
282+ abort ();
283+
284+ return true;
285+}
286+
287 /* Copy the extra info we tack onto an elf_link_hash_entry. */
288
289 static void
290@@ -2743,6 +2841,40 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
291 edir = (struct elf64_mb_link_hash_entry *) dir;
292 eind = (struct elf64_mb_link_hash_entry *) ind;
293
294+ if (eind->dyn_relocs != NULL)
295+ {
296+ if (edir->dyn_relocs != NULL)
297+ {
298+ struct elf64_mb_dyn_relocs **pp;
299+ struct elf64_mb_dyn_relocs *p;
300+
301+ if (ind->root.type == bfd_link_hash_indirect)
302+ abort ();
303+
304+ /* Add reloc counts against the weak sym to the strong sym
305+ list. Merge any entries against the same section. */
306+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
307+ {
308+ struct elf64_mb_dyn_relocs *q;
309+
310+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
311+ if (q->sec == p->sec)
312+ {
313+ q->pc_count += p->pc_count;
314+ q->count += p->count;
315+ *pp = p->next;
316+ break;
317+ }
318+ if (q == NULL)
319+ pp = &p->next;
320+ }
321+ *pp = edir->dyn_relocs;
322+ }
323+
324+ edir->dyn_relocs = eind->dyn_relocs;
325+ eind->dyn_relocs = NULL;
326+ }
327+
328 edir->tls_mask |= eind->tls_mask;
329
330 _bfd_elf_link_hash_copy_indirect (info, dir, ind);
331@@ -2828,9 +2960,17 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
332 return true;
333 }
334
335- /* If we don't find any dynamic relocs in read-only sections, then
336+ eh = (struct elf64_mb_link_hash_entry *) h;
337+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
338+ {
339+ s = p->sec->output_section;
340+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
341+ break;
342+ }
343+
344+ /* If we didn't find any dynamic relocs in read-only sections, then
345 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
346- if (!_bfd_elf_readonly_dynrelocs (h))
347+ if (p == NULL)
348 {
349 h->non_got_ref = 0;
350 return true;
351@@ -2849,19 +2989,11 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
352 /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
353 to copy the initial value out of the dynamic object and into the
354 runtime process image. */
355- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
356- {
357- s = htab->elf.sdynrelro;
358- srel = htab->elf.sreldynrelro;
359- }
360- else
361- {
362- s = htab->elf.sdynbss;
363- srel = htab->elf.srelbss;
364- }
365+ dynobj = elf_hash_table (info)->dynobj;
366+ BFD_ASSERT (dynobj != NULL);
367 if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
368 {
369- srel->size += sizeof (Elf64_External_Rela);
370+ htab->srelbss->size += sizeof (Elf64_External_Rela);
371 h->needs_copy = 1;
372 }
373
374@@ -2871,11 +3003,12 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
375 if (power_of_two > 3)
376 power_of_two = 3;
377
378+ sdynbss = htab->sdynbss;
379 /* Apply the required alignment. */
380- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
381- if (power_of_two > s->alignment_power)
382+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
383+ if (power_of_two > sdynbss->alignment_power)
384 {
385- if (!bfd_set_section_alignment (s, power_of_two))
386+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
387 return false;
388 }
389
390@@ -2897,7 +3030,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
391 struct bfd_link_info *info;
392 struct elf64_mb_link_hash_table *htab;
393 struct elf64_mb_link_hash_entry *eh;
394- struct elf_dyn_relocs *p;
395+ struct elf64_mb_dyn_relocs *p;
396
397 if (h->root.type == bfd_link_hash_indirect)
398 return true;
399@@ -2949,7 +3082,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
400 htab->elf.sgotplt->size += 4;
401
402 /* We also need to make an entry in the .rel.plt section. */
403- htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
404+ htab->elf.srelplt->size += sizeof (Elf64_External_Rela);
405 }
406 else
407 {
408@@ -3015,7 +3148,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
409 else
410 h->got.offset = (bfd_vma) -1;
411
412- if (h->dyn_relocs == NULL)
413+ if (eh->dyn_relocs == NULL)
414 return true;
415
416 /* In the shared -Bsymbolic case, discard space allocated for
417@@ -3030,9 +3163,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
418 && (h->forced_local
419 || info->symbolic))
420 {
421- struct elf_dyn_relocs **pp;
422+ struct elf64_mb_dyn_relocs **pp;
423
424- for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
425+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
426 {
427 p->count -= p->pc_count;
428 p->pc_count = 0;
429@@ -3124,7 +3257,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
430 {
431 struct elf_dyn_relocs *p;
432
433- for (p = ((struct elf_dyn_relocs *)
434+ for (p = ((struct elf64_mb_dyn_relocs *)
435 elf_section_data (s)->local_dynrel);
436 p != NULL;
437 p = p->next)
438@@ -3601,13 +3734,14 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
439 #define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
440 #define elf_backend_relocate_section microblaze_elf_relocate_section
441 #define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
442-#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
443+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
444 #define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
445
446 #define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
447-#define elf_backend_check_relocs microblaze_elf_check_relocs
448-#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
449-#define bfd_elf32_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
450+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
451+#define elf_backend_check_relocs microblaze_elf_check_relocs
452+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
453+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
454 #define elf_backend_can_gc_sections 1
455 #define elf_backend_can_refcount 1
456 #define elf_backend_want_got_plt 1
457@@ -3617,11 +3751,11 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
458 #define elf_backend_rela_normal 1
459 #define elf_backend_dtrel_excludes_plt 1
460
461-#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
462-#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
463-#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
464-#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
465-#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
466+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
467+#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections
468+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
469+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
470+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
471 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
472
473 #include "elf64-target.h"
474diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
475index dfcd0ab1569..e34af099640 100644
476--- a/gas/config/tc-microblaze.c
477+++ b/gas/config/tc-microblaze.c
478@@ -433,7 +433,7 @@ const pseudo_typeS md_pseudo_table[] =
479 void
480 md_begin (void)
481 {
482- const struct op_code_struct * opcode;
483+ struct op_code_struct * opcode;
484 const char *prev_name = "";
485
486 opcode_hash_control = str_htab_create ();
487diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
488index d945d144c44..5e8ebb28b8f 100644
489--- a/opcodes/microblaze-dis.c
490+++ b/opcodes/microblaze-dis.c
491@@ -140,7 +140,7 @@ get_field_imm16 (struct string_buf *buf, long instr)
492
493 static char *
494 get_field_special (struct string_buf *buf, long instr,
495- const struct op_code_struct *op)
496+ struct op_code_struct *op)
497 {
498 char *p = strbuf (buf);
499 char *spr;
500@@ -213,11 +213,11 @@ get_field_special (struct string_buf *buf, long instr,
501 static unsigned long
502 read_insn_microblaze (bfd_vma memaddr,
503 struct disassemble_info *info,
504- const struct op_code_struct **opr)
505+ struct op_code_struct **opr)
506 {
507 unsigned char ibytes[4];
508 int status;
509- const struct op_code_struct *op;
510+ struct op_code_struct *op;
511 unsigned long inst;
512
513 status = info->read_memory_func (memaddr, ibytes, 4, info);
514@@ -253,7 +253,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
515 fprintf_ftype print_func = info->fprintf_func;
516 void *stream = info->stream;
517 unsigned long inst, prev_inst;
518- const struct op_code_struct *op, *pop;
519+ struct op_code_struct *op, *pop;
520 int immval = 0;
521 bool immfound = false;
522 static bfd_vma prev_insn_addr = -1; /* Init the prev insn addr. */
523@@ -496,7 +496,7 @@ get_insn_microblaze (long inst,
524 enum microblaze_instr_type *insn_type,
525 short *delay_slots)
526 {
527- const struct op_code_struct *op;
528+ struct op_code_struct *op;
529 *isunsignedimm = false;
530
531 /* Just a linear search of the table. */
532@@ -538,7 +538,7 @@ microblaze_get_target_address (long inst, bool immfound, int immval,
533 bool *targetvalid,
534 bool *unconditionalbranch)
535 {
536- const struct op_code_struct *op;
537+ struct op_code_struct *op;
538 long targetaddr = 0;
539
540 *unconditionalbranch = false;
541diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
542index 6f9a5a60dab..a6165649793 100644
543--- a/opcodes/microblaze-opc.h
544+++ b/opcodes/microblaze-opc.h
545@@ -145,7 +145,7 @@
546
547 #define MAX_OPCODES 424
548
549-const struct op_code_struct
550+struct op_code_struct
551 {
552 const char * name;
553 short inst_type; /* Registers and immediate values involved. */
554--
5552.17.1
556
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch
deleted file mode 100644
index 646914a4..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-support-for-native-gdb.patch
+++ /dev/null
@@ -1,495 +0,0 @@
1From eef1384ec08bbbac893e4a564981517f92f90b57 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 20 Jul 2012 15:18:35 +1000
4Subject: [PATCH 39/52] Initial support for native gdb
5
6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE
8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10
11Conflicts:
12 gdb/Makefile.in
13---
14 gdb/Makefile.in | 2 +
15 gdb/config/microblaze/linux.mh | 9 +
16 gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++
17 3 files changed, 442 insertions(+)
18 create mode 100644 gdb/config/microblaze/linux.mh
19 create mode 100644 gdb/microblaze-linux-nat.c
20
21diff --git a/gdb/Makefile.in b/gdb/Makefile.in
22index 9ae9fe2d1e..a44464b983 100644
23--- a/gdb/Makefile.in
24+++ b/gdb/Makefile.in
25@@ -1328,6 +1328,7 @@ HFILES_NO_SRCDIR = \
26 memory-map.h \
27 memrange.h \
28 microblaze-tdep.h \
29+ microblaze-linux-tdep.h \
30 mips-linux-tdep.h \
31 mips-nbsd-tdep.h \
32 mips-tdep.h \
33@@ -2207,6 +2208,7 @@ ALLDEPFILES = \
34 m68k-tdep.c \
35 microblaze-linux-tdep.c \
36 microblaze-tdep.c \
37+ microblaze-linux-nat.c \
38 mingw-hdep.c \
39 mips-fbsd-nat.c \
40 mips-fbsd-tdep.c \
41diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
42new file mode 100644
43index 0000000000..a4eaf540e1
44--- /dev/null
45+++ b/gdb/config/microblaze/linux.mh
46@@ -0,0 +1,9 @@
47+# Host: Microblaze, running Linux
48+
49+NAT_FILE= config/nm-linux.h
50+NATDEPFILES= inf-ptrace.o fork-child.o \
51+ microblaze-linux-nat.o proc-service.o linux-thread-db.o \
52+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
53+NAT_CDEPS = $(srcdir)/proc-service.list
54+
55+LOADLIBES = -ldl $(RDYNAMIC)
56diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
57new file mode 100644
58index 0000000000..e9b8c9c522
59--- /dev/null
60+++ b/gdb/microblaze-linux-nat.c
61@@ -0,0 +1,431 @@
62+/* Microblaze GNU/Linux native support.
63+
64+ Copyright (C) 1988-1989, 1991-1992, 1994, 1996, 2000-2012 Free
65+ Software Foundation, Inc.
66+
67+ This file is part of GDB.
68+
69+ This program is free software; you can redistribute it and/or modify
70+ it under the terms of the GNU General Public License as published by
71+ the Free Software Foundation; either version 3 of the License, or
72+ (at your option) any later version.
73+
74+ This program is distributed in the hope that it will be useful,
75+ but WITHOUT ANY WARRANTY; without even the implied warranty of
76+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+ GNU General Public License for more details.
78+
79+ You should have received a copy of the GNU General Public License
80+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
81+
82+#include "defs.h"
83+#include "arch-utils.h"
84+#include "dis-asm.h"
85+#include "frame.h"
86+#include "trad-frame.h"
87+#include "symtab.h"
88+#include "value.h"
89+#include "gdbcmd.h"
90+#include "breakpoint.h"
91+#include "inferior.h"
92+#include "regcache.h"
93+#include "target.h"
94+#include "frame.h"
95+#include "frame-base.h"
96+#include "frame-unwind.h"
97+#include "dwarf2-frame.h"
98+#include "osabi.h"
99+
100+#include "gdb_assert.h"
101+#include "gdb_string.h"
102+#include "target-descriptions.h"
103+#include "opcodes/microblaze-opcm.h"
104+#include "opcodes/microblaze-dis.h"
105+
106+#include "linux-nat.h"
107+#include "target-descriptions.h"
108+
109+#include <sys/user.h>
110+#include <sys/utsname.h>
111+#include <sys/procfs.h>
112+#include <sys/ptrace.h>
113+
114+/* Prototypes for supply_gregset etc. */
115+#include "gregset.h"
116+
117+#include "microblaze-tdep.h"
118+
119+#include <elf/common.h>
120+#include "auxv.h"
121+
122+/* Defines ps_err_e, struct ps_prochandle. */
123+#include "gdb_proc_service.h"
124+
125+/* On GNU/Linux, threads are implemented as pseudo-processes, in which
126+ case we may be tracing more than one process at a time. In that
127+ case, inferior_ptid will contain the main process ID and the
128+ individual thread (process) ID. get_thread_id () is used to get
129+ the thread id if it's available, and the process id otherwise. */
130+
131+int
132+get_thread_id (ptid_t ptid)
133+{
134+ int tid = TIDGET (ptid);
135+ if (0 == tid)
136+ tid = PIDGET (ptid);
137+ return tid;
138+}
139+
140+#define GET_THREAD_ID(PTID) get_thread_id (PTID)
141+
142+/* Non-zero if our kernel may support the PTRACE_GETREGS and
143+ PTRACE_SETREGS requests, for reading and writing the
144+ general-purpose registers. Zero if we've tried one of
145+ them and gotten an error. */
146+int have_ptrace_getsetregs = 1;
147+
148+static int
149+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
150+{
151+ int u_addr = -1;
152+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
153+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
154+ interface, and not the wordsize of the program's ABI. */
155+ int wordsize = sizeof (long);
156+
157+ /* General purpose registers occupy 1 slot each in the buffer. */
158+ if (regno >= MICROBLAZE_R0_REGNUM
159+ && regno <= MICROBLAZE_FSR_REGNUM)
160+ u_addr = (regno * wordsize);
161+
162+ return u_addr;
163+}
164+
165+
166+static void
167+fetch_register (struct regcache *regcache, int tid, int regno)
168+{
169+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
170+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
171+ /* This isn't really an address. But ptrace thinks of it as one. */
172+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
173+ int bytes_transferred;
174+ unsigned int offset; /* Offset of registers within the u area. */
175+ char buf[MAX_REGISTER_SIZE];
176+
177+ if (regaddr == -1)
178+ {
179+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
180+ regcache_raw_supply (regcache, regno, buf);
181+ return;
182+ }
183+
184+ /* Read the raw register using sizeof(long) sized chunks. On a
185+ 32-bit platform, 64-bit floating-point registers will require two
186+ transfers. */
187+ for (bytes_transferred = 0;
188+ bytes_transferred < register_size (gdbarch, regno);
189+ bytes_transferred += sizeof (long))
190+ {
191+ long l;
192+
193+ errno = 0;
194+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
195+ regaddr += sizeof (long);
196+ if (errno != 0)
197+ {
198+ char message[128];
199+ sprintf (message, "reading register %s (#%d)",
200+ gdbarch_register_name (gdbarch, regno), regno);
201+ perror_with_name (message);
202+ }
203+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
204+ }
205+
206+ /* Now supply the register. Keep in mind that the regcache's idea
207+ of the register's size may not be a multiple of sizeof
208+ (long). */
209+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
210+ {
211+ /* Little-endian values are always found at the left end of the
212+ bytes transferred. */
213+ regcache_raw_supply (regcache, regno, buf);
214+ }
215+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
216+ {
217+ /* Big-endian values are found at the right end of the bytes
218+ transferred. */
219+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
220+ regcache_raw_supply (regcache, regno, buf + padding);
221+ }
222+ else
223+ internal_error (__FILE__, __LINE__,
224+ _("fetch_register: unexpected byte order: %d"),
225+ gdbarch_byte_order (gdbarch));
226+}
227+
228+/* This function actually issues the request to ptrace, telling
229+ it to get all general-purpose registers and put them into the
230+ specified regset.
231+
232+ If the ptrace request does not exist, this function returns 0
233+ and properly sets the have_ptrace_* flag. If the request fails,
234+ this function calls perror_with_name. Otherwise, if the request
235+ succeeds, then the regcache gets filled and 1 is returned. */
236+static int
237+fetch_all_gp_regs (struct regcache *regcache, int tid)
238+{
239+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
240+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
241+ gdb_gregset_t gregset;
242+
243+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
244+ {
245+ if (errno == EIO)
246+ {
247+ have_ptrace_getsetregs = 0;
248+ return 0;
249+ }
250+ perror_with_name (_("Couldn't get general-purpose registers."));
251+ }
252+
253+ supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
254+
255+ return 1;
256+}
257+
258+
259+/* This is a wrapper for the fetch_all_gp_regs function. It is
260+ responsible for verifying if this target has the ptrace request
261+ that can be used to fetch all general-purpose registers at one
262+ shot. If it doesn't, then we should fetch them using the
263+ old-fashioned way, which is to iterate over the registers and
264+ request them one by one. */
265+static void
266+fetch_gp_regs (struct regcache *regcache, int tid)
267+{
268+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
269+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
270+ int i;
271+
272+ if (have_ptrace_getsetregs)
273+ if (fetch_all_gp_regs (regcache, tid))
274+ return;
275+
276+ /* If we've hit this point, it doesn't really matter which
277+ architecture we are using. We just need to read the
278+ registers in the "old-fashioned way". */
279+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
280+ fetch_register (regcache, tid, i);
281+}
282+
283+
284+static void
285+store_register (const struct regcache *regcache, int tid, int regno)
286+{
287+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
288+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
289+ /* This isn't really an address. But ptrace thinks of it as one. */
290+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
291+ int i;
292+ size_t bytes_to_transfer;
293+ char buf[MAX_REGISTER_SIZE];
294+
295+ if (regaddr == -1)
296+ return;
297+
298+ /* First collect the register. Keep in mind that the regcache's
299+ idea of the register's size may not be a multiple of sizeof
300+ (long). */
301+ memset (buf, 0, sizeof buf);
302+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
303+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
304+ {
305+ /* Little-endian values always sit at the left end of the buffer. */
306+ regcache_raw_collect (regcache, regno, buf);
307+ }
308+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
309+ {
310+ /* Big-endian values sit at the right end of the buffer. */
311+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
312+ regcache_raw_collect (regcache, regno, buf + padding);
313+ }
314+
315+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
316+ {
317+ long l;
318+
319+ memcpy (&l, &buf[i], sizeof (l));
320+ errno = 0;
321+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
322+ regaddr += sizeof (long);
323+
324+ if (errno != 0)
325+ {
326+ char message[128];
327+ sprintf (message, "writing register %s (#%d)",
328+ gdbarch_register_name (gdbarch, regno), regno);
329+ perror_with_name (message);
330+ }
331+ }
332+}
333+
334+/* This function actually issues the request to ptrace, telling
335+ it to store all general-purpose registers present in the specified
336+ regset.
337+
338+ If the ptrace request does not exist, this function returns 0
339+ and properly sets the have_ptrace_* flag. If the request fails,
340+ this function calls perror_with_name. Otherwise, if the request
341+ succeeds, then the regcache is stored and 1 is returned. */
342+static int
343+store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
344+{
345+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
346+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
347+ gdb_gregset_t gregset;
348+
349+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
350+ {
351+ if (errno == EIO)
352+ {
353+ have_ptrace_getsetregs = 0;
354+ return 0;
355+ }
356+ perror_with_name (_("Couldn't get general-purpose registers."));
357+ }
358+
359+ fill_gregset (regcache, &gregset, regno);
360+
361+ if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0)
362+ {
363+ if (errno == EIO)
364+ {
365+ have_ptrace_getsetregs = 0;
366+ return 0;
367+ }
368+ perror_with_name (_("Couldn't set general-purpose registers."));
369+ }
370+
371+ return 1;
372+}
373+
374+/* This is a wrapper for the store_all_gp_regs function. It is
375+ responsible for verifying if this target has the ptrace request
376+ that can be used to store all general-purpose registers at one
377+ shot. If it doesn't, then we should store them using the
378+ old-fashioned way, which is to iterate over the registers and
379+ store them one by one. */
380+static void
381+store_gp_regs (const struct regcache *regcache, int tid, int regno)
382+{
383+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
384+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
385+ int i;
386+
387+ if (have_ptrace_getsetregs)
388+ if (store_all_gp_regs (regcache, tid, regno))
389+ return;
390+
391+ /* If we hit this point, it doesn't really matter which
392+ architecture we are using. We just need to store the
393+ registers in the "old-fashioned way". */
394+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
395+ store_register (regcache, tid, i);
396+}
397+
398+
399+/* Fetch registers from the child process. Fetch all registers if
400+ regno == -1, otherwise fetch all general registers or all floating
401+ point registers depending upon the value of regno. */
402+
403+static void
404+microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
405+ struct regcache *regcache, int regno)
406+{
407+ /* Get the thread id for the ptrace call. */
408+ int tid = GET_THREAD_ID (inferior_ptid);
409+
410+ if (regno == -1)
411+ fetch_gp_regs (regcache, tid);
412+ else
413+ fetch_register (regcache, tid, regno);
414+}
415+
416+/* Store registers back into the inferior. Store all registers if
417+ regno == -1, otherwise store all general registers or all floating
418+ point registers depending upon the value of regno. */
419+
420+static void
421+microblaze_linux_store_inferior_registers (struct target_ops *ops,
422+ struct regcache *regcache, int regno)
423+{
424+ /* Get the thread id for the ptrace call. */
425+ int tid = GET_THREAD_ID (inferior_ptid);
426+
427+ if (regno >= 0)
428+ store_register (regcache, tid, regno);
429+ else
430+ store_gp_regs (regcache, tid, -1);
431+}
432+
433+/* Wrapper functions for the standard regset handling, used by
434+ thread debugging. */
435+
436+void
437+fill_gregset (const struct regcache *regcache,
438+ gdb_gregset_t *gregsetp, int regno)
439+{
440+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
441+}
442+
443+void
444+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
445+{
446+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
447+}
448+
449+void
450+fill_fpregset (const struct regcache *regcache,
451+ gdb_fpregset_t *fpregsetp, int regno)
452+{
453+ /* FIXME. */
454+}
455+
456+void
457+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
458+{
459+ /* FIXME. */
460+}
461+
462+static const struct target_desc *
463+microblaze_linux_read_description (struct target_ops *ops)
464+{
465+ CORE_ADDR microblaze_hwcap = 0;
466+
467+ if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
468+ return NULL;
469+
470+ return NULL;
471+}
472+
473+
474+void _initialize_microblaze_linux_nat (void);
475+
476+void
477+_initialize_microblaze_linux_nat (void)
478+{
479+ struct target_ops *t;
480+
481+ /* Fill in the generic GNU/Linux methods. */
482+ t = linux_target ();
483+
484+ /* Add our register access methods. */
485+ t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
486+ t->to_store_registers = microblaze_linux_store_inferior_registers;
487+
488+ t->to_read_description = microblaze_linux_read_description;
489+
490+ /* Register the target. */
491+ linux_nat_add_target (t);
492+}
493--
4942.17.1
495
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
deleted file mode 100644
index 2cb1cc81..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0041-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
+++ /dev/null
@@ -1,1008 +0,0 @@
1From 90412eba37c683e0526470c39926318ae7f5bd27 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 41/52] Adding 64 bit MB support Added new architecture to
5 Microblaze 64-bit support to GDB Signed-off-by :Nagaraju Mekala
6 <nmekala@xilix.com>
7
8Conflicts:
9 gdb/Makefile.in
10---
11 bfd/archures.c | 2 +
12 bfd/bfd-in2.h | 2 +
13 bfd/cpu-microblaze.c | 8 +-
14 gas/config/tc-microblaze.c | 13 ++
15 gas/config/tc-microblaze.h | 4 +
16 gdb/features/Makefile | 3 +
17 gdb/features/microblaze-core.xml | 6 +-
18 gdb/features/microblaze-stack-protect.xml | 4 +-
19 gdb/features/microblaze-with-stack-protect.c | 8 +-
20 gdb/features/microblaze.c | 6 +-
21 gdb/features/microblaze64-core.xml | 69 ++++++
22 gdb/features/microblaze64-stack-protect.xml | 12 +
23 .../microblaze64-with-stack-protect.c | 79 +++++++
24 .../microblaze64-with-stack-protect.xml | 12 +
25 gdb/features/microblaze64.c | 77 +++++++
26 gdb/features/microblaze64.xml | 11 +
27 gdb/microblaze-tdep.c | 207 ++++++++++++++++--
28 gdb/microblaze-tdep.h | 8 +-
29 .../microblaze-with-stack-protect.dat | 4 +-
30 19 files changed, 491 insertions(+), 44 deletions(-)
31 create mode 100644 gdb/features/microblaze64-core.xml
32 create mode 100644 gdb/features/microblaze64-stack-protect.xml
33 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
34 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
35 create mode 100644 gdb/features/microblaze64.c
36 create mode 100644 gdb/features/microblaze64.xml
37
38diff --git a/bfd/archures.c b/bfd/archures.c
39index 551ec8732f..627d81261d 100644
40--- a/bfd/archures.c
41+++ b/bfd/archures.c
42@@ -522,6 +522,8 @@ DESCRIPTION
43 . bfd_arch_lm32, {* Lattice Mico32. *}
44 .#define bfd_mach_lm32 1
45 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
46+.#define bfd_mach_microblaze 1
47+.#define bfd_mach_microblaze64 2
48 . bfd_arch_tilepro, {* Tilera TILEPro. *}
49 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
50 .#define bfd_mach_tilepro 1
51diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
52index 05fbeb9b3a..788fb2b48b 100644
53--- a/bfd/bfd-in2.h
54+++ b/bfd/bfd-in2.h
55@@ -1922,6 +1922,8 @@ enum bfd_architecture
56 bfd_arch_lm32, /* Lattice Mico32. */
57 #define bfd_mach_lm32 1
58 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
59+#define bfd_mach_microblaze 1
60+#define bfd_mach_microblaze64 2
61 bfd_arch_tilepro, /* Tilera TILEPro. */
62 bfd_arch_tilegx, /* Tilera TILE-Gx. */
63 #define bfd_mach_tilepro 1
64diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
65index 194920b20b..f3e8bbda75 100644
66--- a/bfd/cpu-microblaze.c
67+++ b/bfd/cpu-microblaze.c
68@@ -31,7 +31,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
69 64, /* 32 bits in an address. */
70 8, /* 8 bits in a byte. */
71 bfd_arch_microblaze, /* Architecture. */
72- 0, /* Machine number - 0 for now. */
73+ bfd_mach_microblaze64, /* 64 bit Machine */
74 "microblaze", /* Architecture name. */
75 "MicroBlaze", /* Printable name. */
76 3, /* Section align power. */
77@@ -46,7 +46,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
78 32, /* Bits in an address. */
79 8, /* Bits in a byte. */
80 bfd_arch_microblaze, /* Architecture number. */
81- 0, /* Machine number - 0 for now. */
82+ bfd_mach_microblaze, /* 32 bit Machine */
83 "microblaze", /* Architecture name. */
84 "MicroBlaze", /* Printable name. */
85 3, /* Section align power. */
86@@ -63,7 +63,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
87 32, /* 32 bits in an address. */
88 8, /* 8 bits in a byte. */
89 bfd_arch_microblaze, /* Architecture. */
90- 0, /* Machine number - 0 for now. */
91+ bfd_mach_microblaze, /* 32 bit Machine */
92 "microblaze", /* Architecture name. */
93 "MicroBlaze", /* Printable name. */
94 3, /* Section align power. */
95@@ -78,7 +78,7 @@ const bfd_arch_info_type bfd_microblaze_arch[] =
96 64, /* 32 bits in an address. */
97 8, /* 8 bits in a byte. */
98 bfd_arch_microblaze, /* Architecture. */
99- 0, /* Machine number - 0 for now. */
100+ bfd_mach_microblaze64, /* 64 bit Machine */
101 "microblaze", /* Architecture name. */
102 "MicroBlaze", /* Printable name. */
103 3, /* Section align power. */
104diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
105index c6ca913f8b..df7088d6c3 100644
106--- a/gas/config/tc-microblaze.c
107+++ b/gas/config/tc-microblaze.c
108@@ -438,6 +438,11 @@ md_begin (void)
109
110 opcode_hash_control = hash_new ();
111
112+ if (microblaze_arch_size == 64)
113+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze64);
114+ else
115+ bfd_set_arch_mach (stdoutput, bfd_arch_microblaze, bfd_mach_microblaze);
116+
117 /* Insert unique names into hash table. */
118 for (opcode = (struct opcodes *)opcodes; opcode->name; opcode ++)
119 {
120@@ -3478,6 +3483,14 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
121 fprintf (stream, " -%-23s%s\n", "m64", N_("generate 64-bit elf"));
122 }
123
124+unsigned long
125+microblaze_mach (void)
126+{
127+ if (microblaze_arch_size == 64)
128+ return bfd_mach_microblaze64;
129+ else
130+ return bfd_mach_microblaze;
131+}
132
133 /* Create a fixup for a cons expression. If parse_cons_expression_microblaze
134 found a machine specific op in an expression,
135diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
136index 7435a70ef5..90c2a4a555 100644
137--- a/gas/config/tc-microblaze.h
138+++ b/gas/config/tc-microblaze.h
139@@ -23,6 +23,10 @@
140 #define TC_MICROBLAZE 1
141
142 #define TARGET_ARCH bfd_arch_microblaze
143+#define TARGET_MACH (microblaze_mach ())
144+#define DEFAULT_MACHINE bfd_mach_microblaze64
145+extern unsigned long microblaze_mach (void);
146+
147 #ifndef TARGET_BYTES_BIG_ENDIAN
148 /* Used to initialise target_big_endian. */
149 #define TARGET_BYTES_BIG_ENDIAN 1
150diff --git a/gdb/features/Makefile b/gdb/features/Makefile
151index d0af9a47b4..2c3cf91b69 100644
152--- a/gdb/features/Makefile
153+++ b/gdb/features/Makefile
154@@ -46,6 +46,7 @@
155 # List of .dat files to create in ../regformats/
156 WHICH = mips-linux mips-dsp-linux \
157 microblaze-with-stack-protect \
158+ microblaze64-with-stack-protect \
159 mips64-linux mips64-dsp-linux \
160 nios2-linux \
161 rs6000/powerpc-32 \
162@@ -107,7 +108,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
163 # to make on the command line.
164 XMLTOC = \
165 microblaze-with-stack-protect.xml \
166+ microblaze64-with-stack-protect.xml \
167 microblaze.xml \
168+ microblaze64.xml \
169 mips-dsp-linux.xml \
170 mips-linux.xml \
171 mips64-dsp-linux.xml \
172diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
173index f272650a41..a87f0f2319 100644
174--- a/gdb/features/microblaze-core.xml
175+++ b/gdb/features/microblaze-core.xml
176@@ -8,7 +8,7 @@
177 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
178 <feature name="org.gnu.gdb.microblaze.core">
179 <reg name="r0" bitsize="32" regnum="0"/>
180- <reg name="r1" bitsize="32" type="data_ptr"/>
181+ <reg name="r1" bitsize="32"/>
182 <reg name="r2" bitsize="32"/>
183 <reg name="r3" bitsize="32"/>
184 <reg name="r4" bitsize="32"/>
185@@ -39,7 +39,7 @@
186 <reg name="r29" bitsize="32"/>
187 <reg name="r30" bitsize="32"/>
188 <reg name="r31" bitsize="32"/>
189- <reg name="rpc" bitsize="32" type="code_ptr"/>
190+ <reg name="rpc" bitsize="32"/>
191 <reg name="rmsr" bitsize="32"/>
192 <reg name="rear" bitsize="32"/>
193 <reg name="resr" bitsize="32"/>
194@@ -64,4 +64,6 @@
195 <reg name="rtlbsx" bitsize="32"/>
196 <reg name="rtlblo" bitsize="32"/>
197 <reg name="rtlbhi" bitsize="32"/>
198+ <reg name="slr" 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"/>
213 </feature>
214diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
215index b39aa19887..609934e2b4 100644
216--- a/gdb/features/microblaze-with-stack-protect.c
217+++ b/gdb/features/microblaze-with-stack-protect.c
218@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
219
220 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
221 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
222- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
223+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
224 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
225 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
226 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
227@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
228 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
229 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
230 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
231- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
232+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
233 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
234 tdesc_create_reg (feature, "rear", 34, 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 }
247diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
248index 6c86fc0770..ceb98ca8b8 100644
249--- a/gdb/features/microblaze.c
250+++ b/gdb/features/microblaze.c
251@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
252
253 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.core");
254 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
255- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
256+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
257 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
258 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
259 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
260@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
261 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
262 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
263 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
264- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
265+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
266 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
267 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
268 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
269@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
270 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
271 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
272 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
273+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
274+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
275
276 tdesc_microblaze = result;
277 }
278diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
279new file mode 100644
280index 0000000000..96e99e2fb2
281--- /dev/null
282+++ b/gdb/features/microblaze64-core.xml
283@@ -0,0 +1,69 @@
284+<?xml version="1.0"?>
285+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
286+
287+ Copying and distribution of this file, with or without modification,
288+ are permitted in any medium without royalty provided the copyright
289+ notice and this notice are preserved. -->
290+
291+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
292+<feature name="org.gnu.gdb.microblaze64.core">
293+ <reg name="r0" bitsize="64" regnum="0"/>
294+ <reg name="r1" bitsize="64"/>
295+ <reg name="r2" bitsize="64"/>
296+ <reg name="r3" bitsize="64"/>
297+ <reg name="r4" bitsize="64"/>
298+ <reg name="r5" bitsize="64"/>
299+ <reg name="r6" bitsize="64"/>
300+ <reg name="r7" bitsize="64"/>
301+ <reg name="r8" bitsize="64"/>
302+ <reg name="r9" bitsize="64"/>
303+ <reg name="r10" bitsize="64"/>
304+ <reg name="r11" bitsize="64"/>
305+ <reg name="r12" bitsize="64"/>
306+ <reg name="r13" bitsize="64"/>
307+ <reg name="r14" bitsize="64"/>
308+ <reg name="r15" bitsize="64"/>
309+ <reg name="r16" bitsize="64"/>
310+ <reg name="r17" bitsize="64"/>
311+ <reg name="r18" bitsize="64"/>
312+ <reg name="r19" bitsize="64"/>
313+ <reg name="r20" bitsize="64"/>
314+ <reg name="r21" bitsize="64"/>
315+ <reg name="r22" bitsize="64"/>
316+ <reg name="r23" bitsize="64"/>
317+ <reg name="r24" bitsize="64"/>
318+ <reg name="r25" bitsize="64"/>
319+ <reg name="r26" bitsize="64"/>
320+ <reg name="r27" bitsize="64"/>
321+ <reg name="r28" bitsize="64"/>
322+ <reg name="r29" bitsize="64"/>
323+ <reg name="r30" bitsize="64"/>
324+ <reg name="r31" bitsize="64"/>
325+ <reg name="rpc" bitsize="64"/>
326+ <reg name="rmsr" bitsize="32"/>
327+ <reg name="rear" bitsize="64"/>
328+ <reg name="resr" bitsize="32"/>
329+ <reg name="rfsr" bitsize="32"/>
330+ <reg name="rbtr" bitsize="64"/>
331+ <reg name="rpvr0" bitsize="32"/>
332+ <reg name="rpvr1" bitsize="32"/>
333+ <reg name="rpvr2" bitsize="32"/>
334+ <reg name="rpvr3" bitsize="32"/>
335+ <reg name="rpvr4" bitsize="32"/>
336+ <reg name="rpvr5" bitsize="32"/>
337+ <reg name="rpvr6" bitsize="32"/>
338+ <reg name="rpvr7" bitsize="32"/>
339+ <reg name="rpvr8" bitsize="64"/>
340+ <reg name="rpvr9" bitsize="64"/>
341+ <reg name="rpvr10" bitsize="32"/>
342+ <reg name="rpvr11" bitsize="32"/>
343+ <reg name="redr" bitsize="32"/>
344+ <reg name="rpid" bitsize="32"/>
345+ <reg name="rzpr" bitsize="32"/>
346+ <reg name="rtlbx" bitsize="32"/>
347+ <reg name="rtlbsx" bitsize="32"/>
348+ <reg name="rtlblo" bitsize="32"/>
349+ <reg name="rtlbhi" bitsize="32"/>
350+ <reg name="slr" bitsize="64"/>
351+ <reg name="shr" bitsize="64"/>
352+</feature>
353diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
354new file mode 100644
355index 0000000000..1bbf5fc3ce
356--- /dev/null
357+++ b/gdb/features/microblaze64-stack-protect.xml
358@@ -0,0 +1,12 @@
359+<?xml version="1.0"?>
360+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
361+
362+ Copying and distribution of this file, with or without modification,
363+ are permitted in any medium without royalty provided the copyright
364+ notice and this notice are preserved. -->
365+
366+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
367+<feature name="org.gnu.gdb.microblaze64.stack-protect">
368+ <reg name="slr" bitsize="64"/>
369+ <reg name="shr" bitsize="64"/>
370+</feature>
371diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
372new file mode 100644
373index 0000000000..f448c9a749
374--- /dev/null
375+++ b/gdb/features/microblaze64-with-stack-protect.c
376@@ -0,0 +1,79 @@
377+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
378+ Original: microblaze-with-stack-protect.xml */
379+
380+#include "defs.h"
381+#include "osabi.h"
382+#include "target-descriptions.h"
383+
384+struct target_desc *tdesc_microblaze64_with_stack_protect;
385+static void
386+initialize_tdesc_microblaze64_with_stack_protect (void)
387+{
388+ struct target_desc *result = allocate_target_description ();
389+ struct tdesc_feature *feature;
390+
391+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
392+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
393+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
394+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
395+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
396+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
397+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
398+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
399+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
400+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
401+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
402+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
403+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
404+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
405+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
406+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
407+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
408+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
409+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
410+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
411+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
412+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
413+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
414+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
415+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
416+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
417+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
418+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
419+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
420+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
421+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
422+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
423+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
424+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
425+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
426+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
427+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
428+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
429+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
430+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
431+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
432+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
433+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
434+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
435+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
436+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
437+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
438+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
439+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
440+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
441+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
442+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
443+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
444+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
445+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
446+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
447+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
448+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
449+
450+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
451+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
452+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
453+
454+ tdesc_microblaze64_with_stack_protect = result;
455+}
456diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
457new file mode 100644
458index 0000000000..0e9f01611f
459--- /dev/null
460+++ b/gdb/features/microblaze64-with-stack-protect.xml
461@@ -0,0 +1,12 @@
462+<?xml version="1.0"?>
463+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
464+
465+ Copying and distribution of this file, with or without modification,
466+ are permitted in any medium without royalty provided the copyright
467+ notice and this notice are preserved. -->
468+
469+<!DOCTYPE target SYSTEM "gdb-target.dtd">
470+<target>
471+ <xi:include href="microblaze64-core.xml"/>
472+ <xi:include href="microblaze64-stack-protect.xml"/>
473+</target>
474diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
475new file mode 100644
476index 0000000000..1aa37c4512
477--- /dev/null
478+++ b/gdb/features/microblaze64.c
479@@ -0,0 +1,77 @@
480+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
481+ Original: microblaze.xml */
482+
483+#include "defs.h"
484+#include "osabi.h"
485+#include "target-descriptions.h"
486+
487+struct target_desc *tdesc_microblaze64;
488+static void
489+initialize_tdesc_microblaze64 (void)
490+{
491+ struct target_desc *result = allocate_target_description ();
492+ struct tdesc_feature *feature;
493+
494+ feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.core");
495+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
496+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
497+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
498+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
499+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
500+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
501+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
502+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
503+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
504+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
505+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
506+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
507+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
508+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
509+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
510+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
511+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
512+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
513+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
514+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
515+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
516+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
517+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
518+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
519+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
520+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
521+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
522+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
523+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
524+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
525+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
526+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
527+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
528+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
529+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
530+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
531+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
532+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
533+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
534+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
535+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
536+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
537+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
538+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
539+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
540+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
541+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
542+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
543+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
544+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
545+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
546+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
547+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
548+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
549+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
550+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
551+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
552+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
553+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
554+
555+ tdesc_microblaze64 = result;
556+}
557diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
558new file mode 100644
559index 0000000000..515d18e65c
560--- /dev/null
561+++ b/gdb/features/microblaze64.xml
562@@ -0,0 +1,11 @@
563+<?xml version="1.0"?>
564+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
565+
566+ Copying and distribution of this file, with or without modification,
567+ are permitted in any medium without royalty provided the copyright
568+ notice and this notice are preserved. -->
569+
570+<!DOCTYPE target SYSTEM "gdb-target.dtd">
571+<target>
572+ <xi:include href="microblaze64-core.xml"/>
573+</target>
574diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
575index 1b5cf38e45..f4ea3cc342 100644
576--- a/gdb/microblaze-tdep.c
577+++ b/gdb/microblaze-tdep.c
578@@ -40,7 +40,9 @@
579 #include "remote.h"
580
581 #include "features/microblaze-with-stack-protect.c"
582+#include "features/microblaze64-with-stack-protect.c"
583 #include "features/microblaze.c"
584+#include "features/microblaze64.c"
585
586 /* Instruction macros used for analyzing the prologue. */
587 /* This set of instruction macros need to be changed whenever the
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"
594 };
595
596 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
597
598 static unsigned int microblaze_debug_flag = 0;
599+int reg_size = 4;
600
601 static void ATTRIBUTE_PRINTF (1, 2)
602 microblaze_debug (const char *fmt, ...)
603@@ -145,6 +148,7 @@ microblaze_store_arguments (struct regcache *regcache, int nargs,
604 error (_("store_arguments not implemented"));
605 return sp;
606 }
607+#if 0
608 static int
609 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
610 struct bp_target_info *bp_tgt)
611@@ -154,7 +158,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
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,
631 return val;
632 }
633
634+#endif
635 /* Allocate and initialize a frame cache. */
636
637 static struct microblaze_frame_cache *
638@@ -570,17 +576,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
639 gdb_byte *valbuf)
640 {
641 gdb_byte buf[8];
642-
643 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
644 switch (TYPE_LENGTH (type))
645 {
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)
659 return (TYPE_LENGTH (type) == 16);
660 }
661
662-
663+#if 0
664+static std::vector<CORE_ADDR>
665+microblaze_software_single_step (struct regcache *regcache)
666+{
667+// struct gdbarch *arch = get_frame_arch(frame);
668+ struct gdbarch *arch = get_regcache_arch (regcache);
669+ struct address_space *aspace = get_regcache_aspace (regcache);
670+// struct address_space *aspace = get_frame_address_space (frame);
671+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
672+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
673+ static char be_breakp[] = MICROBLAZE_BREAKPOINT;
674+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
675+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
676+ std::vector<CORE_ADDR> ret = 0;
677+
678+ /* Save the address and the values of the next_pc and the target */
679+ static struct sstep_breaks
680+ {
681+ CORE_ADDR address;
682+ bfd_boolean valid;
683+ /* Shadow contents. */
684+ char data[INST_WORD_SIZE];
685+ } stepbreaks[2];
686+ int ii;
687+
688+ if (1)
689+ {
690+ CORE_ADDR pc;
691+ std::vector<CORE_ADDR> *next_pcs = NULL;
692+ long insn;
693+ enum microblaze_instr minstr;
694+ bfd_boolean isunsignednum;
695+ enum microblaze_instr_type insn_type;
696+ short delay_slots;
697+ int imm;
698+ bfd_boolean immfound = FALSE;
699+
700+ /* Set a breakpoint at the next instruction */
701+ /* If the current instruction is an imm, set it at the inst after */
702+ /* If the instruction has a delay slot, skip the delay slot */
703+ pc = regcache_read_pc (regcache);
704+ insn = microblaze_fetch_instruction (pc);
705+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
706+ if (insn_type == immediate_inst)
707+ {
708+ int rd, ra, rb;
709+ immfound = TRUE;
710+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
711+ pc = pc + INST_WORD_SIZE;
712+ insn = microblaze_fetch_instruction (pc);
713+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
714+ }
715+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE;
716+ if (insn_type != return_inst) {
717+ stepbreaks[0].valid = TRUE;
718+ } else {
719+ stepbreaks[0].valid = FALSE;
720+ }
721+
722+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn);
723+ /* Now check for branch or return instructions */
724+ if (insn_type == branch_inst || insn_type == return_inst) {
725+ int limm;
726+ int lrd, lra, lrb;
727+ int ra, rb;
728+ bfd_boolean targetvalid;
729+ bfd_boolean unconditionalbranch;
730+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm);
731+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS)
732+ ra = regcache_raw_get_unsigned(regcache, lra);
733+ else
734+ ra = 0;
735+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
736+ rb = regcache_raw_get_unsigned(regcache, lrb);
737+ else
738+ rb = 0;
739+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
740+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
741+ if (unconditionalbranch)
742+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
743+ if (targetvalid && (stepbreaks[0].valid == FALSE ||
744+ (stepbreaks[0].address != stepbreaks[1].address))
745+ && (stepbreaks[1].address != pc)) {
746+ stepbreaks[1].valid = TRUE;
747+ } else {
748+ stepbreaks[1].valid = FALSE;
749+ }
750+ } else {
751+ stepbreaks[1].valid = FALSE;
752+ }
753+
754+ /* Insert the breakpoints */
755+ for (ii = 0; ii < 2; ++ii)
756+ {
757+
758+ /* ignore invalid breakpoint. */
759+ if (stepbreaks[ii].valid) {
760+ VEC_safe_push (CORE_ADDR, next_pcs, stepbreaks[ii].address);;
761+// insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address);
762+ ret = next_pcs;
763+ }
764+ }
765+ }
766+ return ret;
767+}
768+#endif
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+
776 static int dwarf2_to_reg_map[78] =
777 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
778 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
779@@ -682,13 +799,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
780 static void
781 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
782 {
783+
784 register_remote_g_packet_guess (gdbarch,
785- 4 * MICROBLAZE_NUM_CORE_REGS,
786- tdesc_microblaze);
787+ 4 * MICROBLAZE_NUM_REGS,
788+ tdesc_microblaze64);
789
790 register_remote_g_packet_guess (gdbarch,
791 4 * MICROBLAZE_NUM_REGS,
792- tdesc_microblaze_with_stack_protect);
793+ tdesc_microblaze64_with_stack_protect);
794 }
795
796 void
797@@ -696,15 +814,15 @@ microblaze_supply_gregset (const struct microblaze_gregset *gregset,
798 struct regcache *regcache,
799 int regnum, const void *gregs)
800 {
801- unsigned int *regs = gregs;
802+ const gdb_byte *regs = (const gdb_byte *) gregs;
803 if (regnum >= 0)
804- regcache_raw_supply (regcache, regnum, regs + regnum);
805+ regcache->raw_supply (regnum, regs + regnum);
806
807 if (regnum == -1) {
808 int i;
809
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,
817 }
818
819
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
832 static struct gdbarch *
833 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
834@@ -769,8 +898,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
835 if (arches != NULL)
836 return arches->gdbarch;
837 if (tdesc == NULL)
838- tdesc = tdesc_microblaze;
839-
840+ {
841+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
842+ {
843+ tdesc = tdesc_microblaze64;
844+ reg_size = 8;
845+ }
846+ else
847+ tdesc = tdesc_microblaze;
848+ }
849 /* Check any target description for validity. */
850 if (tdesc_has_registers (tdesc))
851 {
852@@ -778,27 +914,35 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
853 int valid_p;
854 int i;
855
856- feature = tdesc_find_feature (tdesc,
857+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
858+ feature = tdesc_find_feature (tdesc,
859+ "org.gnu.gdb.microblaze64.core");
860+ else
861+ feature = tdesc_find_feature (tdesc,
862 "org.gnu.gdb.microblaze.core");
863 if (feature == NULL)
864 return NULL;
865 tdesc_data = tdesc_data_alloc ();
866
867 valid_p = 1;
868- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
869+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
870 valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
871 microblaze_register_names[i]);
872- feature = tdesc_find_feature (tdesc,
873+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
874+ feature = tdesc_find_feature (tdesc,
875+ "org.gnu.gdb.microblaze64.stack-protect");
876+ else
877+ feature = tdesc_find_feature (tdesc,
878 "org.gnu.gdb.microblaze.stack-protect");
879 if (feature != NULL)
880 {
881 valid_p = 1;
882 valid_p &= tdesc_numbered_register (feature, tdesc_data,
883 MICROBLAZE_SLR_REGNUM,
884- "rslr");
885+ "slr");
886 valid_p &= tdesc_numbered_register (feature, tdesc_data,
887 MICROBLAZE_SHR_REGNUM,
888- "rshr");
889+ "shr");
890 }
891
892 if (!valid_p)
893@@ -806,6 +950,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
894 tdesc_data_cleanup (tdesc_data);
895 return NULL;
896 }
897+
898 }
899
900 /* Allocate space for the new architecture. */
901@@ -825,7 +970,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
902 /* Register numbers of various important registers. */
903 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
904 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
905+
906+ /* Register set.
907+ make_regs (gdbarch); */
908+ switch (info.bfd_arch_info->mach)
909+ {
910+ case bfd_mach_microblaze64:
911+ set_gdbarch_ptr_bit (gdbarch, 64);
912+ break;
913+ }
914
915+
916 /* Map Dwarf2 registers to GDB registers. */
917 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
918
919@@ -845,13 +1000,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
920 microblaze_breakpoint::kind_from_pc);
921 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
922 microblaze_breakpoint::bp_from_kind);
923- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
924+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
925+
926+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
927
928 set_gdbarch_frame_args_skip (gdbarch, 8);
929
930 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
931
932- microblaze_register_g_packet_guesses (gdbarch);
933+ //microblaze_register_g_packet_guesses (gdbarch);
934
935 frame_base_set_default (gdbarch, &microblaze_frame_base);
936
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 ()
952
953 initialize_tdesc_microblaze_with_stack_protect ();
954 initialize_tdesc_microblaze ();
955+ initialize_tdesc_microblaze64_with_stack_protect ();
956+ initialize_tdesc_microblaze64 ();
957 /* Debug this files internals. */
958 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
959 &microblaze_debug_flag, _("\
960diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
961index 1234f8a36f..c0fc900733 100644
962--- a/gdb/microblaze-tdep.h
963+++ b/gdb/microblaze-tdep.h
964@@ -27,7 +27,7 @@ struct microblaze_gregset
965 microblaze_gregset() {}
966 unsigned int gregs[32];
967 unsigned int fpregs[32];
968- unsigned int pregs[16];
969+ unsigned int pregs[18];
970 };
971
972 struct gdbarch_tdep
973@@ -101,9 +101,9 @@ enum microblaze_regnum
974 MICROBLAZE_RTLBSX_REGNUM,
975 MICROBLAZE_RTLBLO_REGNUM,
976 MICROBLAZE_RTLBHI_REGNUM,
977- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
978+ MICROBLAZE_SLR_REGNUM,
979 MICROBLAZE_SHR_REGNUM,
980- MICROBLAZE_NUM_REGS
981+ MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS
982 };
983
984 struct microblaze_frame_cache
985@@ -128,7 +128,7 @@ struct microblaze_frame_cache
986 struct trad_frame_saved_reg *saved_regs;
987 };
988 /* All registers are 32 bits. */
989-#define MICROBLAZE_REGISTER_SIZE 4
990+//#define MICROBLAZE_REGISTER_SIZE 8
991
992 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
993 Only used for native debugging. */
994diff --git a/gdb/regformats/microblaze-with-stack-protect.dat b/gdb/regformats/microblaze-with-stack-protect.dat
995index 8040a7b3fd..450e321d49 100644
996--- a/gdb/regformats/microblaze-with-stack-protect.dat
997+++ b/gdb/regformats/microblaze-with-stack-protect.dat
998@@ -60,5 +60,5 @@ expedite:r1,rpc
999 32:rtlbsx
1000 32:rtlblo
1001 32:rtlbhi
1002-32:rslr
1003-32:rshr
1004+32:slr
1005+32:shr
1006--
10072.17.1
1008
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
deleted file mode 100644
index e115666c..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0042-porting-GDB-for-linux.patch
+++ /dev/null
@@ -1,155 +0,0 @@
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
deleted file mode 100644
index 969ac2c0..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0043-Binutils-security-check-is-causing-build-error-for-w.patch
+++ /dev/null
@@ -1,41 +0,0 @@
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
deleted file mode 100644
index 48c9c2c9..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0044-Correcting-the-register-names-from-slr-shr-to-rslr-r.patch
+++ /dev/null
@@ -1,146 +0,0 @@
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
deleted file mode 100644
index 46124c12..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0045-Removing-the-header-gdb_assert.h-from-MB-target-file.patch
+++ /dev/null
@@ -1,24 +0,0 @@
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
deleted file mode 100644
index 46d51dd6..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0046-bfd-cpu-microblaze.c-Enhance-disassembler.patch
+++ /dev/null
@@ -1,39 +0,0 @@
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
deleted file mode 100644
index 423b224b..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0047-bfd-elf64-microblaze.c-Fix-build-failures.patch
+++ /dev/null
@@ -1,78 +0,0 @@
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@@ -2911,7 +2911,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
25
26 /* If we didn't find any dynamic relocs in read-only sections, then
27 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
28- if (!_bfd_elf_readonly_dynrelocs (h))
29+ if (p == NULL)
30 {
31 h->non_got_ref = 0;
32 return TRUE;
33@@ -3096,7 +3096,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
34 else
35 h->got.offset = (bfd_vma) -1;
36
37- if (h->dyn_relocs == NULL)
38+ if (eh->dyn_relocs == NULL)
39 return TRUE;
40
41 /* In the shared -Bsymbolic case, discard space allocated for
42@@ -3113,7 +3113,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
43 {
44 struct elf64_mb_dyn_relocs **pp;
45
46- for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
47+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
48 {
49 p->count -= p->pc_count;
50 p->pc_count = 0;
51@@ -3124,7 +3124,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
52 }
53 }
54 else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
55- h->dyn_relocs = NULL;
56+ eh->dyn_relocs = NULL;
57 }
58 else
59 {
60@@ -3154,13 +3154,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
61 goto keep;
62 }
63
64- h->dyn_relocs = NULL;
65+ eh->dyn_relocs = NULL;
66
67 keep: ;
68 }
69
70 /* Finally, allocate space. */
71- for (p = h->dyn_relocs; p != NULL; p = p->next)
72+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
73 {
74 asection *sreloc = elf_section_data (p->sec)->sreloc;
75 sreloc->size += p->count * sizeof (Elf64_External_Rela);
76--
772.17.1
78
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
deleted file mode 100644
index 7feaceb9..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0048-bfd-elf-microblaze.c-Remove-obsolete-entries.patch
+++ /dev/null
@@ -1,75 +0,0 @@
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
deleted file mode 100644
index 5f4a2714..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0049-bfd-elf64-microblaze.c-Resolve-various-compiler-warn.patch
+++ /dev/null
@@ -1,45 +0,0 @@
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
deleted file mode 100644
index 475a53ba..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0050-opcodes-microblaze-dis.c-Fix-compile-warnings.patch
+++ /dev/null
@@ -1,37 +0,0 @@
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
deleted file mode 100644
index 263f0a9b..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0051-gdb-microblaze-tdep.c-Remove-unused-functions.patch
+++ /dev/null
@@ -1,99 +0,0 @@
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/0052-sim-Allow-microblaze-architecture.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0052-sim-Allow-microblaze-architecture.patch
deleted file mode 100644
index ee5caf0a..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0052-sim-Allow-microblaze-architecture.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 5fa859e73662f96c9cfaf21bd2cf01b92afc9c1c Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Thu, 6 Aug 2020 15:37:52 -0500
4Subject: [PATCH 52/52] sim: Allow microblaze* architecture
5
6Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
7---
8 sim/configure | 2 +-
9 sim/configure.tgt | 2 +-
10 2 files changed, 2 insertions(+), 2 deletions(-)
11
12diff --git a/sim/configure b/sim/configure
13index 72f95cd5c7..9e28cc7868 100755
14--- a/sim/configure
15+++ b/sim/configure
16@@ -3795,7 +3795,7 @@ subdirs="$subdirs aarch64"
17
18
19 ;;
20- microblaze-*-*)
21+ microblaze*-*-*)
22
23 sim_arch=microblaze
24 subdirs="$subdirs microblaze"
25diff --git a/sim/configure.tgt b/sim/configure.tgt
26index 8a8e03d96f..f6743fe8d4 100644
27--- a/sim/configure.tgt
28+++ b/sim/configure.tgt
29@@ -59,7 +59,7 @@ case "${target}" in
30 mcore-*-*)
31 SIM_ARCH(mcore)
32 ;;
33- microblaze-*-*)
34+ microblaze*-*-*)
35 SIM_ARCH(microblaze)
36 ;;
37 mips*-*-*)
38--
392.17.1
40
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0053-gdb-Fix-microblaze-target-compilation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0053-gdb-Fix-microblaze-target-compilation.patch
deleted file mode 100644
index af0e3268..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0053-gdb-Fix-microblaze-target-compilation.patch
+++ /dev/null
@@ -1,288 +0,0 @@
1From efa3750ffda1ae16caf071b8b8ea31f752a3324a Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@kernel.crashing.org>
3Date: Mon, 7 Dec 2020 12:03:25 -0600
4Subject: [PATCH] gdb: Fix microblaze target compilation
5
6Add microblaze-linux-nat.c to configure.nat
7
8Transition microblaze-linux-nat.c to use the new gdb C++ style functions.
9
10Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
11---
12 gdb/configure.nat | 5 ++
13 gdb/microblaze-linux-nat.c | 96 ++++++++++++++------------------------
14 gdb/microblaze-tdep.h | 3 ++
15 3 files changed, 43 insertions(+), 61 deletions(-)
16
17diff --git a/gdb/configure.nat b/gdb/configure.nat
18index 6ea2583495..1fba80f6c9 100644
19--- a/gdb/configure.nat
20+++ b/gdb/configure.nat
21@@ -261,6 +261,11 @@ case ${gdb_host} in
22 # Host: Motorola m68k running GNU/Linux.
23 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
24 ;;
25+ microblaze)
26+ # Host: Microblaze running GNU/Linux.
27+ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o"
28+ NAT_CDEPS=
29+ ;;
30 mips)
31 # Host: Linux/MIPS
32 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
33diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
34index e9b8c9c522..bac4697e1e 100644
35--- a/gdb/microblaze-linux-nat.c
36+++ b/gdb/microblaze-linux-nat.c
37@@ -36,13 +36,14 @@
38 #include "dwarf2-frame.h"
39 #include "osabi.h"
40
41-#include "gdb_assert.h"
42-#include "gdb_string.h"
43+#include "gdbsupport/gdb_assert.h"
44+#include <string.h>
45 #include "target-descriptions.h"
46 #include "opcodes/microblaze-opcm.h"
47 #include "opcodes/microblaze-dis.h"
48
49 #include "linux-nat.h"
50+#include "linux-tdep.h"
51 #include "target-descriptions.h"
52
53 #include <sys/user.h>
54@@ -61,22 +62,17 @@
55 /* Defines ps_err_e, struct ps_prochandle. */
56 #include "gdb_proc_service.h"
57
58-/* On GNU/Linux, threads are implemented as pseudo-processes, in which
59- case we may be tracing more than one process at a time. In that
60- case, inferior_ptid will contain the main process ID and the
61- individual thread (process) ID. get_thread_id () is used to get
62- the thread id if it's available, and the process id otherwise. */
63-
64-int
65-get_thread_id (ptid_t ptid)
66+class microblaze_linux_nat_target final : public linux_nat_target
67 {
68- int tid = TIDGET (ptid);
69- if (0 == tid)
70- tid = PIDGET (ptid);
71- return tid;
72-}
73+public:
74+ /* Add our register access methods. */
75+ void fetch_registers (struct regcache *, int) override;
76+ void store_registers (struct regcache *, int) override;
77+
78+ const struct target_desc *read_description () override;
79+};
80
81-#define GET_THREAD_ID(PTID) get_thread_id (PTID)
82+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
83
84 /* Non-zero if our kernel may support the PTRACE_GETREGS and
85 PTRACE_SETREGS requests, for reading and writing the
86@@ -88,7 +84,6 @@ static int
87 microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
88 {
89 int u_addr = -1;
90- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
91 /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
92 interface, and not the wordsize of the program's ABI. */
93 int wordsize = sizeof (long);
94@@ -105,18 +100,16 @@ microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
95 static void
96 fetch_register (struct regcache *regcache, int tid, int regno)
97 {
98- struct gdbarch *gdbarch = get_regcache_arch (regcache);
99- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
100+ struct gdbarch *gdbarch = regcache->arch ();
101 /* This isn't really an address. But ptrace thinks of it as one. */
102 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
103 int bytes_transferred;
104- unsigned int offset; /* Offset of registers within the u area. */
105- char buf[MAX_REGISTER_SIZE];
106+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
107
108 if (regaddr == -1)
109 {
110 memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
111- regcache_raw_supply (regcache, regno, buf);
112+ regcache->raw_supply (regno, buf);
113 return;
114 }
115
116@@ -149,14 +142,14 @@ fetch_register (struct regcache *regcache, int tid, int regno)
117 {
118 /* Little-endian values are always found at the left end of the
119 bytes transferred. */
120- regcache_raw_supply (regcache, regno, buf);
121+ regcache->raw_supply (regno, buf);
122 }
123 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
124 {
125 /* Big-endian values are found at the right end of the bytes
126 transferred. */
127 size_t padding = (bytes_transferred - register_size (gdbarch, regno));
128- regcache_raw_supply (regcache, regno, buf + padding);
129+ regcache->raw_supply (regno, buf + padding);
130 }
131 else
132 internal_error (__FILE__, __LINE__,
133@@ -175,8 +168,6 @@ fetch_register (struct regcache *regcache, int tid, int regno)
134 static int
135 fetch_all_gp_regs (struct regcache *regcache, int tid)
136 {
137- struct gdbarch *gdbarch = get_regcache_arch (regcache);
138- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
139 gdb_gregset_t gregset;
140
141 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
142@@ -204,8 +195,6 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
143 static void
144 fetch_gp_regs (struct regcache *regcache, int tid)
145 {
146- struct gdbarch *gdbarch = get_regcache_arch (regcache);
147- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
148 int i;
149
150 if (have_ptrace_getsetregs)
151@@ -223,13 +212,12 @@ fetch_gp_regs (struct regcache *regcache, int tid)
152 static void
153 store_register (const struct regcache *regcache, int tid, int regno)
154 {
155- struct gdbarch *gdbarch = get_regcache_arch (regcache);
156- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
157+ struct gdbarch *gdbarch = regcache->arch ();
158 /* This isn't really an address. But ptrace thinks of it as one. */
159 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
160 int i;
161 size_t bytes_to_transfer;
162- char buf[MAX_REGISTER_SIZE];
163+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
164
165 if (regaddr == -1)
166 return;
167@@ -242,13 +230,13 @@ store_register (const struct regcache *regcache, int tid, int regno)
168 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
169 {
170 /* Little-endian values always sit at the left end of the buffer. */
171- regcache_raw_collect (regcache, regno, buf);
172+ regcache->raw_collect (regno, buf);
173 }
174 else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
175 {
176 /* Big-endian values sit at the right end of the buffer. */
177 size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
178- regcache_raw_collect (regcache, regno, buf + padding);
179+ regcache->raw_collect (regno, buf + padding);
180 }
181
182 for (i = 0; i < bytes_to_transfer; i += sizeof (long))
183@@ -281,8 +269,6 @@ store_register (const struct regcache *regcache, int tid, int regno)
184 static int
185 store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
186 {
187- struct gdbarch *gdbarch = get_regcache_arch (regcache);
188- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
189 gdb_gregset_t gregset;
190
191 if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
192@@ -319,8 +305,6 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
193 static void
194 store_gp_regs (const struct regcache *regcache, int tid, int regno)
195 {
196- struct gdbarch *gdbarch = get_regcache_arch (regcache);
197- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
198 int i;
199
200 if (have_ptrace_getsetregs)
201@@ -339,12 +323,12 @@ store_gp_regs (const struct regcache *regcache, int tid, int regno)
202 regno == -1, otherwise fetch all general registers or all floating
203 point registers depending upon the value of regno. */
204
205-static void
206-microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
207- struct regcache *regcache, int regno)
208+void
209+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache,
210+ int regno)
211 {
212 /* Get the thread id for the ptrace call. */
213- int tid = GET_THREAD_ID (inferior_ptid);
214+ int tid = regcache->ptid ().lwp ();
215
216 if (regno == -1)
217 fetch_gp_regs (regcache, tid);
218@@ -356,12 +340,12 @@ microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
219 regno == -1, otherwise store all general registers or all floating
220 point registers depending upon the value of regno. */
221
222-static void
223-microblaze_linux_store_inferior_registers (struct target_ops *ops,
224- struct regcache *regcache, int regno)
225+void
226+microblaze_linux_nat_target::store_registers (struct regcache *regcache,
227+ int regno)
228 {
229 /* Get the thread id for the ptrace call. */
230- int tid = GET_THREAD_ID (inferior_ptid);
231+ int tid = regcache->ptid ().lwp ();
232
233 if (regno >= 0)
234 store_register (regcache, tid, regno);
235@@ -398,12 +382,12 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
236 /* FIXME. */
237 }
238
239-static const struct target_desc *
240-microblaze_linux_read_description (struct target_ops *ops)
241+const struct target_desc *
242+microblaze_linux_nat_target::read_description ()
243 {
244- CORE_ADDR microblaze_hwcap = 0;
245+ CORE_ADDR microblaze_hwcap = linux_get_hwcap (this);
246
247- if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
248+ if (microblaze_hwcap != 1)
249 return NULL;
250
251 return NULL;
252@@ -415,17 +399,7 @@ void _initialize_microblaze_linux_nat (void);
253 void
254 _initialize_microblaze_linux_nat (void)
255 {
256- struct target_ops *t;
257-
258- /* Fill in the generic GNU/Linux methods. */
259- t = linux_target ();
260-
261- /* Add our register access methods. */
262- t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
263- t->to_store_registers = microblaze_linux_store_inferior_registers;
264-
265- t->to_read_description = microblaze_linux_read_description;
266-
267 /* Register the target. */
268- linux_nat_add_target (t);
269+ linux_target = &the_microblaze_linux_nat_target;
270+ add_inf_child_target (&the_microblaze_linux_nat_target);
271 }
272diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
273index c0fc900733..c777d93a95 100644
274--- a/gdb/microblaze-tdep.h
275+++ b/gdb/microblaze-tdep.h
276@@ -106,6 +106,9 @@ enum microblaze_regnum
277 MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS
278 };
279
280+/* Big enough to hold the size of the largest register in bytes. */
281+#define MICROBLAZE_MAX_REGISTER_SIZE 64
282+
283 struct microblaze_frame_cache
284 {
285 /* Base address. */
286--
2872.17.1
288
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0054-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0054-Patch-MicroBlaze.patch
deleted file mode 100644
index d5cf929a..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0054-Patch-MicroBlaze.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From 75272152884a0cb003a8e45f8ca9ffa0ac43eea2 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 15 Apr 2021 16:16:11 +0530
4Subject: [PATCH 54] [Patch,MicroBlaze]: 1. set BFD machine to
5 bfd_mach_microblaze64 for 64 bit elf. 2. XSDB and QEMU : agreed to append r
6 to all special registers except slr/shr
7
8---
9 bfd/elf64-microblaze.c | 11 +++++++++++
10 gdb/features/microblaze-core.xml | 4 ++--
11 gdb/features/microblaze-stack-protect.xml | 4 ++--
12 gdb/features/microblaze-with-stack-protect.c | 4 ++--
13 gdb/features/microblaze.c | 4 ++--
14 gdb/features/microblaze64-core.xml | 4 ++--
15 gdb/features/microblaze64-stack-protect.xml | 4 ++--
16 gdb/features/microblaze64-with-stack-protect.c | 4 ++--
17 gdb/features/microblaze64.c | 4 ++--
18 gdb/microblaze-tdep.c | 2 +-
19 10 files changed, 28 insertions(+), 17 deletions(-)
20
21Index: gdb-9.2/bfd/elf64-microblaze.c
22===================================================================
23--- gdb-9.2.orig/bfd/elf64-microblaze.c
24+++ gdb-9.2/bfd/elf64-microblaze.c
25@@ -3631,6 +3631,16 @@ microblaze_elf_finish_dynamic_sections (
26 return TRUE;
27 }
28
29+static bfd_boolean
30+microblaze_elf64_object_p (bfd *abfd)
31+{
32+ bfd_default_set_arch_mach (abfd, bfd_arch_microblaze,
33+ bfd_mach_microblaze64);
34+ return TRUE;
35+}
36+
37+
38+
39 /* Hook called by the linker routine which adds symbols from an object
40 file. We use it to put .comm items in .sbss, and not .bss. */
41
42@@ -3698,5 +3708,6 @@ microblaze_elf_add_symbol_hook (bfd *abf
43 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
44 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
45 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
46+/* #define elf_backend_object_p microblaze_elf64_object_p */
47
48 #include "elf64-target.h"
49Index: gdb-9.2/gdb/features/microblaze-core.xml
50===================================================================
51--- gdb-9.2.orig/gdb/features/microblaze-core.xml
52+++ gdb-9.2/gdb/features/microblaze-core.xml
53@@ -64,6 +64,6 @@
54 <reg name="rtlbsx" bitsize="32"/>
55 <reg name="rtlblo" bitsize="32"/>
56 <reg name="rtlbhi" bitsize="32"/>
57- <reg name="rslr" bitsize="32"/>
58- <reg name="rshr" bitsize="32"/>
59+ <reg name="slr" bitsize="32"/>
60+ <reg name="shr" bitsize="32"/>
61 </feature>
62Index: gdb-9.2/gdb/features/microblaze-stack-protect.xml
63===================================================================
64--- gdb-9.2.orig/gdb/features/microblaze-stack-protect.xml
65+++ gdb-9.2/gdb/features/microblaze-stack-protect.xml
66@@ -7,6 +7,6 @@
67
68 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
69 <feature name="org.gnu.gdb.microblaze.stack-protect">
70- <reg name="rslr" bitsize="32"/>
71- <reg name="rshr" bitsize="32"/>
72+ <reg name="slr" bitsize="32"/>
73+ <reg name="shr" bitsize="32"/>
74 </feature>
75Index: gdb-9.2/gdb/features/microblaze-with-stack-protect.c
76===================================================================
77--- gdb-9.2.orig/gdb/features/microblaze-with-stack-protect.c
78+++ gdb-9.2/gdb/features/microblaze-with-stack-protect.c
79@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_p
80 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
81
82 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze.stack-protect");
83- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
84- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
85+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
86+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
87
88 tdesc_microblaze_with_stack_protect = result;
89 }
90Index: gdb-9.2/gdb/features/microblaze.c
91===================================================================
92--- gdb-9.2.orig/gdb/features/microblaze.c
93+++ gdb-9.2/gdb/features/microblaze.c
94@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
95 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
96 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
97 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
98- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
99- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
100+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
101+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
102
103 tdesc_microblaze = result;
104 }
105Index: gdb-9.2/gdb/features/microblaze64-core.xml
106===================================================================
107--- gdb-9.2.orig/gdb/features/microblaze64-core.xml
108+++ gdb-9.2/gdb/features/microblaze64-core.xml
109@@ -64,6 +64,6 @@
110 <reg name="rtlbsx" bitsize="32"/>
111 <reg name="rtlblo" bitsize="32"/>
112 <reg name="rtlbhi" bitsize="32"/>
113- <reg name="rslr" bitsize="64"/>
114- <reg name="rshr" bitsize="64"/>
115+ <reg name="slr" bitsize="64"/>
116+ <reg name="shr" bitsize="64"/>
117 </feature>
118Index: gdb-9.2/gdb/features/microblaze64-stack-protect.xml
119===================================================================
120--- gdb-9.2.orig/gdb/features/microblaze64-stack-protect.xml
121+++ gdb-9.2/gdb/features/microblaze64-stack-protect.xml
122@@ -7,6 +7,6 @@
123
124 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
125 <feature name="org.gnu.gdb.microblaze64.stack-protect">
126- <reg name="rslr" bitsize="64"/>
127- <reg name="rshr" bitsize="64"/>
128+ <reg name="slr" bitsize="64"/>
129+ <reg name="shr" bitsize="64"/>
130 </feature>
131Index: gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
132===================================================================
133--- gdb-9.2.orig/gdb/features/microblaze64-with-stack-protect.c
134+++ gdb-9.2/gdb/features/microblaze64-with-stack-protect.c
135@@ -72,8 +72,8 @@ initialize_tdesc_microblaze64_with_stack
136 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
137
138 feature = tdesc_create_feature (result, "org.gnu.gdb.microblaze64.stack-protect");
139- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
140- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
141+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
142+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
143
144 tdesc_microblaze64_with_stack_protect = result;
145 }
146Index: gdb-9.2/gdb/features/microblaze64.c
147===================================================================
148--- gdb-9.2.orig/gdb/features/microblaze64.c
149+++ gdb-9.2/gdb/features/microblaze64.c
150@@ -70,8 +70,8 @@ initialize_tdesc_microblaze64 (void)
151 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
152 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
153 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
154- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 64, "uint64");
155- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 64, "uint64");
156+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
157+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
158
159 tdesc_microblaze64 = result;
160 }
161Index: gdb-9.2/gdb/microblaze-tdep.c
162===================================================================
163--- gdb-9.2.orig/gdb/microblaze-tdep.c
164+++ gdb-9.2/gdb/microblaze-tdep.c
165@@ -77,7 +77,7 @@ static const char *microblaze_register_n
166 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
167 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
168 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
169- "rslr", "rshr"
170+ "slr", "shr"
171 };
172
173 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
deleted file mode 100644
index 320d6ecb..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0055-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 6b29e1a8ff62e01299ee07840b4443cbda5b8c61 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 19 Apr 2021 14:33:27 +0530
4Subject: [PATCH 55] [Patch,MicroBlaze] : these changes will make 64 bit
5 vectors as default target types when we built gdb with microblaze 64 bit type
6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7
8---
9 bfd/config.bfd | 8 ++++++++
10 1 file changed, 8 insertions(+)
11
12Index: gdb-9.2/bfd/config.bfd
13===================================================================
14--- gdb-9.2.orig/bfd/config.bfd
15+++ gdb-9.2/bfd/config.bfd
16@@ -838,7 +838,15 @@ case "${targ}" in
17 targ_defvec=metag_elf32_vec
18 targ_underscore=yes
19 ;;
20+ microblazeel*-*64)
21+ targ_defvec=microblaze_elf64_le_vec
22+ targ_selvecs=microblaze_elf64_vec
23+ ;;
24
25+ microblaze*-*64)
26+ targ_defvec=microblaze_elf64_vec
27+ targ_selvecs=microblaze_elf64_le_vec
28+ ;;
29 microblazeel*-*)
30 targ_defvec=microblaze_elf32_le_vec
31 targ_selvecs=microblaze_elf32_vec