summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2024-11-21 13:54:05 -0600
committerMark Hatle <mark.hatle@amd.com>2024-11-21 13:54:05 -0600
commit1241013c7bce4262a6128eb4ccb3db410831746d (patch)
treeda79ab94a5b4ae9abf6211d8289a4bf5dbdcde9f /meta-microblaze/recipes-devtools
parent6e3a214d268c7d75a42a9a329b5621fb5a49a89a (diff)
parent10531c26195f97f9565e9770c21977805e53c46b (diff)
downloadmeta-xilinx-1241013c7bce4262a6128eb4ccb3db410831746d.tar.gz
Merge remote-tracking branch 'origin/scarthgap' into yocto-master
This moves the system to scarthgap. It is known to NOT work with Styhead and master, Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc59
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch42
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch)40
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0003-Initial-port-of-core-reading-support-Added-support-f.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch)42
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-debug-message-when-register-is-unavailable.patch45
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-MicroBlaze-native-gdb-port.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch)774
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch1841
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch)19
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch)2139
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch (renamed from meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch)43
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch133
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch28
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0012-Add-mlittle-endian-and-mbig-endian-flags.patch46
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0013-Disable-the-warning-message-for-eh_frame_hdr.patch35
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0014-Fix-relaxation-of-assembler-resolved-references-Fixu.patch48
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch43
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0016-Add-new-bit-field-instructions.patch219
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-fixed-bug-in-GCC-so-that-It-will-support-.long-0U-an.patch34
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0018-Compiler-will-give-error-messages-in-more-detail-for.patch37
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0019-initial-support-for-MicroBlaze-64-bit-m64.patch202
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-initial-support-for-MicroBlaze-64-bit-m64.patch82
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0021-Added-relocations-for-MB-X.patch108
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0022-initial-support-for-MicroBlaze-64-bit-m64.patch958
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-relocations-for-MB-X.patch246
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-MB-x-relocation-issues-Added-imml-for-required.patch52
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-address-computation-issues-with-64bit-address-.patch160
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch110
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state-defsym-symb.patch84
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch58
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0029-Added-support-to-new-arithmetic-single-register-inst.patch371
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0030-double-imml-generation-for-64-bit-values.patch545
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0031-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch88
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0032-This-patch-will-remove-imml-0-and-imml-1-instruction.patch38
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Changing-the-long-to-long-long-as-in-Windows-long-is.patch32
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0034-gas-revert-moving-of-md_pseudo_table-from-const.patch62
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch44
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch79
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch107
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0038-MB-binutils-Upstream-port-issues.patch99
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-port-of-core-reading-support-Added-support-f.patch89
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch185
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0041-disable-truncated-register-warning-gdb-remote.c.patch26
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch42
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch177
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch32
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch61
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch116
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch32
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch465
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0049-When-unwinding-pc-value-adjust-return-pc-value.patch92
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0050-info-reg-pc-does-not-print-symbolic-value.patch116
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0051-Wrong-target-description-accepted-by-microblaze-arch.patch51
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0052-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch42
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0053-Roll-back-an-improvement-which-inlines-target_gdbarc.patch29
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13.3.inc (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc)31
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0001-LOCAL-Testsuite-builtins-tests-require-fpic-Signed-o.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0002-Quick-fail-g-.dg-opt-memcpy1.C-This-particular-testc.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0003-For-dejagnu-static-testing-on-qemu-suppress-warnings.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0004-Add-MicroBlaze-to-target-supports-for-atomic-buil.-..patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0005-Update-MicroBlaze-strings-test-for-new-scan-assembly.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0006-Allow-MicroBlaze-.weakext-pattern-in-regex-match-Ext.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0007-Add-MicroBlaze-to-check_profiling_available-Testsuit.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch)17
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch)19
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0009-Fix-atomic-boolean-return-value.-In-atomic_compare_a.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0010-Fix-the-Microblaze-crash-with-msmall-divides-flag-Co.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch)23
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0011-Added-ashrsi3_with_size_opt-Added-ashrsi3_with_size_.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch)16
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0012-Use-bralid-for-profiler-calls-Signed-off-by-Edgar-E..patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0013-Removed-moddi3-routinue-Using-the-default-moddi3-fun.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0014-Add-INIT_PRIORITY-support-Added-TARGET_ASM_CONSTRUCT.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch)18
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0015-Add-optimized-lshrsi3-When-barrel-shifter-is-not-pre.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0016-Add-cbranchsi4_reg-This-patch-optimizes-the-generati.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0017-Inline-Expansion-of-fsqrt-builtin.-The-changes-are-m.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch)34
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0018-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0019-Update-ashlsi3-movsf-patterns-This-patch-removes-the.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0020-8-stage-pipeline-for-microblaze-This-patch-adds-the-.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch)24
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0021-Correct-the-const-high-double-immediate-value-with-t.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0022-Fix-internal-compiler-error-with-msmall-divides-This.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0023-Fix-the-calculation-of-high-word-in-a-long-long-64-b.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0024-this-patch-has-1.Fixed-the-bug-in-version-calculatio.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch)42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0025-Fixing-the-issue-with-the-builtin_alloc.-register-r1.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0026-Removed-fsqrt-generation-for-double-values.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch)13
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0027-Intial-commit-of-64-bit-Microblaze.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch)36
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0028-Intial-commit-for-64bit-MB-sources.-Need-to-cleanup-.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch)90
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0029-re-arrangement-of-the-compare-branches.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch)27
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0030-previous-commit-broke-the-handling-of-SI-Branch-comp.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0031-Support-of-multilibs-with-m64.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0032-Fixed-issues-like-1-Interrupt-alignment-issue-2-Sign.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0033-fixed-below-issues-Floating-point-print-issues-in-64.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch)27
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0034-Added-double-arith-instructions-Fixed-prologue-stack.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch)20
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0038-fixing-the-typo-errors-in-umodsi3-file.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0041-corrected-SPN-for-dlong-instruction-mapping.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch)13
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0044-We-will-check-the-possibility-of-peephole2-optimizat.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch)14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0045-fixed-typos-in-mul-div-and-mod-assembly-files.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch)21
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0046-MB-64-removal-of-barrel-shift-instructions-from-defa.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch)23
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0048-Added-support-for-64-bit-Immediate-values.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch)15
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0049-Fix-Compiler-crash-with-freg-struct-return-This-patc.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch)22
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0050-Add-TARGET_OPTION_OPTIMIZATION-and-disable-fivopts-b.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch)12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0051-Reducing-Stack-space-for-arguments.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch)18
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0052-If-we-use-break_handler-attribute-then-interrupt-vec.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch)31
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0053-Add-Zero_extended-instructions.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch)10
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/0054-Fix-failure-with-gcc.c-torture-execute-ashrdi-1.c-Os.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-13/microblaze-mulitlib-hack.patch (renamed from meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc18
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc7
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend59
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source_13.%.bbappend63
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc9
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch10
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch97
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch103
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch16
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch24
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch69
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch9
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch24
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch56
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch11
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch6
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch10
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch38
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch6
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch31
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch233
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0027-Fix-gcc-vect-module-testcases.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch19
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch63
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb)2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-common.inc2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb)2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran.inc5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran_13.3.bb (renamed from meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb)0
-rw-r--r--meta-microblaze/recipes-devtools/gcc/microblaze-block.inc1
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-common.inc66
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc44
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross.inc31
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc58
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb.inc20
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch639
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch50
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch301
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch52
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch50
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch45
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch834
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch36
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch1891
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch300
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch48
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch4104
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch55
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch49
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch74
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch40
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch133
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch43
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch88
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch150
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch82
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch69
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch113
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch176
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch29
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch44
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch79
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch107
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch83
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch89
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch185
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch177
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch61
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch125
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch32
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch46
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch27
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch116
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch51
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch29
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch26
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb39
228 files changed, 20105 insertions, 4630 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
index 3701d245..014729a5 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
@@ -2,3 +2,62 @@ FILESEXTRAPATHS:append := ":${THISDIR}/binutils"
2 2
3LDGOLD_ALTS:microblaze = "" 3LDGOLD_ALTS:microblaze = ""
4USE_ALTERNATIVES_FOR:remove:microblaze = "gprof" 4USE_ALTERNATIVES_FOR:remove:microblaze = "gprof"
5
6# Our changes are all local, no real patch-status
7ERROR_QA:remove = "patch-status"
8
9SRC_URI += " \
10 file://0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
11 file://0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
12 file://0003-Initial-port-of-core-reading-support-Added-support-f.patch \
13 file://0004-Fix-debug-message-when-register-is-unavailable.patch \
14 file://0005-MicroBlaze-native-gdb-port.patch \
15 file://0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch \
16 file://0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch \
17 file://0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch \
18 file://0009-Depth-Total-number-of-inline-functions-refer-inline-.patch \
19 file://0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch \
20 file://0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch \
21 file://0012-Add-mlittle-endian-and-mbig-endian-flags.patch \
22 file://0013-Disable-the-warning-message-for-eh_frame_hdr.patch \
23 file://0014-Fix-relaxation-of-assembler-resolved-references-Fixu.patch \
24 file://0015-upstream-change-to-garbage-collection-sweep-causes-m.patch \
25 file://0016-Add-new-bit-field-instructions.patch \
26 file://0017-fixed-bug-in-GCC-so-that-It-will-support-.long-0U-an.patch \
27 file://0018-Compiler-will-give-error-messages-in-more-detail-for.patch \
28 file://0019-initial-support-for-MicroBlaze-64-bit-m64.patch \
29 file://0020-initial-support-for-MicroBlaze-64-bit-m64.patch \
30 file://0021-Added-relocations-for-MB-X.patch \
31 file://0022-initial-support-for-MicroBlaze-64-bit-m64.patch \
32 file://0023-Added-relocations-for-MB-X.patch \
33 file://0024-Fixed-MB-x-relocation-issues-Added-imml-for-required.patch \
34 file://0025-Fixed-address-computation-issues-with-64bit-address-.patch \
35 file://0026-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch \
36 file://0027-Revert-ld-Remove-unused-expression-state-defsym-symb.patch \
37 file://0028-fixing-the-long-long-long-mingw-toolchain-issue.patch \
38 file://0029-Added-support-to-new-arithmetic-single-register-inst.patch \
39 file://0030-double-imml-generation-for-64-bit-values.patch \
40 file://0031-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \
41 file://0032-This-patch-will-remove-imml-0-and-imml-1-instruction.patch \
42 file://0033-Changing-the-long-to-long-long-as-in-Windows-long-is.patch \
43 file://0034-gas-revert-moving-of-md_pseudo_table-from-const.patch \
44 file://0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
45 file://0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch \
46 file://0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch \
47 file://0038-MB-binutils-Upstream-port-issues.patch \
48 file://0039-Initial-port-of-core-reading-support-Added-support-f.patch \
49 file://0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch \
50 file://0041-disable-truncated-register-warning-gdb-remote.c.patch \
51 file://0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch \
52 file://0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch \
53 file://0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch \
54 file://0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch \
55 file://0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch \
56 file://0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch \
57 file://0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch \
58 file://0049-When-unwinding-pc-value-adjust-return-pc-value.patch \
59 file://0050-info-reg-pc-does-not-print-symbolic-value.patch \
60 file://0051-Wrong-target-description-accepted-by-microblaze-arch.patch \
61 file://0052-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch \
62 file://0053-Roll-back-an-improvement-which-inlines-target_gdbarc.patch \
63"
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
new file mode 100644
index 00000000..fd8a96c9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -0,0 +1,42 @@
1From add4545f804219232f16f96e3a83af2fadf41463 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 01/53] 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>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdbserver/Makefile.in | 1 +
26 1 file changed, 1 insertion(+)
27
28diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
29index d12f8746611..ee606908bae 100644
30--- a/gdbserver/Makefile.in
31+++ b/gdbserver/Makefile.in
32@@ -180,6 +180,7 @@ SFILES = \
33 $(srcdir)/linux-loongarch-low.cc \
34 $(srcdir)/linux-low.cc \
35 $(srcdir)/linux-m68k-low.cc \
36+ $(srcdir)/linux-microblaze-low.cc \
37 $(srcdir)/linux-mips-low.cc \
38 $(srcdir)/linux-nios2-low.cc \
39 $(srcdir)/linux-or1k-low.cc \
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
index 050bdde5..ea6689fe 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -1,7 +1,7 @@
1From baac387700a72407b3994bfd0a03825112c9745f Mon Sep 17 00:00:00 2001 1From aebe2fdb45467fe4a07874cc310e441a38c23f84 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530 3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 1/8] Add initial port of linux gdbserver add 4Subject: [PATCH 02/53] Add initial port of linux gdbserver add
5 gdb_proc_service_h to gdbserver microblaze-linux 5 gdb_proc_service_h to gdbserver microblaze-linux
6 6
7gdbserver needs to initialise the microblaze registers 7gdbserver needs to initialise the microblaze registers
@@ -17,11 +17,10 @@ architecture specific setup - may need to add in future
17 * add set_gdbarch_fetch_tls_load_module_address 17 * add set_gdbarch_fetch_tls_load_module_address
18 * Force reading of r0 as 0, prevent stores 18 * Force reading of r0 as 0, prevent stores
19 19
20Upstream-Status: Pending
21
22Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
23Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
24Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
25--- 24---
26 gdb/configure.host | 2 + 25 gdb/configure.host | 2 +
27 gdb/features/Makefile | 1 + 26 gdb/features/Makefile | 1 +
@@ -31,10 +30,9 @@ Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
31 gdb/microblaze-tdep.h | 4 +- 30 gdb/microblaze-tdep.h | 4 +-
32 gdb/regformats/microblaze-linux.dat | 64 +++++++ 31 gdb/regformats/microblaze-linux.dat | 64 +++++++
33 gdb/regformats/reg-microblaze.dat | 41 +++++ 32 gdb/regformats/reg-microblaze.dat | 41 +++++
34 gdbserver/Makefile.in | 1 +
35 gdbserver/configure.srv | 10 ++ 33 gdbserver/configure.srv | 10 ++
36 gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++ 34 gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++
37 11 files changed, 466 insertions(+), 3 deletions(-) 35 10 files changed, 465 insertions(+), 3 deletions(-)
38 create mode 100644 gdb/features/microblaze-linux.xml 36 create mode 100644 gdb/features/microblaze-linux.xml
39 create mode 100644 gdb/regformats/microblaze-linux.dat 37 create mode 100644 gdb/regformats/microblaze-linux.dat
40 create mode 100644 gdb/regformats/reg-microblaze.dat 38 create mode 100644 gdb/regformats/reg-microblaze.dat
@@ -61,7 +59,7 @@ index da71675b201..877537d06ef 100644
61 mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu) 59 mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu)
62 gdb_host=nbsd ;; 60 gdb_host=nbsd ;;
63diff --git a/gdb/features/Makefile b/gdb/features/Makefile 61diff --git a/gdb/features/Makefile b/gdb/features/Makefile
64index 68e17d0085d..fc3196864c9 100644 62index cda6a49d563..8ac30d8cea3 100644
65--- a/gdb/features/Makefile 63--- a/gdb/features/Makefile
66+++ b/gdb/features/Makefile 64+++ b/gdb/features/Makefile
67@@ -46,6 +46,7 @@ 65@@ -46,6 +46,7 @@
@@ -92,7 +90,7 @@ index 00000000000..688a3f83d1e
92+ <xi:include href="microblaze-core.xml"/> 90+ <xi:include href="microblaze-core.xml"/>
93+</target> 91+</target>
94diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 92diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
95index daa7ddf7e4d..5748556a556 100644 93index 7d620a3688b..d25100ef867 100644
96--- a/gdb/microblaze-linux-tdep.c 94--- a/gdb/microblaze-linux-tdep.c
97+++ b/gdb/microblaze-linux-tdep.c 95+++ b/gdb/microblaze-linux-tdep.c
98@@ -37,6 +37,22 @@ 96@@ -37,6 +37,22 @@
@@ -152,7 +150,7 @@ index daa7ddf7e4d..5748556a556 100644
152 150
153 void _initialize_microblaze_linux_tdep (); 151 void _initialize_microblaze_linux_tdep ();
154diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 152diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
155index 3d5dd669341..3e8e8fe35b9 100644 153index fc83634d1e6..3ff7ec644b6 100644
156--- a/gdb/microblaze-tdep.c 154--- a/gdb/microblaze-tdep.c
157+++ b/gdb/microblaze-tdep.c 155+++ b/gdb/microblaze-tdep.c
158@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc) 156@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
@@ -195,7 +193,7 @@ index 3d5dd669341..3e8e8fe35b9 100644
195 193
196 /* Allocate and initialize a frame cache. */ 194 /* Allocate and initialize a frame cache. */
197 195
198@@ -716,6 +747,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 196@@ -714,6 +745,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
199 microblaze_breakpoint::kind_from_pc); 197 microblaze_breakpoint::kind_from_pc);
200 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 198 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
201 microblaze_breakpoint::bp_from_kind); 199 microblaze_breakpoint::bp_from_kind);
@@ -203,14 +201,14 @@ index 3d5dd669341..3e8e8fe35b9 100644
203 201
204 set_gdbarch_frame_args_skip (gdbarch, 8); 202 set_gdbarch_frame_args_skip (gdbarch, 8);
205 203
206@@ -756,4 +788,5 @@ When non-zero, microblaze specific debugging is enabled."), 204@@ -754,4 +786,5 @@ When non-zero, microblaze specific debugging is enabled."),
207 NULL, 205 NULL,
208 &setdebuglist, &showdebuglist); 206 &setdebuglist, &showdebuglist);
209 207
210+ 208+
211 } 209 }
212diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 210diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
213index 4d90e8785dc..53fcb2297e6 100644 211index 0b4a5a3f472..56736b9b0c9 100644
214--- a/gdb/microblaze-tdep.h 212--- a/gdb/microblaze-tdep.h
215+++ b/gdb/microblaze-tdep.h 213+++ b/gdb/microblaze-tdep.h
216@@ -118,6 +118,8 @@ struct microblaze_frame_cache 214@@ -118,6 +118,8 @@ struct microblaze_frame_cache
@@ -340,23 +338,11 @@ index 00000000000..bd8a4384424
340+32:fsr 338+32:fsr
341+32:slr 339+32:slr
342+32:shr 340+32:shr
343diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
344index 47648b8d962..55a5f5b81ae 100644
345--- a/gdbserver/Makefile.in
346+++ b/gdbserver/Makefile.in
347@@ -178,6 +178,7 @@ SFILES = \
348 $(srcdir)/linux-ia64-low.cc \
349 $(srcdir)/linux-low.cc \
350 $(srcdir)/linux-m68k-low.cc \
351+ $(srcdir)/linux-microblaze-low.cc \
352 $(srcdir)/linux-mips-low.cc \
353 $(srcdir)/linux-nios2-low.cc \
354 $(srcdir)/linux-or1k-low.cc \
355diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv 341diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
356index 6e09b0eeb79..1817f1f04fb 100644 342index 9e861a75088..11ce617e72f 100644
357--- a/gdbserver/configure.srv 343--- a/gdbserver/configure.srv
358+++ b/gdbserver/configure.srv 344+++ b/gdbserver/configure.srv
359@@ -145,6 +145,16 @@ case "${gdbserver_host}" in 345@@ -159,6 +159,16 @@ case "${gdbserver_host}" in
360 srv_linux_regsets=yes 346 srv_linux_regsets=yes
361 srv_linux_thread_db=yes 347 srv_linux_thread_db=yes
362 ;; 348 ;;
@@ -649,5 +635,5 @@ index 00000000000..bf9eecc41ab
649+} 635+}
650+ 636+
651-- 637--
6522.37.1 (Apple Git-137.1) 6382.34.1
653 639
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Initial-port-of-core-reading-support-Added-support-f.patch
index f7af2a62..c0515aa6 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -1,16 +1,14 @@
1From 7da397cae8c0f8826184d6e12fda9ccd11f92753 Mon Sep 17 00:00:00 2001 1From 67943e124abc6b1228d84399fbde5b129015ac7f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530 3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 2/8] [Patch,MicroBlaze]: Initial port of core reading support 4Subject: [PATCH 03/53] Initial port of core reading support Added support for
5 Added support for reading notes in linux core dumps Support for reading of 5 reading notes in linux core dumps Support for reading of PRSTATUS and PSINFO
6 PRSTATUS and PSINFO information for rebuilding ".reg" sections of core dumps 6 information for rebuilding ".reg" sections of core dumps at run time.
7 at run time.
8
9Upstream-Status: Pending
10 7
11Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
12Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
13Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
14--- 12---
15 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++ 13 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
16 gdb/configure.tgt | 2 +- 14 gdb/configure.tgt | 2 +-
@@ -20,10 +18,10 @@ Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
20 5 files changed, 177 insertions(+), 2 deletions(-) 18 5 files changed, 177 insertions(+), 2 deletions(-)
21 19
22diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c 20diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
23index d09b3f7095d..d3b3c66cf00 100644 21index 64198b8f1a6..022ce365c59 100644
24--- a/bfd/elf32-microblaze.c 22--- a/bfd/elf32-microblaze.c
25+++ b/bfd/elf32-microblaze.c 23+++ b/bfd/elf32-microblaze.c
26@@ -713,6 +713,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name) 24@@ -772,6 +772,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
27 return _bfd_elf_is_local_label_name (abfd, name); 25 return _bfd_elf_is_local_label_name (abfd, name);
28 } 26 }
29 27
@@ -111,7 +109,7 @@ index d09b3f7095d..d3b3c66cf00 100644
111 /* ELF linker hash entry. */ 109 /* ELF linker hash entry. */
112 110
113 struct elf32_mb_link_hash_entry 111 struct elf32_mb_link_hash_entry
114@@ -3434,4 +3515,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, 112@@ -3500,4 +3581,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
115 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections 113 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
116 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 114 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
117 115
@@ -120,10 +118,10 @@ index d09b3f7095d..d3b3c66cf00 100644
120+ 118+
121 #include "elf32-target.h" 119 #include "elf32-target.h"
122diff --git a/gdb/configure.tgt b/gdb/configure.tgt 120diff --git a/gdb/configure.tgt b/gdb/configure.tgt
123index 0705ccf32b8..7ea186481f3 100644 121index 47a674201f9..d0673abd2b8 100644
124--- a/gdb/configure.tgt 122--- a/gdb/configure.tgt
125+++ b/gdb/configure.tgt 123+++ b/gdb/configure.tgt
126@@ -400,7 +400,7 @@ mep-*-*) 124@@ -415,7 +415,7 @@ mep-*-*)
127 125
128 microblaze*-linux-*|microblaze*-*-linux*) 126 microblaze*-linux-*|microblaze*-*-linux*)
129 # Target: Xilinx MicroBlaze running Linux 127 # Target: Xilinx MicroBlaze running Linux
@@ -133,7 +131,7 @@ index 0705ccf32b8..7ea186481f3 100644
133 ;; 131 ;;
134 microblaze*-*-*) 132 microblaze*-*-*)
135diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 133diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
136index 5748556a556..d6197c49dfd 100644 134index d25100ef867..eef09bacec0 100644
137--- a/gdb/microblaze-linux-tdep.c 135--- a/gdb/microblaze-linux-tdep.c
138+++ b/gdb/microblaze-linux-tdep.c 136+++ b/gdb/microblaze-linux-tdep.c
139@@ -36,6 +36,7 @@ 137@@ -36,6 +36,7 @@
@@ -179,10 +177,10 @@ index 5748556a556..d6197c49dfd 100644
179 set_gdbarch_fetch_tls_load_module_address (gdbarch, 177 set_gdbarch_fetch_tls_load_module_address (gdbarch,
180 svr4_fetch_objfile_link_map); 178 svr4_fetch_objfile_link_map);
181diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 179diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
182index 3e8e8fe35b9..ccd37d085d6 100644 180index 3ff7ec644b6..7c98331f8a9 100644
183--- a/gdb/microblaze-tdep.c 181--- a/gdb/microblaze-tdep.c
184+++ b/gdb/microblaze-tdep.c 182+++ b/gdb/microblaze-tdep.c
185@@ -666,6 +666,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch) 183@@ -665,6 +665,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
186 tdesc_microblaze_with_stack_protect); 184 tdesc_microblaze_with_stack_protect);
187 } 185 }
188 186
@@ -226,9 +224,9 @@ index 3e8e8fe35b9..ccd37d085d6 100644
226 static struct gdbarch * 224 static struct gdbarch *
227 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 225 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
228 { 226 {
229@@ -718,6 +755,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 227@@ -716,6 +753,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
230 microblaze_gdbarch_tdep *tdep = new microblaze_gdbarch_tdep; 228 gdbarch *gdbarch
231 gdbarch = gdbarch_alloc (&info, tdep); 229 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
232 230
233+ tdep->gregset = NULL; 231+ tdep->gregset = NULL;
234+ tdep->sizeof_gregset = 0; 232+ tdep->sizeof_gregset = 0;
@@ -237,7 +235,7 @@ index 3e8e8fe35b9..ccd37d085d6 100644
237 set_gdbarch_long_double_bit (gdbarch, 128); 235 set_gdbarch_long_double_bit (gdbarch, 128);
238 236
239 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS); 237 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
240@@ -766,6 +807,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 238@@ -764,6 +805,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
241 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer); 239 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
242 if (tdesc_data != NULL) 240 if (tdesc_data != NULL)
243 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); 241 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
@@ -252,7 +250,7 @@ index 3e8e8fe35b9..ccd37d085d6 100644
252 return gdbarch; 250 return gdbarch;
253 } 251 }
254diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 252diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
255index 53fcb2297e6..2e853d84d72 100644 253index 56736b9b0c9..07a160a463c 100644
256--- a/gdb/microblaze-tdep.h 254--- a/gdb/microblaze-tdep.h
257+++ b/gdb/microblaze-tdep.h 255+++ b/gdb/microblaze-tdep.h
258@@ -23,8 +23,23 @@ 256@@ -23,8 +23,23 @@
@@ -267,7 +265,7 @@ index 53fcb2297e6..2e853d84d72 100644
267+ unsigned int pregs[16]; 265+ unsigned int pregs[16];
268+}; 266+};
269+ 267+
270 struct microblaze_gdbarch_tdep : gdbarch_tdep 268 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
271 { 269 {
272+ int dummy; // declare something. 270+ int dummy; // declare something.
273+ 271+
@@ -299,5 +297,5 @@ index 53fcb2297e6..2e853d84d72 100644
299 297
300 #endif /* microblaze-tdep.h */ 298 #endif /* microblaze-tdep.h */
301-- 299--
3022.37.1 (Apple Git-137.1) 3002.34.1
303 301
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-debug-message-when-register-is-unavailable.patch
new file mode 100644
index 00000000..1383efd8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0004-Fix-debug-message-when-register-is-unavailable.patch
@@ -0,0 +1,45 @@
1From 087f77ebdbdf5b9b5d199ba92b31c6503cb66b37 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 04/53] Fix debug message when register is unavailable
5
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7
8Conflicts:
9 gdb/frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gdb/frame.c | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15diff --git a/gdb/frame.c b/gdb/frame.c
16index d95d63eb0f6..859e1a6553d 100644
17--- a/gdb/frame.c
18+++ b/gdb/frame.c
19@@ -1317,12 +1317,20 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
20 else
21 {
22 int i;
23- gdb::array_view<const gdb_byte> buf = value->contents ();
24+
25+ const gdb_byte *buf = NULL;
26+ if (value_entirely_available(value)) {
27+ gdb::array_view<const gdb_byte> buf = value->contents ();
28+ }
29
30 gdb_printf (&debug_file, " bytes=");
31 gdb_printf (&debug_file, "[");
32- for (i = 0; i < register_size (gdbarch, regnum); i++)
33- gdb_printf (&debug_file, "%02x", buf[i]);
34+ if (buf != NULL) {
35+ for (i = 0; i < register_size (gdbarch, regnum); i++)
36+ gdb_printf (&debug_file, "%02x", buf[i]);
37+ } else {
38+ gdb_printf (&debug_file, "unavailable");
39+ }
40 gdb_printf (&debug_file, "]");
41 }
42 }
43--
442.34.1
45
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0005-MicroBlaze-native-gdb-port.patch
index 08b0ae17..75c06b62 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0005-MicroBlaze-native-gdb-port.patch
@@ -1,13 +1,11 @@
1From 8d05b79cda7617f228fa4bb6e5147689b662699e Mon Sep 17 00:00:00 2001 1From 5b633480eb0b45dc15b6416c54535c54c062d23c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 18:53:46 +0530 3Date: Mon, 10 Oct 2022 18:53:46 +0530
4Subject: [PATCH 4/8] [Patch,MicroBlaze] : MicroBlaze native gdb port. 4Subject: [PATCH 05/53] MicroBlaze native gdb port.
5 5
6signed-off-by : Mahesh Bodapati <mbodapat@amd.com> 6signed-off-by : Mahesh Bodapati <mbodapat@amd.com>
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
11--- 9---
12 gdb/Makefile.in | 2 + 10 gdb/Makefile.in | 2 +
13 gdb/configure.nat | 4 + 11 gdb/configure.nat | 4 +
@@ -23,10 +21,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
23 create mode 100644 gdb/microblaze-linux-tdep.h 21 create mode 100644 gdb/microblaze-linux-tdep.h
24 22
25diff --git a/gdb/Makefile.in b/gdb/Makefile.in 23diff --git a/gdb/Makefile.in b/gdb/Makefile.in
26index aecab41eeb8..fb63e1662c1 100644 24index 0e0f19c40c9..056588d88d0 100644
27--- a/gdb/Makefile.in 25--- a/gdb/Makefile.in
28+++ b/gdb/Makefile.in 26+++ b/gdb/Makefile.in
29@@ -1374,6 +1374,7 @@ HFILES_NO_SRCDIR = \ 27@@ -1409,6 +1409,7 @@ HFILES_NO_SRCDIR = \
30 memory-map.h \ 28 memory-map.h \
31 memrange.h \ 29 memrange.h \
32 microblaze-tdep.h \ 30 microblaze-tdep.h \
@@ -34,7 +32,7 @@ index aecab41eeb8..fb63e1662c1 100644
34 mips-linux-tdep.h \ 32 mips-linux-tdep.h \
35 mips-netbsd-tdep.h \ 33 mips-netbsd-tdep.h \
36 mips-tdep.h \ 34 mips-tdep.h \
37@@ -2249,6 +2250,7 @@ ALLDEPFILES = \ 35@@ -1757,6 +1758,7 @@ ALLDEPFILES = \
38 m68k-linux-nat.c \ 36 m68k-linux-nat.c \
39 m68k-linux-tdep.c \ 37 m68k-linux-tdep.c \
40 m68k-tdep.c \ 38 m68k-tdep.c \
@@ -43,10 +41,10 @@ index aecab41eeb8..fb63e1662c1 100644
43 microblaze-tdep.c \ 41 microblaze-tdep.c \
44 mingw-hdep.c \ 42 mingw-hdep.c \
45diff --git a/gdb/configure.nat b/gdb/configure.nat 43diff --git a/gdb/configure.nat b/gdb/configure.nat
46index b45519fd116..256c666e760 100644 44index 8b98511cef7..c9f0fb25010 100644
47--- a/gdb/configure.nat 45--- a/gdb/configure.nat
48+++ b/gdb/configure.nat 46+++ b/gdb/configure.nat
49@@ -270,6 +270,10 @@ case ${gdb_host} in 47@@ -274,6 +274,10 @@ case ${gdb_host} in
50 # Host: Motorola m68k running GNU/Linux. 48 # Host: Motorola m68k running GNU/Linux.
51 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o" 49 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
52 ;; 50 ;;
@@ -144,378 +142,378 @@ index 00000000000..267e12f6d59
144+} 142+}
145diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c 143diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
146new file mode 100755 144new file mode 100755
147index 00000000000..6b9daa23120 145index 00000000000..a348001a3e2
148--- /dev/null 146--- /dev/null
149+++ b/gdb/microblaze-linux-nat.c 147+++ b/gdb/microblaze-linux-nat.c
150@@ -0,0 +1,366 @@ 148@@ -0,0 +1,366 @@
151+/* Native-dependent code for GNU/Linux MicroBlaze. 149+/* Native-dependent code for GNU/Linux MicroBlaze.
152+ Copyright (C) 2021 Free Software Foundation, Inc. 150+ Copyright (C) 2021 Free Software Foundation, Inc.
153+ 151+
154+ This file is part of GDB. 152+ This file is part of GDB.
155+ 153+
156+ This program is free software; you can redistribute it and/or modify 154+ This program is free software; you can redistribute it and/or modify
157+ it under the terms of the GNU General Public License as published by 155+ it under the terms of the GNU General Public License as published by
158+ the Free Software Foundation; either version 3 of the License, or 156+ the Free Software Foundation; either version 3 of the License, or
159+ (at your option) any later version. 157+ (at your option) any later version.
160+ 158+
161+ This program is distributed in the hope that it will be useful, 159+ This program is distributed in the hope that it will be useful,
162+ but WITHOUT ANY WARRANTY; without even the implied warranty of 160+ but WITHOUT ANY WARRANTY; without even the implied warranty of
163+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 161+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164+ GNU General Public License for more details. 162+ GNU General Public License for more details.
165+ 163+
166+ You should have received a copy of the GNU General Public License 164+ You should have received a copy of the GNU General Public License
167+ along with this program. If not, see <http://www.gnu.org/licenses/>. */ 165+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
168+ 166+
169+#include "defs.h" 167+#include "defs.h"
170+#include "arch-utils.h" 168+#include "arch-utils.h"
171+#include "dis-asm.h" 169+#include "dis-asm.h"
172+#include "frame.h" 170+#include "frame.h"
173+#include "trad-frame.h" 171+#include "trad-frame.h"
174+#include "symtab.h" 172+#include "symtab.h"
175+#include "value.h" 173+#include "value.h"
176+#include "gdbcmd.h" 174+#include "gdbcmd.h"
177+#include "breakpoint.h" 175+#include "breakpoint.h"
178+#include "inferior.h" 176+#include "inferior.h"
179+#include "gdbthread.h" 177+#include "gdbthread.h"
180+#include "gdbcore.h" 178+#include "gdbcore.h"
181+#include "regcache.h" 179+#include "regcache.h"
182+#include "regset.h" 180+#include "regset.h"
183+#include "target.h" 181+#include "target.h"
184+#include "frame.h" 182+#include "frame.h"
185+#include "frame-base.h" 183+#include "frame-base.h"
186+#include "frame-unwind.h" 184+#include "frame-unwind.h"
187+#include "osabi.h" 185+#include "osabi.h"
188+#include "gdbsupport/gdb_assert.h" 186+#include "gdbsupport/gdb_assert.h"
189+#include <string.h> 187+#include <string.h>
190+#include "target-descriptions.h" 188+#include "target-descriptions.h"
191+#include "opcodes/microblaze-opcm.h" 189+#include "opcodes/microblaze-opcm.h"
192+#include "opcodes/microblaze-dis.h" 190+#include "opcodes/microblaze-dis.h"
193+#include "gregset.h" 191+#include "gregset.h"
194+ 192+
195+#include "linux-nat.h" 193+#include "linux-nat.h"
196+#include "linux-tdep.h" 194+#include "linux-tdep.h"
197+#include "target-descriptions.h" 195+#include "target-descriptions.h"
198+ 196+
199+#include <sys/user.h> 197+#include <sys/user.h>
200+#include <sys/ioctl.h> 198+#include <sys/ioctl.h>
201+#include <sys/uio.h> 199+#include <sys/uio.h>
202+#include "gdbsupport/gdb_wait.h" 200+#include "gdbsupport/gdb_wait.h"
203+#include <fcntl.h> 201+#include <fcntl.h>
204+#include <sys/procfs.h> 202+#include <sys/procfs.h>
205+#include "nat/gdb_ptrace.h" 203+#include "nat/gdb_ptrace.h"
206+#include "nat/linux-ptrace.h" 204+#include "nat/linux-ptrace.h"
207+#include "inf-ptrace.h" 205+#include "inf-ptrace.h"
208+#include <algorithm> 206+#include <algorithm>
209+#include <unordered_map> 207+#include <unordered_map>
210+#include <list> 208+#include <list>
211+#include <sys/ptrace.h> 209+#include <sys/ptrace.h>
212+ 210+
213+/* Prototypes for supply_gregset etc. */ 211+/* Prototypes for supply_gregset etc. */
214+#include "gregset.h" 212+#include "gregset.h"
215+ 213+
216+#include "microblaze-tdep.h" 214+#include "microblaze-tdep.h"
217+#include "microblaze-linux-tdep.h" 215+#include "microblaze-linux-tdep.h"
218+#include "inferior.h" 216+#include "inferior.h"
219+ 217+
220+#include "elf/common.h" 218+#include "elf/common.h"
221+ 219+
222+#include "auxv.h" 220+#include "auxv.h"
223+#include "linux-tdep.h" 221+#include "linux-tdep.h"
224+ 222+
225+#include <sys/ptrace.h> 223+#include <sys/ptrace.h>
226+ 224+
227+ 225+
228+//int have_ptrace_getsetregs=1; 226+//int have_ptrace_getsetregs=1;
229+ 227+
230+/* MicroBlaze Linux native additions to the default linux support. */ 228+/* MicroBlaze Linux native additions to the default linux support. */
231+ 229+
232+class microblaze_linux_nat_target final : public linux_nat_target 230+class microblaze_linux_nat_target final : public linux_nat_target
233+{ 231+{
234+public: 232+public:
235+ /* Add our register access methods. */ 233+ /* Add our register access methods. */
236+ void fetch_registers (struct regcache *regcache, int regnum) override; 234+ void fetch_registers (struct regcache *regcache, int regnum) override;
237+ void store_registers (struct regcache *regcache, int regnum) override; 235+ void store_registers (struct regcache *regcache, int regnum) override;
238+ 236+
239+ /* Read suitable target description. */ 237+ /* Read suitable target description. */
240+ const struct target_desc *read_description () override; 238+ const struct target_desc *read_description () override;
241+}; 239+};
242+ 240+
243+static microblaze_linux_nat_target the_microblaze_linux_nat_target; 241+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
244+ 242+
245+static int 243+static int
246+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno) 244+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
247+{ 245+{
248+ int u_addr = -1; 246+ int u_addr = -1;
249+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 247+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
250+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace 248+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
251+ * interface, and not the wordsize of the program's ABI. */ 249+ * interface, and not the wordsize of the program's ABI. */
252+ int wordsize = sizeof (long); 250+ int wordsize = sizeof (long);
253+ 251+
254+ /* General purpose registers occupy 1 slot each in the buffer. */ 252+ /* General purpose registers occupy 1 slot each in the buffer. */
255+ if (regno >= MICROBLAZE_R0_REGNUM 253+ if (regno >= MICROBLAZE_R0_REGNUM
256+ && regno <= MICROBLAZE_FSR_REGNUM) 254+ && regno <= MICROBLAZE_FSR_REGNUM)
257+ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize); 255+ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize);
258+ 256+
259+ return u_addr; 257+ return u_addr;
260+} 258+}
261+ 259+
262+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1) 260+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
263+ from regset GREGS into REGCACHE. */ 261+ from regset GREGS into REGCACHE. */
264+ 262+
265+static void 263+static void
266+supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs, 264+supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs,
267+ int regnum) 265+ int regnum)
268+{ 266+{
269+ int i; 267+ int i;
270+ const elf_greg_t *regp = *gregs; 268+ const elf_greg_t *regp = *gregs;
271+ /* Access all registers */ 269+ /* Access all registers */
272+ if (regnum == -1) 270+ if (regnum == -1)
273+ { 271+ {
274+ /* We fill the general purpose registers. */ 272+ /* We fill the general purpose registers. */
275+ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++) 273+ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
276+ regcache->raw_supply (i, regp + i); 274+ regcache->raw_supply (i, regp + i);
277+ 275+
278+ /* Supply MICROBLAZE_PC_REGNUM from index 32. */ 276+ /* Supply MICROBLAZE_PC_REGNUM from index 32. */
279+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32); 277+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
280+ 278+
281+ /* Fill the inaccessible zero register with zero. */ 279+ /* Fill the inaccessible zero register with zero. */
282+ regcache->raw_supply_zeroed (0); 280+ regcache->raw_supply_zeroed (0);
283+ } 281+ }
284+ else if (regnum == MICROBLAZE_R0_REGNUM) 282+ else if (regnum == MICROBLAZE_R0_REGNUM)
285+ regcache->raw_supply_zeroed (0); 283+ regcache->raw_supply_zeroed (0);
286+ else if (regnum == MICROBLAZE_PC_REGNUM) 284+ else if (regnum == MICROBLAZE_PC_REGNUM)
287+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32); 285+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
288+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM) 286+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
289+ regcache->raw_supply (regnum, regp + regnum); 287+ regcache->raw_supply (regnum, regp + regnum);
290+} 288+}
291+ 289+
292+/* Copy all general purpose registers from regset GREGS into REGCACHE. */ 290+/* Copy all general purpose registers from regset GREGS into REGCACHE. */
293+ 291+
294+void 292+void
295+supply_gregset (struct regcache *regcache, const prgregset_t *gregs) 293+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
296+{ 294+{
297+ supply_gregset_regnum (regcache, gregs, -1); 295+ supply_gregset_regnum (regcache, gregs, -1);
298+} 296+}
299+ 297+
300+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1) 298+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
301+ from REGCACHE into regset GREGS. */ 299+ from REGCACHE into regset GREGS. */
302+ 300+
303+void 301+void
304+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum) 302+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
305+{ 303+{
306+ elf_greg_t *regp = *gregs; 304+ elf_greg_t *regp = *gregs;
307+ if (regnum == -1) 305+ if (regnum == -1)
308+ { 306+ {
309+ /* We fill the general purpose registers. */ 307+ /* We fill the general purpose registers. */
310+ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++) 308+ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
311+ regcache->raw_collect (i, regp + i); 309+ regcache->raw_collect (i, regp + i);
312+ 310+
313+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32); 311+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
314+ } 312+ }
315+ else if (regnum == MICROBLAZE_R0_REGNUM) 313+ else if (regnum == MICROBLAZE_R0_REGNUM)
316+ /* Nothing to do here. */ 314+ /* Nothing to do here. */
317+ ; 315+ ;
318+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM) 316+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
319+ regcache->raw_collect (regnum, regp + regnum); 317+ regcache->raw_collect (regnum, regp + regnum);
320+ else if (regnum == MICROBLAZE_PC_REGNUM) 318+ else if (regnum == MICROBLAZE_PC_REGNUM)
321+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32); 319+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
322+} 320+}
323+ 321+
324+/* Transfering floating-point registers between GDB, inferiors and cores. 322+/* Transfering floating-point registers between GDB, inferiors and cores.
325+ Since MicroBlaze floating-point registers are the same as GPRs these do 323+ Since MicroBlaze floating-point registers are the same as GPRs these do
326+ nothing. */ 324+ nothing. */
327+ 325+
328+void 326+void
329+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs) 327+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
330+{ 328+{
331+} 329+}
332+ 330+
333+void 331+void
334+fill_fpregset (const struct regcache *regcache, 332+fill_fpregset (const struct regcache *regcache,
335+ gdb_fpregset_t *fpregs, int regno) 333+ gdb_fpregset_t *fpregs, int regno)
336+{ 334+{
337+} 335+}
338+ 336+
339+ 337+
340+static void 338+static void
341+fetch_register (struct regcache *regcache, int tid, int regno) 339+fetch_register (struct regcache *regcache, int tid, int regno)
342+{ 340+{
343+ struct gdbarch *gdbarch = regcache->arch (); 341+ struct gdbarch *gdbarch = regcache->arch ();
344+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 342+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
345+ /* This isn't really an address. But ptrace thinks of it as one. */ 343+ /* This isn't really an address. But ptrace thinks of it as one. */
346+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); 344+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
347+ int bytes_transferred; 345+ int bytes_transferred;
348+ char buf[MICROBLAZE_MAX_REGISTER_SIZE]; 346+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
349+ 347+
350+ if (regaddr == -1) 348+ if (regaddr == -1)
351+ { 349+ {
352+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ 350+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
353+ regcache->raw_supply (regno, buf); 351+ regcache->raw_supply (regno, buf);
354+ return; 352+ return;
355+ } 353+ }
356+ 354+
357+ /* Read the raw register using sizeof(long) sized chunks. On a 355+ /* Read the raw register using sizeof(long) sized chunks. On a
358+ * 32-bit platform, 64-bit floating-point registers will require two 356+ * 32-bit platform, 64-bit floating-point registers will require two
359+ * transfers. */ 357+ * transfers. */
360+ for (bytes_transferred = 0; 358+ for (bytes_transferred = 0;
361+ bytes_transferred < register_size (gdbarch, regno); 359+ bytes_transferred < register_size (gdbarch, regno);
362+ bytes_transferred += sizeof (long)) 360+ bytes_transferred += sizeof (long))
363+ { 361+ {
364+ long l; 362+ long l;
365+ 363+
366+ errno = 0; 364+ errno = 0;
367+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); 365+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
368+ if (errno == EIO) 366+ if (errno == EIO)
369+ { 367+ {
370+ printf("ptrace io error\n"); 368+ printf("ptrace io error\n");
371+ } 369+ }
372+ regaddr += sizeof (long); 370+ regaddr += sizeof (long);
373+ if (errno != 0) 371+ if (errno != 0)
374+ { 372+ {
375+ char message[128]; 373+ char message[128];
376+ sprintf (message, "reading register %s (#%d)", 374+ sprintf (message, "reading register %s (#%d)",
377+ gdbarch_register_name (gdbarch, regno), regno); 375+ gdbarch_register_name (gdbarch, regno), regno);
378+ perror_with_name (message); 376+ perror_with_name (message);
379+ } 377+ }
380+ memcpy (&buf[bytes_transferred], &l, sizeof (l)); 378+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
381+ } 379+ }
382+ 380+
383+ /* Now supply the register. Keep in mind that the regcache's idea 381+ /* Now supply the register. Keep in mind that the regcache's idea
384+ * of the register's size may not be a multiple of sizeof 382+ * of the register's size may not be a multiple of sizeof
385+ * (long). */ 383+ * (long). */
386+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) 384+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
387+ { 385+ {
388+ /* Little-endian values are always found at the left end of the 386+ /* Little-endian values are always found at the left end of the
389+ * bytes transferred. */ 387+ * bytes transferred. */
390+ regcache->raw_supply (regno, buf); 388+ regcache->raw_supply (regno, buf);
391+ } 389+ }
392+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 390+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
393+ { 391+ {
394+ /* Big-endian values are found at the right end of the bytes 392+ /* Big-endian values are found at the right end of the bytes
395+ * transferred. */ 393+ * transferred. */
396+ size_t padding = (bytes_transferred - register_size (gdbarch, regno)); 394+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
397+ regcache->raw_supply (regno, buf + padding); 395+ regcache->raw_supply (regno, buf + padding);
398+ } 396+ }
399+ else 397+ else
400+ internal_error (__FILE__, __LINE__, 398+ internal_error (__FILE__, __LINE__,
401+ _("fetch_register: unexpected byte order: %d"), 399+ _("fetch_register: unexpected byte order: %d"),
402+ gdbarch_byte_order (gdbarch)); 400+ gdbarch_byte_order (gdbarch));
403+} 401+}
404+ 402+
405+ 403+
406+/* This is a wrapper for the fetch_all_gp_regs function. It is 404+/* This is a wrapper for the fetch_all_gp_regs function. It is
407+ * responsible for verifying if this target has the ptrace request 405+ * responsible for verifying if this target has the ptrace request
408+ * that can be used to fetch all general-purpose registers at one 406+ * that can be used to fetch all general-purpose registers at one
409+ * shot. If it doesn't, then we should fetch them using the 407+ * shot. If it doesn't, then we should fetch them using the
410+ * old-fashioned way, which is to iterate over the registers and 408+ * old-fashioned way, which is to iterate over the registers and
411+ * request them one by one. */ 409+ * request them one by one. */
412+static void 410+static void
413+fetch_gp_regs (struct regcache *regcache, int tid) 411+fetch_gp_regs (struct regcache *regcache, int tid)
414+{ 412+{
415+ int i; 413+ int i;
416+/* If we've hit this point, it doesn't really matter which 414+/* If we've hit this point, it doesn't really matter which
417+ architecture we are using. We just need to read the 415+ architecture we are using. We just need to read the
418+ registers in the "old-fashioned way". */ 416+ registers in the "old-fashioned way". */
419+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++) 417+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
420+ fetch_register (regcache, tid, i); 418+ fetch_register (regcache, tid, i);
421+} 419+}
422+ 420+
423+/* Return a target description for the current target. */ 421+/* Return a target description for the current target. */
424+ 422+
425+const struct target_desc * 423+const struct target_desc *
426+microblaze_linux_nat_target::read_description () 424+microblaze_linux_nat_target::read_description ()
427+{ 425+{
428+ return tdesc_microblaze_linux; 426+ return tdesc_microblaze_linux;
429+} 427+}
430+ 428+
431+/* Fetch REGNUM (or all registers if REGNUM == -1) from the target 429+/* Fetch REGNUM (or all registers if REGNUM == -1) from the target
432+ into REGCACHE using PTRACE_GETREGSET. */ 430+ into REGCACHE using PTRACE_GETREGSET. */
433+ 431+
434+void 432+void
435+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache, 433+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache,
436+ int regno) 434+ int regno)
437+{ 435+{
438+ /* Get the thread id for the ptrace call. */ 436+ /* Get the thread id for the ptrace call. */
439+ int tid = regcache->ptid ().lwp (); 437+ int tid = regcache->ptid ().lwp ();
440+//int tid = get_ptrace_pid (regcache->ptid()); 438+//int tid = get_ptrace_pid (regcache->ptid());
441+#if 1 439+#if 1
442+ if (regno == -1) 440+ if (regno == -1)
443+#endif 441+#endif
444+ fetch_gp_regs (regcache, tid); 442+ fetch_gp_regs (regcache, tid);
445+#if 1 443+#if 1
446+ else 444+ else
447+ fetch_register (regcache, tid, regno); 445+ fetch_register (regcache, tid, regno);
448+#endif 446+#endif
449+} 447+}
450+ 448+
451+ 449+
452+/* Store REGNUM (or all registers if REGNUM == -1) to the target 450+/* Store REGNUM (or all registers if REGNUM == -1) to the target
453+ from REGCACHE using PTRACE_SETREGSET. */ 451+ from REGCACHE using PTRACE_SETREGSET. */
454+ 452+
455+void 453+void
456+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno) 454+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
457+{ 455+{
458+ int tid; 456+ int tid;
459+ 457+
460+ tid = get_ptrace_pid (regcache->ptid ()); 458+ tid = get_ptrace_pid (regcache->ptid ());
461+ 459+
462+ struct gdbarch *gdbarch = regcache->arch (); 460+ struct gdbarch *gdbarch = regcache->arch ();
463+ /* This isn't really an address. But ptrace thinks of it as one. */ 461+ /* This isn't really an address. But ptrace thinks of it as one. */
464+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); 462+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
465+ int i; 463+ int i;
466+ size_t bytes_to_transfer; 464+ size_t bytes_to_transfer;
467+ char buf[MICROBLAZE_MAX_REGISTER_SIZE]; 465+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
468+ 466+
469+ if (regaddr == -1) 467+ if (regaddr == -1)
470+ return; 468+ return;
471+ 469+
472+ /* First collect the register. Keep in mind that the regcache's 470+ /* First collect the register. Keep in mind that the regcache's
473+ * idea of the register's size may not be a multiple of sizeof 471+ * idea of the register's size may not be a multiple of sizeof
474+ * (long). */ 472+ * (long). */
475+ memset (buf, 0, sizeof buf); 473+ memset (buf, 0, sizeof buf);
476+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); 474+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
477+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) 475+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
478+ { 476+ {
479+ /* Little-endian values always sit at the left end of the buffer. */ 477+ /* Little-endian values always sit at the left end of the buffer. */
480+ regcache->raw_collect (regno, buf); 478+ regcache->raw_collect (regno, buf);
481+ } 479+ }
482+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 480+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
483+ { 481+ {
484+ /* Big-endian values sit at the right end of the buffer. */ 482+ /* Big-endian values sit at the right end of the buffer. */
485+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); 483+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
486+ regcache->raw_collect (regno, buf + padding); 484+ regcache->raw_collect (regno, buf + padding);
487+ } 485+ }
488+ 486+
489+ for (i = 0; i < bytes_to_transfer; i += sizeof (long)) 487+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
490+ { 488+ {
491+ long l; 489+ long l;
492+ 490+
493+ memcpy (&l, &buf[i], sizeof (l)); 491+ memcpy (&l, &buf[i], sizeof (l));
494+ errno = 0; 492+ errno = 0;
495+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l); 493+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
496+ regaddr += sizeof (long); 494+ regaddr += sizeof (long);
497+ 495+
498+ if (errno != 0) 496+ if (errno != 0)
499+ { 497+ {
500+ char message[128]; 498+ char message[128];
501+ sprintf (message, "writing register %s (#%d)", 499+ sprintf (message, "writing register %s (#%d)",
502+ gdbarch_register_name (gdbarch, regno), regno); 500+ gdbarch_register_name (gdbarch, regno), regno);
503+ perror_with_name (message); 501+ perror_with_name (message);
504+ } 502+ }
505+ } 503+ }
506+} 504+}
507+ 505+
508+void _initialize_microblaze_linux_nat (void); 506+void _initialize_microblaze_linux_nat (void);
509+ 507+
510+void 508+void
511+_initialize_microblaze_linux_nat (void) 509+_initialize_microblaze_linux_nat (void)
512+{ 510+{
513+ /* Register the target. */ 511+ /* Register the target. */
514+ linux_target = &the_microblaze_linux_nat_target; 512+ linux_target = &the_microblaze_linux_nat_target;
515+ add_inf_child_target (linux_target); 513+ add_inf_child_target (linux_target);
516+} 514+}
517diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c 515diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
518index d6197c49dfd..fc52adffb72 100644 516index eef09bacec0..d086debc4f8 100644
519--- a/gdb/microblaze-linux-tdep.c 517--- a/gdb/microblaze-linux-tdep.c
520+++ b/gdb/microblaze-linux-tdep.c 518+++ b/gdb/microblaze-linux-tdep.c
521@@ -37,6 +37,7 @@ 519@@ -37,6 +37,7 @@
@@ -563,7 +561,7 @@ index 00000000000..a2c744e2961
563+ 561+
564+#endif /* MICROBLAZE_LINUX_TDEP_H */ 562+#endif /* MICROBLAZE_LINUX_TDEP_H */
565diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 563diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
566index ccd37d085d6..ccb6b730d64 100644 564index 7c98331f8a9..b0b4c1b2614 100644
567--- a/gdb/microblaze-tdep.c 565--- a/gdb/microblaze-tdep.c
568+++ b/gdb/microblaze-tdep.c 566+++ b/gdb/microblaze-tdep.c
569@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, 567@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
@@ -595,7 +593,7 @@ index ccd37d085d6..ccb6b730d64 100644
595 if (ostart_pc > start_pc) 593 if (ostart_pc > start_pc)
596 return ostart_pc; 594 return ostart_pc;
597 return start_pc; 595 return start_pc;
598@@ -453,6 +456,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) 596@@ -453,6 +456,7 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
599 struct microblaze_frame_cache *cache; 597 struct microblaze_frame_cache *cache;
600 struct gdbarch *gdbarch = get_frame_arch (next_frame); 598 struct gdbarch *gdbarch = get_frame_arch (next_frame);
601 int rn; 599 int rn;
@@ -603,7 +601,7 @@ index ccd37d085d6..ccb6b730d64 100644
603 601
604 if (*this_cache) 602 if (*this_cache)
605 return (struct microblaze_frame_cache *) *this_cache; 603 return (struct microblaze_frame_cache *) *this_cache;
606@@ -466,10 +470,17 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache) 604@@ -466,10 +470,17 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
607 cache->register_offsets[rn] = -1; 605 cache->register_offsets[rn] = -1;
608 606
609 /* Call for side effects. */ 607 /* Call for side effects. */
@@ -625,7 +623,7 @@ index ccd37d085d6..ccb6b730d64 100644
625 return cache; 623 return cache;
626 } 624 }
627 625
628@@ -494,6 +505,25 @@ microblaze_frame_prev_register (struct frame_info *this_frame, 626@@ -494,6 +505,25 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
629 struct microblaze_frame_cache *cache = 627 struct microblaze_frame_cache *cache =
630 microblaze_frame_cache (this_frame, this_cache); 628 microblaze_frame_cache (this_frame, this_cache);
631 629
@@ -651,7 +649,7 @@ index ccd37d085d6..ccb6b730d64 100644
651 if (cache->frameless_p) 649 if (cache->frameless_p)
652 { 650 {
653 if (regnum == MICROBLAZE_PC_REGNUM) 651 if (regnum == MICROBLAZE_PC_REGNUM)
654@@ -506,7 +536,9 @@ microblaze_frame_prev_register (struct frame_info *this_frame, 652@@ -506,7 +536,9 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
655 else 653 else
656 return trad_frame_get_prev_register (this_frame, cache->saved_regs, 654 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
657 regnum); 655 regnum);
@@ -662,8 +660,8 @@ index ccd37d085d6..ccb6b730d64 100644
662 } 660 }
663 661
664 static const struct frame_unwind microblaze_frame_unwind = 662 static const struct frame_unwind microblaze_frame_unwind =
665@@ -622,7 +654,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) 663@@ -621,7 +653,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
666 return (TYPE_LENGTH (type) == 16); 664 return (type->length () == 16);
667 } 665 }
668 666
669- 667-
@@ -770,7 +768,7 @@ index ccd37d085d6..ccb6b730d64 100644
770 static int dwarf2_to_reg_map[78] = 768 static int dwarf2_to_reg_map[78] =
771 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ 769 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
772 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */ 770 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
773@@ -790,6 +921,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 771@@ -788,6 +919,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
774 microblaze_breakpoint::bp_from_kind); 772 microblaze_breakpoint::bp_from_kind);
775 set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 773 set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
776 774
@@ -780,7 +778,7 @@ index ccd37d085d6..ccb6b730d64 100644
780 778
781 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); 779 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
782diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 780diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
783index 2e853d84d72..2415acfe7b6 100644 781index 07a160a463c..c4c8098308f 100644
784--- a/gdb/microblaze-tdep.h 782--- a/gdb/microblaze-tdep.h
785+++ b/gdb/microblaze-tdep.h 783+++ b/gdb/microblaze-tdep.h
786@@ -60,11 +60,11 @@ enum microblaze_regnum 784@@ -60,11 +60,11 @@ enum microblaze_regnum
@@ -832,5 +830,5 @@ index 2e853d84d72..2415acfe7b6 100644
832 int frameless_p; 830 int frameless_p;
833 831
834-- 832--
8352.37.1 (Apple Git-137.1) 8332.34.1
836 834
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
new file mode 100644
index 00000000..a61c17d9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
@@ -0,0 +1,1841 @@
1From ff4596845becf48fa17f06ea30a59658e9722e06 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 06/53] 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> Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com>
7
8Conflicts:
9 gdb/Makefile.in
10
11Conflicts:
12 bfd/cpu-microblaze.c
13 gdb/microblaze-tdep.c
14 ld/Makefile.am
15 ld/Makefile.in
16 opcodes/microblaze-dis.c
17
18Conflicts:
19 bfd/configure
20 gas/config/tc-microblaze.c
21 ld/Makefile.in
22 opcodes/microblaze-opcm.h
23
24Conflicts:
25 gdb/microblaze-tdep.c
26
27Conflicts:
28 bfd/elf32-microblaze.c
29 gas/config/tc-microblaze.c
30 gdb/features/Makefile
31 gdb/features/microblaze-with-stack-protect.c
32 gdb/microblaze-tdep.c
33 gdb/regformats/microblaze-with-stack-protect.dat
34 gdbserver/linux-microblaze-low.c
35 include/elf/common.h
36
37Signed-off-by: Aayush Misra <aayushm@amd.com>
38---
39 bfd/Makefile.am | 2 +
40 bfd/Makefile.in | 3 +
41 bfd/archures.c | 2 +
42 bfd/bfd-in2.h | 41 ++++-
43 bfd/config.bfd | 4 +
44 bfd/configure | 2 +
45 bfd/cpu-microblaze.c | 55 +++++-
46 bfd/elf32-microblaze.c | 133 ++++++++++++--
47 bfd/libbfd.h | 2 +
48 bfd/reloc.c | 20 +++
49 bfd/targets.c | 6 +
50 gdb/features/Makefile | 2 +
51 gdb/features/microblaze-core.xml | 6 +-
52 gdb/features/microblaze-stack-protect.xml | 4 +-
53 gdb/features/microblaze-with-stack-protect.c | 8 +-
54 gdb/features/microblaze.c | 6 +-
55 gdb/features/microblaze64-core.xml | 69 ++++++++
56 gdb/features/microblaze64-stack-protect.xml | 12 ++
57 .../microblaze64-with-stack-protect.c | 79 +++++++++
58 .../microblaze64-with-stack-protect.xml | 12 ++
59 gdb/features/microblaze64.c | 77 +++++++++
60 gdb/features/microblaze64.xml | 11 ++
61 gdb/microblaze-linux-tdep.c | 36 +++-
62 gdb/microblaze-tdep.c | 125 ++++++++++----
63 gdb/microblaze-tdep.h | 4 +-
64 include/elf/common.h | 1 +
65 include/elf/microblaze.h | 2 +
66 opcodes/microblaze-dis.c | 52 +++---
67 opcodes/microblaze-opc.h | 162 ++++++++++++++++--
68 opcodes/microblaze-opcm.h | 24 ++-
69 30 files changed, 853 insertions(+), 109 deletions(-)
70 create mode 100644 gdb/features/microblaze64-core.xml
71 create mode 100644 gdb/features/microblaze64-stack-protect.xml
72 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
73 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
74 create mode 100644 gdb/features/microblaze64.c
75 create mode 100644 gdb/features/microblaze64.xml
76
77diff --git a/bfd/Makefile.am b/bfd/Makefile.am
78index 4f67b59585d..510f96439b7 100644
79--- a/bfd/Makefile.am
80+++ b/bfd/Makefile.am
81@@ -568,6 +568,7 @@ BFD64_BACKENDS = \
82 elf64-ppc.lo \
83 elf64-riscv.lo \
84 elf64-s390.lo \
85+ elf64-microblaze.lo \
86 elf64-sparc.lo \
87 elf64-tilegx.lo \
88 elf64-x86-64.lo \
89@@ -617,6 +618,7 @@ BFD64_BACKENDS_CFILES = \
90 elf64-nfp.c \
91 elf64-ppc.c \
92 elf64-s390.c \
93+ elf64-microblaze.c \
94 elf64-sparc.c \
95 elf64-tilegx.c \
96 elf64-x86-64.c \
97diff --git a/bfd/Makefile.in b/bfd/Makefile.in
98index faaa0c424b8..71982d9f729 100644
99--- a/bfd/Makefile.in
100+++ b/bfd/Makefile.in
101@@ -1036,6 +1036,7 @@ BFD64_BACKENDS = \
102 elf64-ppc.lo \
103 elf64-riscv.lo \
104 elf64-s390.lo \
105+ elf64-microblaze.lo \
106 elf64-sparc.lo \
107 elf64-tilegx.lo \
108 elf64-x86-64.lo \
109@@ -1085,6 +1086,7 @@ BFD64_BACKENDS_CFILES = \
110 elf64-nfp.c \
111 elf64-ppc.c \
112 elf64-s390.c \
113+ elf64-microblaze.c \
114 elf64-sparc.c \
115 elf64-tilegx.c \
116 elf64-x86-64.c \
117@@ -1661,6 +1663,7 @@ distclean-compile:
118 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
119 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
120 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
121+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
122 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
125diff --git a/bfd/archures.c b/bfd/archures.c
126index 94118b8d2cf..b9db26627ea 100644
127--- a/bfd/archures.c
128+++ b/bfd/archures.c
129@@ -515,6 +515,8 @@ DESCRIPTION
130 . bfd_arch_lm32, {* Lattice Mico32. *}
131 .#define bfd_mach_lm32 1
132 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
133+.#define bfd_mach_microblaze 1
134+.#define bfd_mach_microblaze64 2
135 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
136 .#define bfd_mach_kv3_unknown 0
137 .#define bfd_mach_kv3_1 1
138diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
139index 581d8fe0b3e..7ccc155394d 100644
140--- a/bfd/bfd-in2.h
141+++ b/bfd/bfd-in2.h
142@@ -1771,6 +1771,8 @@ enum bfd_architecture
143 bfd_arch_lm32, /* Lattice Mico32. */
144 #define bfd_mach_lm32 1
145 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
146+#define bfd_mach_microblaze 1
147+#define bfd_mach_microblaze64 2
148 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
149 #define bfd_mach_kv3_unknown 0
150 #define bfd_mach_kv3_1 1
151@@ -6444,23 +6446,44 @@ enum bfd_reloc_code_real
152 the form "Symbol Op Symbol". */
153 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
154
155- /* This is a 32 bit reloc that stores the 32 bit pc relative value in
156- two words (with an imm instruction). No relocation is done here -
157- only used for relaxing. */
158+/* This is a 32 bit reloc that stores the 32 bit pc relative
159+value in two words (with an imm instruction). No relocation is
160+done here - only used for relaxing */
161 BFD_RELOC_MICROBLAZE_32_NONE,
162
163- /* This is a 64 bit reloc that stores the 32 bit pc relative value in
164- two words (with an imm instruction). No relocation is done here -
165- only used for relaxing. */
166- BFD_RELOC_MICROBLAZE_64_NONE,
167+/* This is a 64 bit reloc that stores the 32 bit pc relative
168+ * +value in two words (with an imml instruction). No relocation is
169+ * +done here - only used for relaxing */
170+ BFD_RELOC_MICROBLAZE_64_PCREL,
171+
172+/* This is a 64 bit reloc that stores the 32 bit relative
173+ * +value in two words (with an imml instruction). No relocation is
174+ * +done here - only used for relaxing */
175+ BFD_RELOC_MICROBLAZE_64,
176+
177+/* This is a 64 bit reloc that stores the 32 bit relative
178+ * +value in two words (with an imml instruction). No relocation is
179+ * +done here - only used for relaxing */
180+ BFD_RELOC_MICROBLAZE_EA64,
181+
182+/* This is a 64 bit reloc that stores the 32 bit pc relative
183+ * +value in two words (with an imm instruction). No relocation is
184+ * +done here - only used for relaxing */
185+ BFD_RELOC_MICROBLAZE_64_NONE,
186
187 /* This is a 64 bit reloc that stores the 32 bit pc relative value in
188 two words (with an imm instruction). The relocation is PC-relative
189 GOT offset. */
190 BFD_RELOC_MICROBLAZE_64_GOTPC,
191
192- /* This is a 64 bit reloc that stores the 32 bit pc relative value in
193- two words (with an imm instruction). The relocation is GOT offset. */
194+/* This is a 64 bit reloc that stores the 32 bit pc relative
195+value in two words (with an imml instruction). The relocation is
196+PC-relative GOT offset */
197+ BFD_RELOC_MICROBLAZE_64_GPC,
198+
199+/* This is a 64 bit reloc that stores the 32 bit pc relative
200+value in two words (with an imm instruction). The relocation is
201+GOT offset */
202 BFD_RELOC_MICROBLAZE_64_GOT,
203
204 /* This is a 64 bit reloc that stores the 32 bit pc relative value in
205diff --git a/bfd/config.bfd b/bfd/config.bfd
206index bbf12447517..cbba305354f 100644
207--- a/bfd/config.bfd
208+++ b/bfd/config.bfd
209@@ -884,11 +884,15 @@ case "${targ}" in
210 microblazeel*-*)
211 targ_defvec=microblaze_elf32_le_vec
212 targ_selvecs=microblaze_elf32_vec
213+ targ64_selvecs=microblaze_elf64_vec
214+ targ64_selvecs=microblaze_elf64_le_vec
215 ;;
216
217 microblaze*-*)
218 targ_defvec=microblaze_elf32_vec
219 targ_selvecs=microblaze_elf32_le_vec
220+ targ64_selvecs=microblaze_elf64_vec
221+ targ64_selvecs=microblaze_elf64_le_vec
222 ;;
223
224 #ifdef BFD64
225diff --git a/bfd/configure b/bfd/configure
226index 5618c5d3217..3c5b58c33b4 100755
227--- a/bfd/configure
228+++ b/bfd/configure
229@@ -16016,6 +16016,8 @@ do
230 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
231 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
232 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
233+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
234+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
235 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
236 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
237 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
238diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
239index a7af3a17237..caf4fb66826 100644
240--- a/bfd/cpu-microblaze.c
241+++ b/bfd/cpu-microblaze.c
242@@ -23,13 +23,30 @@
243 #include "bfd.h"
244 #include "libbfd.h"
245
246-const bfd_arch_info_type bfd_microblaze_arch =
247+const bfd_arch_info_type bfd_microblaze_arch[] =
248+{
249+#if BFD_DEFAULT_TARGET_SIZE == 64
250+{
251+ 64, /* 32 bits in a word. */
252+ 64, /* 32 bits in an address. */
253+ 8, /* 8 bits in a byte. */
254+ bfd_arch_microblaze, /* Architecture. */
255+ bfd_mach_microblaze64, /* 64 bit Machine */
256+ "microblaze", /* Architecture name. */
257+ "MicroBlaze", /* Printable name. */
258+ 3, /* Section align power. */
259+ false, /* Is this the default architecture ? */
260+ bfd_default_compatible, /* Architecture comparison function. */
261+ bfd_default_scan, /* String to architecture conversion. */
262+ bfd_arch_default_fill, /* Default fill. */
263+ &bfd_microblaze_arch[1] /* Next in list. */
264+},
265 {
266 32, /* Bits in a word. */
267 32, /* Bits in an address. */
268 8, /* Bits in a byte. */
269 bfd_arch_microblaze, /* Architecture number. */
270- 0, /* Machine number - 0 for now. */
271+ bfd_mach_microblaze, /* Machine number - 0 for now. */
272 "microblaze", /* Architecture name. */
273 "MicroBlaze", /* Printable name. */
274 3, /* Section align power. */
275@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
276 bfd_arch_default_fill, /* Default fill. */
277 NULL, /* Next in list. */
278 0 /* Maximum offset of a reloc from the start of an insn. */
279+}
280+#else
281+{
282+ 32, /* 32 bits in a word. */
283+ 32, /* 32 bits in an address. */
284+ 8, /* 8 bits in a byte. */
285+ bfd_arch_microblaze, /* Architecture. */
286+ bfd_mach_microblaze, /* 32 bit Machine */
287+ "microblaze", /* Architecture name. */
288+ "MicroBlaze", /* Printable name. */
289+ 3, /* Section align power. */
290+ true, /* Is this the default architecture ? */
291+ bfd_default_compatible, /* Architecture comparison function. */
292+ bfd_default_scan, /* String to architecture conversion. */
293+ bfd_arch_default_fill, /* Default fill. */
294+ &bfd_microblaze_arch[1] /* Next in list. */
295+},
296+{
297+ 64, /* 32 bits in a word. */
298+ 64, /* 32 bits in an address. */
299+ 8, /* 8 bits in a byte. */
300+ bfd_arch_microblaze, /* Architecture. */
301+ bfd_mach_microblaze64, /* 64 bit Machine */
302+ "microblaze", /* Architecture name. */
303+ "MicroBlaze", /* Printable name. */
304+ 3, /* Section align power. */
305+ false, /* Is this the default architecture ? */
306+ bfd_default_compatible, /* Architecture comparison function. */
307+ bfd_default_scan, /* String to architecture conversion. */
308+ bfd_arch_default_fill, /* Default fill. */
309+ NULL, /* Next in list. */
310+ 0
311+}
312+#endif
313 };
314diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
315index 022ce365c59..7e7c4bf471d 100644
316--- a/bfd/elf32-microblaze.c
317+++ b/bfd/elf32-microblaze.c
318@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
319 0x0000ffff, /* Dest Mask. */
320 true), /* PC relative offset? */
321
322+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
323+ 0, /* Rightshift. */
324+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
325+ 16, /* Bitsize. */
326+ true, /* PC_relative. */
327+ 0, /* Bitpos. */
328+ complain_overflow_dont, /* Complain on overflow. */
329+ bfd_elf_generic_reloc,/* Special Function. */
330+ "R_MICROBLAZE_IMML_64", /* Name. */
331+ false, /* Partial Inplace. */
332+ 0, /* Source Mask. */
333+ 0x0000ffff, /* Dest Mask. */
334+ false), /* PC relative offset? */
335+
336 /* A 64 bit relocation. Table entry not really used. */
337 HOWTO (R_MICROBLAZE_64, /* Type. */
338 0, /* Rightshift. */
339@@ -279,6 +293,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
340 0x0000ffff, /* Dest Mask. */
341 true), /* PC relative offset? */
342
343+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
344+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
345+ 0, /* Rightshift. */
346+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
347+ 16, /* Bitsize. */
348+ true, /* PC_relative. */
349+ 0, /* Bitpos. */
350+ complain_overflow_dont, /* Complain on overflow. */
351+ bfd_elf_generic_reloc, /* Special Function. */
352+ "R_MICROBLAZE_GPC_64", /* Name. */
353+ false, /* Partial Inplace. */
354+ 0, /* Source Mask. */
355+ 0x0000ffff, /* Dest Mask. */
356+ true), /* PC relative offset? */
357+
358 /* A 64 bit GOT relocation. Table-entry not really used. */
359 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
360 0, /* Rightshift. */
361@@ -618,9 +647,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
362 case BFD_RELOC_VTABLE_ENTRY:
363 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
364 break;
365+ case BFD_RELOC_MICROBLAZE_64:
366+ microblaze_reloc = R_MICROBLAZE_IMML_64;
367+ break;
368 case BFD_RELOC_MICROBLAZE_64_GOTPC:
369 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
370 break;
371+ case BFD_RELOC_MICROBLAZE_64_GPC:
372+ microblaze_reloc = R_MICROBLAZE_GPC_64;
373+ break;
374 case BFD_RELOC_MICROBLAZE_64_GOT:
375 microblaze_reloc = R_MICROBLAZE_GOT_64;
376 break;
377@@ -1582,7 +1617,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
378 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
379 {
380 relocation += addend;
381- if (r_type == R_MICROBLAZE_32)
382+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
383 bfd_put_32 (input_bfd, relocation, contents + offset);
384 else
385 {
386@@ -1987,8 +2022,7 @@ microblaze_elf_relax_section (bfd *abfd,
387 else
388 symval += irel->r_addend;
389
390- if ((symval & 0xffff8000) == 0
391- || (symval & 0xffff8000) == 0xffff8000)
392+ if ((symval & 0xffff8000) == 0)
393 {
394 /* We can delete this instruction. */
395 sdata->relax[sdata->relax_count].addr = irel->r_offset;
396@@ -2052,16 +2086,45 @@ microblaze_elf_relax_section (bfd *abfd,
397 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
398 }
399 break;
400+ case R_MICROBLAZE_IMML_64:
401+ {
402+ /* This was a PC-relative instruction that was
403+ completely resolved. */
404+ int sfix, efix;
405+ unsigned int val;
406+ bfd_vma target_address;
407+ target_address = irel->r_addend + irel->r_offset;
408+ sfix = calc_fixup (irel->r_offset, 0, sec);
409+ efix = calc_fixup (target_address, 0, sec);
410+
411+ /* Validate the in-band val. */
412+ val = bfd_get_32 (abfd, contents + irel->r_offset);
413+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
414+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
415+ }
416+ irel->r_addend -= (efix - sfix);
417+ /* Should use HOWTO. */
418+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
419+ irel->r_addend);
420+ }
421+ break;
422 case R_MICROBLAZE_NONE:
423 case R_MICROBLAZE_32_NONE:
424 {
425 /* This was a PC-relative instruction that was
426 completely resolved. */
427 size_t sfix, efix;
428+ unsigned int val;
429 bfd_vma target_address;
430 target_address = irel->r_addend + irel->r_offset;
431 sfix = calc_fixup (irel->r_offset, 0, sec);
432 efix = calc_fixup (target_address, 0, sec);
433+
434+ /* Validate the in-band val. */
435+ val = bfd_get_32 (abfd, contents + irel->r_offset);
436+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
437+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
438+ }
439 irel->r_addend -= (efix - sfix);
440 /* Should use HOWTO. */
441 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
442@@ -2078,8 +2141,8 @@ microblaze_elf_relax_section (bfd *abfd,
443 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
444 efix = calc_fixup (target_address, 0, sec);
445 irel->r_addend -= (efix - sfix);
446- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
447- + INST_WORD_SIZE, irel->r_addend);
448+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
449+ irel->r_addend);
450 }
451 break;
452 }
453@@ -2109,10 +2172,50 @@ microblaze_elf_relax_section (bfd *abfd,
454 irelscanend = irelocs + o->reloc_count;
455 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
456 {
457- if ((ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
458- || (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE))
459- {
460- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
461+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
462+ {
463+ unsigned int val;
464+
465+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
466+
467+ /* hax: We only do the following fixup for debug location lists. */
468+ if (strcmp(".debug_loc", o->name))
469+ continue;
470+
471+ /* This was a PC-relative instruction that was completely resolved. */
472+ if (ocontents == NULL)
473+ {
474+ if (elf_section_data (o)->this_hdr.contents != NULL)
475+ ocontents = elf_section_data (o)->this_hdr.contents;
476+ else
477+ {
478+ /* We always cache the section contents.
479+ Perhaps, if info->keep_memory is FALSE, we
480+ should free them, if we are permitted to. */
481+
482+ if (o->rawsize == 0)
483+ o->rawsize = o->size;
484+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
485+ if (ocontents == NULL)
486+ goto error_return;
487+ if (!bfd_get_section_contents (abfd, o, ocontents,
488+ (file_ptr) 0,
489+ o->rawsize))
490+ goto error_return;
491+ elf_section_data (o)->this_hdr.contents = ocontents;
492+ }
493+ }
494+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
495+ if (val != irelscan->r_addend) {
496+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
497+ }
498+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
499+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
500+ irelscan->r_addend);
501+ }
502+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
503+ {
504+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
505
506 /* Look at the reloc only if the value has been resolved. */
507 if (isym->st_shndx == shndx
508@@ -3510,6 +3613,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
509 return true;
510 }
511
512+
513+static bool
514+elf_microblaze_object_p (bfd *abfd)
515+{
516+ /* Set the right machine number for an s390 elf32 file. */
517+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
518+}
519+
520 /* Hook called by the linker routine which adds symbols from an object
521 file. We use it to put .comm items in .sbss, and not .bss. */
522
523@@ -3580,8 +3691,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
524 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
525 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
526 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
527-
528-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
529-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
530+#define elf_backend_object_p elf_microblaze_object_p
531
532 #include "elf32-target.h"
533diff --git a/bfd/libbfd.h b/bfd/libbfd.h
534index ebd4f24149b..7a3e558d70a 100644
535--- a/bfd/libbfd.h
536+++ b/bfd/libbfd.h
537@@ -3011,6 +3011,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
538 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
539 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
540 "BFD_RELOC_MICROBLAZE_COPY",
541+ "BFD_RELOC_MICROBLAZE_64",
542+ "BFD_RELOC_MICROBLAZE_64_PCREL",
543 "BFD_RELOC_MICROBLAZE_64_TLS",
544 "BFD_RELOC_MICROBLAZE_64_TLSGD",
545 "BFD_RELOC_MICROBLAZE_64_TLSLD",
546diff --git a/bfd/reloc.c b/bfd/reloc.c
547index e74cbd75e96..fda67e5ffda 100644
548--- a/bfd/reloc.c
549+++ b/bfd/reloc.c
550@@ -6665,6 +6665,12 @@ ENUMDOC
551 This is a 32 bit reloc that stores the 32 bit pc relative value in
552 two words (with an imm instruction). No relocation is done here -
553 only used for relaxing.
554+ENUM
555+ BFD_RELOC_MICROBLAZE_32_NONE
556+ENUMDOC
557+ This is a 32 bit reloc that stores the 32 bit pc relative
558+ value in two words (with an imm instruction). No relocation is
559+ done here - only used for relaxing
560 ENUM
561 BFD_RELOC_MICROBLAZE_64_NONE
562 ENUMDOC
563@@ -7886,6 +7892,20 @@ ENUMX
564 ENUMDOC
565 Tilera TILE-Gx Relocations.
566
567+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
568+ to two words (uses imml instruction).
569+ENUM
570+BFD_RELOC_MICROBLAZE_64,
571+ENUMDOC
572+ This is a 64 bit reloc that stores the 64 bit pc relative
573+ value in two words (with an imml instruction). No relocation is
574+ done here - only used for relaxing
575+ENUM
576+BFD_RELOC_MICROBLAZE_64_PCREL,
577+ENUMDOC
578+ This is a 32 bit reloc that stores the 32 bit pc relative
579+ value in two words (with an imml instruction). No relocation is
580+ done here - only used for relaxing
581 ENUM
582 BFD_RELOC_BPF_64
583 ENUMX
584diff --git a/bfd/targets.c b/bfd/targets.c
585index 3addf2fe373..a9a9b975c82 100644
586--- a/bfd/targets.c
587+++ b/bfd/targets.c
588@@ -799,6 +799,8 @@ extern const bfd_target mep_elf32_le_vec;
589 extern const bfd_target metag_elf32_vec;
590 extern const bfd_target microblaze_elf32_vec;
591 extern const bfd_target microblaze_elf32_le_vec;
592+extern const bfd_target microblaze_elf64_vec;
593+extern const bfd_target microblaze_elf64_le_vec;
594 extern const bfd_target mips_ecoff_be_vec;
595 extern const bfd_target mips_ecoff_le_vec;
596 extern const bfd_target mips_ecoff_bele_vec;
597@@ -1167,6 +1169,10 @@ static const bfd_target * const _bfd_target_vector[] =
598
599 &metag_elf32_vec,
600
601+#ifdef BFD64
602+ &microblaze_elf64_vec,
603+ &microblaze_elf64_le_vec,
604+#endif
605 &microblaze_elf32_vec,
606
607 &mips_ecoff_be_vec,
608diff --git a/gdb/features/Makefile b/gdb/features/Makefile
609index 8ac30d8cea3..690f1e94570 100644
610--- a/gdb/features/Makefile
611+++ b/gdb/features/Makefile
612@@ -102,7 +102,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
613 # to make on the command line.
614 XMLTOC = \
615 microblaze-with-stack-protect.xml \
616+ microblaze64-with-stack-protect.xml \
617 microblaze.xml \
618+ microblaze64.xml \
619 mips-dsp-linux.xml \
620 mips-linux.xml \
621 mips64-dsp-linux.xml \
622diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
623index d1d7d538461..4d77d9d898f 100644
624--- a/gdb/features/microblaze-core.xml
625+++ b/gdb/features/microblaze-core.xml
626@@ -8,7 +8,7 @@
627 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
628 <feature name="org.gnu.gdb.microblaze.core">
629 <reg name="r0" bitsize="32" regnum="0"/>
630- <reg name="r1" bitsize="32" type="data_ptr"/>
631+ <reg name="r1" bitsize="32"/>
632 <reg name="r2" bitsize="32"/>
633 <reg name="r3" bitsize="32"/>
634 <reg name="r4" bitsize="32"/>
635@@ -39,7 +39,7 @@
636 <reg name="r29" bitsize="32"/>
637 <reg name="r30" bitsize="32"/>
638 <reg name="r31" bitsize="32"/>
639- <reg name="rpc" bitsize="32" type="code_ptr"/>
640+ <reg name="rpc" bitsize="32"/>
641 <reg name="rmsr" bitsize="32"/>
642 <reg name="rear" bitsize="32"/>
643 <reg name="resr" bitsize="32"/>
644@@ -64,4 +64,6 @@
645 <reg name="rtlbsx" bitsize="32"/>
646 <reg name="rtlblo" bitsize="32"/>
647 <reg name="rtlbhi" bitsize="32"/>
648+ <reg name="slr" bitsize="32"/>
649+ <reg name="shr" bitsize="32"/>
650 </feature>
651diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
652index b5f68403bd5..013240ce798 100644
653--- a/gdb/features/microblaze-stack-protect.xml
654+++ b/gdb/features/microblaze-stack-protect.xml
655@@ -7,6 +7,6 @@
656
657 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
658 <feature name="org.gnu.gdb.microblaze.stack-protect">
659- <reg name="rslr" bitsize="32"/>
660- <reg name="rshr" bitsize="32"/>
661+ <reg name="slr" bitsize="32"/>
662+ <reg name="shr" bitsize="32"/>
663 </feature>
664diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
665index 574dc02db67..8ab9565a047 100644
666--- a/gdb/features/microblaze-with-stack-protect.c
667+++ b/gdb/features/microblaze-with-stack-protect.c
668@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
669
670 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
671 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
672- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
673+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
674 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
675 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
676 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
677@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
678 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
679 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
680 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
681- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
682+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
683 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
684 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
685 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
686@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
687 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
688
689 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
690- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
691- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
692+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
693+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
694
695 tdesc_microblaze_with_stack_protect = result.release ();
696 }
697diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
698index 8f1fb0a142f..ed12e5bcfd2 100644
699--- a/gdb/features/microblaze.c
700+++ b/gdb/features/microblaze.c
701@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
702
703 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
704 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
705- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
706+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
707 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
708 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
709 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
710@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
711 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
712 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
713 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
714- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
715+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
716 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
717 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
718 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
719@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
720 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
721 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
722 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
723+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
724+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
725
726 tdesc_microblaze = result.release ();
727 }
728diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
729new file mode 100644
730index 00000000000..96e99e2fb24
731--- /dev/null
732+++ b/gdb/features/microblaze64-core.xml
733@@ -0,0 +1,69 @@
734+<?xml version="1.0"?>
735+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
736+
737+ Copying and distribution of this file, with or without modification,
738+ are permitted in any medium without royalty provided the copyright
739+ notice and this notice are preserved. -->
740+
741+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
742+<feature name="org.gnu.gdb.microblaze64.core">
743+ <reg name="r0" bitsize="64" regnum="0"/>
744+ <reg name="r1" bitsize="64"/>
745+ <reg name="r2" bitsize="64"/>
746+ <reg name="r3" bitsize="64"/>
747+ <reg name="r4" bitsize="64"/>
748+ <reg name="r5" bitsize="64"/>
749+ <reg name="r6" bitsize="64"/>
750+ <reg name="r7" bitsize="64"/>
751+ <reg name="r8" bitsize="64"/>
752+ <reg name="r9" bitsize="64"/>
753+ <reg name="r10" bitsize="64"/>
754+ <reg name="r11" bitsize="64"/>
755+ <reg name="r12" bitsize="64"/>
756+ <reg name="r13" bitsize="64"/>
757+ <reg name="r14" bitsize="64"/>
758+ <reg name="r15" bitsize="64"/>
759+ <reg name="r16" bitsize="64"/>
760+ <reg name="r17" bitsize="64"/>
761+ <reg name="r18" bitsize="64"/>
762+ <reg name="r19" bitsize="64"/>
763+ <reg name="r20" bitsize="64"/>
764+ <reg name="r21" bitsize="64"/>
765+ <reg name="r22" bitsize="64"/>
766+ <reg name="r23" bitsize="64"/>
767+ <reg name="r24" bitsize="64"/>
768+ <reg name="r25" bitsize="64"/>
769+ <reg name="r26" bitsize="64"/>
770+ <reg name="r27" bitsize="64"/>
771+ <reg name="r28" bitsize="64"/>
772+ <reg name="r29" bitsize="64"/>
773+ <reg name="r30" bitsize="64"/>
774+ <reg name="r31" bitsize="64"/>
775+ <reg name="rpc" bitsize="64"/>
776+ <reg name="rmsr" bitsize="32"/>
777+ <reg name="rear" bitsize="64"/>
778+ <reg name="resr" bitsize="32"/>
779+ <reg name="rfsr" bitsize="32"/>
780+ <reg name="rbtr" bitsize="64"/>
781+ <reg name="rpvr0" bitsize="32"/>
782+ <reg name="rpvr1" bitsize="32"/>
783+ <reg name="rpvr2" bitsize="32"/>
784+ <reg name="rpvr3" bitsize="32"/>
785+ <reg name="rpvr4" bitsize="32"/>
786+ <reg name="rpvr5" bitsize="32"/>
787+ <reg name="rpvr6" bitsize="32"/>
788+ <reg name="rpvr7" bitsize="32"/>
789+ <reg name="rpvr8" bitsize="64"/>
790+ <reg name="rpvr9" bitsize="64"/>
791+ <reg name="rpvr10" bitsize="32"/>
792+ <reg name="rpvr11" bitsize="32"/>
793+ <reg name="redr" bitsize="32"/>
794+ <reg name="rpid" bitsize="32"/>
795+ <reg name="rzpr" bitsize="32"/>
796+ <reg name="rtlbx" bitsize="32"/>
797+ <reg name="rtlbsx" bitsize="32"/>
798+ <reg name="rtlblo" bitsize="32"/>
799+ <reg name="rtlbhi" bitsize="32"/>
800+ <reg name="slr" bitsize="64"/>
801+ <reg name="shr" bitsize="64"/>
802+</feature>
803diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
804new file mode 100644
805index 00000000000..1bbf5fc3cea
806--- /dev/null
807+++ b/gdb/features/microblaze64-stack-protect.xml
808@@ -0,0 +1,12 @@
809+<?xml version="1.0"?>
810+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
811+
812+ Copying and distribution of this file, with or without modification,
813+ are permitted in any medium without royalty provided the copyright
814+ notice and this notice are preserved. -->
815+
816+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
817+<feature name="org.gnu.gdb.microblaze64.stack-protect">
818+ <reg name="slr" bitsize="64"/>
819+ <reg name="shr" bitsize="64"/>
820+</feature>
821diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
822new file mode 100644
823index 00000000000..a4de4666c76
824--- /dev/null
825+++ b/gdb/features/microblaze64-with-stack-protect.c
826@@ -0,0 +1,79 @@
827+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
828+ Original: microblaze-with-stack-protect.xml */
829+
830+#include "defs.h"
831+#include "osabi.h"
832+#include "target-descriptions.h"
833+
834+struct target_desc *tdesc_microblaze64_with_stack_protect;
835+static void
836+initialize_tdesc_microblaze64_with_stack_protect (void)
837+{
838+ target_desc_up result = allocate_target_description ();
839+ struct tdesc_feature *feature;
840+
841+ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core");
842+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
843+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
844+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
845+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
846+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
847+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
848+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
849+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
850+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
851+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
852+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
853+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
854+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
855+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
856+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
857+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
858+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
859+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
860+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
861+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
862+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
863+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
864+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
865+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
866+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
867+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
868+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
869+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
870+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
871+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
872+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
873+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
874+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
875+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
876+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
877+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
878+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
879+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
880+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
881+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
882+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
883+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
884+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
885+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
886+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
887+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
888+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
889+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
890+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
891+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
892+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
893+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
894+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
895+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
896+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
897+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
898+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
899+
900+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect");
901+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
902+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
903+
904+ tdesc_microblaze64_with_stack_protect = result.release();
905+}
906diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
907new file mode 100644
908index 00000000000..0e9f01611f3
909--- /dev/null
910+++ b/gdb/features/microblaze64-with-stack-protect.xml
911@@ -0,0 +1,12 @@
912+<?xml version="1.0"?>
913+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
914+
915+ Copying and distribution of this file, with or without modification,
916+ are permitted in any medium without royalty provided the copyright
917+ notice and this notice are preserved. -->
918+
919+<!DOCTYPE target SYSTEM "gdb-target.dtd">
920+<target>
921+ <xi:include href="microblaze64-core.xml"/>
922+ <xi:include href="microblaze64-stack-protect.xml"/>
923+</target>
924diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
925new file mode 100644
926index 00000000000..8ab7a90dd95
927--- /dev/null
928+++ b/gdb/features/microblaze64.c
929@@ -0,0 +1,77 @@
930+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
931+ Original: microblaze.xml */
932+
933+#include "defs.h"
934+#include "osabi.h"
935+#include "target-descriptions.h"
936+
937+struct target_desc *tdesc_microblaze64;
938+static void
939+initialize_tdesc_microblaze64 (void)
940+{
941+ target_desc_up result = allocate_target_description ();
942+ struct tdesc_feature *feature;
943+
944+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core");
945+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
946+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
947+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
948+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
949+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
950+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
951+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
952+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
953+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
954+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
955+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
956+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
957+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
958+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
959+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
960+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
961+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
962+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
963+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
964+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
965+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
966+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
967+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
968+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
969+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
970+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
971+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
972+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
973+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
974+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
975+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
976+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
977+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
978+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
979+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
980+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
981+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
982+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
983+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
984+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
985+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
986+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
987+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
988+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
989+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
990+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
991+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
992+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
993+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
994+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
995+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
996+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
997+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
998+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
999+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
1000+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
1001+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
1002+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
1003+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
1004+
1005+ tdesc_microblaze64 = result.release();
1006+}
1007diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
1008new file mode 100644
1009index 00000000000..515d18e65cf
1010--- /dev/null
1011+++ b/gdb/features/microblaze64.xml
1012@@ -0,0 +1,11 @@
1013+<?xml version="1.0"?>
1014+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
1015+
1016+ Copying and distribution of this file, with or without modification,
1017+ are permitted in any medium without royalty provided the copyright
1018+ notice and this notice are preserved. -->
1019+
1020+<!DOCTYPE target SYSTEM "gdb-target.dtd">
1021+<target>
1022+ <xi:include href="microblaze64-core.xml"/>
1023+</target>
1024diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
1025index d086debc4f8..f34b0fa9fd4 100644
1026--- a/gdb/microblaze-linux-tdep.c
1027+++ b/gdb/microblaze-linux-tdep.c
1028@@ -40,6 +40,7 @@
1029 #include "features/microblaze-linux.c"
1030
1031 static int microblaze_debug_flag = 0;
1032+int MICROBLAZE_REGISTER_SIZE=4;
1033
1034 static void
1035 microblaze_debug (const char *fmt, ...)
1036@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...)
1037 }
1038 }
1039
1040+#if 0
1041 static int
1042 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1043 struct bp_target_info *bp_tgt)
1044@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1045 return val;
1046 }
1047
1048+#endif
1049+
1050 static void
1051 microblaze_linux_sigtramp_cache (frame_info_ptr next_frame,
1052 struct trad_frame_cache *this_cache,
1053@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1054
1055 linux_init_abi (info, gdbarch, 0);
1056
1057- set_gdbarch_memory_remove_breakpoint (gdbarch,
1058- microblaze_linux_memory_remove_breakpoint);
1059+ // set_gdbarch_memory_remove_breakpoint (gdbarch,
1060+ // microblaze_linux_memory_remove_breakpoint);
1061
1062 /* Shared library handling. */
1063 set_solib_svr4_fetch_link_map_offsets (gdbarch,
1064@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1065
1066 /* BFD target for core files. */
1067 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
1068- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1069+ {
1070+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1071+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
1072+ MICROBLAZE_REGISTER_SIZE=8;
1073+ }
1074+ else
1075+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1076+ }
1077 else
1078- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1079+ {
1080+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1081+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
1082+ MICROBLAZE_REGISTER_SIZE=8;
1083+ }
1084+ else
1085+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1086+ }
1087
1088+ switch (info.bfd_arch_info->mach)
1089+ {
1090+ case bfd_mach_microblaze64:
1091+ set_gdbarch_ptr_bit (gdbarch, 64);
1092+ break;
1093+ }
1094
1095 /* Shared library handling. */
1096 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
1097@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep ();
1098 void
1099 _initialize_microblaze_linux_tdep ()
1100 {
1101- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
1102+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
1103+ microblaze_linux_init_abi);
1104+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
1105 microblaze_linux_init_abi);
1106 initialize_tdesc_microblaze_linux ();
1107 }
1108diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
1109index b0b4c1b2614..7cbbc8986a1 100644
1110--- a/gdb/microblaze-tdep.c
1111+++ b/gdb/microblaze-tdep.c
1112@@ -40,7 +40,9 @@
1113 #include "remote.h"
1114
1115 #include "features/microblaze-with-stack-protect.c"
1116+#include "features/microblaze64-with-stack-protect.c"
1117 #include "features/microblaze.c"
1118+#include "features/microblaze64.c"
1119
1120 /* Instruction macros used for analyzing the prologue. */
1121 /* This set of instruction macros need to be changed whenever the
1122@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] =
1123 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
1124 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
1125 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
1126- "rslr", "rshr"
1127+ "slr", "shr"
1128 };
1129
1130 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
1131
1132 static unsigned int microblaze_debug_flag = 0;
1133+int reg_size = 4;
1134
1135 #define microblaze_debug(fmt, ...) \
1136 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
1137@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
1138 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
1139
1140 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
1141+static CORE_ADDR
1142+microblaze_store_arguments (struct regcache *regcache, int nargs,
1143+ struct value **args, CORE_ADDR sp,
1144+ int struct_return, CORE_ADDR struct_addr)
1145+{
1146+ error (_("store_arguments not implemented"));
1147+ return sp;
1148+}
1149+#if 0
1150 static int
1151 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1152 struct bp_target_info *bp_tgt)
1153@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1154 /* Make sure we see the memory breakpoints. */
1155 scoped_restore restore_memory
1156 = make_scoped_restore_show_memory_breakpoints (1);
1157-
1158 val = target_read_memory (addr, old_contents, bplen);
1159
1160 /* If our breakpoint is no longer at the address, this means that the
1161@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1162 return val;
1163 }
1164
1165+#endif
1166 /* Allocate and initialize a frame cache. */
1167
1168 static struct microblaze_frame_cache *
1169@@ -583,11 +595,11 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
1170 {
1171 case 1: /* return last byte in the register. */
1172 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1173- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
1174+ memcpy(valbuf, buf + reg_size - 1, 1);
1175 return;
1176 case 2: /* return last 2 bytes in register. */
1177 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1178- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
1179+ memcpy(valbuf, buf + reg_size - 2, 2);
1180 return;
1181 case 4: /* for sizes 4 or 8, copy the required length. */
1182 case 8:
1183@@ -753,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache)
1184 }
1185 #endif
1186
1187+static void
1188+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
1189+{
1190+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
1191+}
1192+
1193 static int dwarf2_to_reg_map[78] =
1194 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
1195 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
1196@@ -787,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
1197 static void
1198 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
1199 {
1200+
1201 register_remote_g_packet_guess (gdbarch,
1202 4 * MICROBLAZE_NUM_CORE_REGS,
1203- tdesc_microblaze);
1204+ tdesc_microblaze64);
1205
1206 register_remote_g_packet_guess (gdbarch,
1207 4 * MICROBLAZE_NUM_REGS,
1208- tdesc_microblaze_with_stack_protect);
1209+ tdesc_microblaze64_with_stack_protect);
1210 }
1211
1212 void
1213@@ -801,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset,
1214 struct regcache *regcache,
1215 int regnum, const void *gregs)
1216 {
1217- const unsigned int *regs = (const unsigned int *)gregs;
1218+ const gdb_byte *regs = (const gdb_byte *) gregs;
1219 if (regnum >= 0)
1220 regcache->raw_supply (regnum, regs + regnum);
1221
1222@@ -809,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset,
1223 int i;
1224
1225 for (i = 0; i < 50; i++) {
1226- regcache->raw_supply (i, regs + i);
1227+ regcache->raw_supply (regnum, regs + i);
1228 }
1229 }
1230 }
1231@@ -832,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
1232 }
1233
1234
1235+static void
1236+make_regs (struct gdbarch *arch)
1237+{
1238+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
1239+ int mach = gdbarch_bfd_arch_info (arch)->mach;
1240+
1241+ if (mach == bfd_mach_microblaze64)
1242+ {
1243+ set_gdbarch_ptr_bit (arch, 64);
1244+ }
1245+}
1246
1247 static struct gdbarch *
1248 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1249@@ -844,8 +874,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1250 if (arches != NULL)
1251 return arches->gdbarch;
1252 if (tdesc == NULL)
1253- tdesc = tdesc_microblaze;
1254-
1255+ {
1256+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1257+ {
1258+ tdesc = tdesc_microblaze64;
1259+ reg_size = 8;
1260+ }
1261+ else
1262+ tdesc = tdesc_microblaze;
1263+ }
1264 /* Check any target description for validity. */
1265 if (tdesc_has_registers (tdesc))
1266 {
1267@@ -853,31 +890,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1268 int valid_p;
1269 int i;
1270
1271- feature = tdesc_find_feature (tdesc,
1272- "org.gnu.gdb.microblaze.core");
1273+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1274+ feature = tdesc_find_feature (tdesc,
1275+ "org.gnu.gdb.microblaze64.core");
1276+ else
1277+ feature = tdesc_find_feature (tdesc,
1278+ "org.gnu.gdb.microblaze.core");
1279 if (feature == NULL)
1280 return NULL;
1281 tdesc_data = tdesc_data_alloc ();
1282
1283 valid_p = 1;
1284- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
1285- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
1286- microblaze_register_names[i]);
1287- feature = tdesc_find_feature (tdesc,
1288- "org.gnu.gdb.microblaze.stack-protect");
1289+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
1290+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
1291+ microblaze_register_names[i]);
1292+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1293+ feature = tdesc_find_feature (tdesc,
1294+ "org.gnu.gdb.microblaze64.stack-protect");
1295+ else
1296+ feature = tdesc_find_feature (tdesc,
1297+ "org.gnu.gdb.microblaze.stack-protect");
1298 if (feature != NULL)
1299- {
1300- valid_p = 1;
1301- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1302- MICROBLAZE_SLR_REGNUM,
1303- "rslr");
1304- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1305- MICROBLAZE_SHR_REGNUM,
1306- "rshr");
1307- }
1308+ {
1309+ valid_p = 1;
1310+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1311+ MICROBLAZE_SLR_REGNUM,
1312+ "slr");
1313+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1314+ MICROBLAZE_SHR_REGNUM,
1315+ "shr");
1316+ }
1317
1318 if (!valid_p)
1319- return NULL;
1320+ {
1321+ // tdesc_data_cleanup (tdesc_data.get ());
1322+ return NULL;
1323+ }
1324 }
1325
1326 /* Allocate space for the new architecture. */
1327@@ -897,7 +945,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1328 /* Register numbers of various important registers. */
1329 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
1330 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
1331+
1332+ /* Register set.
1333+ make_regs (gdbarch); */
1334+ switch (info.bfd_arch_info->mach)
1335+ {
1336+ case bfd_mach_microblaze64:
1337+ set_gdbarch_ptr_bit (gdbarch, 64);
1338+ break;
1339+ }
1340
1341+
1342 /* Map Dwarf2 registers to GDB registers. */
1343 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
1344
1345@@ -917,7 +975,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1346 microblaze_breakpoint::kind_from_pc);
1347 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1348 microblaze_breakpoint::bp_from_kind);
1349- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1350+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1351+
1352+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1353
1354 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1355
1356@@ -925,7 +985,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1357
1358 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
1359
1360- microblaze_register_g_packet_guesses (gdbarch);
1361+ //microblaze_register_g_packet_guesses (gdbarch);
1362
1363 frame_base_set_default (gdbarch, &microblaze_frame_base);
1364
1365@@ -940,12 +1000,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1366 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
1367 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
1368
1369- /* If we have register sets, enable the generic core file support. */
1370+ /* If we have register sets, enable the generic core file support.
1371 if (tdep->gregset) {
1372 set_gdbarch_iterate_over_regset_sections (gdbarch,
1373 microblaze_iterate_over_regset_sections);
1374- }
1375-
1376+ }*/
1377 return gdbarch;
1378 }
1379
1380@@ -957,6 +1016,8 @@ _initialize_microblaze_tdep ()
1381
1382 initialize_tdesc_microblaze_with_stack_protect ();
1383 initialize_tdesc_microblaze ();
1384+ initialize_tdesc_microblaze64_with_stack_protect ();
1385+ initialize_tdesc_microblaze64 ();
1386 /* Debug this files internals. */
1387 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
1388 &microblaze_debug_flag, _("\
1389diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1390index c4c8098308f..81f7f30cb8e 100644
1391--- a/gdb/microblaze-tdep.h
1392+++ b/gdb/microblaze-tdep.h
1393@@ -28,7 +28,7 @@ struct microblaze_gregset
1394 microblaze_gregset() {}
1395 unsigned int gregs[32];
1396 unsigned int fpregs[32];
1397- unsigned int pregs[16];
1398+ unsigned int pregs[18];
1399 };
1400
1401 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
1402@@ -134,7 +134,7 @@ struct microblaze_frame_cache
1403 struct trad_frame_saved_reg *saved_regs;
1404 };
1405 /* All registers are 32 bits. */
1406-#define MICROBLAZE_REGISTER_SIZE 4
1407+//#define MICROBLAZE_REGISTER_SIZE 8
1408
1409 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1410 Only used for native debugging. */
1411diff --git a/include/elf/common.h b/include/elf/common.h
1412index 6a66456cd22..11f5d1a3cc9 100644
1413--- a/include/elf/common.h
1414+++ b/include/elf/common.h
1415@@ -360,6 +360,7 @@
1416 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
1417 #define EM_TACHYUM 261 /* Tachyum */
1418 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
1419+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
1420
1421 /* If it is necessary to assign new unofficial EM_* values, please pick large
1422 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
1423diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
1424index a48b1358efd..c515f15bfb8 100644
1425--- a/include/elf/microblaze.h
1426+++ b/include/elf/microblaze.h
1427@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
1428 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
1429 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
1430 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
1431+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
1432+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
1433 END_RELOC_NUMBERS (R_MICROBLAZE_max)
1434
1435 /* Global base address names. */
1436diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
1437index 3d696325803..ee447cecc3f 100644
1438--- a/opcodes/microblaze-dis.c
1439+++ b/opcodes/microblaze-dis.c
1440@@ -33,6 +33,7 @@
1441 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
1442 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
1443 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
1444+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
1445 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
1446
1447 #define NUM_STRBUFS 4
1448@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
1449 }
1450
1451 static char *
1452-get_field_imm5 (struct string_buf *buf, long instr)
1453+get_field_imml (struct string_buf *buf, long instr)
1454 {
1455 char *p = strbuf (buf);
1456
1457- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
1458+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
1459+ return p;
1460+}
1461+
1462+static char *
1463+get_field_imms (struct string_buf *buf, long instr)
1464+{
1465+ char *p = strbuf (buf);
1466+
1467+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
1468 return p;
1469 }
1470
1471@@ -96,12 +106,9 @@ get_field_immw (struct string_buf *buf, long instr)
1472 char *p = strbuf (buf);
1473
1474 if (instr & 0x00004000)
1475- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK)
1476- >> IMM_WIDTH_LOW))); /* bsefi */
1477- else
1478- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >>
1479- IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >>
1480- IMM_LOW) + 1)); /* bsifi */
1481+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
1482+ else
1483+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
1484 return p;
1485 }
1486
1487@@ -311,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1488 }
1489 }
1490 break;
1491- case INST_TYPE_RD_R1_IMM5:
1492+ case INST_TYPE_RD_R1_IMML:
1493+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1494+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
1495+ /* TODO: Also print symbol */
1496+ break;
1497+ case INST_TYPE_RD_R1_IMMS:
1498 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1499- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
1500+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
1501 break;
1502 case INST_TYPE_RD_RFSL:
1503 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1504@@ -417,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1505 }
1506 }
1507 break;
1508- case INST_TYPE_RD_R2:
1509- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1510- get_field_r2 (&buf, inst));
1511+ case INST_TYPE_IMML:
1512+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
1513+ /* TODO: Also print symbol */
1514+ break;
1515+ case INST_TYPE_RD_R2:
1516+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
1517 break;
1518 case INST_TYPE_R2:
1519 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
1520@@ -442,15 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1521 /* For mbar 16 or sleep insn. */
1522 case INST_TYPE_NONE:
1523 break;
1524- /* For bit field insns. */
1525+ /* For bit field insns. */
1526 case INST_TYPE_RD_R1_IMMW_IMMS:
1527- print_func (stream, "\t%s, %s, %s, %s",
1528- get_field_rd (&buf, inst),
1529- get_field_r1 (&buf, inst),
1530- get_field_immw (&buf, inst),
1531- get_field_imm5 (&buf, inst));
1532+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
1533+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
1534 break;
1535- /* For tuqula instruction */
1536+ /* For tuqula instruction */
1537 case INST_TYPE_RD:
1538 print_func (stream, "\t%s", get_field_rd (&buf, inst));
1539 break;
1540diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
1541index fe23b0af56a..afc1220e357 100644
1542--- a/opcodes/microblaze-opc.h
1543+++ b/opcodes/microblaze-opc.h
1544@@ -40,7 +40,7 @@
1545 #define INST_TYPE_RD_SPECIAL 11
1546 #define INST_TYPE_R1 12
1547 /* New instn type for barrel shift imms. */
1548-#define INST_TYPE_RD_R1_IMM5 13
1549+#define INST_TYPE_RD_R1_IMMS 13
1550 #define INST_TYPE_RD_RFSL 14
1551 #define INST_TYPE_R1_RFSL 15
1552
1553@@ -62,6 +62,11 @@
1554 /* For bsefi and bsifi */
1555 #define INST_TYPE_RD_R1_IMMW_IMMS 21
1556
1557+/* For 64-bit instructions */
1558+#define INST_TYPE_IMML 22
1559+#define INST_TYPE_RD_R1_IMML 23
1560+#define INST_TYPE_R1_IMML 24
1561+
1562 #define INST_TYPE_NONE 25
1563
1564
1565@@ -91,15 +96,14 @@
1566 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
1567 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
1568 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
1569-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
1570-#define OPCODE_MASK_H3B 0xFC00F9E0 /* High 6 bits and bits 16:20 and
1571- bits 23:26. */
1572+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
1573+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
1574 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
1575-#define OPCODE_MASK_H32B 0xFC00F820 /* High 6 bits and bits 16:20 and
1576- bit 26 */
1577+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
1578 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
1579 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
1580 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
1581+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
1582
1583 /* New Mask for msrset, msrclr insns. */
1584 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
1585@@ -109,7 +113,7 @@
1586 #define DELAY_SLOT 1
1587 #define NO_DELAY_SLOT 0
1588
1589-#define MAX_OPCODES 291
1590+#define MAX_OPCODES 412
1591
1592 const struct op_code_struct
1593 {
1594@@ -127,6 +131,7 @@ const struct op_code_struct
1595 /* More info about output format here. */
1596 } microblaze_opcodes[MAX_OPCODES] =
1597 {
1598+ /* 32-bit instructions */
1599 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
1600 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
1601 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
1602@@ -163,9 +168,9 @@ const struct op_code_struct
1603 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
1604 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
1605 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
1606- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
1607- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
1608- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
1609+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
1610+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
1611+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
1612 {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
1613 {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
1614 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
1615@@ -269,9 +274,7 @@ const struct op_code_struct
1616 {"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. */
1617 {"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. */
1618 {"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. */
1619- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1620 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
1621- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1622 {"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 },
1623 {"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 },
1624 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
1625@@ -427,7 +430,131 @@ const struct op_code_struct
1626 {"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. */
1627 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
1628 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
1629- {NULL, 0, 0, 0, 0, 0, 0, 0, 0},
1630+ /* 64-bit instructions */
1631+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
1632+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
1633+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
1634+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
1635+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
1636+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
1637+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
1638+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
1639+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
1640+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
1641+ {"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 */
1642+ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1643+ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1644+ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1645+ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1646+ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1647+ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1648+ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1649+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
1650+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
1651+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
1652+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
1653+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
1654+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
1655+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
1656+ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst },
1657+ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst },
1658+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
1659+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
1660+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
1661+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
1662+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
1663+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
1664+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
1665+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
1666+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
1667+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
1668+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
1669+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
1670+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
1671+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
1672+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
1673+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
1674+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
1675+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
1676+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
1677+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
1678+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
1679+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
1680+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
1681+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
1682+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
1683+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
1684+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
1685+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
1686+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
1687+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
1688+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
1689+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
1690+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
1691+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
1692+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
1693+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
1694+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
1695+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
1696+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
1697+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
1698+ {"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 */
1699+ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1700+ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1701+ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1702+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
1703+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
1704+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
1705+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
1706+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
1707+ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */
1708+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
1709+ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */
1710+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
1711+ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */
1712+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
1713+ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */
1714+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
1715+ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */
1716+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
1717+ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */
1718+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
1719+ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */
1720+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
1721+ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */
1722+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
1723+ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */
1724+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
1725+ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */
1726+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
1727+ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */
1728+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
1729+ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */
1730+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
1731+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
1732+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
1733+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
1734+ {"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 */
1735+ {"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 */
1736+ {"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 */
1737+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
1738+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
1739+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
1740+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
1741+ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst },
1742+ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst },
1743+ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst },
1744+ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst },
1745+ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst },
1746+ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst },
1747+ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst },
1748+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
1749+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
1750+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
1751+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1752+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1753+
1754+ {"", 0, 0, 0, 0, 0, 0, 0, 0},
1755 };
1756
1757 /* Prefix for register names. */
1758@@ -447,8 +574,17 @@ char pvr_register_prefix[] = "rpvr";
1759 #define MIN_IMM5 ((int) 0x00000000)
1760 #define MAX_IMM5 ((int) 0x0000001f)
1761
1762+#define MIN_IMM6 ((int) 0x00000000)
1763+#define MAX_IMM6 ((int) 0x0000003f)
1764+
1765 #define MIN_IMM_WIDTH ((int) 0x00000001)
1766 #define MAX_IMM_WIDTH ((int) 0x00000020)
1767
1768+#define MIN_IMM6_WIDTH ((int) 0x00000001)
1769+#define MAX_IMM6_WIDTH ((int) 0x00000040)
1770+
1771+#define MIN_IMML ((long) 0xffffff8000000000L)
1772+#define MAX_IMML ((long) 0x0000007fffffffffL)
1773+
1774 #endif /* MICROBLAZE_OPC */
1775
1776diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
1777index cb8d3a59949..08ed44352ee 100644
1778--- a/opcodes/microblaze-opcm.h
1779+++ b/opcodes/microblaze-opcm.h
1780@@ -25,6 +25,7 @@
1781
1782 enum microblaze_instr
1783 {
1784+ /* 32-bit instructions */
1785 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
1786 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
1787 mulh, mulhu, mulhsu, swapb, swaph,
1788@@ -39,8 +40,8 @@ enum microblaze_instr
1789 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
1790 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
1791 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
1792- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
1793- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1794+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
1795+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1796 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
1797 /* 'fsqrt' is a glibc:math.h symbol. */
1798 fint, microblaze_fsqrt,
1799@@ -59,6 +60,18 @@ enum microblaze_instr
1800 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
1801 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
1802 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
1803+
1804+ /* 64-bit instructions */
1805+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
1806+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
1807+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
1808+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
1809+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
1810+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
1811+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
1812+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
1813+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
1814+ dcmp_un, dbl, dlong, dsqrt,
1815 invalid_inst
1816 };
1817
1818@@ -136,15 +149,18 @@ enum microblaze_instr_type
1819 #define RA_MASK 0x001F0000
1820 #define RB_MASK 0x0000F800
1821 #define IMM_MASK 0x0000FFFF
1822+#define IMML_MASK 0x00FFFFFF
1823
1824-/* Imm mask for barrel shifts. */
1825+/* Imm masks for barrel shifts. */
1826 #define IMM5_MASK 0x0000001F
1827+#define IMM6_MASK 0x0000003F
1828
1829 /* Imm mask for mbar. */
1830 #define IMM5_MBAR_MASK 0x03E00000
1831
1832-/* Imm mask for extract/insert width. */
1833+/* Imm masks for extract/insert width. */
1834 #define IMM5_WIDTH_MASK 0x000007C0
1835+#define IMM6_WIDTH_MASK 0x00000FC0
1836
1837 /* FSL imm mask for get, put instructions. */
1838 #define RFSL_MASK 0x000000F
1839--
18402.34.1
1841
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
index 9d12cc53..a744bcb4 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
@@ -1,23 +1,20 @@
1From ef411b49f3b2c9e4048eb273f43ab4ee96f96b7e Mon Sep 17 00:00:00 2001 1From 6c699df5c33f13ea3226d144f544d5a295edcf17 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 19 Apr 2021 14:33:27 +0530 3Date: Mon, 19 Apr 2021 14:33:27 +0530
4Subject: [PATCH 6/8] [Patch,MicroBlaze] : these changes will make 64 bit 4Subject: [PATCH 07/53] these changes will make 64 bit vectors as default
5 vectors as default target types when we built gdb with microblaze 64 bit type 5 target types when we built gdb with microblaze 64 bit type targets,for
6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64 6 instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7
8Upstream-Status: Pending
9
10Signed-off-by: Mark Hatle <mark.hatle@amd.com>
11 7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
12--- 9---
13 bfd/config.bfd | 8 ++++++++ 10 bfd/config.bfd | 8 ++++++++
14 1 file changed, 8 insertions(+) 11 1 file changed, 8 insertions(+)
15 12
16diff --git a/bfd/config.bfd b/bfd/config.bfd 13diff --git a/bfd/config.bfd b/bfd/config.bfd
17index 5e9ba3d9805..deb3d078439 100644 14index cbba305354f..f7134608693 100644
18--- a/bfd/config.bfd 15--- a/bfd/config.bfd
19+++ b/bfd/config.bfd 16+++ b/bfd/config.bfd
20@@ -856,7 +856,15 @@ case "${targ}" in 17@@ -880,7 +880,15 @@ case "${targ}" in
21 targ_defvec=metag_elf32_vec 18 targ_defvec=metag_elf32_vec
22 targ_underscore=yes 19 targ_underscore=yes
23 ;; 20 ;;
@@ -34,5 +31,5 @@ index 5e9ba3d9805..deb3d078439 100644
34 targ_defvec=microblaze_elf32_le_vec 31 targ_defvec=microblaze_elf32_le_vec
35 targ_selvecs=microblaze_elf32_vec 32 targ_selvecs=microblaze_elf32_vec
36-- 33--
372.37.1 (Apple Git-137.1) 342.34.1
38 35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
index 6eea28fe..10517953 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
@@ -1,591 +1,21 @@
1From 6aadc445a00275c37112e431c6a29f5a331e6e16 Mon Sep 17 00:00:00 2001 1From 815e641399628fcde8e13f925e4a6d3bc565a762 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530 3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 5/8] [Patch, microblaze]: Adding 64 bit MB support Added new 4Subject: [PATCH 08/53] Added m64 abi for 64 bit target descriptions. set m64
5 architecture to Microblaze 64-bit support to GDB Signed-off-by :Nagaraju 5 abi for 64 bit elf.
6 Mekala <nmekala@xilix.com> Signed-off-by :Mahesh Bodapati
7 <mbodapat@xilinx.com>
8 6
9Conflicts: 7Conflicts:
10 gdb/Makefile.in
11
12Conflicts:
13 bfd/cpu-microblaze.c
14 gdb/microblaze-tdep.c 8 gdb/microblaze-tdep.c
15 ld/Makefile.am 9 gdb/microblaze-tdep.h
16 ld/Makefile.in
17 opcodes/microblaze-dis.c
18
19Conflicts:
20 bfd/configure
21 gas/config/tc-microblaze.c
22 ld/Makefile.in
23 opcodes/microblaze-opcm.h
24
25Conflicts:
26 gdb/microblaze-tdep.c
27
28Conflicts:
29 bfd/elf32-microblaze.c
30 gas/config/tc-microblaze.c
31 gdb/features/Makefile
32 gdb/features/microblaze-with-stack-protect.c
33 gdb/microblaze-tdep.c
34 gdb/regformats/microblaze-with-stack-protect.dat
35 gdbserver/linux-microblaze-low.c
36 include/elf/common.h
37Upstream-Status: Pending
38
39Signed-off-by: Mark Hatle <mark.hatle@amd.com>
40 10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
41--- 12---
42 bfd/Makefile.am | 2 + 13 bfd/elf64-microblaze.c | 3810 ++++++++++++++++++++++++++++++++++++++++
43 bfd/Makefile.in | 3 + 14 gdb/microblaze-tdep.c | 160 +-
44 bfd/archures.c | 2 + 15 gdb/microblaze-tdep.h | 13 +-
45 bfd/bfd-in2.h | 31 +- 16 3 files changed, 3975 insertions(+), 8 deletions(-)
46 bfd/config.bfd | 4 +
47 bfd/configure | 2 +
48 bfd/cpu-microblaze.c | 55 +-
49 bfd/elf32-microblaze.c | 162 +-
50 bfd/elf64-microblaze.c | 3810 +++++++++++++++++
51 bfd/libbfd.h | 3 +
52 bfd/reloc.c | 20 +
53 bfd/targets.c | 6 +
54 gdb/features/Makefile | 2 +
55 gdb/features/microblaze-core.xml | 6 +-
56 gdb/features/microblaze-stack-protect.xml | 4 +-
57 gdb/features/microblaze-with-stack-protect.c | 8 +-
58 gdb/features/microblaze.c | 6 +-
59 gdb/features/microblaze64-core.xml | 69 +
60 gdb/features/microblaze64-stack-protect.xml | 12 +
61 .../microblaze64-with-stack-protect.c | 79 +
62 .../microblaze64-with-stack-protect.xml | 12 +
63 gdb/features/microblaze64.c | 77 +
64 gdb/features/microblaze64.xml | 11 +
65 gdb/microblaze-linux-tdep.c | 36 +-
66 gdb/microblaze-tdep.c | 126 +-
67 gdb/microblaze-tdep.h | 4 +-
68 include/elf/common.h | 1 +
69 include/elf/microblaze.h | 4 +
70 opcodes/microblaze-dis.c | 51 +-
71 opcodes/microblaze-opc.h | 180 +-
72 opcodes/microblaze-opcm.h | 36 +-
73 31 files changed, 4729 insertions(+), 95 deletions(-)
74 create mode 100755 bfd/elf64-microblaze.c 17 create mode 100755 bfd/elf64-microblaze.c
75 create mode 100644 gdb/features/microblaze64-core.xml
76 create mode 100644 gdb/features/microblaze64-stack-protect.xml
77 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
78 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
79 create mode 100644 gdb/features/microblaze64.c
80 create mode 100644 gdb/features/microblaze64.xml
81 18
82diff --git a/bfd/Makefile.am b/bfd/Makefile.am
83index b9a3f8207ac..2ddd7891661 100644
84--- a/bfd/Makefile.am
85+++ b/bfd/Makefile.am
86@@ -571,6 +571,7 @@ BFD64_BACKENDS = \
87 elf64-riscv.lo \
88 elfxx-riscv.lo \
89 elf64-s390.lo \
90+ elf64-microblaze.lo \
91 elf64-sparc.lo \
92 elf64-tilegx.lo \
93 elf64-x86-64.lo \
94@@ -608,6 +609,7 @@ BFD64_BACKENDS_CFILES = \
95 elf64-nfp.c \
96 elf64-ppc.c \
97 elf64-s390.c \
98+ elf64-microblaze.c \
99 elf64-sparc.c \
100 elf64-tilegx.c \
101 elf64-x86-64.c \
102diff --git a/bfd/Makefile.in b/bfd/Makefile.in
103index 934dd4bc066..7efb10f111d 100644
104--- a/bfd/Makefile.in
105+++ b/bfd/Makefile.in
106@@ -1040,6 +1040,7 @@ BFD64_BACKENDS = \
107 elf64-riscv.lo \
108 elfxx-riscv.lo \
109 elf64-s390.lo \
110+ elf64-microblaze.lo \
111 elf64-sparc.lo \
112 elf64-tilegx.lo \
113 elf64-x86-64.lo \
114@@ -1077,6 +1078,7 @@ BFD64_BACKENDS_CFILES = \
115 elf64-nfp.c \
116 elf64-ppc.c \
117 elf64-s390.c \
118+ elf64-microblaze.c \
119 elf64-sparc.c \
120 elf64-tilegx.c \
121 elf64-x86-64.c \
122@@ -1664,6 +1666,7 @@ distclean-compile:
123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
125 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
126+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
127 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
128 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
129 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
130diff --git a/bfd/archures.c b/bfd/archures.c
131index fac9fe82a08..1790c741c58 100644
132--- a/bfd/archures.c
133+++ b/bfd/archures.c
134@@ -524,6 +524,8 @@ DESCRIPTION
135 . bfd_arch_lm32, {* Lattice Mico32. *}
136 .#define bfd_mach_lm32 1
137 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
138+.#define bfd_mach_microblaze 1
139+.#define bfd_mach_microblaze64 2
140 . bfd_arch_tilepro, {* Tilera TILEPro. *}
141 . bfd_arch_tilegx, {* Tilera TILE-Gx. *}
142 .#define bfd_mach_tilepro 1
143diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
144index c0b563aec02..ccaeecb9476 100644
145--- a/bfd/bfd-in2.h
146+++ b/bfd/bfd-in2.h
147@@ -1903,6 +1903,8 @@ enum bfd_architecture
148 bfd_arch_lm32, /* Lattice Mico32. */
149 #define bfd_mach_lm32 1
150 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
151+#define bfd_mach_microblaze 1
152+#define bfd_mach_microblaze64 2
153 bfd_arch_tilepro, /* Tilera TILEPro. */
154 bfd_arch_tilegx, /* Tilera TILE-Gx. */
155 #define bfd_mach_tilepro 1
156@@ -5443,16 +5445,41 @@ value relative to the read-write small data area anchor */
157 expressions of the form "Symbol Op Symbol" */
158 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
159
160-/* This is a 64 bit reloc that stores the 32 bit pc relative
161+/* This is a 32 bit reloc that stores the 32 bit pc relative
162 value in two words (with an imm instruction). No relocation is
163 done here - only used for relaxing */
164- BFD_RELOC_MICROBLAZE_64_NONE,
165+ BFD_RELOC_MICROBLAZE_32_NONE,
166+
167+/* This is a 64 bit reloc that stores the 32 bit pc relative
168+ * +value in two words (with an imml instruction). No relocation is
169+ * +done here - only used for relaxing */
170+ BFD_RELOC_MICROBLAZE_64_PCREL,
171+
172+/* This is a 64 bit reloc that stores the 32 bit relative
173+ * +value in two words (with an imml instruction). No relocation is
174+ * +done here - only used for relaxing */
175+ BFD_RELOC_MICROBLAZE_64,
176+
177+/* This is a 64 bit reloc that stores the 32 bit relative
178+ * +value in two words (with an imml instruction). No relocation is
179+ * +done here - only used for relaxing */
180+ BFD_RELOC_MICROBLAZE_EA64,
181+
182+/* This is a 64 bit reloc that stores the 32 bit pc relative
183+ * +value in two words (with an imm instruction). No relocation is
184+ * +done here - only used for relaxing */
185+ BFD_RELOC_MICROBLAZE_64_NONE,
186
187 /* This is a 64 bit reloc that stores the 32 bit pc relative
188 value in two words (with an imm instruction). The relocation is
189 PC-relative GOT offset */
190 BFD_RELOC_MICROBLAZE_64_GOTPC,
191
192+/* This is a 64 bit reloc that stores the 32 bit pc relative
193+value in two words (with an imml instruction). The relocation is
194+PC-relative GOT offset */
195+ BFD_RELOC_MICROBLAZE_64_GPC,
196+
197 /* This is a 64 bit reloc that stores the 32 bit pc relative
198 value in two words (with an imm instruction). The relocation is
199 GOT offset */
200diff --git a/bfd/config.bfd b/bfd/config.bfd
201index 872685cfb72..5e9ba3d9805 100644
202--- a/bfd/config.bfd
203+++ b/bfd/config.bfd
204@@ -860,11 +860,15 @@ case "${targ}" in
205 microblazeel*-*)
206 targ_defvec=microblaze_elf32_le_vec
207 targ_selvecs=microblaze_elf32_vec
208+ targ64_selvecs=microblaze_elf64_vec
209+ targ64_selvecs=microblaze_elf64_le_vec
210 ;;
211
212 microblaze*-*)
213 targ_defvec=microblaze_elf32_vec
214 targ_selvecs=microblaze_elf32_le_vec
215+ targ64_selvecs=microblaze_elf64_vec
216+ targ64_selvecs=microblaze_elf64_le_vec
217 ;;
218
219 #ifdef BFD64
220diff --git a/bfd/configure b/bfd/configure
221index 0ef4c206fb0..b7547c6777c 100755
222--- a/bfd/configure
223+++ b/bfd/configure
224@@ -13547,6 +13547,8 @@ do
225 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
226 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
227 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
228+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
229+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
230 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
231 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
232 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
233diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
234index 0c1d2b1aa69..106f78229b5 100644
235--- a/bfd/cpu-microblaze.c
236+++ b/bfd/cpu-microblaze.c
237@@ -23,13 +23,30 @@
238 #include "bfd.h"
239 #include "libbfd.h"
240
241-const bfd_arch_info_type bfd_microblaze_arch =
242+const bfd_arch_info_type bfd_microblaze_arch[] =
243+{
244+#if BFD_DEFAULT_TARGET_SIZE == 64
245+{
246+ 64, /* 32 bits in a word. */
247+ 64, /* 32 bits in an address. */
248+ 8, /* 8 bits in a byte. */
249+ bfd_arch_microblaze, /* Architecture. */
250+ bfd_mach_microblaze64, /* 64 bit Machine */
251+ "microblaze", /* Architecture name. */
252+ "MicroBlaze", /* Printable name. */
253+ 3, /* Section align power. */
254+ false, /* Is this the default architecture ? */
255+ bfd_default_compatible, /* Architecture comparison function. */
256+ bfd_default_scan, /* String to architecture conversion. */
257+ bfd_arch_default_fill, /* Default fill. */
258+ &bfd_microblaze_arch[1] /* Next in list. */
259+},
260 {
261 32, /* Bits in a word. */
262 32, /* Bits in an address. */
263 8, /* Bits in a byte. */
264 bfd_arch_microblaze, /* Architecture number. */
265- 0, /* Machine number - 0 for now. */
266+ bfd_mach_microblaze, /* Machine number - 0 for now. */
267 "microblaze", /* Architecture name. */
268 "MicroBlaze", /* Printable name. */
269 3, /* Section align power. */
270@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
271 bfd_arch_default_fill, /* Default fill. */
272 NULL, /* Next in list. */
273 0 /* Maximum offset of a reloc from the start of an insn. */
274+}
275+#else
276+{
277+ 32, /* 32 bits in a word. */
278+ 32, /* 32 bits in an address. */
279+ 8, /* 8 bits in a byte. */
280+ bfd_arch_microblaze, /* Architecture. */
281+ bfd_mach_microblaze, /* 32 bit Machine */
282+ "microblaze", /* Architecture name. */
283+ "MicroBlaze", /* Printable name. */
284+ 3, /* Section align power. */
285+ true, /* Is this the default architecture ? */
286+ bfd_default_compatible, /* Architecture comparison function. */
287+ bfd_default_scan, /* String to architecture conversion. */
288+ bfd_arch_default_fill, /* Default fill. */
289+ &bfd_microblaze_arch[1] /* Next in list. */
290+},
291+{
292+ 64, /* 32 bits in a word. */
293+ 64, /* 32 bits in an address. */
294+ 8, /* 8 bits in a byte. */
295+ bfd_arch_microblaze, /* Architecture. */
296+ bfd_mach_microblaze64, /* 64 bit Machine */
297+ "microblaze", /* Architecture name. */
298+ "MicroBlaze", /* Printable name. */
299+ 3, /* Section align power. */
300+ false, /* Is this the default architecture ? */
301+ bfd_default_compatible, /* Architecture comparison function. */
302+ bfd_default_scan, /* String to architecture conversion. */
303+ bfd_arch_default_fill, /* Default fill. */
304+ NULL, /* Next in list. */
305+ 0
306+}
307+#endif
308 };
309diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
310index d3b3c66cf00..053c1b432f9 100644
311--- a/bfd/elf32-microblaze.c
312+++ b/bfd/elf32-microblaze.c
313@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
314 0x0000ffff, /* Dest Mask. */
315 true), /* PC relative offset? */
316
317+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
318+ 0, /* Rightshift. */
319+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
320+ 16, /* Bitsize. */
321+ true, /* PC_relative. */
322+ 0, /* Bitpos. */
323+ complain_overflow_dont, /* Complain on overflow. */
324+ bfd_elf_generic_reloc,/* Special Function. */
325+ "R_MICROBLAZE_IMML_64", /* Name. */
326+ false, /* Partial Inplace. */
327+ 0, /* Source Mask. */
328+ 0x0000ffff, /* Dest Mask. */
329+ false), /* PC relative offset? */
330+
331 /* A 64 bit relocation. Table entry not really used. */
332 HOWTO (R_MICROBLAZE_64, /* Type. */
333 0, /* Rightshift. */
334@@ -174,7 +188,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
335 0x0000ffff, /* Dest Mask. */
336 false), /* PC relative offset? */
337
338- /* This reloc does nothing. Used for relaxation. */
339+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
340+ 0, /* Rightshift. */
341+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
342+ 32, /* Bitsize. */
343+ true, /* PC_relative. */
344+ 0, /* Bitpos. */
345+ complain_overflow_bitfield, /* Complain on overflow. */
346+ NULL, /* Special Function. */
347+ "R_MICROBLAZE_32_NONE",/* Name. */
348+ false, /* Partial Inplace. */
349+ 0, /* Source Mask. */
350+ 0, /* Dest Mask. */
351+ false), /* PC relative offset? */
352+
353+ /* This reloc does nothing. Used for relaxation. */
354 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
355 0, /* Rightshift. */
356 3, /* Size (0 = byte, 1 = short, 2 = long). */
357@@ -264,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
358 0x0000ffff, /* Dest Mask. */
359 true), /* PC relative offset? */
360
361+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
362+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
363+ 0, /* Rightshift. */
364+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
365+ 16, /* Bitsize. */
366+ true, /* PC_relative. */
367+ 0, /* Bitpos. */
368+ complain_overflow_dont, /* Complain on overflow. */
369+ bfd_elf_generic_reloc, /* Special Function. */
370+ "R_MICROBLAZE_GPC_64", /* Name. */
371+ false, /* Partial Inplace. */
372+ 0, /* Source Mask. */
373+ 0x0000ffff, /* Dest Mask. */
374+ true), /* PC relative offset? */
375+
376 /* A 64 bit GOT relocation. Table-entry not really used. */
377 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
378 0, /* Rightshift. */
379@@ -560,6 +603,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
380 case BFD_RELOC_NONE:
381 microblaze_reloc = R_MICROBLAZE_NONE;
382 break;
383+ case BFD_RELOC_MICROBLAZE_32_NONE:
384+ microblaze_reloc = R_MICROBLAZE_32_NONE;
385+ break;
386 case BFD_RELOC_MICROBLAZE_64_NONE:
387 microblaze_reloc = R_MICROBLAZE_64_NONE;
388 break;
389@@ -600,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
390 case BFD_RELOC_VTABLE_ENTRY:
391 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
392 break;
393+ case BFD_RELOC_MICROBLAZE_64:
394+ microblaze_reloc = R_MICROBLAZE_IMML_64;
395+ break;
396 case BFD_RELOC_MICROBLAZE_64_GOTPC:
397 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
398 break;
399+ case BFD_RELOC_MICROBLAZE_64_GPC:
400+ microblaze_reloc = R_MICROBLAZE_GPC_64;
401+ break;
402 case BFD_RELOC_MICROBLAZE_64_GOT:
403 microblaze_reloc = R_MICROBLAZE_GOT_64;
404 break;
405@@ -1507,9 +1559,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
406 relocation += addend;
407 relocation -= dtprel_base(info);
408 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
409- contents + offset + 2);
410+ contents + offset + endian);
411 bfd_put_16 (input_bfd, relocation & 0xffff,
412- contents + offset + 2 + INST_WORD_SIZE);
413+ contents + offset + endian + INST_WORD_SIZE);
414 break;
415 case (int) R_MICROBLAZE_TEXTREL_64:
416 case (int) R_MICROBLAZE_TEXTREL_32_LO:
417@@ -1523,7 +1575,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
418 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
419 {
420 relocation += addend;
421- if (r_type == R_MICROBLAZE_32)
422+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
423 bfd_put_32 (input_bfd, relocation, contents + offset);
424 else
425 {
426@@ -1925,8 +1977,7 @@ microblaze_elf_relax_section (bfd *abfd,
427 else
428 symval += irel->r_addend;
429
430- if ((symval & 0xffff8000) == 0
431- || (symval & 0xffff8000) == 0xffff8000)
432+ if ((symval & 0xffff8000) == 0)
433 {
434 /* We can delete this instruction. */
435 sec->relax[sec->relax_count].addr = irel->r_offset;
436@@ -1990,21 +2041,51 @@ microblaze_elf_relax_section (bfd *abfd,
437 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
438 }
439 break;
440+ case R_MICROBLAZE_IMML_64:
441+ {
442+ /* This was a PC-relative instruction that was
443+ completely resolved. */
444+ int sfix, efix;
445+ unsigned int val;
446+ bfd_vma target_address;
447+ target_address = irel->r_addend + irel->r_offset;
448+ sfix = calc_fixup (irel->r_offset, 0, sec);
449+ efix = calc_fixup (target_address, 0, sec);
450+
451+ /* Validate the in-band val. */
452+ val = bfd_get_32 (abfd, contents + irel->r_offset);
453+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
454+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
455+ }
456+ irel->r_addend -= (efix - sfix);
457+ /* Should use HOWTO. */
458+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
459+ irel->r_addend);
460+ }
461+ break;
462 case R_MICROBLAZE_NONE:
463+ case R_MICROBLAZE_32_NONE:
464 {
465 /* This was a PC-relative instruction that was
466 completely resolved. */
467 int sfix, efix;
468+ unsigned int val;
469 bfd_vma target_address;
470 target_address = irel->r_addend + irel->r_offset;
471 sfix = calc_fixup (irel->r_offset, 0, sec);
472 efix = calc_fixup (target_address, 0, sec);
473+
474+ /* Validate the in-band val. */
475+ val = bfd_get_32 (abfd, contents + irel->r_offset);
476+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
477+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
478+ }
479 irel->r_addend -= (efix - sfix);
480 /* Should use HOWTO. */
481 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
482 irel->r_addend);
483- }
484- break;
485+ }
486+ break;
487 case R_MICROBLAZE_64_NONE:
488 {
489 /* This was a PC-relative 64-bit instruction that was
490@@ -2015,8 +2096,8 @@ microblaze_elf_relax_section (bfd *abfd,
491 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
492 efix = calc_fixup (target_address, 0, sec);
493 irel->r_addend -= (efix - sfix);
494- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
495- + INST_WORD_SIZE, irel->r_addend);
496+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
497+ irel->r_addend);
498 }
499 break;
500 }
501@@ -2046,9 +2127,50 @@ microblaze_elf_relax_section (bfd *abfd,
502 irelscanend = irelocs + o->reloc_count;
503 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
504 {
505- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
506- {
507- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
508+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
509+ {
510+ unsigned int val;
511+
512+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
513+
514+ /* hax: We only do the following fixup for debug location lists. */
515+ if (strcmp(".debug_loc", o->name))
516+ continue;
517+
518+ /* This was a PC-relative instruction that was completely resolved. */
519+ if (ocontents == NULL)
520+ {
521+ if (elf_section_data (o)->this_hdr.contents != NULL)
522+ ocontents = elf_section_data (o)->this_hdr.contents;
523+ else
524+ {
525+ /* We always cache the section contents.
526+ Perhaps, if info->keep_memory is FALSE, we
527+ should free them, if we are permitted to. */
528+
529+ if (o->rawsize == 0)
530+ o->rawsize = o->size;
531+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
532+ if (ocontents == NULL)
533+ goto error_return;
534+ if (!bfd_get_section_contents (abfd, o, ocontents,
535+ (file_ptr) 0,
536+ o->rawsize))
537+ goto error_return;
538+ elf_section_data (o)->this_hdr.contents = ocontents;
539+ }
540+ }
541+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
542+ if (val != irelscan->r_addend) {
543+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
544+ }
545+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
546+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
547+ irelscan->r_addend);
548+ }
549+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
550+ {
551+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
552
553 /* Look at the reloc only if the value has been resolved. */
554 if (isym->st_shndx == shndx
555@@ -2105,7 +2227,7 @@ microblaze_elf_relax_section (bfd *abfd,
556 elf_section_data (o)->this_hdr.contents = ocontents;
557 }
558 }
559- irelscan->r_addend -= calc_fixup (irel->r_addend
560+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
561 + isym->st_value,
562 0,
563 sec);
564@@ -3445,6 +3567,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
565 return true;
566 }
567
568+
569+static bool
570+elf_microblaze_object_p (bfd *abfd)
571+{
572+ /* Set the right machine number for an s390 elf32 file. */
573+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
574+}
575+
576 /* Hook called by the linker routine which adds symbols from an object
577 file. We use it to put .comm items in .sbss, and not .bss. */
578
579@@ -3514,8 +3644,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
580 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
581 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
582 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
583-
584-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
585-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
586+#define elf_backend_object_p elf_microblaze_object_p
587
588 #include "elf32-target.h"
589diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c 19diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
590new file mode 100755 20new file mode 100755
591index 00000000000..6cd9753a592 21index 00000000000..6cd9753a592
@@ -4402,1388 +3832,273 @@ index 00000000000..6cd9753a592
4402+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook 3832+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
4403+ 3833+
4404+#include "elf64-target.h" 3834+#include "elf64-target.h"
4405diff --git a/bfd/libbfd.h b/bfd/libbfd.h 3835diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
4406index 6e62e556962..ef5568a78b0 100644 3836index 7cbbc8986a1..597507e53cd 100644
4407--- a/bfd/libbfd.h 3837--- a/gdb/microblaze-tdep.c
4408+++ b/bfd/libbfd.h 3838+++ b/gdb/microblaze-tdep.c
4409@@ -2992,6 +2992,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", 3839@@ -65,8 +65,95 @@
4410 "BFD_RELOC_MICROBLAZE_32_ROSDA", 3840 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
4411 "BFD_RELOC_MICROBLAZE_32_RWSDA", 3841 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
4412 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
4413+ "BFD_RELOC_MICROBLAZE_32_NONE",
4414 "BFD_RELOC_MICROBLAZE_64_NONE",
4415 "BFD_RELOC_MICROBLAZE_64_GOTPC",
4416 "BFD_RELOC_MICROBLAZE_64_GOT",
4417@@ -2999,6 +3000,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
4418 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
4419 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
4420 "BFD_RELOC_MICROBLAZE_COPY",
4421+ "BFD_RELOC_MICROBLAZE_64",
4422+ "BFD_RELOC_MICROBLAZE_64_PCREL",
4423 "BFD_RELOC_MICROBLAZE_64_TLS",
4424 "BFD_RELOC_MICROBLAZE_64_TLSGD",
4425 "BFD_RELOC_MICROBLAZE_64_TLSLD",
4426diff --git a/bfd/reloc.c b/bfd/reloc.c
4427index 164060361a9..e733e2397f4 100644
4428--- a/bfd/reloc.c
4429+++ b/bfd/reloc.c
4430@@ -6898,6 +6898,12 @@ ENUM
4431 ENUMDOC
4432 This is a 32 bit reloc for the microblaze to handle
4433 expressions of the form "Symbol Op Symbol"
4434+ENUM
4435+ BFD_RELOC_MICROBLAZE_32_NONE
4436+ENUMDOC
4437+ This is a 32 bit reloc that stores the 32 bit pc relative
4438+ value in two words (with an imm instruction). No relocation is
4439+ done here - only used for relaxing
4440 ENUM
4441 BFD_RELOC_MICROBLAZE_64_NONE
4442 ENUMDOC
4443@@ -6991,6 +6997,20 @@ ENUMDOC
4444 value in two words (with an imm instruction). The relocation is
4445 relative offset from start of TEXT.
4446
4447+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
4448+ to two words (uses imml instruction).
4449+ENUM
4450+BFD_RELOC_MICROBLAZE_64,
4451+ENUMDOC
4452+ This is a 64 bit reloc that stores the 64 bit pc relative
4453+ value in two words (with an imml instruction). No relocation is
4454+ done here - only used for relaxing
4455+ENUM
4456+BFD_RELOC_MICROBLAZE_64_PCREL,
4457+ENUMDOC
4458+ This is a 32 bit reloc that stores the 32 bit pc relative
4459+ value in two words (with an imml instruction). No relocation is
4460+ done here - only used for relaxing
4461 ENUM
4462 BFD_RELOC_AARCH64_RELOC_START
4463 ENUMDOC
4464diff --git a/bfd/targets.c b/bfd/targets.c
4465index 417743efc0e..333f05c55f4 100644
4466--- a/bfd/targets.c
4467+++ b/bfd/targets.c
4468@@ -795,6 +795,8 @@ extern const bfd_target mep_elf32_le_vec;
4469 extern const bfd_target metag_elf32_vec;
4470 extern const bfd_target microblaze_elf32_vec;
4471 extern const bfd_target microblaze_elf32_le_vec;
4472+extern const bfd_target microblaze_elf64_vec;
4473+extern const bfd_target microblaze_elf64_le_vec;
4474 extern const bfd_target mips_ecoff_be_vec;
4475 extern const bfd_target mips_ecoff_le_vec;
4476 extern const bfd_target mips_ecoff_bele_vec;
4477@@ -1165,6 +1167,10 @@ static const bfd_target * const _bfd_target_vector[] =
4478
4479 &metag_elf32_vec,
4480
4481+#ifdef BFD64
4482+ &microblaze_elf64_vec,
4483+ &microblaze_elf64_le_vec,
4484+#endif
4485 &microblaze_elf32_vec,
4486
4487 &mips_ecoff_be_vec,
4488diff --git a/gdb/features/Makefile b/gdb/features/Makefile
4489index fc3196864c9..1bb198abfd3 100644
4490--- a/gdb/features/Makefile
4491+++ b/gdb/features/Makefile
4492@@ -101,7 +101,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
4493 # to make on the command line.
4494 XMLTOC = \
4495 microblaze-with-stack-protect.xml \
4496+ microblaze64-with-stack-protect.xml \
4497 microblaze.xml \
4498+ microblaze64.xml \
4499 mips-dsp-linux.xml \
4500 mips-linux.xml \
4501 mips64-dsp-linux.xml \
4502diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
4503index 29fdd6c0a2f..a5c3cce069d 100644
4504--- a/gdb/features/microblaze-core.xml
4505+++ b/gdb/features/microblaze-core.xml
4506@@ -8,7 +8,7 @@
4507 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4508 <feature name="org.gnu.gdb.microblaze.core">
4509 <reg name="r0" bitsize="32" regnum="0"/>
4510- <reg name="r1" bitsize="32" type="data_ptr"/>
4511+ <reg name="r1" bitsize="32"/>
4512 <reg name="r2" bitsize="32"/>
4513 <reg name="r3" bitsize="32"/>
4514 <reg name="r4" bitsize="32"/>
4515@@ -39,7 +39,7 @@
4516 <reg name="r29" bitsize="32"/>
4517 <reg name="r30" bitsize="32"/>
4518 <reg name="r31" bitsize="32"/>
4519- <reg name="rpc" bitsize="32" type="code_ptr"/>
4520+ <reg name="rpc" bitsize="32"/>
4521 <reg name="rmsr" bitsize="32"/>
4522 <reg name="rear" bitsize="32"/>
4523 <reg name="resr" bitsize="32"/>
4524@@ -64,4 +64,6 @@
4525 <reg name="rtlbsx" bitsize="32"/>
4526 <reg name="rtlblo" bitsize="32"/>
4527 <reg name="rtlbhi" bitsize="32"/>
4528+ <reg name="slr" bitsize="32"/>
4529+ <reg name="shr" bitsize="32"/>
4530 </feature>
4531diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
4532index aac51ea471c..722a51f0df5 100644
4533--- a/gdb/features/microblaze-stack-protect.xml
4534+++ b/gdb/features/microblaze-stack-protect.xml
4535@@ -7,6 +7,6 @@
4536
4537 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
4538 <feature name="org.gnu.gdb.microblaze.stack-protect">
4539- <reg name="rslr" bitsize="32"/>
4540- <reg name="rshr" bitsize="32"/>
4541+ <reg name="slr" bitsize="32"/>
4542+ <reg name="shr" bitsize="32"/>
4543 </feature>
4544diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
4545index aa180bf35d5..6a9e74c7a6f 100644
4546--- a/gdb/features/microblaze-with-stack-protect.c
4547+++ b/gdb/features/microblaze-with-stack-protect.c
4548@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4549
4550 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
4551 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4552- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4553+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4554 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4555 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4556 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4557@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4558 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4559 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4560 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4561- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4562+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4563 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4564 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4565 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4566@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
4567 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4568
4569 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
4570- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
4571- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
4572+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
4573+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
4574
4575 tdesc_microblaze_with_stack_protect = result.release ();
4576 }
4577diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
4578index ef2c64c720e..201232dff83 100644
4579--- a/gdb/features/microblaze.c
4580+++ b/gdb/features/microblaze.c
4581@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
4582
4583 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
4584 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
4585- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
4586+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
4587 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
4588 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
4589 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
4590@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
4591 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
4592 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
4593 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
4594- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
4595+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
4596 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4597 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
4598 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4599@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
4600 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4601 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4602 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4603+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4604+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4605 3842
4606 tdesc_microblaze = result.release (); 3843+static const char *microblaze_abi_string;
4607 }
4608diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
4609new file mode 100644
4610index 00000000000..96e99e2fb24
4611--- /dev/null
4612+++ b/gdb/features/microblaze64-core.xml
4613@@ -0,0 +1,69 @@
4614+<?xml version="1.0"?>
4615+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4616+
4617+ Copying and distribution of this file, with or without modification,
4618+ are permitted in any medium without royalty provided the copyright
4619+ notice and this notice are preserved. -->
4620+
4621+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4622+<feature name="org.gnu.gdb.microblaze64.core">
4623+ <reg name="r0" bitsize="64" regnum="0"/>
4624+ <reg name="r1" bitsize="64"/>
4625+ <reg name="r2" bitsize="64"/>
4626+ <reg name="r3" bitsize="64"/>
4627+ <reg name="r4" bitsize="64"/>
4628+ <reg name="r5" bitsize="64"/>
4629+ <reg name="r6" bitsize="64"/>
4630+ <reg name="r7" bitsize="64"/>
4631+ <reg name="r8" bitsize="64"/>
4632+ <reg name="r9" bitsize="64"/>
4633+ <reg name="r10" bitsize="64"/>
4634+ <reg name="r11" bitsize="64"/>
4635+ <reg name="r12" bitsize="64"/>
4636+ <reg name="r13" bitsize="64"/>
4637+ <reg name="r14" bitsize="64"/>
4638+ <reg name="r15" bitsize="64"/>
4639+ <reg name="r16" bitsize="64"/>
4640+ <reg name="r17" bitsize="64"/>
4641+ <reg name="r18" bitsize="64"/>
4642+ <reg name="r19" bitsize="64"/>
4643+ <reg name="r20" bitsize="64"/>
4644+ <reg name="r21" bitsize="64"/>
4645+ <reg name="r22" bitsize="64"/>
4646+ <reg name="r23" bitsize="64"/>
4647+ <reg name="r24" bitsize="64"/>
4648+ <reg name="r25" bitsize="64"/>
4649+ <reg name="r26" bitsize="64"/>
4650+ <reg name="r27" bitsize="64"/>
4651+ <reg name="r28" bitsize="64"/>
4652+ <reg name="r29" bitsize="64"/>
4653+ <reg name="r30" bitsize="64"/>
4654+ <reg name="r31" bitsize="64"/>
4655+ <reg name="rpc" bitsize="64"/>
4656+ <reg name="rmsr" bitsize="32"/>
4657+ <reg name="rear" bitsize="64"/>
4658+ <reg name="resr" bitsize="32"/>
4659+ <reg name="rfsr" bitsize="32"/>
4660+ <reg name="rbtr" bitsize="64"/>
4661+ <reg name="rpvr0" bitsize="32"/>
4662+ <reg name="rpvr1" bitsize="32"/>
4663+ <reg name="rpvr2" bitsize="32"/>
4664+ <reg name="rpvr3" bitsize="32"/>
4665+ <reg name="rpvr4" bitsize="32"/>
4666+ <reg name="rpvr5" bitsize="32"/>
4667+ <reg name="rpvr6" bitsize="32"/>
4668+ <reg name="rpvr7" bitsize="32"/>
4669+ <reg name="rpvr8" bitsize="64"/>
4670+ <reg name="rpvr9" bitsize="64"/>
4671+ <reg name="rpvr10" bitsize="32"/>
4672+ <reg name="rpvr11" bitsize="32"/>
4673+ <reg name="redr" bitsize="32"/>
4674+ <reg name="rpid" bitsize="32"/>
4675+ <reg name="rzpr" bitsize="32"/>
4676+ <reg name="rtlbx" bitsize="32"/>
4677+ <reg name="rtlbsx" bitsize="32"/>
4678+ <reg name="rtlblo" bitsize="32"/>
4679+ <reg name="rtlbhi" bitsize="32"/>
4680+ <reg name="slr" bitsize="64"/>
4681+ <reg name="shr" bitsize="64"/>
4682+</feature>
4683diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
4684new file mode 100644
4685index 00000000000..1bbf5fc3cea
4686--- /dev/null
4687+++ b/gdb/features/microblaze64-stack-protect.xml
4688@@ -0,0 +1,12 @@
4689+<?xml version="1.0"?>
4690+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4691+
4692+ Copying and distribution of this file, with or without modification,
4693+ are permitted in any medium without royalty provided the copyright
4694+ notice and this notice are preserved. -->
4695+
4696+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
4697+<feature name="org.gnu.gdb.microblaze64.stack-protect">
4698+ <reg name="slr" bitsize="64"/>
4699+ <reg name="shr" bitsize="64"/>
4700+</feature>
4701diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
4702new file mode 100644
4703index 00000000000..a4de4666c76
4704--- /dev/null
4705+++ b/gdb/features/microblaze64-with-stack-protect.c
4706@@ -0,0 +1,79 @@
4707+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4708+ Original: microblaze-with-stack-protect.xml */
4709+ 3844+
4710+#include "defs.h" 3845+static const char *const microblaze_abi_strings[] = {
4711+#include "osabi.h" 3846+ "auto",
4712+#include "target-descriptions.h" 3847+ "m64",
3848+};
3849+
3850+enum microblaze_abi
3851+microblaze_abi (struct gdbarch *gdbarch)
3852+{
3853+ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
3854+ return tdep->microblaze_abi;
3855+}
3856 /* The registers of the Xilinx microblaze processor. */
3857
3858+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
3859+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
4713+ 3860+
4714+struct target_desc *tdesc_microblaze64_with_stack_protect;
4715+static void 3861+static void
4716+initialize_tdesc_microblaze64_with_stack_protect (void) 3862+microblaze_abi_update (const char *ignore_args,
3863+ int from_tty, struct cmd_list_element *c)
4717+{ 3864+{
4718+ target_desc_up result = allocate_target_description (); 3865+ struct gdbarch_info info;
4719+ struct tdesc_feature *feature; 3866+
4720+ 3867+ /* Force the architecture to update, and (if it's a microblaze architecture)
4721+ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core"); 3868+ * microblaze_gdbarch_init will take care of the rest. */
4722+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); 3869+// gdbarch_info_init (&info);
4723+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); 3870+ gdbarch_update_p (info);
4724+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
4725+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4726+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4727+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4728+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4729+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4730+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4731+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4732+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4733+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4734+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4735+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4736+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4737+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4738+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4739+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4740+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4741+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4742+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4743+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4744+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4745+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4746+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4747+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4748+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4749+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4750+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4751+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4752+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4753+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4754+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4755+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4756+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
4757+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4758+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4759+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4760+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4761+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4762+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4763+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4764+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4765+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4766+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4767+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4768+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4769+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4770+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4771+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4772+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4773+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4774+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4775+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4776+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4777+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4778+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4779+
4780+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect");
4781+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4782+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4783+
4784+ tdesc_microblaze64_with_stack_protect = result.release();
4785+} 3871+}
4786diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
4787new file mode 100644
4788index 00000000000..0e9f01611f3
4789--- /dev/null
4790+++ b/gdb/features/microblaze64-with-stack-protect.xml
4791@@ -0,0 +1,12 @@
4792+<?xml version="1.0"?>
4793+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4794+
4795+ Copying and distribution of this file, with or without modification,
4796+ are permitted in any medium without royalty provided the copyright
4797+ notice and this notice are preserved. -->
4798+
4799+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4800+<target>
4801+ <xi:include href="microblaze64-core.xml"/>
4802+ <xi:include href="microblaze64-stack-protect.xml"/>
4803+</target>
4804diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
4805new file mode 100644
4806index 00000000000..8ab7a90dd95
4807--- /dev/null
4808+++ b/gdb/features/microblaze64.c
4809@@ -0,0 +1,77 @@
4810+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
4811+ Original: microblaze.xml */
4812+ 3872+
4813+#include "defs.h"
4814+#include "osabi.h"
4815+#include "target-descriptions.h"
4816+ 3873+
4817+struct target_desc *tdesc_microblaze64; 3874+static enum microblaze_abi
4818+static void 3875+global_microblaze_abi (void)
4819+initialize_tdesc_microblaze64 (void)
4820+{ 3876+{
4821+ target_desc_up result = allocate_target_description (); 3877+ int i;
4822+ struct tdesc_feature *feature; 3878+
4823+ 3879+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
4824+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core"); 3880+ if (microblaze_abi_strings[i] == microblaze_abi_string)
4825+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64"); 3881+ return (enum microblaze_abi) i;
4826+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64"); 3882+
4827+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64"); 3883+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
4828+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
4829+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
4830+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
4831+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
4832+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
4833+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
4834+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
4835+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
4836+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
4837+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
4838+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
4839+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
4840+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
4841+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
4842+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
4843+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
4844+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
4845+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
4846+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
4847+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
4848+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
4849+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
4850+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
4851+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
4852+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
4853+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
4854+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
4855+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
4856+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
4857+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
4858+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
4859+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
4860+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
4861+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
4862+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
4863+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
4864+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
4865+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
4866+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
4867+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
4868+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
4869+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
4870+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
4871+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
4872+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
4873+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
4874+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
4875+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
4876+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
4877+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
4878+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
4879+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
4880+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
4881+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
4882+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
4883+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
4884+
4885+ tdesc_microblaze64 = result.release();
4886+} 3884+}
4887diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
4888new file mode 100644
4889index 00000000000..515d18e65cf
4890--- /dev/null
4891+++ b/gdb/features/microblaze64.xml
4892@@ -0,0 +1,11 @@
4893+<?xml version="1.0"?>
4894+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
4895+
4896+ Copying and distribution of this file, with or without modification,
4897+ are permitted in any medium without royalty provided the copyright
4898+ notice and this notice are preserved. -->
4899+
4900+<!DOCTYPE target SYSTEM "gdb-target.dtd">
4901+<target>
4902+ <xi:include href="microblaze64-core.xml"/>
4903+</target>
4904diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
4905index fc52adffb72..f2db32f0087 100644
4906--- a/gdb/microblaze-linux-tdep.c
4907+++ b/gdb/microblaze-linux-tdep.c
4908@@ -40,6 +40,7 @@
4909 #include "features/microblaze-linux.c"
4910
4911 static int microblaze_debug_flag = 0;
4912+int MICROBLAZE_REGISTER_SIZE=4;
4913
4914 static void
4915 microblaze_debug (const char *fmt, ...)
4916@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...)
4917 }
4918 }
4919
4920+#if 0
4921 static int
4922 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4923 struct bp_target_info *bp_tgt)
4924@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
4925 return val;
4926 }
4927
4928+#endif
4929+ 3885+
4930 static void 3886+static void
4931 microblaze_linux_sigtramp_cache (struct frame_info *next_frame, 3887+show_microblaze_abi (struct ui_file *file,
4932 struct trad_frame_cache *this_cache, 3888+ int from_tty,
4933@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info, 3889+ struct cmd_list_element *ignored_cmd,
4934 3890+ const char *ignored_value)
4935 linux_init_abi (info, gdbarch, 0); 3891+{
4936 3892+ enum microblaze_abi global_abi = global_microblaze_abi ();
4937- set_gdbarch_memory_remove_breakpoint (gdbarch, 3893+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
4938- microblaze_linux_memory_remove_breakpoint); 3894+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
4939+ // set_gdbarch_memory_remove_breakpoint (gdbarch, 3895+
4940+ // microblaze_linux_memory_remove_breakpoint); 3896+#if 1
4941 3897+ if (global_abi == MICROBLAZE_ABI_AUTO)
4942 /* Shared library handling. */ 3898+ fprintf_filtered
4943 set_solib_svr4_fetch_link_map_offsets (gdbarch, 3899+ (file,
4944@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info, 3900+ "The microblaze ABI is set automatically (currently \"%s\").\n",
4945 3901+ actual_abi_str);
4946 /* BFD target for core files. */ 3902+ else if (global_abi == actual_abi)
4947 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) 3903+ fprintf_filtered
4948- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); 3904+ (file,
4949+ { 3905+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
4950+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { 3906+ actual_abi_str);
4951+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
4952+ MICROBLAZE_REGISTER_SIZE=8;
4953+ }
4954+ else 3907+ else
4955+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze"); 3908+ {
4956+ } 3909+#endif
4957 else 3910+ /* Probably shouldn't happen... */
4958- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); 3911+ fprintf_filtered (file,
4959+ { 3912+ "The (auto detected) microblaze ABI \"%s\" is in use "
4960+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) { 3913+ "even though the user setting was \"%s\".\n",
4961+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel"); 3914+ actual_abi_str, microblaze_abi_strings[global_abi]);
4962+ MICROBLAZE_REGISTER_SIZE=8;
4963+ } 3915+ }
4964+ else 3916+}
4965+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel"); 3917+
4966+ } 3918+static void
4967 3919+show_microblaze_command (const char *args, int from_tty)
4968+ switch (info.bfd_arch_info->mach)
4969+ {
4970+ case bfd_mach_microblaze64:
4971+ set_gdbarch_ptr_bit (gdbarch, 64);
4972+ break;
4973+ }
4974
4975 /* Shared library handling. */
4976 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
4977@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep ();
4978 void
4979 _initialize_microblaze_linux_tdep ()
4980 {
4981- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
4982+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
4983+ microblaze_linux_init_abi);
4984+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
4985 microblaze_linux_init_abi);
4986 initialize_tdesc_microblaze_linux ();
4987 }
4988diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
4989index ccb6b730d64..c347bb9516b 100644
4990--- a/gdb/microblaze-tdep.c
4991+++ b/gdb/microblaze-tdep.c
4992@@ -40,7 +40,9 @@
4993 #include "remote.h"
4994
4995 #include "features/microblaze-with-stack-protect.c"
4996+#include "features/microblaze64-with-stack-protect.c"
4997 #include "features/microblaze.c"
4998+#include "features/microblaze64.c"
4999
5000 /* Instruction macros used for analyzing the prologue. */
5001 /* This set of instruction macros need to be changed whenever the
5002@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] =
5003 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
5004 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
5005 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
5006- "rslr", "rshr"
5007+ "slr", "shr"
5008 };
5009
5010 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
5011
5012 static unsigned int microblaze_debug_flag = 0;
5013+int reg_size = 4;
5014
5015 #define microblaze_debug(fmt, ...) \
5016 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
5017@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
5018 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
5019
5020 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
5021+static CORE_ADDR
5022+microblaze_store_arguments (struct regcache *regcache, int nargs,
5023+ struct value **args, CORE_ADDR sp,
5024+ int struct_return, CORE_ADDR struct_addr)
5025+{ 3920+{
5026+ error (_("store_arguments not implemented")); 3921+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
5027+ return sp;
5028+} 3922+}
5029+#if 0 3923+
5030 static int
5031 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5032 struct bp_target_info *bp_tgt)
5033@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5034 /* Make sure we see the memory breakpoints. */
5035 scoped_restore restore_memory
5036 = make_scoped_restore_show_memory_breakpoints (1);
5037-
5038 val = target_read_memory (addr, old_contents, bplen);
5039
5040 /* If our breakpoint is no longer at the address, this means that the
5041@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
5042 return val;
5043 }
5044
5045+#endif
5046 /* Allocate and initialize a frame cache. */
5047
5048 static struct microblaze_frame_cache *
5049@@ -577,17 +589,16 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
5050 gdb_byte *valbuf)
5051 {
5052 gdb_byte buf[8];
5053-
5054 /* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
5055 switch (TYPE_LENGTH (type))
5056 {
5057 case 1: /* return last byte in the register. */
5058 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5059- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
5060+ memcpy(valbuf, buf + reg_size - 1, 1);
5061 return;
5062 case 2: /* return last 2 bytes in register. */
5063 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
5064- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
5065+ memcpy(valbuf, buf + reg_size - 2, 2);
5066 return;
5067 case 4: /* for sizes 4 or 8, copy the required length. */
5068 case 8:
5069@@ -754,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache)
5070 }
5071 #endif
5072
5073+static void 3924+static void
5074+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) 3925+set_microblaze_command (const char *args, int from_tty)
5075+{ 3926+{
5076+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc); 3927+ printf_unfiltered
3928+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
3929+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
5077+} 3930+}
5078+ 3931+
5079 static int dwarf2_to_reg_map[78] = 3932 static const char * const microblaze_register_names[] =
5080 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
5081 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
5082@@ -788,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
5083 static void
5084 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
5085 { 3933 {
5086+ 3934 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
5087 register_remote_g_packet_guess (gdbarch, 3935@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] =
5088 4 * MICROBLAZE_NUM_CORE_REGS, 3936 static unsigned int microblaze_debug_flag = 0;
5089- tdesc_microblaze); 3937 int reg_size = 4;
5090+ tdesc_microblaze64);
5091
5092 register_remote_g_packet_guess (gdbarch,
5093 4 * MICROBLAZE_NUM_REGS,
5094- tdesc_microblaze_with_stack_protect);
5095+ tdesc_microblaze64_with_stack_protect);
5096 }
5097
5098 void
5099@@ -802,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset,
5100 struct regcache *regcache,
5101 int regnum, const void *gregs)
5102 {
5103- const unsigned int *regs = (const unsigned int *)gregs;
5104+ const gdb_byte *regs = (const gdb_byte *) gregs;
5105 if (regnum >= 0)
5106 regcache->raw_supply (regnum, regs + regnum);
5107
5108@@ -810,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset,
5109 int i;
5110
5111 for (i = 0; i < 50; i++) {
5112- regcache->raw_supply (i, regs + i);
5113+ regcache->raw_supply (regnum, regs + i);
5114 }
5115 }
5116 }
5117@@ -833,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
5118 }
5119
5120 3938
5121+static void 3939+unsigned int
5122+make_regs (struct gdbarch *arch) 3940+microblaze_abi_regsize (struct gdbarch *gdbarch)
5123+{ 3941+{
5124+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch); 3942+ switch (microblaze_abi (gdbarch))
5125+ int mach = gdbarch_bfd_arch_info (arch)->mach;
5126+
5127+ if (mach == bfd_mach_microblaze64)
5128+ { 3943+ {
5129+ set_gdbarch_ptr_bit (arch, 64); 3944+ case MICROBLAZE_ABI_M64:
3945+ return 8;
3946+ default:
3947+ return 4;
5130+ } 3948+ }
5131+} 3949+}
3950+
3951 #define microblaze_debug(fmt, ...) \
3952 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
3953- fmt, ## __VA_ARGS__)
3954+ fmt, ## __VA_ARGS__)
5132 3955
5133 static struct gdbarch * 3956
3957 /* Return the name of register REGNUM. */
3958@@ -867,15 +966,30 @@ static struct gdbarch *
5134 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3959 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5135@@ -846,8 +875,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3960 {
5136 if (arches != NULL) 3961 tdesc_arch_data_up tdesc_data;
3962+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
3963 const struct target_desc *tdesc = info.target_desc;
3964
3965+ /* What has the user specified from the command line? */
3966+ wanted_abi = global_microblaze_abi ();
3967+ if (gdbarch_debug)
3968+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
3969+ wanted_abi);
3970+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
3971+ microblaze_abi = wanted_abi;
3972+
3973 /* If there is already a candidate, use it. */
3974 arches = gdbarch_list_lookup_by_info (arches, &info);
3975- if (arches != NULL)
3976+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
5137 return arches->gdbarch; 3977 return arches->gdbarch;
5138 if (tdesc == NULL) 3978+
5139- tdesc = tdesc_microblaze; 3979+ if (microblaze_abi == MICROBLAZE_ABI_M64)
5140-
5141+ { 3980+ {
5142+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 3981+ tdesc = tdesc_microblaze64;
5143+ {
5144+ tdesc = tdesc_microblaze64;
5145+ reg_size = 8; 3982+ reg_size = 8;
5146+ }
5147+ else
5148+ tdesc = tdesc_microblaze;
5149+ } 3983+ }
5150 /* Check any target description for validity. */ 3984 if (tdesc == NULL)
5151 if (tdesc_has_registers (tdesc))
5152 { 3985 {
5153@@ -855,31 +891,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 3986- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
3987+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
3988 {
3989 tdesc = tdesc_microblaze64;
3990 reg_size = 8;
3991@@ -890,7 +1004,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5154 int valid_p; 3992 int valid_p;
5155 int i; 3993 int i;
5156 3994
5157- feature = tdesc_find_feature (tdesc, 3995- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5158- "org.gnu.gdb.microblaze.core"); 3996+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
5159+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) 3997 feature = tdesc_find_feature (tdesc,
5160+ feature = tdesc_find_feature (tdesc, 3998 "org.gnu.gdb.microblaze64.core");
5161+ "org.gnu.gdb.microblaze64.core"); 3999 else
5162+ else 4000@@ -904,7 +1018,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5163+ feature = tdesc_find_feature (tdesc, 4001 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
5164+ "org.gnu.gdb.microblaze.core"); 4002 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
5165 if (feature == NULL) 4003 microblaze_register_names[i]);
5166 return NULL; 4004- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5167 tdesc_data = tdesc_data_alloc (); 4005+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
5168 4006 feature = tdesc_find_feature (tdesc,
5169 valid_p = 1; 4007 "org.gnu.gdb.microblaze64.stack-protect");
5170- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++) 4008 else
5171- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i, 4009@@ -954,7 +1068,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
5172- microblaze_register_names[i]); 4010 set_gdbarch_ptr_bit (gdbarch, 64);
5173- feature = tdesc_find_feature (tdesc, 4011 break;
5174- "org.gnu.gdb.microblaze.stack-protect");
5175+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
5176+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
5177+ microblaze_register_names[i]);
5178+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
5179+ feature = tdesc_find_feature (tdesc,
5180+ "org.gnu.gdb.microblaze64.stack-protect");
5181+ else
5182+ feature = tdesc_find_feature (tdesc,
5183+ "org.gnu.gdb.microblaze.stack-protect");
5184 if (feature != NULL)
5185- {
5186- valid_p = 1;
5187- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
5188- MICROBLAZE_SLR_REGNUM,
5189- "rslr");
5190- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
5191- MICROBLAZE_SHR_REGNUM,
5192- "rshr");
5193- }
5194+ {
5195+ valid_p = 1;
5196+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
5197+ MICROBLAZE_SLR_REGNUM,
5198+ "slr");
5199+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
5200+ MICROBLAZE_SHR_REGNUM,
5201+ "shr");
5202+ }
5203
5204 if (!valid_p)
5205- return NULL;
5206+ {
5207+ // tdesc_data_cleanup (tdesc_data.get ());
5208+ return NULL;
5209+ }
5210 } 4012 }
5211 4013-
5212 /* Allocate space for the new architecture. */ 4014+ if(microblaze_abi == MICROBLAZE_ABI_M64)
5213@@ -899,7 +946,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4015+ set_gdbarch_ptr_bit (gdbarch, 64);
5214 /* Register numbers of various important registers. */ 4016
5215 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
5216 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
5217+
5218+ /* Register set.
5219+ make_regs (gdbarch); */
5220+ switch (info.bfd_arch_info->mach)
5221+ {
5222+ case bfd_mach_microblaze64:
5223+ set_gdbarch_ptr_bit (gdbarch, 64);
5224+ break;
5225+ }
5226
5227+
5228 /* Map Dwarf2 registers to GDB registers. */ 4017 /* Map Dwarf2 registers to GDB registers. */
5229 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum); 4018 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
4019@@ -1014,6 +1129,38 @@ _initialize_microblaze_tdep ()
4020 {
4021 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
5230 4022
5231@@ -919,7 +976,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4023+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
5232 microblaze_breakpoint::kind_from_pc); 4024+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
5233 set_gdbarch_sw_breakpoint_from_kind (gdbarch, 4025+
5234 microblaze_breakpoint::bp_from_kind); 4026+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
5235- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 4027+
5236+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint); 4028+ add_setshow_prefix_cmd ("microblaze", no_class,
5237+ 4029+ _("Various microblaze specific commands."),
5238+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); 4030+ _("Various microblaze specific commands."),
5239 4031+ &setmicroblazecmdlist,&showmicroblazecmdlist,
5240 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step); 4032+ &setlist,&showlist);
5241 4033+#if 0
5242@@ -927,7 +986,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4034+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
5243 4035+ _("Various microblaze specific commands."),
5244 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); 4036+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
5245 4037+
5246- microblaze_register_g_packet_guesses (gdbarch); 4038+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
5247+ //microblaze_register_g_packet_guesses (gdbarch); 4039+ _("Various microblaze specific commands."),
5248 4040+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
5249 frame_base_set_default (gdbarch, &microblaze_frame_base); 4041+#endif
5250 4042+
5251@@ -942,12 +1001,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 4043+ /* Allow the user to override the ABI. */
5252 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data)); 4044+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
5253 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer); 4045+ &microblaze_abi_string, _("\
4046+Set the microblaze ABI used by this program."), _("\
4047+Show the microblaze ABI used by this program."), _("\
4048+This option can be set to one of:\n\
4049+ auto - the default ABI associated with the current binary\n\
4050+ m64"),
4051+ microblaze_abi_update,
4052+ show_microblaze_abi,
4053+ &setmicroblazecmdlist, &showmicroblazecmdlist);
4054+
4055 initialize_tdesc_microblaze_with_stack_protect ();
4056 initialize_tdesc_microblaze ();
4057 initialize_tdesc_microblaze64_with_stack_protect ();
4058@@ -1028,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."),
4059 NULL,
4060 &setdebuglist, &showdebuglist);
5254 4061
5255- /* If we have register sets, enable the generic core file support. */
5256+ /* If we have register sets, enable the generic core file support.
5257 if (tdep->gregset) {
5258 set_gdbarch_iterate_over_regset_sections (gdbarch,
5259 microblaze_iterate_over_regset_sections);
5260- }
5261- 4062-
5262+ }*/
5263 return gdbarch;
5264 } 4063 }
5265
5266@@ -959,6 +1017,8 @@ _initialize_microblaze_tdep ()
5267
5268 initialize_tdesc_microblaze_with_stack_protect ();
5269 initialize_tdesc_microblaze ();
5270+ initialize_tdesc_microblaze64_with_stack_protect ();
5271+ initialize_tdesc_microblaze64 ();
5272 /* Debug this files internals. */
5273 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
5274 &microblaze_debug_flag, _("\
5275diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h 4064diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
5276index 2415acfe7b6..f4d810303ca 100644 4065index 81f7f30cb8e..f6cef7c9a33 100644
5277--- a/gdb/microblaze-tdep.h 4066--- a/gdb/microblaze-tdep.h
5278+++ b/gdb/microblaze-tdep.h 4067+++ b/gdb/microblaze-tdep.h
5279@@ -28,7 +28,7 @@ struct microblaze_gregset 4068@@ -19,9 +19,17 @@
5280 microblaze_gregset() {}
5281 unsigned int gregs[32];
5282 unsigned int fpregs[32];
5283- unsigned int pregs[16];
5284+ unsigned int pregs[18];
5285 };
5286
5287 struct microblaze_gdbarch_tdep : gdbarch_tdep
5288@@ -134,7 +134,7 @@ struct microblaze_frame_cache
5289 struct trad_frame_saved_reg *saved_regs;
5290 };
5291 /* All registers are 32 bits. */
5292-#define MICROBLAZE_REGISTER_SIZE 4
5293+//#define MICROBLAZE_REGISTER_SIZE 8
5294
5295 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
5296 Only used for native debugging. */
5297diff --git a/include/elf/common.h b/include/elf/common.h
5298index 70d63e3299c..8aa330d6631 100644
5299--- a/include/elf/common.h
5300+++ b/include/elf/common.h
5301@@ -360,6 +360,7 @@
5302 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
5303 #define EM_TACHYUM 261 /* Tachyum */
5304 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
5305+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
5306
5307 /* If it is necessary to assign new unofficial EM_* values, please pick large
5308 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
5309diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
5310index 43ad3ad3904..79799b86a49 100644
5311--- a/include/elf/microblaze.h
5312+++ b/include/elf/microblaze.h
5313@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
5314 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
5315 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
5316 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
5317+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
5318+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
5319+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
5320+
5321 END_RELOC_NUMBERS (R_MICROBLAZE_max)
5322
5323 /* Global base address names. */
5324diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
5325index b057492ba93..283d87c04a2 100644
5326--- a/opcodes/microblaze-dis.c
5327+++ b/opcodes/microblaze-dis.c
5328@@ -33,6 +33,7 @@
5329 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
5330 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
5331 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
5332+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
5333 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
5334
5335 #define NUM_STRBUFS 3
5336@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
5337 }
5338 4069
5339 static char * 4070 #ifndef MICROBLAZE_TDEP_H
5340-get_field_imm5 (struct string_buf *buf, long instr) 4071 #define MICROBLAZE_TDEP_H 1
5341+get_field_imml (struct string_buf *buf, long instr) 4072-
5342 { 4073+#include "objfiles.h"
5343 char *p = strbuf (buf); 4074 #include "gdbarch.h"
5344
5345- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
5346+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
5347+ return p;
5348+}
5349+
5350+static char *
5351+get_field_imms (struct string_buf *buf, long instr)
5352+{
5353+ char *p = strbuf (buf);
5354+
5355+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
5356 return p;
5357 }
5358
5359@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
5360 return p;
5361 }
5362
5363+static char *
5364+get_field_immw (struct string_buf *buf, long instr)
5365+{
5366+ char *p = strbuf (buf);
5367+
5368+ if (instr & 0x00004000)
5369+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
5370+ else
5371+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
5372+ return p;
5373+}
5374+
5375 static char *
5376 get_field_rfsl (struct string_buf *buf, long instr)
5377 {
5378@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5379 }
5380 }
5381 break;
5382- case INST_TYPE_RD_R1_IMM5:
5383+ case INST_TYPE_RD_R1_IMML:
5384+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
5385+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
5386+ /* TODO: Also print symbol */
5387+ break;
5388+ case INST_TYPE_RD_R1_IMMS:
5389 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
5390- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
5391+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
5392 break;
5393 case INST_TYPE_RD_RFSL:
5394 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
5395@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5396 }
5397 }
5398 break;
5399- case INST_TYPE_RD_R2:
5400- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
5401- get_field_r2 (&buf, inst));
5402+ case INST_TYPE_IMML:
5403+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
5404+ /* TODO: Also print symbol */
5405+ break;
5406+ case INST_TYPE_RD_R2:
5407+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
5408 break;
5409 case INST_TYPE_R2:
5410 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
5411@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
5412 /* For mbar 16 or sleep insn. */
5413 case INST_TYPE_NONE:
5414 break;
5415- /* For tuqula instruction */
5416+ /* For bit field insns. */
5417+ case INST_TYPE_RD_R1_IMMW_IMMS:
5418+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
5419+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
5420+ break;
5421+ /* For tuqula instruction */
5422 case INST_TYPE_RD:
5423 print_func (stream, "\t%s", get_field_rd (&buf, inst));
5424 break;
5425diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
5426index ffb0f08c692..5e45df995de 100644
5427--- a/opcodes/microblaze-opc.h
5428+++ b/opcodes/microblaze-opc.h
5429@@ -40,7 +40,7 @@
5430 #define INST_TYPE_RD_SPECIAL 11
5431 #define INST_TYPE_R1 12
5432 /* New instn type for barrel shift imms. */
5433-#define INST_TYPE_RD_R1_IMM5 13
5434+#define INST_TYPE_RD_R1_IMMS 13
5435 #define INST_TYPE_RD_RFSL 14
5436 #define INST_TYPE_R1_RFSL 15
5437
5438@@ -59,6 +59,15 @@
5439 /* For mbar. */
5440 #define INST_TYPE_IMM5 20
5441
5442+/* For bsefi and bsifi */
5443+#define INST_TYPE_RD_R1_IMMW_IMMS 21
5444+
5445+/* For 64-bit instructions */
5446+#define INST_TYPE_IMML 22
5447+#define INST_TYPE_RD_R1_IMML 23
5448+#define INST_TYPE_R1_IMML 24
5449+#define INST_TYPE_RD_R1_IMMW_IMMS 21
5450+
5451 #define INST_TYPE_NONE 25
5452
5453
5454@@ -88,10 +97,14 @@
5455 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
5456 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
5457 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
5458-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
5459+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
5460+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
5461 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
5462+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
5463 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
5464+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
5465 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
5466+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
5467
5468 /* New Mask for msrset, msrclr insns. */
5469 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
5470@@ -101,7 +114,7 @@
5471 #define DELAY_SLOT 1
5472 #define NO_DELAY_SLOT 0
5473
5474-#define MAX_OPCODES 289
5475+#define MAX_OPCODES 412
5476 4075
5477 const struct op_code_struct 4076+struct gdbarch;
4077+enum microblaze_abi
4078+ {
4079+ MICROBLAZE_ABI_AUTO = 0,
4080+ MICROBLAZE_ABI_M64,
4081+ };
4082+
4083+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
4084 /* Microblaze architecture-specific information. */
4085 struct microblaze_gregset
5478 { 4086 {
5479@@ -119,6 +132,7 @@ const struct op_code_struct 4087@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep_base
5480 /* More info about output format here. */
5481 } microblaze_opcodes[MAX_OPCODES] =
5482 { 4088 {
5483+ /* 32-bit instructions */ 4089 int dummy; // declare something.
5484 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
5485 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
5486 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
5487@@ -155,9 +169,11 @@ const struct op_code_struct
5488 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
5489 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
5490 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
5491- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
5492- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
5493- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
5494+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
5495+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
5496+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
5497+ {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
5498+ {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
5499 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
5500 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
5501 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
5502@@ -174,9 +190,14 @@ const struct op_code_struct
5503 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
5504 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
5505 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
5506+ {"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 },
5507 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
5508+ {"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 },
5509+ {"wdc.clear.ea", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E6, OPCODE_MASK_H34B, wdcclearea, special_inst },
5510 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
5511+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst },
5512 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
5513+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst },
5514 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
5515 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
5516 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
5517@@ -226,18 +247,24 @@ const struct op_code_struct
5518 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
5519 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
5520 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
5521+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst },
5522 {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
5523 {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst },
5524+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst },
5525 {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
5526 {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst },
5527 {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
5528+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst },
5529 {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
5530 {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst },
5531+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst },
5532 {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
5533 {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst },
5534+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst },
5535 {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
5536 {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst },
5537 {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
5538+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst },
5539 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
5540 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
5541 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
5542@@ -248,9 +275,7 @@ const struct op_code_struct
5543 {"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. */
5544 {"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. */
5545 {"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. */
5546- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5547 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
5548- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
5549 {"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 },
5550 {"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 },
5551 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
5552@@ -402,8 +427,135 @@ const struct op_code_struct
5553 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
5554 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
5555 {"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. */
5556+ {"hibernate", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB9020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 8. */
5557+ {"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. */
5558 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
5559 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
5560+
5561+ /* 64-bit instructions */
5562+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
5563+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
5564+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
5565+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
5566+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
5567+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
5568+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
5569+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
5570+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
5571+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
5572+ {"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 */
5573+ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5574+ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5575+ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5576+ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5577+ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5578+ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5579+ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
5580+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
5581+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
5582+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
5583+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
5584+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
5585+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
5586+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
5587+ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst },
5588+ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst },
5589+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
5590+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
5591+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
5592+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
5593+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
5594+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
5595+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
5596+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
5597+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
5598+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
5599+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
5600+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
5601+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
5602+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
5603+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
5604+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
5605+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
5606+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
5607+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
5608+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
5609+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
5610+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
5611+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
5612+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
5613+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
5614+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
5615+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
5616+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
5617+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
5618+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
5619+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
5620+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
5621+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
5622+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
5623+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
5624+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
5625+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
5626+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
5627+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
5628+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
5629+ {"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 */
5630+ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5631+ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5632+ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
5633+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
5634+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
5635+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
5636+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
5637+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
5638+ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */
5639+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
5640+ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */
5641+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
5642+ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */
5643+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
5644+ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */
5645+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
5646+ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */
5647+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
5648+ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */
5649+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
5650+ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */
5651+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
5652+ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */
5653+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
5654+ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */
5655+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
5656+ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */
5657+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
5658+ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */
5659+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
5660+ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */
5661+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
5662+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
5663+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
5664+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
5665+ {"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 */
5666+ {"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 */
5667+ {"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 */
5668+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
5669+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
5670+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
5671+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
5672+ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst },
5673+ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst },
5674+ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst },
5675+ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst },
5676+ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst },
5677+ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst },
5678+ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst },
5679+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
5680+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
5681+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
5682+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
5683+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
5684+
5685 {"", 0, 0, 0, 0, 0, 0, 0, 0},
5686 };
5687
5688@@ -424,5 +576,17 @@ char pvr_register_prefix[] = "rpvr";
5689 #define MIN_IMM5 ((int) 0x00000000)
5690 #define MAX_IMM5 ((int) 0x0000001f)
5691 4090
5692+#define MIN_IMM6 ((int) 0x00000000) 4091+ enum microblaze_abi microblaze_abi {};
5693+#define MAX_IMM6 ((int) 0x0000003f) 4092+ enum microblaze_abi found_abi {};
5694+ 4093 /* Register sets. */
5695+#define MIN_IMM_WIDTH ((int) 0x00000001) 4094 struct regset *gregset;
5696+#define MAX_IMM_WIDTH ((int) 0x00000020) 4095 size_t sizeof_gregset;
5697+ 4096 struct regset *fpregset;
5698+#define MIN_IMM6_WIDTH ((int) 0x00000001) 4097 size_t sizeof_fpregset;
5699+#define MAX_IMM6_WIDTH ((int) 0x00000040) 4098+ int register_size;
5700+
5701+#define MIN_IMML ((long) 0xffffff8000000000L)
5702+#define MAX_IMML ((long) 0x0000007fffffffffL)
5703+
5704 #endif /* MICROBLAZE_OPC */
5705
5706diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
5707index 8e293465fec..254d9fe911e 100644
5708--- a/opcodes/microblaze-opcm.h
5709+++ b/opcodes/microblaze-opcm.h
5710@@ -25,22 +25,23 @@
5711
5712 enum microblaze_instr
5713 {
5714+ /* 32-bit instructions */
5715 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
5716 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
5717 mulh, mulhu, mulhsu,swapb,swaph,
5718 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
5719- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
5720+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
5721 /* 'or/and/xor' are C++ keywords. */
5722 microblaze_or, microblaze_and, microblaze_xor,
5723 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
5724- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
5725- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
5726- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5727+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse,
5728+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd,
5729+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
5730 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
5731 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
5732- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
5733- shr, sw, swr, swx, lbui, lhui, lwi,
5734- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5735+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
5736+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
5737+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5738 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
5739 /* 'fsqrt' is a glibc:math.h symbol. */
5740 fint, microblaze_fsqrt,
5741@@ -59,6 +60,18 @@ enum microblaze_instr
5742 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
5743 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
5744 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
5745+
5746+ /* 64-bit instructions */
5747+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
5748+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
5749+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
5750+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
5751+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
5752+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
5753+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
5754+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
5755+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
5756+ dcmp_un, dbl, dlong, dsqrt,
5757 invalid_inst
5758 }; 4099 };
5759 4100
5760@@ -130,18 +143,25 @@ enum microblaze_instr_type 4101 /* Register numbers. */
5761 #define RB_LOW 11 /* Low bit for RB. */
5762 #define IMM_LOW 0 /* Low bit for immediate. */
5763 #define IMM_MBAR 21 /* low bit for mbar instruction. */
5764+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
5765
5766 #define RD_MASK 0x03E00000
5767 #define RA_MASK 0x001F0000
5768 #define RB_MASK 0x0000F800
5769 #define IMM_MASK 0x0000FFFF
5770+#define IMML_MASK 0x00FFFFFF
5771
5772-/* Imm mask for barrel shifts. */
5773+/* Imm masks for barrel shifts. */
5774 #define IMM5_MASK 0x0000001F
5775+#define IMM6_MASK 0x0000003F
5776
5777 /* Imm mask for mbar. */
5778 #define IMM5_MBAR_MASK 0x03E00000
5779
5780+/* Imm masks for extract/insert width. */
5781+#define IMM5_WIDTH_MASK 0x000007C0
5782+#define IMM6_WIDTH_MASK 0x00000FC0
5783+
5784 /* FSL imm mask for get, put instructions. */
5785 #define RFSL_MASK 0x000000F
5786
5787-- 4102--
57882.37.1 (Apple Git-137.1) 41032.34.1
5789 4104
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
index 941a3b9c..6ec184d0 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
@@ -1,32 +1,41 @@
1From 0532b1db08b9d8efc670f7288fe2d8168b8ed0d1 Mon Sep 17 00:00:00 2001 1From bd2d24cf21943babe2e0a73cf68da273a38d7058 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 21 Jul 2022 11:45:01 +0530 3Date: Thu, 21 Jul 2022 11:45:01 +0530
4Subject: [PATCH 8/8] =?UTF-8?q?[Patch,MicroBlaze]:=20Depth:=20=20Total=20n?= 4Subject: [PATCH 09/53] =?UTF-8?q?Depth:=20Total=20number=20of=20inline=20f?=
5 =?UTF-8?q?umber=20of=20inline=20functions=20[refer=20inline-frame.c]=20st?= 5 =?UTF-8?q?unctions=20[refer=20inline-frame.c]=20state->skipped=5Fframes?=
6 =?UTF-8?q?ate->skipped=5Fframes=20:=20Number=20of=20inline=20functions=20?= 6 =?UTF-8?q?=20:=20Number=20of=20inline=20functions=20skipped.=20the=20curr?=
7 =?UTF-8?q?skipped.=20the=20current=20unwind=5Fpc=20is=20causing=20an=20is?= 7 =?UTF-8?q?ent=20unwind=5Fpc=20is=20causing=20an=20issue=20when=20we=20try?=
8 =?UTF-8?q?sue=20when=20we=20try=20to=20step=20into=20inline=20functions[D?= 8 =?UTF-8?q?=20to=20step=20into=20inline=20functions[Depth=20is=20becoming?=
9 =?UTF-8?q?epth=20is=20becoming=200].=20It=E2=80=99s=20incrementing=20pc?= 9 =?UTF-8?q?=200].=20It=E2=80=99s=20incrementing=20pc=20by=208=20even=20wit?=
10 =?UTF-8?q?=20by=208=20even=20with=20si=20instruction.?= 10 =?UTF-8?q?h=20si=20instruction.?=
11MIME-Version: 1.0 11MIME-Version: 1.0
12Content-Type: text/plain; charset=UTF-8 12Content-Type: text/plain; charset=UTF-8
13Content-Transfer-Encoding: 8bit 13Content-Transfer-Encoding: 8bit
14 14
15Upstream-Status: Pending 15Signed-off-by: Aayush Misra <aayushm@amd.com>
16
17Signed-off-by: Mark Hatle <mark.hatle@amd.com>
18
19--- 16---
20 gdb/microblaze-tdep.c | 14 +++----------- 17 gdb/features/microblaze64.xml | 1 +
21 1 file changed, 3 insertions(+), 11 deletions(-) 18 gdb/microblaze-tdep.c | 14 +++-----------
19 2 files changed, 4 insertions(+), 11 deletions(-)
22 20
21diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
22index 515d18e65cf..9c1b7d22003 100644
23--- a/gdb/features/microblaze64.xml
24+++ b/gdb/features/microblaze64.xml
25@@ -7,5 +7,6 @@
26
27 <!DOCTYPE target SYSTEM "gdb-target.dtd">
28 <target>
29+ <architecture>microblaze64</architecture>
30 <xi:include href="microblaze64-core.xml"/>
31 </target>
23diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c 32diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
24index d83072cdaef..38ba38e8c7d 100644 33index 597507e53cd..aed5f2ec30c 100644
25--- a/gdb/microblaze-tdep.c 34--- a/gdb/microblaze-tdep.c
26+++ b/gdb/microblaze-tdep.c 35+++ b/gdb/microblaze-tdep.c
27@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, 36@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
28 static CORE_ADDR 37 static CORE_ADDR
29 microblaze_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) 38 microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
30 { 39 {
31- gdb_byte buf[4]; 40- gdb_byte buf[4];
32 CORE_ADDR pc; 41 CORE_ADDR pc;
@@ -61,5 +70,5 @@ index d83072cdaef..38ba38e8c7d 100644
61 70
62 static CORE_ADDR 71 static CORE_ADDR
63-- 72--
642.37.1 (Apple Git-137.1) 732.34.1
65 74
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
new file mode 100644
index 00000000..78e4970b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
@@ -0,0 +1,133 @@
1From 3616ef25911d9fa8b5c0e4883f19131da48896d5 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:53:04 +0530
4Subject: [PATCH 10/53] Fix gdb-14 build errors for microblaze-xilinx-elf
5 2023.2 merge
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/elf64-microblaze.c | 12 ++++++++++++
10 gdb/frame.c | 2 +-
11 gdb/microblaze-tdep.c | 17 +++++++++++------
12 3 files changed, 24 insertions(+), 7 deletions(-)
13
14diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
15index 6cd9753a592..119d266f95a 100755
16--- a/bfd/elf64-microblaze.c
17+++ b/bfd/elf64-microblaze.c
18@@ -750,6 +750,18 @@ microblaze_elf_info_to_howto (bfd * abfd,
19 return true;
20 }
21
22+/* Relax table contains information about instructions which can
23+ be removed by relaxation -- replacing a long address with a
24+ short address. */
25+struct relax_table
26+{
27+ /* Address where bytes may be deleted. */
28+ bfd_vma addr;
29+
30+ /* Number of bytes to be deleted. */
31+ size_t size;
32+};
33+
34 struct _microblaze_elf_section_data
35 {
36 struct bfd_elf_section_data elf;
37diff --git a/gdb/frame.c b/gdb/frame.c
38index 859e1a6553d..94bb026c4d9 100644
39--- a/gdb/frame.c
40+++ b/gdb/frame.c
41@@ -1319,7 +1319,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
42 int i;
43
44 const gdb_byte *buf = NULL;
45- if (value_entirely_available(value)) {
46+ if (value->entirely_available()) {
47 gdb::array_view<const gdb_byte> buf = value->contents ();
48 }
49
50diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
51index aed5f2ec30c..e1a7a49eb84 100644
52--- a/gdb/microblaze-tdep.c
53+++ b/gdb/microblaze-tdep.c
54@@ -75,7 +75,7 @@ static const char *const microblaze_abi_strings[] = {
55 enum microblaze_abi
56 microblaze_abi (struct gdbarch *gdbarch)
57 {
58- microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
59+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
60 return tdep->microblaze_abi;
61 }
62 /* The registers of the Xilinx microblaze processor. */
63@@ -120,12 +120,12 @@ show_microblaze_abi (struct ui_file *file,
64
65 #if 1
66 if (global_abi == MICROBLAZE_ABI_AUTO)
67- fprintf_filtered
68+ gdb_printf
69 (file,
70 "The microblaze ABI is set automatically (currently \"%s\").\n",
71 actual_abi_str);
72 else if (global_abi == actual_abi)
73- fprintf_filtered
74+ gdb_printf
75 (file,
76 "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
77 actual_abi_str);
78@@ -133,7 +133,7 @@ show_microblaze_abi (struct ui_file *file,
79 {
80 #endif
81 /* Probably shouldn't happen... */
82- fprintf_filtered (file,
83+ gdb_printf (file,
84 "The (auto detected) microblaze ABI \"%s\" is in use "
85 "even though the user setting was \"%s\".\n",
86 actual_abi_str, microblaze_abi_strings[global_abi]);
87@@ -934,7 +934,7 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
88 void *cb_data,
89 const struct regcache *regcache)
90 {
91- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
92+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
93
94 cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
95
96@@ -942,6 +942,8 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
97 }
98
99
100+#if 0
101+// compilation errors - function is not actually used ?
102 static void
103 make_regs (struct gdbarch *arch)
104 {
105@@ -953,6 +955,7 @@ make_regs (struct gdbarch *arch)
106 set_gdbarch_ptr_bit (arch, 64);
107 }
108 }
109+#endif
110
111 static struct gdbarch *
112 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
113@@ -964,7 +967,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
114 /* What has the user specified from the command line? */
115 wanted_abi = global_microblaze_abi ();
116 if (gdbarch_debug)
117- fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
118+ gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
119 wanted_abi);
120 if (wanted_abi != MICROBLAZE_ABI_AUTO)
121 microblaze_abi = wanted_abi;
122@@ -1038,6 +1041,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
123 gdbarch *gdbarch
124 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
125
126+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
127+
128 tdep->gregset = NULL;
129 tdep->sizeof_gregset = 0;
130 tdep->fpregset = NULL;
131--
1322.34.1
133
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
new file mode 100644
index 00000000..d3da41d5
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
@@ -0,0 +1,28 @@
1From 9037b1a9e862263ba935314e8604a922d14c8dd4 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:55:16 +0530
4Subject: [PATCH 11/53] fix gdb microblaze-xilinx-elf crash issue on invocation
5 Regression from merging microblaze 64-bit support
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gdb/microblaze-tdep.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
13index e1a7a49eb84..f9cb3dfda33 100644
14--- a/gdb/microblaze-tdep.c
15+++ b/gdb/microblaze-tdep.c
16@@ -1124,6 +1124,9 @@ void _initialize_microblaze_tdep ();
17 void
18 _initialize_microblaze_tdep ()
19 {
20+ //Setting abi to auto manually, should be able to modify in 'arch'_gdbarch_init function
21+ microblaze_abi_string = microblaze_abi_strings[0];
22+
23 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
24
25 // static struct cmd_list_element *setmicroblazecmdlist = NULL;
26--
272.34.1
28
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0012-Add-mlittle-endian-and-mbig-endian-flags.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0012-Add-mlittle-endian-and-mbig-endian-flags.patch
new file mode 100644
index 00000000..e1074c85
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0012-Add-mlittle-endian-and-mbig-endian-flags.patch
@@ -0,0 +1,46 @@
1From 05a5677c1b5cd7f109c49e6697b6716f7ac0fb97 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 19 Mar 2013 17:18:23 +0530
4Subject: [PATCH 12/53] Add mlittle-endian and mbig-endian flags
5
6Added support in gas for mlittle-endian and mbig-endian flags
7as options.
8
9Updated show usage for MicroBlaze specific assembler options
10to include new entries.
11
12Signed-off-by:nagaraju <nmekala@xilix.com>
13Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 gas/config/tc-microblaze.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
20index c971d187095..62238646a52 100644
21--- a/gas/config/tc-microblaze.c
22+++ b/gas/config/tc-microblaze.c
23@@ -37,6 +37,8 @@
24
25 #define OPTION_EB (OPTION_MD_BASE + 0)
26 #define OPTION_EL (OPTION_MD_BASE + 1)
27+#define OPTION_LITTLE (OPTION_MD_BASE + 2)
28+#define OPTION_BIG (OPTION_MD_BASE + 3)
29
30 void microblaze_generate_symbol (char *sym);
31 static bool check_spl_reg (unsigned *);
32@@ -2565,9 +2567,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
33 switch (c)
34 {
35 case OPTION_EB:
36+ case OPTION_BIG:
37 target_big_endian = 1;
38 break;
39 case OPTION_EL:
40+ case OPTION_LITTLE:
41 target_big_endian = 0;
42 break;
43 default:
44--
452.34.1
46
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0013-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
new file mode 100644
index 00000000..31529d0d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -0,0 +1,35 @@
1From a622ee3ff40515edf05a61a77fbcd8999ecf0905 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 13/53] Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7
8Conflicts:
9 bfd/elf-eh-frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/elf-eh-frame.c | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
16index 9a504234163..5e393558293 100644
17--- a/bfd/elf-eh-frame.c
18+++ b/bfd/elf-eh-frame.c
19@@ -1045,10 +1045,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
20 goto success;
21
22 free_no_table:
23+/* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
24+if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
25 _bfd_error_handler
26 /* xgettext:c-format */
27 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
28 abfd, sec);
29+}
30 hdr_info->u.dwarf.table = false;
31 free (sec_info);
32 success:
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Fix-relaxation-of-assembler-resolved-references-Fixu.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Fix-relaxation-of-assembler-resolved-references-Fixu.patch
new file mode 100644
index 00000000..7574067d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Fix-relaxation-of-assembler-resolved-references-Fixu.patch
@@ -0,0 +1,48 @@
1From 965a464418e8c8968453206f27763043fb38dc64 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 8 Nov 2016 11:54:08 +0530
4Subject: [PATCH 14/53] Fix relaxation of assembler resolved references,Fixup
5 debug_loc sections after linker relaxation Adds a new reloctype
6 R_MICROBLAZE_32_NONE, used for passing reloc info from the assembler to the
7 linker when the linker manages to fully resolve a local symbol reference.
8
9This is a workaround for design flaws in the assembler to
10linker interface with regards to linker relaxation.
11
12Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
14
15Conflicts:
16 bfd/elf32-microblaze.c
17 binutils/readelf.c
18 include/elf/microblaze.h
19
20Conflicts:
21 binutils/readelf.c
22
23Conflicts:
24 bfd/elf32-microblaze.c
25Signed-off-by: Aayush Misra <aayushm@amd.com>
26---
27 binutils/readelf.c | 5 +++++
28 1 file changed, 5 insertions(+)
29
30diff --git a/binutils/readelf.c b/binutils/readelf.c
31index 5e4ad6ea6ad..3ca9f3697d1 100644
32--- a/binutils/readelf.c
33+++ b/binutils/readelf.c
34@@ -15288,6 +15288,11 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
35 || reloc_type == 9 /* R_MICROBLAZE_64_NONE. */);
36 default:
37 return false;
38+ /* REVISIT microblaze-binutils-merge */
39+ case EM_MICROBLAZE:
40+ return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */
41+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
42+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
43 }
44 }
45
46--
472.34.1
48
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
new file mode 100644
index 00000000..c46af2e7
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -0,0 +1,43 @@
1From 07743ed9395bfea466cdbdf0bbe9566fa93165de Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 15/53] upstream change to garbage collection sweep causes mb
5 regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21
22Conflicts:
23 bfd/elflink.c
24Signed-off-by: Aayush Misra <aayushm@amd.com>
25---
26 bfd/elflink.c | 1 -
27 1 file changed, 1 deletion(-)
28
29diff --git a/bfd/elflink.c b/bfd/elflink.c
30index c2494b3e12e..1f8f54cd4e6 100644
31--- a/bfd/elflink.c
32+++ b/bfd/elflink.c
33@@ -6633,7 +6633,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
34
35 inf = (struct elf_gc_sweep_symbol_info *) data;
36 (*inf->hide_symbol) (inf->info, h, true);
37- h->def_regular = 0;
38 h->ref_regular = 0;
39 h->ref_regular_nonweak = 0;
40 }
41--
422.34.1
43
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0016-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Add-new-bit-field-instructions.patch
new file mode 100644
index 00000000..aab6c5d1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Add-new-bit-field-instructions.patch
@@ -0,0 +1,219 @@
1From 39ef5af3dd4551b24a47c8e48af67478183a7149 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 16/53] Add new bit-field instructions
5
6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a
8register and place it right-adjusted in the destination register.
9The other bits in the destination register shall be set to zero
10BSIFI- The instruction shall insert a right-adjusted bit field
11from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged
13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
18
19Conflicts:
20 gas/config/tc-microblaze.c
21 opcodes/microblaze-opc.h
22
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gas/config/tc-microblaze.c | 82 ++++++++++++++++----------------------
26 opcodes/microblaze-dis.c | 18 ++++++++-
27 opcodes/microblaze-opc.h | 6 +++
28 3 files changed, 58 insertions(+), 48 deletions(-)
29
30diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
31index 62238646a52..f13efcae979 100644
32--- a/gas/config/tc-microblaze.c
33+++ b/gas/config/tc-microblaze.c
34@@ -1150,88 +1150,76 @@ md_assemble (char * str)
35 inst |= (reg2 << RA_LOW) & RA_MASK;
36 inst |= (immed << IMM_LOW) & IMM5_MASK;
37 break;
38-
39- case INST_TYPE_RD_R1_IMMW_IMMS:
40+ case INST_TYPE_RD_R1_IMM5_IMM5:
41 if (strcmp (op_end, ""))
42- op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
43+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
44 else
45 {
46- as_fatal (_("Error in statement syntax"));
47- reg1 = 0;
48- }
49-
50+ as_fatal (_("Error in statement syntax"));
51+ reg1 = 0;
52+ }
53 if (strcmp (op_end, ""))
54- op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
55+ op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
56 else
57 {
58- as_fatal (_("Error in statement syntax"));
59- reg2 = 0;
60- }
61+ as_fatal (_("Error in statement syntax"));
62+ reg2 = 0;
63+ }
64
65 /* Check for spl registers. */
66 if (check_spl_reg (&reg1))
67- as_fatal (_("Cannot use special register with this instruction"));
68+ as_fatal (_("Cannot use special register with this instruction"));
69 if (check_spl_reg (&reg2))
70- as_fatal (_("Cannot use special register with this instruction"));
71+ as_fatal (_("Cannot use special register with this instruction"));
72
73 /* Width immediate value. */
74 if (strcmp (op_end, ""))
75- op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH);
76+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH);
77 else
78- as_fatal (_("Error in statement syntax"));
79-
80+ as_fatal (_("Error in statement syntax"));
81 if (exp.X_op != O_constant)
82 {
83- as_warn (_(
84- "Symbol used as immediate width value for bit field instruction"));
85- immed = 1;
86- }
87+ as_warn (_("Symbol used as immediate width value for bit field instruction"));
88+ immed = 1;
89+ }
90 else
91- immed = exp.X_add_number;
92-
93+ immed = exp.X_add_number;
94 if (opcode->instr == bsefi && immed > 31)
95- as_fatal (_("Width value must be less than 32"));
96+ as_fatal (_("Width value must be less than 32"));
97
98 /* Shift immediate value. */
99 if (strcmp (op_end, ""))
100- op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM);
101+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM);
102 else
103- as_fatal (_("Error in statement syntax"));
104-
105+ as_fatal (_("Error in statement syntax"));
106 if (exp.X_op != O_constant)
107- {
108- as_warn (_(
109- "Symbol used as immediate shift value for bit field instruction"));
110- immed2 = 0;
111- }
112+ {
113+ as_warn (_("Symbol used as immediate shift value for bit field instruction"));
114+ immed2 = 0;
115+ }
116 else
117- {
118- output = frag_more (isize);
119- immed2 = exp.X_add_number;
120- }
121-
122+ {
123+ output = frag_more (isize);
124+ immed2 = exp.X_add_number;
125+ }
126 if (immed2 != (immed2 % 32))
127- {
128- as_warn (_("Shift value greater than 32. using <value %% 32>"));
129- immed2 = immed2 % 32;
130- }
131+ {
132+ as_warn (_("Shift value greater than 32. using <value %% 32>"));
133+ immed2 = immed2 % 32;
134+ }
135
136 /* Check combined value. */
137 if (immed + immed2 > 32)
138- as_fatal (_("Width value + shift value must not be greater than 32"));
139+ as_fatal (_("Width value + shift value must not be greater than 32"));
140
141 inst |= (reg1 << RD_LOW) & RD_MASK;
142 inst |= (reg2 << RA_LOW) & RA_MASK;
143-
144 if (opcode->instr == bsefi)
145- inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */
146+ inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */
147 else
148- inst |= ((immed + immed2 - 1) & IMM5_MASK)
149- << IMM_WIDTH_LOW; /* bsifi */
150-
151+ inst |= ((immed + immed2 - 1) & IMM5_MASK) << IMM_WIDTH_LOW; /* bsifi */
152 inst |= (immed2 << IMM_LOW) & IMM5_MASK;
153 break;
154-
155 case INST_TYPE_R1_R2:
156 if (strcmp (op_end, ""))
157 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
158diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
159index ee447cecc3f..45135f9d264 100644
160--- a/opcodes/microblaze-dis.c
161+++ b/opcodes/microblaze-dis.c
162@@ -113,7 +113,19 @@ get_field_immw (struct string_buf *buf, long instr)
163 }
164
165 static char *
166-get_field_rfsl (struct string_buf *buf, long instr)
167+get_field_imm5width (struct string_buf *buf, long instr)
168+{
169+ char *p = strbuf (buf);
170+
171+ if (instr & 0x00004000)
172+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
173+ else
174+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
175+ return p;
176+}
177+
178+static char *
179+get_field_rfsl (struct string_buf *buf,long instr)
180 {
181 char *p = strbuf (buf);
182
183@@ -462,6 +474,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
184 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
185 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
186 break;
187+ /* For bit field insns. */
188+ case INST_TYPE_RD_R1_IMM5_IMM5:
189+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
190+ break;
191 /* For tuqula instruction */
192 case INST_TYPE_RD:
193 print_func (stream, "\t%s", get_field_rd (&buf, inst));
194diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
195index afc1220e357..a952b9ac3c2 100644
196--- a/opcodes/microblaze-opc.h
197+++ b/opcodes/microblaze-opc.h
198@@ -67,6 +67,9 @@
199 #define INST_TYPE_RD_R1_IMML 23
200 #define INST_TYPE_R1_IMML 24
201
202+/* For bsefi and bsifi */
203+#define INST_TYPE_RD_R1_IMM5_IMM5 21
204+
205 #define INST_TYPE_NONE 25
206
207
208@@ -586,5 +589,8 @@ char pvr_register_prefix[] = "rpvr";
209 #define MIN_IMML ((long) 0xffffff8000000000L)
210 #define MAX_IMML ((long) 0x0000007fffffffffL)
211
212+#define MIN_IMM_WIDTH ((int) 0x00000001)
213+#define MAX_IMM_WIDTH ((int) 0x00000020)
214+
215 #endif /* MICROBLAZE_OPC */
216
217--
2182.34.1
219
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0017-fixed-bug-in-GCC-so-that-It-will-support-.long-0U-an.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0017-fixed-bug-in-GCC-so-that-It-will-support-.long-0U-an.patch
new file mode 100644
index 00000000..f679971d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0017-fixed-bug-in-GCC-so-that-It-will-support-.long-0U-an.patch
@@ -0,0 +1,34 @@
1From ea27bc6ec052b20f4c193054ecdef9bd4ecbcde7 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Fri, 29 Sep 2017 18:00:23 +0530
4Subject: [PATCH 17/53] fixed bug in GCC so that It will support .long 0U and
5 .long 0u
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gas/expr.c | 9 +++++++++
10 1 file changed, 9 insertions(+)
11
12diff --git a/gas/expr.c b/gas/expr.c
13index 3a01b88e310..8214bdf3263 100644
14--- a/gas/expr.c
15+++ b/gas/expr.c
16@@ -833,6 +833,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
17 break;
18 }
19 }
20+ if ((*input_line_pointer == 'U') || (*input_line_pointer == 'u'))
21+ {
22+ input_line_pointer--;
23+
24+ integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri)
25+ ? 0 : 10,
26+ expressionP);
27+ break;
28+ }
29 c = *input_line_pointer;
30 switch (c)
31 {
32--
332.34.1
34
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Compiler-will-give-error-messages-in-more-detail-for.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Compiler-will-give-error-messages-in-more-detail-for.patch
new file mode 100644
index 00000000..c63f4566
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Compiler-will-give-error-messages-in-more-detail-for.patch
@@ -0,0 +1,37 @@
1From 3056650d65b5bfa34bf16cd1ee7829a64dfb19ac Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 21 Feb 2018 12:32:02 +0530
4Subject: [PATCH 18/53] Compiler will give error messages in more detail for
5 mxl-gp-opt flag..
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 ld/ldmain.c | 12 ++++++++++++
10 1 file changed, 12 insertions(+)
11
12diff --git a/ld/ldmain.c b/ld/ldmain.c
13index e90c2021b33..e135939fade 100644
14--- a/ld/ldmain.c
15+++ b/ld/ldmain.c
16@@ -1575,6 +1575,18 @@ reloc_overflow (struct bfd_link_info *info,
17 break;
18 case bfd_link_hash_defined:
19 case bfd_link_hash_defweak:
20+
21+ if((strcmp(reloc_name,"R_MICROBLAZE_SRW32") == 0) && entry->type == bfd_link_hash_defined)
22+ {
23+ einfo (_(" relocation truncated to fit: don't enable small data pointer optimizations[mxl-gp-opt] if extern or multiple declarations used: "
24+ "%s against symbol `%T' defined in %A section in %B"),
25+ reloc_name, entry->root.string,
26+ entry->u.def.section,
27+ entry->u.def.section == bfd_abs_section_ptr
28+ ? info->output_bfd : entry->u.def.section->owner);
29+ break;
30+ }
31+
32 einfo (_(" relocation truncated to fit: "
33 "%s against symbol `%pT' defined in %pA section in %pB"),
34 reloc_name, entry->root.string,
35--
362.34.1
37
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0019-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..452c1418
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,202 @@
1From 06c3e8ef9bdea329af1099e14abbde3d76a114a9 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 19/53] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/bfd-in2.h | 14 ++++++++++++--
17 bfd/libbfd.h | 2 ++
18 bfd/reloc.c | 18 +++++++++++++++---
19 gas/config/tc-microblaze.h | 4 +++-
20 ld/Makefile.am | 2 ++
21 ld/configure.tgt | 3 +++
22 opcodes/microblaze-dis.c | 8 ++++++--
23 opcodes/microblaze-opc.h | 11 +++++++----
24 8 files changed, 50 insertions(+), 12 deletions(-)
25
26diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
27index 7ccc155394d..8b2815d7303 100644
28--- a/bfd/bfd-in2.h
29+++ b/bfd/bfd-in2.h
30@@ -6472,8 +6472,13 @@ done here - only used for relaxing */
31 BFD_RELOC_MICROBLAZE_64_NONE,
32
33 /* This is a 64 bit reloc that stores the 32 bit pc relative value in
34- two words (with an imm instruction). The relocation is PC-relative
35- GOT offset. */
36+ two words (with an imm instruction). No relocation is done here
37+ only used for relaxing */
38+ BFD_RELOC_MICROBLAZE_64,
39+
40+/* This is a 64 bit reloc that stores the 32 bit pc relative
41+value in two words (with an imm instruction). The relocation is
42+PC-relative GOT offset */
43 BFD_RELOC_MICROBLAZE_64_GOTPC,
44
45 /* This is a 64 bit reloc that stores the 32 bit pc relative
46@@ -6481,6 +6486,11 @@ value in two words (with an imml instruction). The relocation is
47 PC-relative GOT offset */
48 BFD_RELOC_MICROBLAZE_64_GPC,
49
50+/* This is a 64 bit reloc that stores the 32 bit pc relative
51+value in two words (with an imml instruction). The relocation is
52+PC-relative GOT offset */
53+ BFD_RELOC_MICROBLAZE_64_GPC,
54+
55 /* This is a 64 bit reloc that stores the 32 bit pc relative
56 value in two words (with an imm instruction). The relocation is
57 GOT offset */
58diff --git a/bfd/libbfd.h b/bfd/libbfd.h
59index 7a3e558d70a..603ed8260cb 100644
60--- a/bfd/libbfd.h
61+++ b/bfd/libbfd.h
62@@ -3005,7 +3005,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
63 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
64 "BFD_RELOC_MICROBLAZE_32_NONE",
65 "BFD_RELOC_MICROBLAZE_64_NONE",
66+ "BFD_RELOC_MICROBLAZE_64",
67 "BFD_RELOC_MICROBLAZE_64_GOTPC",
68+ "BFD_RELOC_MICROBLAZE_64_GPC",
69 "BFD_RELOC_MICROBLAZE_64_GOT",
70 "BFD_RELOC_MICROBLAZE_64_PLT",
71 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
72diff --git a/bfd/reloc.c b/bfd/reloc.c
73index fda67e5ffda..3e8647f601e 100644
74--- a/bfd/reloc.c
75+++ b/bfd/reloc.c
76@@ -6677,12 +6677,24 @@ ENUMDOC
77 This is a 64 bit reloc that stores the 32 bit pc relative value in
78 two words (with an imm instruction). No relocation is done here -
79 only used for relaxing.
80+ENUM
81+ BFD_RELOC_MICROBLAZE_64
82+ENUMDOC
83+ This is a 64 bit reloc that stores the 32 bit pc relative
84+ value in two words (with an imm instruction). No relocation is
85+ done here - only used for relaxing
86 ENUM
87 BFD_RELOC_MICROBLAZE_64_GOTPC
88 ENUMDOC
89- This is a 64 bit reloc that stores the 32 bit pc relative value in
90- two words (with an imm instruction). The relocation is PC-relative
91- GOT offset.
92+ This is a 64 bit reloc that stores the 32 bit pc relative
93+ value in two words (with an imml instruction). No relocation is
94+ done here - only used for relaxing
95+ENUM
96+ BFD_RELOC_MICROBLAZE_64_GPC
97+ENUMDOC
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 ENUM
102 BFD_RELOC_MICROBLAZE_64_GOT
103 ENUMDOC
104diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
105index 20d0da5496d..f0f861c3373 100644
106--- a/gas/config/tc-microblaze.h
107+++ b/gas/config/tc-microblaze.h
108@@ -81,7 +81,9 @@ extern const struct relax_type md_relax_table[];
109
110 #ifdef OBJ_ELF
111
112-#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
113+#define TARGET_FORMAT microblaze_target_format()
114+extern const char *microblaze_target_format (void);
115+//#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
116
117 #define ELF_TC_SPECIAL_SECTIONS \
118 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
119diff --git a/ld/Makefile.am b/ld/Makefile.am
120index f9ee05b1400..c1daf842444 100644
121--- a/ld/Makefile.am
122+++ b/ld/Makefile.am
123@@ -424,6 +424,8 @@ ALL_64_EMULATION_SOURCES = \
124 eelf32ltsmipn32.c \
125 eelf32ltsmipn32_fbsd.c \
126 eelf32mipswindiss.c \
127+ eelf64microblazeel.c \
128+ eelf64microblaze.c \
129 eelf64_aix.c \
130 eelf64_ia64.c \
131 eelf64_ia64_fbsd.c \
132diff --git a/ld/configure.tgt b/ld/configure.tgt
133index f937f78b876..a9d3004e445 100644
134--- a/ld/configure.tgt
135+++ b/ld/configure.tgt
136@@ -527,6 +527,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux"
137 microblazeel*) targ_emul=elf32microblazeel
138 targ_extra_emuls=elf32microblaze
139 ;;
140+microblazeel64*) targ_emul=elf64microblazeel
141+ targ_extra_emuls=elf64microblaze
142+ ;;
143 microblaze*) targ_emul=elf32microblaze
144 targ_extra_emuls=elf32microblazeel
145 ;;
146diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
147index 45135f9d264..45262aef909 100644
148--- a/opcodes/microblaze-dis.c
149+++ b/opcodes/microblaze-dis.c
150@@ -457,6 +457,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
151 case INST_TYPE_R1_R2_SPECIAL:
152 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
153 get_field_r2 (&buf, inst));
154+ break;
155+ case INST_TYPE_IMML:
156+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
157+ /* TODO: Also print symbol */
158 break;
159 case INST_TYPE_RD_IMM15:
160 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
161@@ -475,8 +479,8 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
162 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
163 break;
164 /* For bit field insns. */
165- case INST_TYPE_RD_R1_IMM5_IMM5:
166- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
167+ case INST_TYPE_RD_R1_IMMW_IMMS:
168+ 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));
169 break;
170 /* For tuqula instruction */
171 case INST_TYPE_RD:
172diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
173index a952b9ac3c2..d9d05721dae 100644
174--- a/opcodes/microblaze-opc.h
175+++ b/opcodes/microblaze-opc.h
176@@ -68,7 +68,13 @@
177 #define INST_TYPE_R1_IMML 24
178
179 /* For bsefi and bsifi */
180-#define INST_TYPE_RD_R1_IMM5_IMM5 21
181+#define INST_TYPE_RD_R1_IMMW_IMMS 21
182+
183+/* For 64-bit instructions */
184+#define INST_TYPE_IMML 22
185+#define INST_TYPE_RD_R1_IMML 23
186+#define INST_TYPE_R1_IMML 24
187+#define INST_TYPE_RD_R1_IMMW_IMMS 21
188
189 #define INST_TYPE_NONE 25
190
191@@ -589,8 +595,5 @@ char pvr_register_prefix[] = "rpvr";
192 #define MIN_IMML ((long) 0xffffff8000000000L)
193 #define MAX_IMML ((long) 0x0000007fffffffffL)
194
195-#define MIN_IMM_WIDTH ((int) 0x00000001)
196-#define MAX_IMM_WIDTH ((int) 0x00000020)
197-
198 #endif /* MICROBLAZE_OPC */
199
200--
2012.34.1
202
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0020-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..f3073f1e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,82 @@
1From f46a81a4ffa73453403a5e99e7005a8f1d974ecf Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 20/53] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 23 +++++++++++++++++++++++
17 ld/emulparams/elf64microblazeel.sh | 23 +++++++++++++++++++++++
18 2 files changed, 46 insertions(+)
19 create mode 100644 ld/emulparams/elf64microblaze.sh
20 create mode 100644 ld/emulparams/elf64microblazeel.sh
21
22diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
23new file mode 100644
24index 00000000000..9c7b0eb7080
25--- /dev/null
26+++ b/ld/emulparams/elf64microblaze.sh
27@@ -0,0 +1,23 @@
28+SCRIPT_NAME=elfmicroblaze
29+OUTPUT_FORMAT="elf64-microblazeel"
30+#BIG_OUTPUT_FORMAT="elf64-microblaze"
31+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
32+#TEXT_START_ADDR=0
33+NONPAGED_TEXT_START_ADDR=0x28
34+ALIGNMENT=4
35+MAXPAGESIZE=4
36+ARCH=microblaze
37+EMBEDDED=yes
38+
39+NOP=0x80000000
40+
41+# Hmmm, there's got to be a better way. This sets the stack to the
42+# top of the simulator memory (2^19 bytes).
43+#PAGE_SIZE=0x1000
44+#DATA_ADDR=0x10000
45+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
46+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
47+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
48+
49+TEMPLATE_NAME=elf32
50+#GENERATE_SHLIB_SCRIPT=yes
51diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
52new file mode 100644
53index 00000000000..9c7b0eb7080
54--- /dev/null
55+++ b/ld/emulparams/elf64microblazeel.sh
56@@ -0,0 +1,23 @@
57+SCRIPT_NAME=elfmicroblaze
58+OUTPUT_FORMAT="elf64-microblazeel"
59+#BIG_OUTPUT_FORMAT="elf64-microblaze"
60+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
61+#TEXT_START_ADDR=0
62+NONPAGED_TEXT_START_ADDR=0x28
63+ALIGNMENT=4
64+MAXPAGESIZE=4
65+ARCH=microblaze
66+EMBEDDED=yes
67+
68+NOP=0x80000000
69+
70+# Hmmm, there's got to be a better way. This sets the stack to the
71+# top of the simulator memory (2^19 bytes).
72+#PAGE_SIZE=0x1000
73+#DATA_ADDR=0x10000
74+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
75+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
76+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
77+
78+TEMPLATE_NAME=elf32
79+#GENERATE_SHLIB_SCRIPT=yes
80--
812.34.1
82
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0021-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0021-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..24e0894d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0021-Added-relocations-for-MB-X.patch
@@ -0,0 +1,108 @@
1From 39ba1e8a13828ac3c860a72b95c3abae024044b5 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 21/53] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/reloc.c | 26 ++++++++++++++------------
16 gas/config/tc-microblaze.c | 11 +++++++++++
17 2 files changed, 25 insertions(+), 12 deletions(-)
18
19diff --git a/bfd/reloc.c b/bfd/reloc.c
20index 3e8647f601e..c5c0ce5d060 100644
21--- a/bfd/reloc.c
22+++ b/bfd/reloc.c
23@@ -6661,12 +6661,6 @@ ENUMDOC
24 the form "Symbol Op Symbol".
25 ENUM
26 BFD_RELOC_MICROBLAZE_32_NONE
27-ENUMDOC
28- This is a 32 bit reloc that stores the 32 bit pc relative value in
29- two words (with an imm instruction). No relocation is done here -
30- only used for relaxing.
31-ENUM
32- BFD_RELOC_MICROBLAZE_32_NONE
33 ENUMDOC
34 This is a 32 bit reloc that stores the 32 bit pc relative
35 value in two words (with an imm instruction). No relocation is
36@@ -6685,12 +6679,6 @@ ENUMDOC
37 done here - only used for relaxing
38 ENUM
39 BFD_RELOC_MICROBLAZE_64_GOTPC
40-ENUMDOC
41- This is a 64 bit reloc that stores the 32 bit pc relative
42- value in two words (with an imml instruction). No relocation is
43- done here - only used for relaxing
44-ENUM
45- BFD_RELOC_MICROBLAZE_64_GPC
46 ENUMDOC
47 This is a 64 bit reloc that stores the 32 bit pc relative
48 value in two words (with an imm instruction). The relocation is
49@@ -7929,6 +7917,20 @@ ENUMX
50 ENUMDOC
51 Linux eBPF relocations.
52
53+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
54+ to two words (uses imml instruction).
55+ENUM
56+BFD_RELOC_MICROBLAZE_64,
57+ENUMDOC
58+ This is a 64 bit reloc that stores the 64 bit pc relative
59+ value in two words (with an imml instruction). No relocation is
60+ done here - only used for relaxing
61+ENUM
62+BFD_RELOC_MICROBLAZE_64_PCREL,
63+ENUMDOC
64+ This is a 32 bit reloc that stores the 32 bit pc relative
65+ value in two words (with an imml instruction). No relocation is
66+ done here - only used for relaxing
67 ENUM
68 BFD_RELOC_EPIPHANY_SIMM8
69 ENUMDOC
70diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
71index f13efcae979..9b8b129e309 100644
72--- a/gas/config/tc-microblaze.c
73+++ b/gas/config/tc-microblaze.c
74@@ -91,6 +91,8 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
75 #define TLSTPREL_OFFSET 16
76 #define TEXT_OFFSET 17
77 #define TEXT_PC_OFFSET 18
78+#define DEFINED_64_OFFSET 19
79+#define DEFINED_64_PC_OFFSET 20
80
81 /* Initialize the relax table. */
82 const relax_typeS md_relax_table[] =
83@@ -114,6 +116,8 @@ const relax_typeS md_relax_table[] =
84 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
85 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
86 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
87+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */
88+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
89 };
90
91 static htab_t opcode_hash_control; /* Opcode mnemonics. */
92@@ -2330,6 +2334,13 @@ md_estimate_size_before_relax (fragS * fragP,
93 /* Variable part does not change. */
94 fragP->fr_var = INST_WORD_SIZE*2;
95 }
96+ else if (streq (fragP->fr_opcode, str_microblaze_64))
97+ {
98+ /* Used as an absolute value. */
99+ fragP->fr_subtype = DEFINED_64_OFFSET;
100+ /* Variable part does not change. */
101+ fragP->fr_var = INST_WORD_SIZE;
102+ }
103 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
104 {
105 /* It is accessed using the small data read only anchor. */
106--
1072.34.1
108
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0022-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..5ef086bd
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,958 @@
1From 6e30e2ce72e9257daae0633a6b57e7a5c4c918f2 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 22/53] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/elf64-microblaze.c | 8 +
17 bfd/reloc.c | 36 +--
18 gas/config/tc-microblaze.c | 556 ++++++++++++++++++++++++++++++++-----
19 3 files changed, 499 insertions(+), 101 deletions(-)
20
21diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
22index 119d266f95a..ca92df647c9 100755
23--- a/bfd/elf64-microblaze.c
24+++ b/bfd/elf64-microblaze.c
25@@ -1666,6 +1666,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
26 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
27 outrel.r_addend = relocation + addend;
28 }
29+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
30+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
31+ {
32+ insn &= ~0x00ffffff;
33+ insn |= (relocation >> 16) & 0xffffff;
34+ bfd_put_32 (input_bfd, insn,
35+ contents + offset + endian);
36+ }
37 else
38 {
39 BFD_FAIL ();
40diff --git a/bfd/reloc.c b/bfd/reloc.c
41index c5c0ce5d060..6eb93e993f0 100644
42--- a/bfd/reloc.c
43+++ b/bfd/reloc.c
44@@ -6677,8 +6677,20 @@ ENUMDOC
45 This is a 64 bit reloc that stores the 32 bit pc relative
46 value in two words (with an imm instruction). No relocation is
47 done here - only used for relaxing
48+ENUM
49+BFD_RELOC_MICROBLAZE_64_PCREL,
50+ENUMDOC
51+ This is a 32 bit reloc that stores the 32 bit pc relative
52+ value in two words (with an imml instruction). No relocation is
53+ done here - only used for relaxing
54 ENUM
55 BFD_RELOC_MICROBLAZE_64_GOTPC
56+ENUMDOC
57+ This is a 64 bit reloc that stores the 32 bit pc relative
58+ value in two words (with an imml instruction). No relocation is
59+ done here - only used for relaxing
60+ENUM
61+ BFD_RELOC_MICROBLAZE_64_GPC
62 ENUMDOC
63 This is a 64 bit reloc that stores the 32 bit pc relative
64 value in two words (with an imm instruction). The relocation is
65@@ -7894,18 +7906,6 @@ ENUMDOC
66
67 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
68 to two words (uses imml instruction).
69-ENUM
70-BFD_RELOC_MICROBLAZE_64,
71-ENUMDOC
72- This is a 64 bit reloc that stores the 64 bit pc relative
73- value in two words (with an imml instruction). No relocation is
74- done here - only used for relaxing
75-ENUM
76-BFD_RELOC_MICROBLAZE_64_PCREL,
77-ENUMDOC
78- This is a 32 bit reloc that stores the 32 bit pc relative
79- value in two words (with an imml instruction). No relocation is
80- done here - only used for relaxing
81 ENUM
82 BFD_RELOC_BPF_64
83 ENUMX
84@@ -7919,18 +7919,6 @@ ENUMDOC
85
86 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
87 to two words (uses imml instruction).
88-ENUM
89-BFD_RELOC_MICROBLAZE_64,
90-ENUMDOC
91- This is a 64 bit reloc that stores the 64 bit pc relative
92- value in two words (with an imml instruction). No relocation is
93- done here - only used for relaxing
94-ENUM
95-BFD_RELOC_MICROBLAZE_64_PCREL,
96-ENUMDOC
97- This is a 32 bit reloc that stores the 32 bit pc relative
98- value in two words (with an imml instruction). No relocation is
99- done here - only used for relaxing
100 ENUM
101 BFD_RELOC_EPIPHANY_SIMM8
102 ENUMDOC
103diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
104index 9b8b129e309..6640266cc47 100644
105--- a/gas/config/tc-microblaze.c
106+++ b/gas/config/tc-microblaze.c
107@@ -35,10 +35,13 @@
108 #define streq(a,b) (strcmp (a, b) == 0)
109 #endif
110
111+static int microblaze_arch_size = 0;
112+
113 #define OPTION_EB (OPTION_MD_BASE + 0)
114 #define OPTION_EL (OPTION_MD_BASE + 1)
115 #define OPTION_LITTLE (OPTION_MD_BASE + 2)
116 #define OPTION_BIG (OPTION_MD_BASE + 3)
117+#define OPTION_M64 (OPTION_MD_BASE + 4)
118
119 void microblaze_generate_symbol (char *sym);
120 static bool check_spl_reg (unsigned *);
121@@ -360,7 +363,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
122 Integer arg to pass to the function. */
123 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
124 and then in the read.c table. */
125-const pseudo_typeS md_pseudo_table[] =
126+pseudo_typeS md_pseudo_table[] =
127 {
128 {"lcomm", microblaze_s_lcomm, 1},
129 {"data8", cons, 1}, /* Same as byte. */
130@@ -369,6 +372,7 @@ const pseudo_typeS md_pseudo_table[] =
131 {"ent", s_func, 0}, /* Treat ent as function entry point. */
132 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
133 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
134+ {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
135 {"weakext", microblaze_s_weakext, 0},
136 {"rodata", microblaze_s_rdata, 0},
137 {"sdata2", microblaze_s_rdata, 1},
138@@ -378,6 +382,7 @@ const pseudo_typeS md_pseudo_table[] =
139 #endif
140 {"sbss", microblaze_s_sbss, 0},
141 {"word", cons, 4},
142+ {"dword", cons, 8},
143 {"frame", s_ignore, 0},
144 {"mask", s_ignore, 0}, /* Emitted by gcc. */
145 {NULL, NULL, 0}
146@@ -749,6 +754,74 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
147 return new_pointer;
148 }
149
150+ static char *
151+parse_imml (char * s, expressionS * e, long min, long max)
152+{
153+ char *new_pointer;
154+ char *atp;
155+ int itype, ilen;
156+
157+ ilen = 0;
158+
159+ /* Find the start of "@GOT" or "@PLT" suffix (if any) */
160+ for (atp = s; *atp != '@'; atp++)
161+ if (is_end_of_line[(unsigned char) *atp])
162+ break;
163+
164+ if (*atp == '@')
165+ {
166+ itype = match_imm (atp + 1, &ilen);
167+ if (itype != 0)
168+ {
169+ *atp = 0;
170+ e->X_md = itype;
171+ }
172+ else
173+ {
174+ atp = NULL;
175+ e->X_md = 0;
176+ ilen = 0;
177+ }
178+ *atp = 0;
179+ }
180+ else
181+ {
182+ atp = NULL;
183+ e->X_md = 0;
184+ }
185+
186+ if (atp && !GOT_symbol)
187+ {
188+ GOT_symbol = symbol_find_or_make (GOT_SYMBOL_NAME);
189+ }
190+
191+ new_pointer = parse_exp (s, e);
192+
193+ if (!GOT_symbol && ! strncmp (s, GOT_SYMBOL_NAME, 20))
194+ {
195+ GOT_symbol = symbol_find_or_make (GOT_SYMBOL_NAME);
196+ }
197+
198+ if (e->X_op == O_absent)
199+ ; /* An error message has already been emitted. */
200+ else if ((e->X_op != O_constant && e->X_op != O_symbol) )
201+ as_fatal (_("operand must be a constant or a label"));
202+ else if ((e->X_op == O_constant) && ((long) e->X_add_number < min
203+ || (long) e->X_add_number > max))
204+ {
205+ as_fatal (_("operand must be absolute in range %ld..%ld, not %ld"),
206+ min, max, (long) e->X_add_number);
207+ }
208+
209+ if (atp)
210+ {
211+ *atp = '@'; /* restore back (needed?) */
212+ if (new_pointer >= atp)
213+ new_pointer += ilen + 1; /* sizeof (imm_suffix) + 1 for '@' */
214+ }
215+ return new_pointer;
216+}
217+
218 static char *
219 check_got (int * got_type, int * got_len)
220 {
221@@ -803,7 +876,7 @@ check_got (int * got_type, int * got_len)
222 extern bfd_reloc_code_real_type
223 parse_cons_expression_microblaze (expressionS *exp, int size)
224 {
225- if (size == 4)
226+ if (size == 4 || (microblaze_arch_size == 64 && size == 8))
227 {
228 /* Handle @GOTOFF et.al. */
229 char *save, *gotfree_copy;
230@@ -835,6 +908,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
231
232 static const char * str_microblaze_ro_anchor = "RO";
233 static const char * str_microblaze_rw_anchor = "RW";
234+static const char * str_microblaze_64 = "64";
235
236 static bool
237 check_spl_reg (unsigned * reg)
238@@ -893,9 +967,10 @@ md_assemble (char * str)
239 unsigned reg2;
240 unsigned reg3;
241 unsigned isize;
242- unsigned int immed = 0, immed2 = 0, temp;
243+ unsigned long immed = 0, immed2 = 0, temp;
244 expressionS exp;
245 char name[20];
246+ long immedl;
247
248 /* Drop leading whitespace. */
249 while (ISSPACE (* str))
250@@ -1014,8 +1089,9 @@ md_assemble (char * str)
251 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
252 else if (streq (name, "smi"))
253 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
254-
255- if (reg2 == REG_ROSDP)
256+ if(streq (name, "lli") || streq (name, "sli"))
257+ opc = str_microblaze_64;
258+ else if (reg2 == REG_ROSDP)
259 opc = str_microblaze_ro_anchor;
260 else if (reg2 == REG_RWSDP)
261 opc = str_microblaze_rw_anchor;
262@@ -1082,36 +1158,60 @@ md_assemble (char * str)
263 inst |= (immed << IMM_LOW) & IMM_MASK;
264 }
265 }
266- else
267- {
268- temp = immed & 0xFFFF8000;
269- if ((temp != 0) && (temp != 0xFFFF8000))
270- {
271+ else if (streq (name, "lli") || streq (name, "sli"))
272+ {
273+ temp = immed & 0xFFFFFF8000;
274+ if (temp != 0 && temp != 0xFFFFFF8000)
275+ {
276 /* Needs an immediate inst. */
277 opcode1
278 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
279- "imm");
280+ "imml");
281 if (opcode1 == NULL)
282 {
283- as_bad (_("unknown opcode \"%s\""), "imm");
284+ as_bad (_("unknown opcode \"%s\""), "imml");
285 return;
286 }
287-
288 inst1 = opcode1->bit_sequence;
289- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
290+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
291 output[0] = INST_BYTE0 (inst1);
292 output[1] = INST_BYTE1 (inst1);
293 output[2] = INST_BYTE2 (inst1);
294 output[3] = INST_BYTE3 (inst1);
295 output = frag_more (isize);
296- }
297- inst |= (reg1 << RD_LOW) & RD_MASK;
298- inst |= (reg2 << RA_LOW) & RA_MASK;
299- inst |= (immed << IMM_LOW) & IMM_MASK;
300- }
301+ }
302+ inst |= (reg1 << RD_LOW) & RD_MASK;
303+ inst |= (reg2 << RA_LOW) & RA_MASK;
304+ inst |= (immed << IMM_LOW) & IMM_MASK;
305+ }
306+ else
307+ {
308+ temp = immed & 0xFFFF8000;
309+ if ((temp != 0) && (temp != 0xFFFF8000))
310+ {
311+ /* Needs an immediate inst. */
312+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
313+ if (opcode1 == NULL)
314+ {
315+ as_bad (_("unknown opcode \"%s\""), "imm");
316+ return;
317+ }
318+
319+ inst1 = opcode1->bit_sequence;
320+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
321+ output[0] = INST_BYTE0 (inst1);
322+ output[1] = INST_BYTE1 (inst1);
323+ output[2] = INST_BYTE2 (inst1);
324+ output[3] = INST_BYTE3 (inst1);
325+ output = frag_more (isize);
326+ }
327+ inst |= (reg1 << RD_LOW) & RD_MASK;
328+ inst |= (reg2 << RA_LOW) & RA_MASK;
329+ inst |= (immed << IMM_LOW) & IMM_MASK;
330+ }
331 break;
332
333- case INST_TYPE_RD_R1_IMM5:
334+ case INST_TYPE_RD_R1_IMMS:
335 if (strcmp (op_end, ""))
336 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
337 else
338@@ -1145,16 +1245,22 @@ md_assemble (char * str)
339 immed = exp.X_add_number;
340 }
341
342- if (immed != (immed % 32))
343+ if ((immed != (immed % 32)) &&
344+ (opcode->instr == bslli || opcode->instr == bsrai || opcode->instr == bsrli))
345 {
346 as_warn (_("Shift value > 32. using <value %% 32>"));
347 immed = immed % 32;
348 }
349+ else if (immed != (immed % 64))
350+ {
351+ as_warn (_("Shift value > 64. using <value %% 64>"));
352+ immed = immed % 64;
353+ }
354 inst |= (reg1 << RD_LOW) & RD_MASK;
355 inst |= (reg2 << RA_LOW) & RA_MASK;
356- inst |= (immed << IMM_LOW) & IMM5_MASK;
357+ inst |= (immed << IMM_LOW) & IMM6_MASK;
358 break;
359- case INST_TYPE_RD_R1_IMM5_IMM5:
360+ case INST_TYPE_RD_R1_IMMW_IMMS:
361 if (strcmp (op_end, ""))
362 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
363 else
364@@ -1178,7 +1284,7 @@ md_assemble (char * str)
365
366 /* Width immediate value. */
367 if (strcmp (op_end, ""))
368- op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH);
369+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM);
370 else
371 as_fatal (_("Error in statement syntax"));
372 if (exp.X_op != O_constant)
373@@ -1190,6 +1296,8 @@ md_assemble (char * str)
374 immed = exp.X_add_number;
375 if (opcode->instr == bsefi && immed > 31)
376 as_fatal (_("Width value must be less than 32"));
377+ else if (opcode->instr == bslefi && immed > 63)
378+ as_fatal (_("Width value must be less than 64"));
379
380 /* Shift immediate value. */
381 if (strcmp (op_end, ""))
382@@ -1206,23 +1314,31 @@ md_assemble (char * str)
383 output = frag_more (isize);
384 immed2 = exp.X_add_number;
385 }
386- if (immed2 != (immed2 % 32))
387- {
388- as_warn (_("Shift value greater than 32. using <value %% 32>"));
389+ if ((immed2 != (immed2 % 32)) && (opcode->instr == bsefi || opcode->instr == bsifi))
390+ {
391+
392+ as_warn (_("Shift value greater than 32. using <value %% 32>"));
393 immed2 = immed2 % 32;
394 }
395+ else if (immed2 != (immed2 % 64))
396+ {
397+ as_warn (_("Shift value greater than 64. using <value %% 64>"));
398+ immed2 = immed2 % 64;
399+ }
400
401 /* Check combined value. */
402- if (immed + immed2 > 32)
403+ if ((immed + immed2 > 32) && (opcode->instr == bsefi || opcode->instr == bsifi))
404 as_fatal (_("Width value + shift value must not be greater than 32"));
405+ else if (immed + immed2 > 64)
406+ as_fatal (_("Width value + shift value must not be greater than 64"));
407
408 inst |= (reg1 << RD_LOW) & RD_MASK;
409 inst |= (reg2 << RA_LOW) & RA_MASK;
410- if (opcode->instr == bsefi)
411- inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */
412+ if (opcode->instr == bsefi || opcode->instr == bslefi)
413+ inst |= (immed & IMM6_MASK) << IMM_WIDTH_LOW; /* bsefi or bslefi */
414 else
415- inst |= ((immed + immed2 - 1) & IMM5_MASK) << IMM_WIDTH_LOW; /* bsifi */
416- inst |= (immed2 << IMM_LOW) & IMM5_MASK;
417+ inst |= ((immed + immed2 - 1) & IMM6_MASK) << IMM_WIDTH_LOW; /* bsifi or bslifi */
418+ inst |= (immed2 << IMM_LOW) & IMM6_MASK;
419 break;
420 case INST_TYPE_R1_R2:
421 if (strcmp (op_end, ""))
422@@ -1722,12 +1838,20 @@ md_assemble (char * str)
423 case INST_TYPE_IMM:
424 if (streq (name, "imm"))
425 as_fatal (_("An IMM instruction should not be present in the .s file"));
426-
427- op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
428+ if (microblaze_arch_size == 64)
429+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
430+ else
431+ op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
432
433 if (exp.X_op != O_constant)
434 {
435- char *opc = NULL;
436+ char *opc;
437+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
438+ streq (name, "breaid") ||
439+ streq (name, "brai") || streq (name, "braid")))
440+ opc = str_microblaze_64;
441+ else
442+ opc = NULL;
443 relax_substateT subtype;
444
445 if (exp.X_md != 0)
446@@ -1750,29 +1874,53 @@ md_assemble (char * str)
447 immed = exp.X_add_number;
448 }
449
450-
451- temp = immed & 0xFFFF8000;
452- if ((temp != 0) && (temp != 0xFFFF8000))
453- {
454- /* Needs an immediate inst. */
455- opcode1
456- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
457- "imm");
458- if (opcode1 == NULL)
459- {
460- as_bad (_("unknown opcode \"%s\""), "imm");
461- return;
462+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
463+ streq (name, "breaid") ||
464+ streq (name, "brai") || streq (name, "braid")))
465+ {
466+ temp = immed & 0xFFFFFF8000;
467+ if (temp != 0)
468+ {
469+ /* Needs an immediate inst. */
470+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
471+ if (opcode1 == NULL)
472+ {
473+ as_bad (_("unknown opcode \"%s\""), "imml");
474+ return;
475+ }
476+ inst1 = opcode1->bit_sequence;
477+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
478+ output[0] = INST_BYTE0 (inst1);
479+ output[1] = INST_BYTE1 (inst1);
480+ output[2] = INST_BYTE2 (inst1);
481+ output[3] = INST_BYTE3 (inst1);
482+ output = frag_more (isize);
483 }
484+ inst |= (immed << IMM_LOW) & IMM_MASK;
485+ }
486+ else
487+ {
488+ temp = immed & 0xFFFF8000;
489+ if ((temp != 0) && (temp != 0xFFFF8000))
490+ {
491+ /* Needs an immediate inst. */
492+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
493+ if (opcode1 == NULL)
494+ {
495+ as_bad (_("unknown opcode \"%s\""), "imm");
496+ return;
497+ }
498
499- inst1 = opcode1->bit_sequence;
500- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
501- output[0] = INST_BYTE0 (inst1);
502- output[1] = INST_BYTE1 (inst1);
503- output[2] = INST_BYTE2 (inst1);
504- output[3] = INST_BYTE3 (inst1);
505- output = frag_more (isize);
506- }
507- inst |= (immed << IMM_LOW) & IMM_MASK;
508+ inst1 = opcode1->bit_sequence;
509+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
510+ output[0] = INST_BYTE0 (inst1);
511+ output[1] = INST_BYTE1 (inst1);
512+ output[2] = INST_BYTE2 (inst1);
513+ output[3] = INST_BYTE3 (inst1);
514+ output = frag_more (isize);
515+ }
516+ inst |= (immed << IMM_LOW) & IMM_MASK;
517+ }
518 break;
519
520 case INST_TYPE_NONE:
521@@ -1903,6 +2051,7 @@ struct option md_longopts[] =
522 {"EL", no_argument, NULL, OPTION_EL},
523 {"mlittle-endian", no_argument, NULL, OPTION_EL},
524 {"mbig-endian", no_argument, NULL, OPTION_EB},
525+ {"m64", no_argument, NULL, OPTION_M64},
526 { NULL, no_argument, NULL, 0}
527 };
528
529@@ -1947,13 +2096,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
530 fragP->fr_fix += INST_WORD_SIZE * 2;
531 fragP->fr_var = 0;
532 break;
533+ case DEFINED_64_OFFSET:
534+ if (fragP->fr_symbol == GOT_symbol)
535+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
536+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
537+ else
538+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
539+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
540+ fragP->fr_fix += INST_WORD_SIZE * 2;
541+ fragP->fr_var = 0;
542+ break;
543 case DEFINED_ABS_SEGMENT:
544 if (fragP->fr_symbol == GOT_symbol)
545 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
546 fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
547 else
548 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
549- fragP->fr_offset, false, BFD_RELOC_64);
550+ fragP->fr_offset, true, BFD_RELOC_64);
551 fragP->fr_fix += INST_WORD_SIZE * 2;
552 fragP->fr_var = 0;
553 break;
554@@ -2174,23 +2333,38 @@ md_apply_fix (fixS * fixP,
555 case BFD_RELOC_64_PCREL:
556 case BFD_RELOC_64:
557 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
558+ case BFD_RELOC_MICROBLAZE_64:
559 /* Add an imm instruction. First save the current instruction. */
560 for (i = 0; i < INST_WORD_SIZE; i++)
561 buf[i + INST_WORD_SIZE] = buf[i];
562+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
563+ {
564+ /* Generate the imm instruction. */
565+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
566+ if (opcode1 == NULL)
567+ {
568+ as_bad (_("unknown opcode \"%s\""), "imml");
569+ return;
570+ }
571
572- /* Generate the imm instruction. */
573- opcode1
574- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
575- if (opcode1 == NULL)
576- {
577- as_bad (_("unknown opcode \"%s\""), "imm");
578- return;
579- }
580-
581- inst1 = opcode1->bit_sequence;
582- if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
583- inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
584-
585+ inst1 = opcode1->bit_sequence;
586+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
587+ inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
588+ }
589+ else
590+ {
591+ /* Generate the imm instruction. */
592+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
593+ if (opcode1 == NULL)
594+ {
595+ as_bad (_("unknown opcode \"%s\""), "imm");
596+ return;
597+ }
598+
599+ inst1 = opcode1->bit_sequence;
600+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
601+ inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
602+ }
603 buf[0] = INST_BYTE0 (inst1);
604 buf[1] = INST_BYTE1 (inst1);
605 buf[2] = INST_BYTE2 (inst1);
606@@ -2219,6 +2393,7 @@ md_apply_fix (fixS * fixP,
607 /* Fall through. */
608
609 case BFD_RELOC_MICROBLAZE_64_GOTPC:
610+ case BFD_RELOC_MICROBLAZE_64_GPC:
611 case BFD_RELOC_MICROBLAZE_64_GOT:
612 case BFD_RELOC_MICROBLAZE_64_PLT:
613 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
614@@ -2226,13 +2401,17 @@ md_apply_fix (fixS * fixP,
615 /* Add an imm instruction. First save the current instruction. */
616 for (i = 0; i < INST_WORD_SIZE; i++)
617 buf[i + INST_WORD_SIZE] = buf[i];
618-
619 /* Generate the imm instruction. */
620- opcode1
621- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
622+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
623+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
624+ else
625+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
626 if (opcode1 == NULL)
627 {
628- as_bad (_("unknown opcode \"%s\""), "imm");
629+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
630+ as_bad (_("unknown opcode \"%s\""), "imml");
631+ else
632+ as_bad (_("unknown opcode \"%s\""), "imm");
633 return;
634 }
635
636@@ -2256,6 +2435,8 @@ md_apply_fix (fixS * fixP,
637 moves code around due to relaxing. */
638 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
639 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
640+ else if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
641+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
642 else if (fixP->fx_r_type == BFD_RELOC_32)
643 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
644 else
645@@ -2298,6 +2479,32 @@ md_estimate_size_before_relax (fragS * fragP,
646 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
647 abort ();
648 }
649+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
650+ && !S_IS_WEAK (fragP->fr_symbol))
651+ {
652+ if (fragP->fr_opcode != NULL) {
653+ if(streq (fragP->fr_opcode, str_microblaze_64))
654+ {
655+ /* Used as an absolute value. */
656+ fragP->fr_subtype = DEFINED_64_OFFSET;
657+ /* Variable part does not change. */
658+ fragP->fr_var = INST_WORD_SIZE;
659+ }
660+ else
661+ {
662+ fragP->fr_subtype = DEFINED_PC_OFFSET;
663+ /* Don't know now whether we need an imm instruction. */
664+ fragP->fr_var = INST_WORD_SIZE;
665+ }
666+ }
667+ else
668+ {
669+ fragP->fr_subtype = DEFINED_PC_OFFSET;
670+ /* Don't know now whether we need an imm instruction. */
671+ fragP->fr_var = INST_WORD_SIZE;
672+ }
673+ }
674+#if 0
675 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
676 !S_IS_WEAK (fragP->fr_symbol))
677 {
678@@ -2305,6 +2512,7 @@ md_estimate_size_before_relax (fragS * fragP,
679 /* Don't know now whether we need an imm instruction. */
680 fragP->fr_var = INST_WORD_SIZE;
681 }
682+#endif
683 else if (S_IS_DEFINED (fragP->fr_symbol)
684 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
685 {
686@@ -2316,7 +2524,14 @@ md_estimate_size_before_relax (fragS * fragP,
687 }
688 else
689 {
690- fragP->fr_subtype = UNDEFINED_PC_OFFSET;
691+ if (fragP->fr_opcode != NULL) {
692+ if (streq (fragP->fr_opcode, str_microblaze_64))
693+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
694+ else
695+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
696+ }
697+ else
698+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
699 fragP->fr_var = INST_WORD_SIZE*2;
700 }
701 break;
702@@ -2395,6 +2610,33 @@ md_estimate_size_before_relax (fragS * fragP,
703 abort ();
704 }
705 }
706+#if 0 //revisit
707+ else if (streq (name, "lli") || streq (name, "sli"))
708+ {
709+ temp = immed & 0xFFFFFFFFFFFF8000;
710+ if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
711+ {
712+ /* Needs an immediate inst. */
713+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
714+ if (opcode1 == NULL)
715+ {
716+ as_bad (_("unknown opcode \"%s\""), "imml");
717+ return;
718+ }
719+
720+ inst1 = opcode1->bit_sequence;
721+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
722+ output[0] = INST_BYTE0 (inst1);
723+ output[1] = INST_BYTE1 (inst1);
724+ output[2] = INST_BYTE2 (inst1);
725+ output[3] = INST_BYTE3 (inst1);
726+ output = frag_more (isize);
727+ }
728+ inst |= (reg1 << RD_LOW) & RD_MASK;
729+ inst |= (reg2 << RA_LOW) & RA_MASK;
730+ inst |= (immed << IMM_LOW) & IMM_MASK;
731+ }
732+#endif
733 else
734 {
735 /* We know the abs value: Should never happen. */
736@@ -2414,6 +2656,7 @@ md_estimate_size_before_relax (fragS * fragP,
737 case TLSLD_OFFSET:
738 case TLSTPREL_OFFSET:
739 case TLSDTPREL_OFFSET:
740+ case DEFINED_64_OFFSET:
741 fragP->fr_var = INST_WORD_SIZE*2;
742 break;
743 case DEFINED_RO_SEGMENT:
744@@ -2467,7 +2710,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
745 else
746 {
747 /* The case where we are going to resolve things... */
748- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
749+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
750 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
751 else
752 return fixp->fx_where + fixp->fx_frag->fr_address;
753@@ -2500,6 +2743,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
754 case BFD_RELOC_MICROBLAZE_32_RWSDA:
755 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
756 case BFD_RELOC_MICROBLAZE_64_GOTPC:
757+ case BFD_RELOC_MICROBLAZE_64_GPC:
758+ case BFD_RELOC_MICROBLAZE_64:
759 case BFD_RELOC_MICROBLAZE_64_GOT:
760 case BFD_RELOC_MICROBLAZE_64_PLT:
761 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
762@@ -2515,6 +2760,143 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
763 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
764 code = fixp->fx_r_type;
765 break;
766+ /* For 64-bit instructions */
767+ case INST_TYPE_RD_R1_IMML:
768+ if (strcmp (op_end, ""))
769+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
770+ else
771+ {
772+ as_fatal (_("Error in statement syntax"));
773+ reg1 = 0;
774+ }
775+ if (strcmp (op_end, ""))
776+ op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
777+ else
778+ {
779+ as_fatal (_("Error in statement syntax"));
780+ reg2 = 0;
781+ }
782+ if (strcmp (op_end, ""))
783+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
784+ else
785+ as_fatal (_("Error in statement syntax"));
786+
787+ /* Check for spl registers. */
788+ if (check_spl_reg (& reg1))
789+ as_fatal (_("Cannot use special register with this instruction"));
790+ if (check_spl_reg (& reg2))
791+ as_fatal (_("Cannot use special register with this instruction"));
792+
793+ if (exp.X_op != O_constant)
794+ {
795+ char *opc = NULL;
796+ //char *opc = str_microblaze_64;
797+ relax_substateT subtype;
798+
799+ if (exp.X_md != 0)
800+ subtype = get_imm_otype(exp.X_md);
801+ else
802+ subtype = opcode->inst_offset_type;
803+
804+ output = frag_var (rs_machine_dependent,
805+ isize * 2, /* maxm of 2 words. */
806+ isize * 2, /* minm of 2 words. */
807+ subtype, /* PC-relative or not. */
808+ exp.X_add_symbol,
809+ exp.X_add_number,
810+ (char *) opc);
811+ immedl = 0L;
812+ }
813+ else
814+ {
815+ output = frag_more (isize);
816+ immedl = exp.X_add_number;
817+
818+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
819+ if (opcode1 == NULL)
820+ {
821+ as_bad (_("unknown opcode \"%s\""), "imml");
822+ return;
823+ }
824+
825+ inst1 = opcode1->bit_sequence;
826+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
827+ output[0] = INST_BYTE0 (inst1);
828+ output[1] = INST_BYTE1 (inst1);
829+ output[2] = INST_BYTE2 (inst1);
830+ output[3] = INST_BYTE3 (inst1);
831+ output = frag_more (isize);
832+ }
833+
834+ inst |= (reg1 << RD_LOW) & RD_MASK;
835+ inst |= (reg2 << RA_LOW) & RA_MASK;
836+ inst |= (immedl << IMM_LOW) & IMM_MASK;
837+ break;
838+
839+ case INST_TYPE_R1_IMML:
840+ if (strcmp (op_end, ""))
841+ op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
842+ else
843+ {
844+ as_fatal (_("Error in statement syntax"));
845+ reg1 = 0;
846+ }
847+ if (strcmp (op_end, ""))
848+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
849+ else
850+ as_fatal (_("Error in statement syntax"));
851+
852+ /* Check for spl registers. */
853+ if (check_spl_reg (&reg1))
854+ as_fatal (_("Cannot use special register with this instruction"));
855+
856+ if (exp.X_op != O_constant)
857+ {
858+ //char *opc = NULL;
859+ char *opc = str_microblaze_64;
860+ relax_substateT subtype;
861+
862+ if (exp.X_md != 0)
863+ subtype = get_imm_otype(exp.X_md);
864+ else
865+ subtype = opcode->inst_offset_type;
866+
867+ output = frag_var (rs_machine_dependent,
868+ isize * 2, /* maxm of 2 words. */
869+ isize * 2, /* minm of 2 words. */
870+ subtype, /* PC-relative or not. */
871+ exp.X_add_symbol,
872+ exp.X_add_number,
873+ (char *) opc);
874+ immedl = 0L;
875+ }
876+ else
877+ {
878+ output = frag_more (isize);
879+ immedl = exp.X_add_number;
880+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
881+ if (opcode1 == NULL)
882+ {
883+ as_bad (_("unknown opcode \"%s\""), "imml");
884+ return;
885+ }
886+
887+ inst1 = opcode1->bit_sequence;
888+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
889+ output[0] = INST_BYTE0 (inst1);
890+ output[1] = INST_BYTE1 (inst1);
891+ output[2] = INST_BYTE2 (inst1);
892+ output[3] = INST_BYTE3 (inst1);
893+ output = frag_more (isize);
894+ }
895+
896+ inst |= (reg1 << RA_LOW) & RA_MASK;
897+ inst |= (immedl << IMM_LOW) & IMM_MASK;
898+ break;
899+
900+ case INST_TYPE_IMML:
901+ as_fatal (_("An IMML instruction should not be present in the .s file"));
902+ break;
903
904 default:
905 switch (F (fixp->fx_size, fixp->fx_pcrel))
906@@ -2560,6 +2942,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
907 return rel;
908 }
909
910+/* Called by TARGET_FORMAT. */
911+const char *
912+microblaze_target_format (void)
913+{
914+
915+ if (microblaze_arch_size == 64)
916+ return "elf64-microblazeel";
917+ else
918+ return target_big_endian ? "elf32-microblaze" : "elf32-microblazeel";
919+}
920+
921+
922 int
923 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
924 {
925@@ -2573,6 +2967,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
926 case OPTION_LITTLE:
927 target_big_endian = 0;
928 break;
929+ case OPTION_M64:
930+ //if (arg != NULL && strcmp (arg, "64") == 0)
931+ microblaze_arch_size = 64;
932+ break;
933 default:
934 return 0;
935 }
936@@ -2588,6 +2986,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
937 fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
938 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
939 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
940+ fprintf (stream, " -%-23s%s\n", "m64", N_("generate 64-bit elf"));
941 }
942
943
944@@ -2625,7 +3024,10 @@ cons_fix_new_microblaze (fragS * frag,
945 r = BFD_RELOC_32;
946 break;
947 case 8:
948- r = BFD_RELOC_64;
949+ if (microblaze_arch_size == 64)
950+ r = BFD_RELOC_32;
951+ else
952+ r = BFD_RELOC_64;
953 break;
954 default:
955 as_bad (_("unsupported BFD relocation size %u"), size);
956--
9572.34.1
958
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..f92dd068
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-relocations-for-MB-X.patch
@@ -0,0 +1,246 @@
1From fb4a4d6855092f5b0b201e40234782822cd63a66 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 23/53] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/libbfd.h | 2 --
16 bfd/reloc.c | 26 ++++++++-------
17 gas/config/tc-microblaze.c | 68 ++++++++++++--------------------------
18 3 files changed, 36 insertions(+), 60 deletions(-)
19
20diff --git a/bfd/libbfd.h b/bfd/libbfd.h
21index 603ed8260cb..7a3e558d70a 100644
22--- a/bfd/libbfd.h
23+++ b/bfd/libbfd.h
24@@ -3005,9 +3005,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
25 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
26 "BFD_RELOC_MICROBLAZE_32_NONE",
27 "BFD_RELOC_MICROBLAZE_64_NONE",
28- "BFD_RELOC_MICROBLAZE_64",
29 "BFD_RELOC_MICROBLAZE_64_GOTPC",
30- "BFD_RELOC_MICROBLAZE_64_GPC",
31 "BFD_RELOC_MICROBLAZE_64_GOT",
32 "BFD_RELOC_MICROBLAZE_64_PLT",
33 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
34diff --git a/bfd/reloc.c b/bfd/reloc.c
35index 6eb93e993f0..b6c9c22a0be 100644
36--- a/bfd/reloc.c
37+++ b/bfd/reloc.c
38@@ -6634,6 +6634,20 @@ ENUM
39 ENUMDOC
40 Address of a GOT entry.
41
42+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
43+ to two words (uses imml instruction).
44+ENUM
45+BFD_RELOC_MICROBLAZE_64,
46+ENUMDOC
47+ This is a 64 bit reloc that stores the 64 bit pc relative
48+ value in two words (with an imml instruction). No relocation is
49+ done here - only used for relaxing
50+ENUM
51+BFD_RELOC_MICROBLAZE_64_PCREL,
52+ENUMDOC
53+ This is a 32 bit reloc that stores the 32 bit pc relative
54+ value in two words (with an imml instruction). No relocation is
55+ done here - only used for relaxing
56 ENUM
57 BFD_RELOC_MICROBLAZE_32_LO
58 ENUMDOC
59@@ -6671,12 +6685,6 @@ ENUMDOC
60 This is a 64 bit reloc that stores the 32 bit pc relative value in
61 two words (with an imm instruction). No relocation is done here -
62 only used for relaxing.
63-ENUM
64- BFD_RELOC_MICROBLAZE_64
65-ENUMDOC
66- This is a 64 bit reloc that stores the 32 bit pc relative
67- value in two words (with an imm instruction). No relocation is
68- done here - only used for relaxing
69 ENUM
70 BFD_RELOC_MICROBLAZE_64_PCREL,
71 ENUMDOC
72@@ -6689,12 +6697,6 @@ ENUMDOC
73 This is a 64 bit reloc that stores the 32 bit pc relative
74 value in two words (with an imml instruction). No relocation is
75 done here - only used for relaxing
76-ENUM
77- BFD_RELOC_MICROBLAZE_64_GPC
78-ENUMDOC
79- This is a 64 bit reloc that stores the 32 bit pc relative
80- value in two words (with an imm instruction). The relocation is
81- PC-relative GOT offset
82 ENUM
83 BFD_RELOC_MICROBLAZE_64_GOT
84 ENUMDOC
85diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
86index 6640266cc47..29fb6360169 100644
87--- a/gas/config/tc-microblaze.c
88+++ b/gas/config/tc-microblaze.c
89@@ -2096,23 +2096,29 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
90 fragP->fr_fix += INST_WORD_SIZE * 2;
91 fragP->fr_var = 0;
92 break;
93+ case DEFINED_64_PC_OFFSET:
94+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
95+ fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_PCREL);
96+ fragP->fr_fix += INST_WORD_SIZE * 2;
97+ fragP->fr_var = 0;
98+ break;
99 case DEFINED_64_OFFSET:
100 if (fragP->fr_symbol == GOT_symbol)
101 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
102- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
103+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64_GPC);
104 else
105 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
106- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
107+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64);
108 fragP->fr_fix += INST_WORD_SIZE * 2;
109 fragP->fr_var = 0;
110 break;
111 case DEFINED_ABS_SEGMENT:
112 if (fragP->fr_symbol == GOT_symbol)
113 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
114- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
115+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
116 else
117 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
118- fragP->fr_offset, true, BFD_RELOC_64);
119+ fragP->fr_offset, false, BFD_RELOC_64);
120 fragP->fr_fix += INST_WORD_SIZE * 2;
121 fragP->fr_var = 0;
122 break;
123@@ -2334,10 +2340,12 @@ md_apply_fix (fixS * fixP,
124 case BFD_RELOC_64:
125 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
126 case BFD_RELOC_MICROBLAZE_64:
127+ case BFD_RELOC_MICROBLAZE_64_PCREL:
128 /* Add an imm instruction. First save the current instruction. */
129 for (i = 0; i < INST_WORD_SIZE; i++)
130 buf[i + INST_WORD_SIZE] = buf[i];
131- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
132+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
133+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
134 {
135 /* Generate the imm instruction. */
136 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
137@@ -2350,6 +2358,10 @@ md_apply_fix (fixS * fixP,
138 inst1 = opcode1->bit_sequence;
139 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
140 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
141+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
142+ fixP->fx_r_type = BFD_RELOC_64;
143+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
144+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
145 }
146 else
147 {
148@@ -2435,8 +2447,6 @@ md_apply_fix (fixS * fixP,
149 moves code around due to relaxing. */
150 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
151 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
152- else if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
153- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
154 else if (fixP->fx_r_type == BFD_RELOC_32)
155 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
156 else
157@@ -2486,9 +2496,9 @@ md_estimate_size_before_relax (fragS * fragP,
158 if(streq (fragP->fr_opcode, str_microblaze_64))
159 {
160 /* Used as an absolute value. */
161- fragP->fr_subtype = DEFINED_64_OFFSET;
162+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
163 /* Variable part does not change. */
164- fragP->fr_var = INST_WORD_SIZE;
165+ fragP->fr_var = INST_WORD_SIZE*2;
166 }
167 else
168 {
169@@ -2504,15 +2514,6 @@ md_estimate_size_before_relax (fragS * fragP,
170 fragP->fr_var = INST_WORD_SIZE;
171 }
172 }
173-#if 0
174- else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
175- !S_IS_WEAK (fragP->fr_symbol))
176- {
177- fragP->fr_subtype = DEFINED_PC_OFFSET;
178- /* Don't know now whether we need an imm instruction. */
179- fragP->fr_var = INST_WORD_SIZE;
180- }
181-#endif
182 else if (S_IS_DEFINED (fragP->fr_symbol)
183 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
184 {
185@@ -2610,33 +2611,6 @@ md_estimate_size_before_relax (fragS * fragP,
186 abort ();
187 }
188 }
189-#if 0 //revisit
190- else if (streq (name, "lli") || streq (name, "sli"))
191- {
192- temp = immed & 0xFFFFFFFFFFFF8000;
193- if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
194- {
195- /* Needs an immediate inst. */
196- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
197- if (opcode1 == NULL)
198- {
199- as_bad (_("unknown opcode \"%s\""), "imml");
200- return;
201- }
202-
203- inst1 = opcode1->bit_sequence;
204- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
205- output[0] = INST_BYTE0 (inst1);
206- output[1] = INST_BYTE1 (inst1);
207- output[2] = INST_BYTE2 (inst1);
208- output[3] = INST_BYTE3 (inst1);
209- output = frag_more (isize);
210- }
211- inst |= (reg1 << RD_LOW) & RD_MASK;
212- inst |= (reg2 << RA_LOW) & RA_MASK;
213- inst |= (immed << IMM_LOW) & IMM_MASK;
214- }
215-#endif
216 else
217 {
218 /* We know the abs value: Should never happen. */
219@@ -2657,6 +2631,7 @@ md_estimate_size_before_relax (fragS * fragP,
220 case TLSTPREL_OFFSET:
221 case TLSDTPREL_OFFSET:
222 case DEFINED_64_OFFSET:
223+ case DEFINED_64_PC_OFFSET:
224 fragP->fr_var = INST_WORD_SIZE*2;
225 break;
226 case DEFINED_RO_SEGMENT:
227@@ -2710,7 +2685,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
228 else
229 {
230 /* The case where we are going to resolve things... */
231- if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
232+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
233 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
234 else
235 return fixp->fx_where + fixp->fx_frag->fr_address;
236@@ -2745,6 +2720,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
237 case BFD_RELOC_MICROBLAZE_64_GOTPC:
238 case BFD_RELOC_MICROBLAZE_64_GPC:
239 case BFD_RELOC_MICROBLAZE_64:
240+ case BFD_RELOC_MICROBLAZE_64_PCREL:
241 case BFD_RELOC_MICROBLAZE_64_GOT:
242 case BFD_RELOC_MICROBLAZE_64_PLT:
243 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
244--
2452.34.1
246
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-MB-x-relocation-issues-Added-imml-for-required.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-MB-x-relocation-issues-Added-imml-for-required.patch
new file mode 100644
index 00000000..18698b02
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Fixed-MB-x-relocation-issues-Added-imml-for-required.patch
@@ -0,0 +1,52 @@
1From 88f7a313f8e21021dacfc8da2c490a433f596fd8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 24/53] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions
6
7Conflicts:
8 bfd/elf64-microblaze.c
9 gas/config/tc-microblaze.c
10
11Conflicts:
12 gas/config/tc-microblaze.c
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 gas/config/tc-microblaze.c | 6 ++++--
17 1 file changed, 4 insertions(+), 2 deletions(-)
18
19diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
20index 29fb6360169..e43ea82a2cc 100644
21--- a/gas/config/tc-microblaze.c
22+++ b/gas/config/tc-microblaze.c
23@@ -363,7 +363,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
24 Integer arg to pass to the function. */
25 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
26 and then in the read.c table. */
27-pseudo_typeS md_pseudo_table[] =
28+const pseudo_typeS md_pseudo_table[] =
29 {
30 {"lcomm", microblaze_s_lcomm, 1},
31 {"data8", cons, 1}, /* Same as byte. */
32@@ -2357,7 +2357,7 @@ md_apply_fix (fixS * fixP,
33
34 inst1 = opcode1->bit_sequence;
35 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
36- inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
37+ inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
38 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
39 fixP->fx_r_type = BFD_RELOC_64;
40 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
41@@ -2946,6 +2946,8 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
42 case OPTION_M64:
43 //if (arg != NULL && strcmp (arg, "64") == 0)
44 microblaze_arch_size = 64;
45+ // UPSTREAM/REVISIT - md_pseudo_table is const
46+ // md_pseudo_table[7].poc_val = 8;
47 break;
48 default:
49 return 0;
50--
512.34.1
52
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-address-computation-issues-with-64bit-address-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-address-computation-issues-with-64bit-address-.patch
new file mode 100644
index 00000000..d480388c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-address-computation-issues-with-64bit-address-.patch
@@ -0,0 +1,160 @@
1From 585f95d1510385ed3f67e76e2ad8f9a27b3ee32a Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 25/53] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
6
7Conflicts:
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
10
11Conflicts:
12 bfd/elf64-microblaze.c
13
14Conflicts:
15 bfd/elf64-microblaze.c
16
17Signed-off-by: Aayush Misra <aayushm@amd.com>
18---
19 bfd/elf64-microblaze.c | 2 +-
20 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
21 2 files changed, 67 insertions(+), 9 deletions(-)
22
23diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
24index ca92df647c9..9f542f55ebd 100755
25--- a/bfd/elf64-microblaze.c
26+++ b/bfd/elf64-microblaze.c
27@@ -2131,7 +2131,7 @@ microblaze_elf_relax_section (bfd *abfd,
28 efix = calc_fixup (target_address, 0, sec);
29
30 /* Validate the in-band val. */
31- val = bfd_get_32 (abfd, contents + irel->r_offset);
32+ val = bfd_get_64 (abfd, contents + irel->r_offset);
33 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
34 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
35 }
36diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
37index e43ea82a2cc..544732649a5 100644
38--- a/gas/config/tc-microblaze.c
39+++ b/gas/config/tc-microblaze.c
40@@ -372,7 +372,6 @@ const pseudo_typeS md_pseudo_table[] =
41 {"ent", s_func, 0}, /* Treat ent as function entry point. */
42 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
43 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
44- {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
45 {"weakext", microblaze_s_weakext, 0},
46 {"rodata", microblaze_s_rdata, 0},
47 {"sdata2", microblaze_s_rdata, 1},
48@@ -2317,18 +2316,74 @@ md_apply_fix (fixS * fixP,
49 case BFD_RELOC_RVA:
50 case BFD_RELOC_32_PCREL:
51 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
52+ /* Don't do anything if the symbol is not defined. */
53+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
54+ {
55+ if ((fixP->fx_r_type == BFD_RELOC_RVA) && (microblaze_arch_size == 64))
56+ {
57+ if (target_big_endian)
58+ {
59+ buf[0] |= ((val >> 56) & 0xff);
60+ buf[1] |= ((val >> 48) & 0xff);
61+ buf[2] |= ((val >> 40) & 0xff);
62+ buf[3] |= ((val >> 32) & 0xff);
63+ buf[4] |= ((val >> 24) & 0xff);
64+ buf[5] |= ((val >> 16) & 0xff);
65+ buf[6] |= ((val >> 8) & 0xff);
66+ buf[7] |= (val & 0xff);
67+ }
68+ else
69+ {
70+ buf[7] |= ((val >> 56) & 0xff);
71+ buf[6] |= ((val >> 48) & 0xff);
72+ buf[5] |= ((val >> 40) & 0xff);
73+ buf[4] |= ((val >> 32) & 0xff);
74+ buf[3] |= ((val >> 24) & 0xff);
75+ buf[2] |= ((val >> 16) & 0xff);
76+ buf[1] |= ((val >> 8) & 0xff);
77+ buf[0] |= (val & 0xff);
78+ }
79+ }
80+ else {
81+ if (target_big_endian)
82+ {
83+ buf[0] |= ((val >> 24) & 0xff);
84+ buf[1] |= ((val >> 16) & 0xff);
85+ buf[2] |= ((val >> 8) & 0xff);
86+ buf[3] |= (val & 0xff);
87+ }
88+ else
89+ {
90+ buf[3] |= ((val >> 24) & 0xff);
91+ buf[2] |= ((val >> 16) & 0xff);
92+ buf[1] |= ((val >> 8) & 0xff);
93+ buf[0] |= (val & 0xff);
94+ }
95+ }
96+ }
97+ break;
98+
99+ case BFD_RELOC_MICROBLAZE_EA64:
100 /* Don't do anything if the symbol is not defined. */
101 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
102 {
103 if (target_big_endian)
104 {
105- buf[0] |= ((val >> 24) & 0xff);
106- buf[1] |= ((val >> 16) & 0xff);
107- buf[2] |= ((val >> 8) & 0xff);
108- buf[3] |= (val & 0xff);
109+ buf[0] |= ((val >> 56) & 0xff);
110+ buf[1] |= ((val >> 48) & 0xff);
111+ buf[2] |= ((val >> 40) & 0xff);
112+ buf[3] |= ((val >> 32) & 0xff);
113+ buf[4] |= ((val >> 24) & 0xff);
114+ buf[5] |= ((val >> 16) & 0xff);
115+ buf[6] |= ((val >> 8) & 0xff);
116+ buf[7] |= (val & 0xff);
117 }
118 else
119 {
120+ buf[7] |= ((val >> 56) & 0xff);
121+ buf[6] |= ((val >> 48) & 0xff);
122+ buf[5] |= ((val >> 40) & 0xff);
123+ buf[4] |= ((val >> 32) & 0xff);
124 buf[3] |= ((val >> 24) & 0xff);
125 buf[2] |= ((val >> 16) & 0xff);
126 buf[1] |= ((val >> 8) & 0xff);
127@@ -2449,6 +2504,8 @@ md_apply_fix (fixS * fixP,
128 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
129 else if (fixP->fx_r_type == BFD_RELOC_32)
130 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
131+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64)
132+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64;
133 else
134 fixP->fx_r_type = BFD_RELOC_NONE;
135 fixP->fx_addsy = section_symbol (absolute_section);
136@@ -2719,6 +2776,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
137 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
138 case BFD_RELOC_MICROBLAZE_64_GOTPC:
139 case BFD_RELOC_MICROBLAZE_64_GPC:
140+ case BFD_RELOC_MICROBLAZE_EA64:
141 case BFD_RELOC_MICROBLAZE_64:
142 case BFD_RELOC_MICROBLAZE_64_PCREL:
143 case BFD_RELOC_MICROBLAZE_64_GOT:
144@@ -3002,10 +3060,10 @@ cons_fix_new_microblaze (fragS * frag,
145 r = BFD_RELOC_32;
146 break;
147 case 8:
148- if (microblaze_arch_size == 64)
149+ /*if (microblaze_arch_size == 64)
150 r = BFD_RELOC_32;
151- else
152- r = BFD_RELOC_64;
153+ else*/
154+ r = BFD_RELOC_MICROBLAZE_EA64;
155 break;
156 default:
157 as_bad (_("unsupported BFD relocation size %u"), size);
158--
1592.34.1
160
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
new file mode 100644
index 00000000..03d8e0b8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
@@ -0,0 +1,110 @@
1From d3fd5a77fa218f8f6c296337758d45cab61483fe Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 2 Nov 2021 17:28:24 +0530
4Subject: [PATCH 26/53] [Patch,MicroBlaze : Adding new relocation to support
5 64bit rodata.
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gas/config/tc-microblaze.c | 49 ++++++++++++++++++++++++++++++++++----
10 1 file changed, 45 insertions(+), 4 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index 544732649a5..c9757796ae8 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -1090,6 +1090,13 @@ md_assemble (char * str)
17 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
18 if(streq (name, "lli") || streq (name, "sli"))
19 opc = str_microblaze_64;
20+ else if ((microblaze_arch_size == 64) && ((streq (name, "lbui")
21+ || streq (name, "lhui") || streq (name, "lwi") || streq (name, "sbi")
22+ || streq (name, "shi") || streq (name, "swi"))))
23+ {
24+ opc = str_microblaze_64;
25+ subtype = opcode->inst_offset_type;
26+ }
27 else if (reg2 == REG_ROSDP)
28 opc = str_microblaze_ro_anchor;
29 else if (reg2 == REG_RWSDP)
30@@ -1157,7 +1164,10 @@ md_assemble (char * str)
31 inst |= (immed << IMM_LOW) & IMM_MASK;
32 }
33 }
34- else if (streq (name, "lli") || streq (name, "sli"))
35+ else if (streq (name, "lli") || streq (name, "sli") || ((microblaze_arch_size == 64)
36+ && ((streq (name, "lbui")) || streq (name, "lhui")
37+ || streq (name, "lwi") || streq (name, "sbi")
38+ || streq (name, "shi") || streq (name, "swi"))))
39 {
40 temp = immed & 0xFFFFFF8000;
41 if (temp != 0 && temp != 0xFFFFFF8000)
42@@ -1773,6 +1783,11 @@ md_assemble (char * str)
43
44 if (exp.X_md != 0)
45 subtype = get_imm_otype(exp.X_md);
46+ else if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
47+ {
48+ opc = str_microblaze_64;
49+ subtype = opcode->inst_offset_type;
50+ }
51 else
52 subtype = opcode->inst_offset_type;
53
54@@ -1790,6 +1805,31 @@ md_assemble (char * str)
55 output = frag_more (isize);
56 immed = exp.X_add_number;
57 }
58+ if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
59+ {
60+ temp = immed & 0xFFFFFF8000;
61+ if (temp != 0 && temp != 0xFFFFFF8000)
62+ {
63+ /* Needs an immediate inst. */
64+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
65+ if (opcode1 == NULL)
66+ {
67+ as_bad (_("unknown opcode \"%s\""), "imml");
68+ return;
69+ }
70+ inst1 = opcode1->bit_sequence;
71+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
72+ output[0] = INST_BYTE0 (inst1);
73+ output[1] = INST_BYTE1 (inst1);
74+ output[2] = INST_BYTE2 (inst1);
75+ output[3] = INST_BYTE3 (inst1);
76+ output = frag_more (isize);
77+ }
78+ inst |= (reg1 << RD_LOW) & RD_MASK;
79+ inst |= (immed << IMM_LOW) & IMM_MASK;
80+ }
81+ else
82+ {
83
84 temp = immed & 0xFFFF8000;
85 if ((temp != 0) && (temp != 0xFFFF8000))
86@@ -1815,6 +1855,7 @@ md_assemble (char * str)
87
88 inst |= (reg1 << RD_LOW) & RD_MASK;
89 inst |= (immed << IMM_LOW) & IMM_MASK;
90+ }
91 break;
92
93 case INST_TYPE_R2:
94@@ -3060,10 +3101,10 @@ cons_fix_new_microblaze (fragS * frag,
95 r = BFD_RELOC_32;
96 break;
97 case 8:
98- /*if (microblaze_arch_size == 64)
99- r = BFD_RELOC_32;
100- else*/
101+ if (microblaze_arch_size == 64)
102 r = BFD_RELOC_MICROBLAZE_EA64;
103+ else
104+ r = BFD_RELOC_64;
105 break;
106 default:
107 as_bad (_("unsupported BFD relocation size %u"), size);
108--
1092.34.1
110
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state-defsym-symb.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state-defsym-symb.patch
new file mode 100644
index 00000000..5a8992df
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Revert-ld-Remove-unused-expression-state-defsym-symb.patch
@@ -0,0 +1,84 @@
1From e89c2729322ce147e8a5a5e7842944593b4dd474 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 27 Feb 2019 15:12:32 +0530
4Subject: [PATCH 27/53] 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.
7
8This reverts commit 65f14869fd3fbee8ed4c4ca49de8aaa86dbc66cb.
9
10Conflicts:
11 ld/ChangeLog
12
13Conflicts:
14 ld/ldexp.c
15 ld/ldexp.h
16
17Signed-off-by: Aayush Misra <aayushm@amd.com>
18---
19 ld/ldexp.c | 8 +++++---
20 ld/ldexp.h | 1 +
21 2 files changed, 6 insertions(+), 3 deletions(-)
22
23diff --git a/ld/ldexp.c b/ld/ldexp.c
24index 3c8ab2d3589..525f3e4262c 100644
25--- a/ld/ldexp.c
26+++ b/ld/ldexp.c
27@@ -1402,6 +1402,7 @@ static etree_type *
28 exp_assop (const char *dst,
29 etree_type *src,
30 enum node_tree_enum class,
31+ bool defsym,
32 bool hidden)
33 {
34 etree_type *n;
35@@ -1413,6 +1414,7 @@ exp_assop (const char *dst,
36 n->assign.type.node_class = class;
37 n->assign.src = src;
38 n->assign.dst = dst;
39+ n->assign.defsym = defsym;
40 n->assign.hidden = hidden;
41 return n;
42 }
43@@ -1422,7 +1424,7 @@ exp_assop (const char *dst,
44 etree_type *
45 exp_assign (const char *dst, etree_type *src, bool hidden)
46 {
47- return exp_assop (dst, src, etree_assign, hidden);
48+ return exp_assop (dst, src, etree_assign, false, hidden);
49 }
50
51 /* Handle --defsym command-line option. */
52@@ -1430,7 +1432,7 @@ exp_assign (const char *dst, etree_type *src, bool hidden)
53 etree_type *
54 exp_defsym (const char *dst, etree_type *src)
55 {
56- return exp_assop (dst, src, etree_assign, false);
57+ return exp_assop (dst, src, etree_assign, true, false);
58 }
59
60 /* Handle PROVIDE. */
61@@ -1438,7 +1440,7 @@ exp_defsym (const char *dst, etree_type *src)
62 etree_type *
63 exp_provide (const char *dst, etree_type *src, bool hidden)
64 {
65- return exp_assop (dst, src, etree_provide, hidden);
66+ return exp_assop (dst, src, etree_provide, false, hidden);
67 }
68
69 /* Handle ASSERT. */
70diff --git a/ld/ldexp.h b/ld/ldexp.h
71index c779729e900..6d583e1b15a 100644
72--- a/ld/ldexp.h
73+++ b/ld/ldexp.h
74@@ -66,6 +66,7 @@ typedef union etree_union {
75 node_type type;
76 const char *dst;
77 union etree_union *src;
78+ bool defsym;
79 bool hidden;
80 } assign;
81 struct {
82--
832.34.1
84
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
new file mode 100644
index 00000000..675ce3ee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -0,0 +1,58 @@
1From 21eacbba925e2aaceaf3d3400030ae61a1aa4fef Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 28/53] fixing the long & long long mingw toolchain issue
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gas/config/tc-microblaze.c | 10 +++++-----
9 opcodes/microblaze-opc.h | 4 ++--
10 2 files changed, 7 insertions(+), 7 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index c9757796ae8..a8194d175e1 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -754,7 +754,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
17 }
18
19 static char *
20-parse_imml (char * s, expressionS * e, long min, long max)
21+parse_imml (char * s, expressionS * e, long long min, long long max)
22 {
23 char *new_pointer;
24 char *atp;
25@@ -805,11 +805,11 @@ parse_imml (char * s, expressionS * e, long min, long max)
26 ; /* An error message has already been emitted. */
27 else if ((e->X_op != O_constant && e->X_op != O_symbol) )
28 as_fatal (_("operand must be a constant or a label"));
29- else if ((e->X_op == O_constant) && ((long) e->X_add_number < min
30- || (long) e->X_add_number > max))
31+ else if ((e->X_op == O_constant) && ((long long) e->X_add_number < min
32+ || (long long) e->X_add_number > max))
33 {
34- as_fatal (_("operand must be absolute in range %ld..%ld, not %ld"),
35- min, max, (long) e->X_add_number);
36+ as_fatal (_("operand must be absolute in range %lld..%lld, not %lld"),
37+ min, max, (long long) e->X_add_number);
38 }
39
40 if (atp)
41diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
42index d9d05721dae..f85f5a600cc 100644
43--- a/opcodes/microblaze-opc.h
44+++ b/opcodes/microblaze-opc.h
45@@ -592,8 +592,8 @@ char pvr_register_prefix[] = "rpvr";
46 #define MIN_IMM6_WIDTH ((int) 0x00000001)
47 #define MAX_IMM6_WIDTH ((int) 0x00000040)
48
49-#define MIN_IMML ((long) 0xffffff8000000000L)
50-#define MAX_IMML ((long) 0x0000007fffffffffL)
51+#define MIN_IMML ((long long) 0xffffff8000000000L)
52+#define MAX_IMML ((long long) 0x0000007fffffffffL)
53
54 #endif /* MICROBLAZE_OPC */
55
56--
572.34.1
58
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0029-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Added-support-to-new-arithmetic-single-register-inst.patch
new file mode 100644
index 00000000..6199a4e5
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0029-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -0,0 +1,371 @@
1From c0cff55375899b12045eef8f5755e68a598ee4ff Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 29/53] Added support to new arithmetic single register
5 instructions
6
7Conflicts:
8 opcodes/microblaze-dis.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12 opcodes/microblaze-dis.c
13
14Conflicts:
15 gas/config/tc-microblaze.c
16signed-off-by:Nagaraju <nmekala@xilinx.com>
17 Mahesh <mbodapat@xilinx.com>
18
19Signed-off-by: Aayush Misra <aayushm@amd.com>
20---
21 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
22 opcodes/microblaze-dis.c | 11 +++
23 opcodes/microblaze-opc.h | 43 ++++++++++-
24 opcodes/microblaze-opcm.h | 5 +-
25 4 files changed, 200 insertions(+), 6 deletions(-)
26
27diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
28index a8194d175e1..3c9aec4c1f9 100644
29--- a/gas/config/tc-microblaze.c
30+++ b/gas/config/tc-microblaze.c
31@@ -394,12 +394,33 @@ void
32 md_begin (void)
33 {
34 const struct op_code_struct * opcode;
35+ const char *prev_name = "";
36
37 opcode_hash_control = str_htab_create ();
38
39 /* Insert unique names into hash table. */
40- for (opcode = microblaze_opcodes; opcode->name; opcode ++)
41- str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
42+ for (opcode = (struct microblaze_opcodes *)microblaze_opcodes; opcode->name; opcode ++)
43+ {
44+ if (strcmp (prev_name, opcode->name))
45+ {
46+ prev_name = (char *) opcode->name;
47+ str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
48+ }
49+ }
50+}
51+
52+static int
53+is_reg (char * s)
54+{
55+ int is_reg = 0;
56+ /* Strip leading whitespace. */
57+ while (ISSPACE (* s))
58+ ++ s;
59+ if (TOLOWER (s[0]) == 'r')
60+ {
61+ is_reg =1;
62+ }
63+ return is_reg;
64 }
65
66 /* Try to parse a reg name. */
67@@ -957,6 +978,7 @@ md_assemble (char * str)
68 {
69 char * op_start;
70 char * op_end;
71+ char * temp_op_end;
72 struct op_code_struct * opcode, *opcode1;
73 char * output = NULL;
74 int nlen = 0;
75@@ -967,9 +989,10 @@ md_assemble (char * str)
76 unsigned reg3;
77 unsigned isize;
78 unsigned long immed = 0, immed2 = 0, temp;
79- expressionS exp;
80+ expressionS exp,exp1;
81 char name[20];
82 long immedl;
83+ int reg=0;
84
85 /* Drop leading whitespace. */
86 while (ISSPACE (* str))
87@@ -1000,7 +1023,78 @@ md_assemble (char * str)
88 as_bad (_("unknown opcode \"%s\""), name);
89 return;
90 }
91-
92+
93+ if ((microblaze_arch_size == 64) && (streq (name, "addli") || streq (name, "addlic") ||
94+ streq (name, "addlik") || streq (name, "addlikc") || streq (name, "rsubli")
95+ || streq (name, "rsublic") || streq (name, "rsublik") || streq (name, "rsublikc")
96+ || streq (name, "andli") || streq (name, "andnli") || streq (name, "orli")
97+ || streq (name, "xorli")))
98+ {
99+ temp_op_end = op_end;
100+ if (strcmp (temp_op_end, ""))
101+ temp_op_end = parse_reg (temp_op_end + 1, &reg1); /* Get rd. */
102+ if (strcmp (temp_op_end, ""))
103+ reg = is_reg (temp_op_end + 1);
104+ if (reg)
105+ {
106+
107+ opcode->inst_type=INST_TYPE_RD_R1_IMML;
108+ opcode->inst_offset_type = OPCODE_MASK_H;
109+ if (streq (name, "addli"))
110+ opcode->bit_sequence = ADDLI_MASK;
111+ else if (streq (name, "addlic"))
112+ opcode->bit_sequence = ADDLIC_MASK;
113+ else if (streq (name, "addlik"))
114+ opcode->bit_sequence = ADDLIK_MASK;
115+ else if (streq (name, "addlikc"))
116+ opcode->bit_sequence = ADDLIKC_MASK;
117+ else if (streq (name, "rsubli"))
118+ opcode->bit_sequence = RSUBLI_MASK;
119+ else if (streq (name, "rsublic"))
120+ opcode->bit_sequence = RSUBLIC_MASK;
121+ else if (streq (name, "rsublik"))
122+ opcode->bit_sequence = RSUBLIK_MASK;
123+ else if (streq (name, "rsublikc"))
124+ opcode->bit_sequence = RSUBLIKC_MASK;
125+ else if (streq (name, "andli"))
126+ opcode->bit_sequence = ANDLI_MASK;
127+ else if (streq (name, "andnli"))
128+ opcode->bit_sequence = ANDLNI_MASK;
129+ else if (streq (name, "orli"))
130+ opcode->bit_sequence = ORLI_MASK;
131+ else if (streq (name, "xorli"))
132+ opcode->bit_sequence = XORLI_MASK;
133+ }
134+ else
135+ {
136+ opcode->inst_type=INST_TYPE_RD_IMML;
137+ opcode->inst_offset_type = OPCODE_MASK_LIMM;
138+ if (streq (name, "addli"))
139+ opcode->bit_sequence = ADDLI_ONE_REG_MASK;
140+ else if (streq (name, "addlic"))
141+ opcode->bit_sequence = ADDLIC_ONE_REG_MASK;
142+ else if (streq (name, "addlik"))
143+ opcode->bit_sequence = ADDLIK_ONE_REG_MASK;
144+ else if (streq (name, "addlikc"))
145+ opcode->bit_sequence = ADDLIKC_ONE_REG_MASK;
146+ else if (streq (name, "rsubli"))
147+ opcode->bit_sequence = RSUBLI_ONE_REG_MASK;
148+ else if (streq (name, "rsublic"))
149+ opcode->bit_sequence = RSUBLIC_ONE_REG_MASK;
150+ else if (streq (name, "rsublik"))
151+ opcode->bit_sequence = RSUBLIK_ONE_REG_MASK;
152+ else if (streq (name, "rsublikc"))
153+ opcode->bit_sequence = RSUBLIKC_ONE_REG_MASK;
154+ else if (streq (name, "andli"))
155+ opcode->bit_sequence = ANDLI_ONE_REG_MASK;
156+ else if (streq (name, "andnli"))
157+ opcode->bit_sequence = ANDLNI_ONE_REG_MASK;
158+ else if (streq (name, "orli"))
159+ opcode->bit_sequence = ORLI_ONE_REG_MASK;
160+ else if (streq (name, "xorli"))
161+ opcode->bit_sequence = XORLI_ONE_REG_MASK;
162+ }
163+ }
164 inst = opcode->bit_sequence;
165 isize = 4;
166
167@@ -1457,6 +1551,51 @@ md_assemble (char * str)
168 inst |= (immed << IMM_LOW) & IMM15_MASK;
169 break;
170
171+ case INST_TYPE_RD_IMML:
172+ if (strcmp (op_end, ""))
173+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
174+ else
175+ {
176+ as_fatal (_("Error in statement syntax"));
177+ reg1 = 0;
178+ }
179+
180+ if (strcmp (op_end, ""))
181+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
182+ else
183+ as_fatal (_("Error in statement syntax"));
184+
185+ /* Check for spl registers. */
186+ if (check_spl_reg (&reg1))
187+ as_fatal (_("Cannot use special register with this instruction"));
188+ if (exp.X_op != O_constant)
189+ {
190+ char *opc = NULL;
191+ relax_substateT subtype;
192+
193+ if (exp.X_md != 0)
194+ subtype = get_imm_otype(exp.X_md);
195+ else
196+ subtype = opcode->inst_offset_type;
197+
198+ output = frag_var (rs_machine_dependent,
199+ isize * 2,
200+ isize * 2,
201+ subtype,
202+ exp.X_add_symbol,
203+ exp.X_add_number,
204+ (char *) opc);
205+ immedl = 0L;
206+ }
207+ else
208+ {
209+ output = frag_more (isize);
210+ immed = exp.X_add_number;
211+ }
212+ inst |= (reg1 << RD_LOW) & RD_MASK;
213+ inst |= (immed << IMM_LOW) & IMM16_MASK;
214+ break;
215+
216 case INST_TYPE_R1_RFSL:
217 if (strcmp (op_end, ""))
218 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
219diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
220index 45262aef909..bdc6db79726 100644
221--- a/opcodes/microblaze-dis.c
222+++ b/opcodes/microblaze-dis.c
223@@ -143,6 +143,14 @@ get_field_imm15 (struct string_buf *buf, long instr)
224 return p;
225 }
226
227+get_field_imm16 (struct string_buf *buf, long instr)
228+{
229+ char *p = strbuf (buf);
230+
231+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
232+ return p;
233+}
234+
235 static char *
236 get_field_special (struct string_buf *buf, long instr,
237 const struct op_code_struct *op)
238@@ -473,6 +481,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
239 /* For mbar 16 or sleep insn. */
240 case INST_TYPE_NONE:
241 break;
242+ case INST_TYPE_RD_IMML:
243+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
244+ break;
245 /* For bit field insns. */
246 case INST_TYPE_RD_R1_IMMW_IMMS:
247 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
248diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
249index f85f5a600cc..6228114698b 100644
250--- a/opcodes/microblaze-opc.h
251+++ b/opcodes/microblaze-opc.h
252@@ -77,6 +77,7 @@
253 #define INST_TYPE_RD_R1_IMMW_IMMS 21
254
255 #define INST_TYPE_NONE 25
256+#define INST_TYPE_RD_IMML 26
257
258
259
260@@ -92,6 +93,7 @@
261 #define IMMVAL_MASK_MFS 0x0000
262
263 #define OPCODE_MASK_H 0xFC000000 /* High 6 bits only. */
264+#define OPCODE_MASK_LIMM 0xFC1F0000 /* High 6 bits and 12-16 bits */
265 #define OPCODE_MASK_H1 0xFFE00000 /* High 11 bits. */
266 #define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16. */
267 #define OPCODE_MASK_H12 0xFFFF0000 /* High 16. */
268@@ -114,6 +116,33 @@
269 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
270 #define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
271
272+/*Defines to identify 64-bit single reg instructions */
273+#define ADDLI_ONE_REG_MASK 0x68000000
274+#define ADDLIC_ONE_REG_MASK 0x68020000
275+#define ADDLIK_ONE_REG_MASK 0x68040000
276+#define ADDLIKC_ONE_REG_MASK 0x68060000
277+#define RSUBLI_ONE_REG_MASK 0x68010000
278+#define RSUBLIC_ONE_REG_MASK 0x68030000
279+#define RSUBLIK_ONE_REG_MASK 0x68050000
280+#define RSUBLIKC_ONE_REG_MASK 0x68070000
281+#define ORLI_ONE_REG_MASK 0x68100000
282+#define ANDLI_ONE_REG_MASK 0x68110000
283+#define XORLI_ONE_REG_MASK 0x68120000
284+#define ANDLNI_ONE_REG_MASK 0x68130000
285+#define ADDLI_MASK 0x20000000
286+#define ADDLIC_MASK 0x28000000
287+#define ADDLIK_MASK 0x30000000
288+#define ADDLIKC_MASK 0x38000000
289+#define RSUBLI_MASK 0x24000000
290+#define RSUBLIC_MASK 0x2C000000
291+#define RSUBLIK_MASK 0x34000000
292+#define RSUBLIKC_MASK 0x3C000000
293+#define ANDLI_MASK 0xA4000000
294+#define ANDLNI_MASK 0xAC000000
295+#define ORLI_MASK 0xA0000000
296+#define XORLI_MASK 0xA8000000
297+
298+
299 /* New Mask for msrset, msrclr insns. */
300 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
301 /* Mask for mbar insn. */
302@@ -122,7 +151,7 @@
303 #define DELAY_SLOT 1
304 #define NO_DELAY_SLOT 0
305
306-#define MAX_OPCODES 412
307+#define MAX_OPCODES 424
308
309 const struct op_code_struct
310 {
311@@ -451,13 +480,21 @@ const struct op_code_struct
312 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
313 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
314 {"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 */
315+ {"addli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68000000, OPCODE_MASK_LIMM, addli, arithmetic_inst },
316 {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
317+ {"rsubli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68010000, OPCODE_MASK_LIMM, rsubli, arithmetic_inst },
318 {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
319+ {"addlic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68020000, OPCODE_MASK_LIMM, addlic, arithmetic_inst },
320 {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
321+ {"rsublic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68030000, OPCODE_MASK_LIMM, rsublic, arithmetic_inst },
322 {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
323+ {"addlik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68040000, OPCODE_MASK_LIMM, addlik, arithmetic_inst },
324 {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
325+ {"rsublik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68050000, OPCODE_MASK_LIMM, rsublik, arithmetic_inst },
326 {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
327+ {"addlikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68060000, OPCODE_MASK_LIMM, addlikc, arithmetic_inst },
328 {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
329+ {"rsublikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68070000, OPCODE_MASK_LIMM, rsublikc, arithmetic_inst },
330 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
331 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
332 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
333@@ -508,9 +545,13 @@ const struct op_code_struct
334 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
335 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
336 {"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 */
337+ {"orli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68100000, OPCODE_MASK_LIMM, orli, arithmetic_inst },
338 {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
339+ {"andli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68110000, OPCODE_MASK_LIMM, andli, arithmetic_inst },
340 {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
341+ {"xorli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68120000, OPCODE_MASK_LIMM, xorli, arithmetic_inst },
342 {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
343+ {"andnli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68130000, OPCODE_MASK_LIMM, andnli, arithmetic_inst },
344 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
345 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
346 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
347diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
348index 08ed44352ee..a57cabf905f 100644
349--- a/opcodes/microblaze-opcm.h
350+++ b/opcodes/microblaze-opcm.h
351@@ -62,7 +62,9 @@ enum microblaze_instr
352 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
353
354 /* 64-bit instructions */
355- addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
356+ addl, addli, addlic, addlik, addlikc, rsubl, rsubli, rsublic, rsublik, rsublikc,
357+ addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
358+ andli, andnli, orli, xorli,
359 bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
360 andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
361 brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
362@@ -167,5 +169,6 @@ enum microblaze_instr_type
363
364 /* Imm mask for msrset, msrclr instructions. */
365 #define IMM15_MASK 0x00007FFF
366+#define IMM16_MASK 0x0000FFFF
367
368 #endif /* MICROBLAZE-OPCM */
369--
3702.34.1
371
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0030-double-imml-generation-for-64-bit-values.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0030-double-imml-generation-for-64-bit-values.patch
new file mode 100644
index 00000000..eb62eaeb
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0030-double-imml-generation-for-64-bit-values.patch
@@ -0,0 +1,545 @@
1From e4d7207d18e47a9ce5fbf57fc4faa370bf150284 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 30/53] double imml generation for 64 bit values.
5
6Conflicts:
7 gas/config/tc-microblaze.c
8
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++-------
12 opcodes/microblaze-opc.h | 4 +-
13 2 files changed, 262 insertions(+), 63 deletions(-)
14
15diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
16index 3c9aec4c1f9..4da765223be 100644
17--- a/gas/config/tc-microblaze.c
18+++ b/gas/config/tc-microblaze.c
19@@ -979,7 +979,7 @@ md_assemble (char * str)
20 char * op_start;
21 char * op_end;
22 char * temp_op_end;
23- struct op_code_struct * opcode, *opcode1;
24+ struct op_code_struct * opcode, *opcode1, *opcode2;
25 char * output = NULL;
26 int nlen = 0;
27 int i;
28@@ -1163,7 +1163,12 @@ md_assemble (char * str)
29 reg2 = 0;
30 }
31 if (strcmp (op_end, ""))
32+ {
33+ if(microblaze_arch_size == 64)
34+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
35+ else
36 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
37+ }
38 else
39 as_fatal (_("Error in statement syntax"));
40
41@@ -1263,26 +1268,51 @@ md_assemble (char * str)
42 || streq (name, "lwi") || streq (name, "sbi")
43 || streq (name, "shi") || streq (name, "swi"))))
44 {
45- temp = immed & 0xFFFFFF8000;
46- if (temp != 0 && temp != 0xFFFFFF8000)
47+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
48+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
49 {
50 /* Needs an immediate inst. */
51- opcode1
52- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
53- "imml");
54- if (opcode1 == NULL)
55+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
56+ {
57+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
58+ if (opcode1 == NULL)
59 {
60 as_bad (_("unknown opcode \"%s\""), "imml");
61 return;
62 }
63 inst1 = opcode1->bit_sequence;
64- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
65+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
66 output[0] = INST_BYTE0 (inst1);
67 output[1] = INST_BYTE1 (inst1);
68 output[2] = INST_BYTE2 (inst1);
69 output[3] = INST_BYTE3 (inst1);
70 output = frag_more (isize);
71 }
72+ else
73+ {
74+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
75+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
76+ if (opcode1 == NULL || opcode2 == NULL)
77+ {
78+ as_bad (_("unknown opcode \"%s\""), "imml");
79+ return;
80+ }
81+ inst1 = opcode2->bit_sequence;
82+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
83+ output[0] = INST_BYTE0 (inst1);
84+ output[1] = INST_BYTE1 (inst1);
85+ output[2] = INST_BYTE2 (inst1);
86+ output[3] = INST_BYTE3 (inst1);
87+ output = frag_more (isize);
88+ inst1 = opcode1->bit_sequence;
89+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
90+ output[0] = INST_BYTE0 (inst1);
91+ output[1] = INST_BYTE1 (inst1);
92+ output[2] = INST_BYTE2 (inst1);
93+ output[3] = INST_BYTE3 (inst1);
94+ output = frag_more (isize);
95+ }
96+ }
97 inst |= (reg1 << RD_LOW) & RD_MASK;
98 inst |= (reg2 << RA_LOW) & RA_MASK;
99 inst |= (immed << IMM_LOW) & IMM_MASK;
100@@ -1299,8 +1329,7 @@ md_assemble (char * str)
101 as_bad (_("unknown opcode \"%s\""), "imm");
102 return;
103 }
104-
105- inst1 = opcode1->bit_sequence;
106+ inst1 = opcode1->bit_sequence;
107 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
108 output[0] = INST_BYTE0 (inst1);
109 output[1] = INST_BYTE1 (inst1);
110@@ -1541,7 +1570,7 @@ md_assemble (char * str)
111 as_fatal (_("Cannot use special register with this instruction"));
112
113 if (exp.X_op != O_constant)
114- as_fatal (_("Symbol used as immediate value for msrset/msrclr instructions"));
115+ as_fatal (_("Symbol used as immediate value for arithmetic long instructions"));
116 else
117 {
118 output = frag_more (isize);
119@@ -1875,6 +1904,7 @@ md_assemble (char * str)
120 temp = immed & 0xFFFF8000;
121 if ((temp != 0) && (temp != 0xFFFF8000))
122 {
123+
124 /* Needs an immediate inst. */
125 opcode1
126 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
127@@ -1907,7 +1937,12 @@ md_assemble (char * str)
128 reg1 = 0;
129 }
130 if (strcmp (op_end, ""))
131+ {
132+ if(microblaze_arch_size == 64)
133+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
134+ else
135 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
136+ }
137 else
138 as_fatal (_("Error in statement syntax"));
139
140@@ -1946,30 +1981,55 @@ md_assemble (char * str)
141 }
142 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
143 {
144- temp = immed & 0xFFFFFF8000;
145- if (temp != 0 && temp != 0xFFFFFF8000)
146+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
147+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
148 {
149 /* Needs an immediate inst. */
150- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
151+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
152+ {
153+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
154 if (opcode1 == NULL)
155 {
156 as_bad (_("unknown opcode \"%s\""), "imml");
157 return;
158 }
159 inst1 = opcode1->bit_sequence;
160- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
161+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
162 output[0] = INST_BYTE0 (inst1);
163 output[1] = INST_BYTE1 (inst1);
164 output[2] = INST_BYTE2 (inst1);
165 output[3] = INST_BYTE3 (inst1);
166 output = frag_more (isize);
167 }
168+ else {
169+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
170+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
171+ if (opcode1 == NULL || opcode2 == NULL)
172+ {
173+ as_bad (_("unknown opcode \"%s\""), "imml");
174+ return;
175+ }
176+ inst1 = opcode2->bit_sequence;
177+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
178+ output[0] = INST_BYTE0 (inst1);
179+ output[1] = INST_BYTE1 (inst1);
180+ output[2] = INST_BYTE2 (inst1);
181+ output[3] = INST_BYTE3 (inst1);
182+ output = frag_more (isize);
183+ inst1 = opcode1->bit_sequence;
184+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
185+ output[0] = INST_BYTE0 (inst1);
186+ output[1] = INST_BYTE1 (inst1);
187+ output[2] = INST_BYTE2 (inst1);
188+ output[3] = INST_BYTE3 (inst1);
189+ output = frag_more (isize);
190+ }
191+ }
192 inst |= (reg1 << RD_LOW) & RD_MASK;
193 inst |= (immed << IMM_LOW) & IMM_MASK;
194 }
195 else
196 {
197-
198 temp = immed & 0xFFFF8000;
199 if ((temp != 0) && (temp != 0xFFFF8000))
200 {
201@@ -2057,24 +2117,50 @@ md_assemble (char * str)
202 streq (name, "breaid") ||
203 streq (name, "brai") || streq (name, "braid")))
204 {
205- temp = immed & 0xFFFFFF8000;
206+ temp = immed & 0xFFFFFFFFFFFF8000;
207 if (temp != 0)
208 {
209 /* Needs an immediate inst. */
210- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
211+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
212+ {
213+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
214 if (opcode1 == NULL)
215 {
216 as_bad (_("unknown opcode \"%s\""), "imml");
217 return;
218 }
219 inst1 = opcode1->bit_sequence;
220- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
221+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
222 output[0] = INST_BYTE0 (inst1);
223 output[1] = INST_BYTE1 (inst1);
224 output[2] = INST_BYTE2 (inst1);
225 output[3] = INST_BYTE3 (inst1);
226 output = frag_more (isize);
227 }
228+ else {
229+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
230+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
231+ if (opcode1 == NULL || opcode2 == NULL)
232+ {
233+ as_bad (_("unknown opcode \"%s\""), "imml");
234+ return;
235+ }
236+ inst1 = opcode2->bit_sequence;
237+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
238+ output[0] = INST_BYTE0 (inst1);
239+ output[1] = INST_BYTE1 (inst1);
240+ output[2] = INST_BYTE2 (inst1);
241+ output[3] = INST_BYTE3 (inst1);
242+ output = frag_more (isize);
243+ inst1 = opcode1->bit_sequence;
244+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
245+ output[0] = INST_BYTE0 (inst1);
246+ output[1] = INST_BYTE1 (inst1);
247+ output[2] = INST_BYTE2 (inst1);
248+ output[3] = INST_BYTE3 (inst1);
249+ output = frag_more (isize);
250+ }
251+ }
252 inst |= (immed << IMM_LOW) & IMM_MASK;
253 }
254 else
255@@ -2394,8 +2480,8 @@ md_apply_fix (fixS * fixP,
256 /* Note: use offsetT because it is signed, valueT is unsigned. */
257 offsetT val = (offsetT) * valp;
258 int i;
259- struct op_code_struct * opcode1;
260- unsigned long inst1;
261+ struct op_code_struct * opcode1, * opcode2;
262+ unsigned long inst1,inst2;
263
264 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
265
266@@ -2576,30 +2662,75 @@ md_apply_fix (fixS * fixP,
267 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
268 case BFD_RELOC_MICROBLAZE_64:
269 case BFD_RELOC_MICROBLAZE_64_PCREL:
270- /* Add an imm instruction. First save the current instruction. */
271- for (i = 0; i < INST_WORD_SIZE; i++)
272- buf[i + INST_WORD_SIZE] = buf[i];
273 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
274 || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
275 {
276 /* Generate the imm instruction. */
277- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
278+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
279+ {
280+ /* Add an imm instruction. First save the current instruction. */
281+ for (i = 0; i < INST_WORD_SIZE; i++)
282+ buf[i + INST_WORD_SIZE] = buf[i];
283+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
284 if (opcode1 == NULL)
285- {
286- as_bad (_("unknown opcode \"%s\""), "imml");
287- return;
288- }
289+ {
290+ as_bad (_("unknown opcode \"%s\""), "imml");
291+ return;
292+ }
293
294 inst1 = opcode1->bit_sequence;
295 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
296- inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
297+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
298+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
299+ fixP->fx_r_type = BFD_RELOC_64;
300+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
301+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
302+ buf[0] = INST_BYTE0 (inst1);
303+ buf[1] = INST_BYTE1 (inst1);
304+ buf[2] = INST_BYTE2 (inst1);
305+ buf[3] = INST_BYTE3 (inst1);
306+ }
307+ else {
308+ /* Add an imm instruction. First save the current instruction. */
309+ for (i = 0; i < INST_WORD_SIZE; i++)
310+ buf[i + INST_WORD_SIZE + 4] = buf[i];
311+
312+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
313+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
314+ if (opcode1 == NULL || opcode2 ==NULL)
315+ {
316+ as_bad (_("unknown opcode \"%s\""), "imml");
317+ return;
318+ }
319+ inst1 = opcode2->bit_sequence;
320+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
321+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 40) & IMML_MASK;
322+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
323+ fixP->fx_r_type = BFD_RELOC_64;
324+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
325+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
326+ inst2 = opcode1->bit_sequence;
327+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
328+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
329 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
330- fixP->fx_r_type = BFD_RELOC_64;
331+ fixP->fx_r_type = BFD_RELOC_64;
332 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
333- fixP->fx_r_type = BFD_RELOC_64_PCREL;
334+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
335+ buf[0] = INST_BYTE0 (inst1);
336+ buf[1] = INST_BYTE1 (inst1);
337+ buf[2] = INST_BYTE2 (inst1);
338+ buf[3] = INST_BYTE3 (inst1);
339+ buf[4] = INST_BYTE0 (inst2);
340+ buf[5] = INST_BYTE1 (inst2);
341+ buf[6] = INST_BYTE2 (inst2);
342+ buf[7] = INST_BYTE3 (inst2);
343+ }
344 }
345 else
346 {
347+ /* Add an imm instruction. First save the current instruction. */
348+ for (i = 0; i < INST_WORD_SIZE; i++)
349+ buf[i + INST_WORD_SIZE] = buf[i];
350 /* Generate the imm instruction. */
351 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
352 if (opcode1 == NULL)
353@@ -2611,12 +2742,11 @@ md_apply_fix (fixS * fixP,
354 inst1 = opcode1->bit_sequence;
355 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
356 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
357- }
358 buf[0] = INST_BYTE0 (inst1);
359 buf[1] = INST_BYTE1 (inst1);
360 buf[2] = INST_BYTE2 (inst1);
361 buf[3] = INST_BYTE3 (inst1);
362-
363+ }
364 /* Add the value only if the symbol is defined. */
365 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
366 {
367@@ -2649,21 +2779,41 @@ md_apply_fix (fixS * fixP,
368 for (i = 0; i < INST_WORD_SIZE; i++)
369 buf[i + INST_WORD_SIZE] = buf[i];
370 /* Generate the imm instruction. */
371- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
372- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
373+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) {
374+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
375+ {
376+ for (i = 0; i < INST_WORD_SIZE; i++)
377+ buf[i + INST_WORD_SIZE] = buf[i];
378+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
379+ }
380+ else {
381+ for (i = 0; i < INST_WORD_SIZE; i++)
382+ buf[i + INST_WORD_SIZE + 4] = buf[i];
383+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
384+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
385+ inst2 = opcode2->bit_sequence;
386+
387+ /* We can fixup call to a defined non-global address
388+ * within the same section only. */
389+ buf[4] = INST_BYTE0 (inst2);
390+ buf[5] = INST_BYTE1 (inst2);
391+ buf[6] = INST_BYTE2 (inst2);
392+ buf[7] = INST_BYTE3 (inst2);
393+ }
394+ }
395 else
396 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
397 if (opcode1 == NULL)
398 {
399+ for (i = 0; i < INST_WORD_SIZE; i++)
400+ buf[i + INST_WORD_SIZE] = buf[i];
401 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
402 as_bad (_("unknown opcode \"%s\""), "imml");
403 else
404 as_bad (_("unknown opcode \"%s\""), "imm");
405 return;
406 }
407-
408 inst1 = opcode1->bit_sequence;
409-
410 /* We can fixup call to a defined non-global address
411 within the same section only. */
412 buf[0] = INST_BYTE0 (inst1);
413@@ -3025,21 +3175,45 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
414 {
415 output = frag_more (isize);
416 immedl = exp.X_add_number;
417-
418- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
419- if (opcode1 == NULL)
420- {
421- as_bad (_("unknown opcode \"%s\""), "imml");
422- return;
423- }
424-
425- inst1 = opcode1->bit_sequence;
426- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
427- output[0] = INST_BYTE0 (inst1);
428- output[1] = INST_BYTE1 (inst1);
429- output[2] = INST_BYTE2 (inst1);
430- output[3] = INST_BYTE3 (inst1);
431- output = frag_more (isize);
432+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
433+ {
434+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
435+ if (opcode1 == NULL)
436+ {
437+ as_bad (_("unknown opcode \"%s\""), "imml");
438+ return;
439+ }
440+ inst1 = opcode1->bit_sequence;
441+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
442+ output[0] = INST_BYTE0 (inst1);
443+ output[1] = INST_BYTE1 (inst1);
444+ output[2] = INST_BYTE2 (inst1);
445+ output[3] = INST_BYTE3 (inst1);
446+ output = frag_more (isize);
447+ }
448+ else {
449+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
450+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
451+ if (opcode2 == NULL || opcode1 == NULL)
452+ {
453+ as_bad (_("unknown opcode \"%s\""), "imml");
454+ return;
455+ }
456+ inst1 = opcode2->bit_sequence;
457+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
458+ output[0] = INST_BYTE0 (inst1);
459+ output[1] = INST_BYTE1 (inst1);
460+ output[2] = INST_BYTE2 (inst1);
461+ output[3] = INST_BYTE3 (inst1);
462+ output = frag_more (isize);
463+ inst1 = opcode1->bit_sequence;
464+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
465+ output[0] = INST_BYTE0 (inst1);
466+ output[1] = INST_BYTE1 (inst1);
467+ output[2] = INST_BYTE2 (inst1);
468+ output[3] = INST_BYTE3 (inst1);
469+ output = frag_more (isize);
470+ }
471 }
472
473 inst |= (reg1 << RD_LOW) & RD_MASK;
474@@ -3088,20 +3262,45 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
475 {
476 output = frag_more (isize);
477 immedl = exp.X_add_number;
478- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
479- if (opcode1 == NULL)
480- {
481- as_bad (_("unknown opcode \"%s\""), "imml");
482- return;
483- }
484-
485+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
486+ {
487+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
488+ if (opcode1 == NULL)
489+ {
490+ as_bad (_("unknown opcode \"%s\""), "imml");
491+ return;
492+ }
493 inst1 = opcode1->bit_sequence;
494- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
495+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
496 output[0] = INST_BYTE0 (inst1);
497 output[1] = INST_BYTE1 (inst1);
498 output[2] = INST_BYTE2 (inst1);
499 output[3] = INST_BYTE3 (inst1);
500 output = frag_more (isize);
501+ }
502+ else {
503+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
504+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
505+ if (opcode2 == NULL || opcode1 == NULL)
506+ {
507+ as_bad (_("unknown opcode \"%s\""), "imml");
508+ return;
509+ }
510+ inst1 = opcode2->bit_sequence;
511+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
512+ output[0] = INST_BYTE0 (inst1);
513+ output[1] = INST_BYTE1 (inst1);
514+ output[2] = INST_BYTE2 (inst1);
515+ output[3] = INST_BYTE3 (inst1);
516+ output = frag_more (isize);
517+ inst1 = opcode1->bit_sequence;
518+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
519+ output[0] = INST_BYTE0 (inst1);
520+ output[1] = INST_BYTE1 (inst1);
521+ output[2] = INST_BYTE2 (inst1);
522+ output[3] = INST_BYTE3 (inst1);
523+ output = frag_more (isize);
524+ }
525 }
526
527 inst |= (reg1 << RA_LOW) & RA_MASK;
528diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
529index 6228114698b..f46fc76a94a 100644
530--- a/opcodes/microblaze-opc.h
531+++ b/opcodes/microblaze-opc.h
532@@ -633,8 +633,8 @@ char pvr_register_prefix[] = "rpvr";
533 #define MIN_IMM6_WIDTH ((int) 0x00000001)
534 #define MAX_IMM6_WIDTH ((int) 0x00000040)
535
536-#define MIN_IMML ((long long) 0xffffff8000000000L)
537-#define MAX_IMML ((long long) 0x0000007fffffffffL)
538+#define MIN_IMML ((long long) -9223372036854775808)
539+#define MAX_IMML ((long long) 9223372036854775807)
540
541 #endif /* MICROBLAZE_OPC */
542
543--
5442.34.1
545
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0031-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
new file mode 100644
index 00000000..5bc507ce
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0031-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
@@ -0,0 +1,88 @@
1From 3cd07844b77691afeb675806cc4c73fe08d2c30e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 3 Nov 2021 12:13:32 +0530
4Subject: [PATCH 31/53] Fixed bug in generation of IMML instruction for the
5
6new MB-64 instructions with single register.
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 gas/config/tc-microblaze.c | 50 +++++++++++++++++++++++++++++++++++---
11 1 file changed, 47 insertions(+), 3 deletions(-)
12
13diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
14index 4da765223be..651d855c800 100644
15--- a/gas/config/tc-microblaze.c
16+++ b/gas/config/tc-microblaze.c
17@@ -1614,12 +1614,56 @@ md_assemble (char * str)
18 exp.X_add_symbol,
19 exp.X_add_number,
20 (char *) opc);
21- immedl = 0L;
22+ immed = 0L;
23 }
24 else
25 {
26 output = frag_more (isize);
27 immed = exp.X_add_number;
28+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
29+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
30+ {
31+ /* Needs an immediate inst. */
32+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
33+ {
34+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
35+ if (opcode1 == NULL)
36+ {
37+ as_bad (_("unknown opcode \"%s\""), "imml");
38+ return;
39+ }
40+ inst1 = opcode1->bit_sequence;
41+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
42+ output[0] = INST_BYTE0 (inst1);
43+ output[1] = INST_BYTE1 (inst1);
44+ output[2] = INST_BYTE2 (inst1);
45+ output[3] = INST_BYTE3 (inst1);
46+ output = frag_more (isize);
47+ }
48+ else {
49+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
50+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
51+ if (opcode1 == NULL || opcode2 == NULL)
52+ {
53+ as_bad (_("unknown opcode \"%s\""), "imml");
54+ return;
55+ }
56+ inst1 = opcode2->bit_sequence;
57+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
58+ output[0] = INST_BYTE0 (inst1);
59+ output[1] = INST_BYTE1 (inst1);
60+ output[2] = INST_BYTE2 (inst1);
61+ output[3] = INST_BYTE3 (inst1);
62+ output = frag_more (isize);
63+ inst1 = opcode1->bit_sequence;
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+ }
72 }
73 inst |= (reg1 << RD_LOW) & RD_MASK;
74 inst |= (immed << IMM_LOW) & IMM16_MASK;
75@@ -2117,8 +2161,8 @@ md_assemble (char * str)
76 streq (name, "breaid") ||
77 streq (name, "brai") || streq (name, "braid")))
78 {
79- temp = immed & 0xFFFFFFFFFFFF8000;
80- if (temp != 0)
81+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
82+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
83 {
84 /* Needs an immediate inst. */
85 if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
86--
872.34.1
88
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0032-This-patch-will-remove-imml-0-and-imml-1-instruction.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0032-This-patch-will-remove-imml-0-and-imml-1-instruction.patch
new file mode 100644
index 00000000..686c8827
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0032-This-patch-will-remove-imml-0-and-imml-1-instruction.patch
@@ -0,0 +1,38 @@
1From 6e672cb099ae9670a9be1d26e36fa33df5757191 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH 32/53] This patch will remove imml 0 and imml -1 instructions
5 when the offset is less than 16 bit for Type A branch EA instructions.
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gas/config/tc-microblaze.c | 6 ++----
10 1 file changed, 2 insertions(+), 4 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index 651d855c800..ce0d3e26204 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -2129,9 +2129,7 @@ md_assemble (char * str)
17 if (exp.X_op != O_constant)
18 {
19 char *opc;
20- if (microblaze_arch_size == 64 && (streq (name, "breai") ||
21- streq (name, "breaid") ||
22- streq (name, "brai") || streq (name, "braid")))
23+ if (microblaze_arch_size == 64 && (streq (name, "brai") || streq (name, "braid")))
24 opc = str_microblaze_64;
25 else
26 opc = NULL;
27@@ -2707,7 +2705,7 @@ md_apply_fix (fixS * fixP,
28 case BFD_RELOC_MICROBLAZE_64:
29 case BFD_RELOC_MICROBLAZE_64_PCREL:
30 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
31- || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
32+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL || (fixP->fx_r_type == BFD_RELOC_64_PCREL && microblaze_arch_size == 64))
33 {
34 /* Generate the imm instruction. */
35 if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
36--
372.34.1
38
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Changing-the-long-to-long-long-as-in-Windows-long-is.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Changing-the-long-to-long-long-as-in-Windows-long-is.patch
new file mode 100644
index 00000000..1dbeaf0e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Changing-the-long-to-long-long-as-in-Windows-long-is.patch
@@ -0,0 +1,32 @@
1From 0c29905801152c8b8230bcca00b49b945054586b Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilinx.com>
3Date: Tue, 20 Apr 2021 21:22:06 +0530
4Subject: [PATCH 33/53] Changing the long to long long as in Windows long is
5 32-bit but we need the variable to be 64-bit
6
7Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
8
9Conflicts:
10 gas/config/tc-microblaze.c
11
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gas/config/tc-microblaze.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
18index ce0d3e26204..dc87429a4e8 100644
19--- a/gas/config/tc-microblaze.c
20+++ b/gas/config/tc-microblaze.c
21@@ -988,7 +988,7 @@ md_assemble (char * str)
22 unsigned reg2;
23 unsigned reg3;
24 unsigned isize;
25- unsigned long immed = 0, immed2 = 0, temp;
26+ unsigned long long immed = 0, immed2 = 0, temp;
27 expressionS exp,exp1;
28 char name[20];
29 long immedl;
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0034-gas-revert-moving-of-md_pseudo_table-from-const.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0034-gas-revert-moving-of-md_pseudo_table-from-const.patch
new file mode 100644
index 00000000..943d3158
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0034-gas-revert-moving-of-md_pseudo_table-from-const.patch
@@ -0,0 +1,62 @@
1From ec4fac4177c4364f52d1bc6ba53ffd971323cc22 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 21:57:13 +0530
4Subject: [PATCH 34/53] gas: revert moving of md_pseudo_table from const
5
6The base system expect md_pseudo_table to be constant, Changing the
7definition will break other architectures when compiled with a
8unified source code.
9
10Patch reverts the change away from const, and implements a newer
11dynamic handler that passes the correct argument value based on word
12size.
13
14Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
15Signed-off-by: Aayush Misra <aayushm@amd.com>
16---
17 gas/config/tc-microblaze.c | 15 ++++++++++++---
18 1 file changed, 12 insertions(+), 3 deletions(-)
19
20diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
21index dc87429a4e8..faa458af3a0 100644
22--- a/gas/config/tc-microblaze.c
23+++ b/gas/config/tc-microblaze.c
24@@ -356,6 +356,17 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
25 demand_empty_rest_of_line ();
26 }
27
28+/* Handle the .gpword pseudo-op, Pass to s_rva */
29+
30+static void
31+microblaze_s_gpword (int ignore ATTRIBUTE_UNUSED)
32+{
33+ int size = 4;
34+ if (microblaze_arch_size == 64)
35+ size = 8;
36+ s_rva(size);
37+}
38+
39 /* This table describes all the machine specific pseudo-ops the assembler
40 has to support. The fields are:
41 Pseudo-op name without dot
42@@ -371,7 +382,7 @@ const pseudo_typeS md_pseudo_table[] =
43 {"data32", cons, 4}, /* Same as word. */
44 {"ent", s_func, 0}, /* Treat ent as function entry point. */
45 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
46- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
47+ {"gpword", microblaze_s_gpword, 0}, /* gpword label => store resolved label address in data section. */
48 {"weakext", microblaze_s_weakext, 0},
49 {"rodata", microblaze_s_rdata, 0},
50 {"sdata2", microblaze_s_rdata, 1},
51@@ -3425,8 +3436,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
52 case OPTION_M64:
53 //if (arg != NULL && strcmp (arg, "64") == 0)
54 microblaze_arch_size = 64;
55- // UPSTREAM/REVISIT - md_pseudo_table is const
56- // md_pseudo_table[7].poc_val = 8;
57 break;
58 default:
59 return 0;
60--
612.34.1
62
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
new file mode 100644
index 00000000..c3ff9baf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
@@ -0,0 +1,44 @@
1From 2148cf1617fe1168ea747346d407e2ece94e163a Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 22:01:23 +0530
4Subject: [PATCH 35/53] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 2 +-
17 ld/emulparams/elf64microblazeel.sh | 2 +-
18 2 files changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
21index 9c7b0eb7080..7b4c7c411bd 100644
22--- a/ld/emulparams/elf64microblaze.sh
23+++ b/ld/emulparams/elf64microblaze.sh
24@@ -19,5 +19,5 @@ NOP=0x80000000
25 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
26 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
27
28-TEMPLATE_NAME=elf32
29+TEMPLATE_NAME=elf
30 #GENERATE_SHLIB_SCRIPT=yes
31diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
32index 9c7b0eb7080..7b4c7c411bd 100644
33--- a/ld/emulparams/elf64microblazeel.sh
34+++ b/ld/emulparams/elf64microblazeel.sh
35@@ -19,5 +19,5 @@ NOP=0x80000000
36 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
37 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
38
39-TEMPLATE_NAME=elf32
40+TEMPLATE_NAME=elf
41 #GENERATE_SHLIB_SCRIPT=yes
42--
432.34.1
44
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
new file mode 100644
index 00000000..fd03fc4c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
@@ -0,0 +1,79 @@
1From 9d691c146a484002e678babb0d40a9387272cb97 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:04:07 +0530
4Subject: [PATCH 36/53] Invalid data offsets (pointer) after relaxation.
5 Proposed patch from community member (dednev@rambler.ru) against 2021.1
6 [CR-1115232]
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/elf32-microblaze.c | 18 ++++++++++++++++++
11 1 file changed, 18 insertions(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 7e7c4bf471d..0ba7e36aa5f 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2176,6 +2176,9 @@ microblaze_elf_relax_section (bfd *abfd,
18 {
19 unsigned int val;
20
21+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
22+ continue;
23+
24 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25
26 /* hax: We only do the following fixup for debug location lists. */
27@@ -2215,6 +2218,9 @@ microblaze_elf_relax_section (bfd *abfd,
28 }
29 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
30 {
31+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
32+ continue;
33+
34 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
35
36 /* Look at the reloc only if the value has been resolved. */
37@@ -2247,6 +2253,9 @@ microblaze_elf_relax_section (bfd *abfd,
38 }
39 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
40 {
41+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
42+ continue;
43+
44 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
45
46 /* Look at the reloc only if the value has been resolved. */
47@@ -2284,6 +2293,9 @@ microblaze_elf_relax_section (bfd *abfd,
48 || (ELF32_R_TYPE (irelscan->r_info)
49 == (int) R_MICROBLAZE_TEXTREL_32_LO))
50 {
51+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
52+ continue;
53+
54 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
55
56 /* Look at the reloc only if the value has been resolved. */
57@@ -2330,6 +2342,9 @@ microblaze_elf_relax_section (bfd *abfd,
58 || (ELF32_R_TYPE (irelscan->r_info)
59 == (int) R_MICROBLAZE_TEXTREL_64))
60 {
61+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
62+ continue;
63+
64 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
65
66 /* Look at the reloc only if the value has been resolved. */
67@@ -2364,6 +2379,9 @@ microblaze_elf_relax_section (bfd *abfd,
68 }
69 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
70 {
71+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
72+ continue;
73+
74 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
75
76 /* Look at the reloc only if the value has been resolved. */
77--
782.34.1
79
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
new file mode 100644
index 00000000..2e632939
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
@@ -0,0 +1,107 @@
1From 36e578efe3e94a6c13b21c364d818d0a8fd675ca Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:59:19 +0530
4Subject: [PATCH 37/53] Double free with ld --no-keep-memory. Proposed patches
5 from the community member (dednev@rambler.ru) for 2021.1. [CR-1115233]
6
7Conflicts:
8 bfd/elf32-microblaze.c
9 bfd/elf64-microblaze.c
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/elf32-microblaze.c | 40 ++++++++++++++++++++++------------------
14 1 file changed, 22 insertions(+), 18 deletions(-)
15
16diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
17index 0ba7e36aa5f..1ff552a151b 100644
18--- a/bfd/elf32-microblaze.c
19+++ b/bfd/elf32-microblaze.c
20@@ -1882,10 +1882,8 @@ microblaze_elf_relax_section (bfd *abfd,
21 {
22 Elf_Internal_Shdr *symtab_hdr;
23 Elf_Internal_Rela *internal_relocs;
24- Elf_Internal_Rela *free_relocs = NULL;
25 Elf_Internal_Rela *irel, *irelend;
26 bfd_byte *contents = NULL;
27- bfd_byte *free_contents = NULL;
28 int rel_count;
29 unsigned int shndx;
30 size_t i, sym_index;
31@@ -1929,8 +1927,6 @@ microblaze_elf_relax_section (bfd *abfd,
32 internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
33 if (internal_relocs == NULL)
34 goto error_return;
35- if (! link_info->keep_memory)
36- free_relocs = internal_relocs;
37
38 sdata->relax_count = 0;
39 sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
40@@ -1958,7 +1954,6 @@ microblaze_elf_relax_section (bfd *abfd,
41 contents = (bfd_byte *) bfd_malloc (sec->size);
42 if (contents == NULL)
43 goto error_return;
44- free_contents = contents;
45
46 if (!bfd_get_section_contents (abfd, sec, contents,
47 (file_ptr) 0, sec->size))
48@@ -2475,25 +2470,26 @@ microblaze_elf_relax_section (bfd *abfd,
49 }
50
51 elf_section_data (sec)->relocs = internal_relocs;
52- free_relocs = NULL;
53
54 elf_section_data (sec)->this_hdr.contents = contents;
55- free_contents = NULL;
56
57 symtab_hdr->contents = (bfd_byte *) isymbuf;
58 }
59
60- free (free_relocs);
61- free_relocs = NULL;
62+ if (internal_relocs != NULL
63+ && elf_section_data (sec)->relocs != internal_relocs)
64+ free (internal_relocs);
65
66- if (free_contents != NULL)
67- {
68- if (!link_info->keep_memory)
69- free (free_contents);
70+ if (contents != NULL
71+ && elf_section_data (sec)->this_hdr.contents != contents)
72+ {
73+ if (! link_info->keep_memory)
74+ free (contents);
75 else
76- /* Cache the section contents for elf_link_input_bfd. */
77- elf_section_data (sec)->this_hdr.contents = contents;
78- free_contents = NULL;
79+ {
80+ /* Cache the section contents for elf_link_input_bfd. */
81+ elf_section_data (sec)->this_hdr.contents = contents;
82+ }
83 }
84
85 if (sdata->relax_count == 0)
86@@ -2507,8 +2503,16 @@ microblaze_elf_relax_section (bfd *abfd,
87 return true;
88
89 error_return:
90- free (free_relocs);
91- free (free_contents);
92+
93+ if (isymbuf != NULL
94+ && symtab_hdr->contents != (unsigned char *) isymbuf)
95+ free (isymbuf);
96+ if (internal_relocs != NULL
97+ && elf_section_data (sec)->relocs != internal_relocs)
98+ free (internal_relocs);
99+ if (contents != NULL
100+ && elf_section_data (sec)->this_hdr.contents != contents)
101+ free (contents);
102 free (sdata->relax);
103 sdata->relax = NULL;
104 sdata->relax_count = 0;
105--
1062.34.1
107
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0038-MB-binutils-Upstream-port-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0038-MB-binutils-Upstream-port-issues.patch
new file mode 100644
index 00000000..cfa1a49e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0038-MB-binutils-Upstream-port-issues.patch
@@ -0,0 +1,99 @@
1From b960fb122b35cb327b9db8fd1bb835899b24d106 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/53] MB binutils Upstream port issues.
5
6It's resolving the seg faults with ADDLIK
7Conflicts:
8 bfd/elf64-microblaze.c
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gas/config/tc-microblaze.c | 2 +-
13 opcodes/microblaze-dis.c | 12 ++++++------
14 opcodes/microblaze-opc.h | 2 +-
15 3 files changed, 8 insertions(+), 8 deletions(-)
16
17diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
18index faa458af3a0..686b1a00177 100644
19--- a/gas/config/tc-microblaze.c
20+++ b/gas/config/tc-microblaze.c
21@@ -404,7 +404,7 @@ const pseudo_typeS md_pseudo_table[] =
22 void
23 md_begin (void)
24 {
25- const struct op_code_struct * opcode;
26+ struct op_code_struct * opcode;
27 const char *prev_name = "";
28
29 opcode_hash_control = str_htab_create ();
30diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
31index bdc6db79726..d61d6bcfeba 100644
32--- a/opcodes/microblaze-dis.c
33+++ b/opcodes/microblaze-dis.c
34@@ -153,7 +153,7 @@ get_field_imm16 (struct string_buf *buf, long instr)
35
36 static char *
37 get_field_special (struct string_buf *buf, long instr,
38- const struct op_code_struct *op)
39+ struct op_code_struct *op)
40 {
41 char *p = strbuf (buf);
42 char *spr;
43@@ -226,11 +226,11 @@ get_field_special (struct string_buf *buf, long instr,
44 static unsigned long
45 read_insn_microblaze (bfd_vma memaddr,
46 struct disassemble_info *info,
47- const struct op_code_struct **opr)
48+ struct op_code_struct **opr)
49 {
50 unsigned char ibytes[4];
51 int status;
52- const struct op_code_struct *op;
53+ struct op_code_struct *op;
54 unsigned long inst;
55
56 status = info->read_memory_func (memaddr, ibytes, 4, info);
57@@ -266,7 +266,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
58 fprintf_ftype print_func = info->fprintf_func;
59 void *stream = info->stream;
60 unsigned long inst, prev_inst;
61- const struct op_code_struct *op, *pop;
62+ struct op_code_struct *op, *pop;
63 int immval = 0;
64 bool immfound = false;
65 static bfd_vma prev_insn_addr = -1; /* Init the prev insn addr. */
66@@ -518,7 +518,7 @@ get_insn_microblaze (long inst,
67 enum microblaze_instr_type *insn_type,
68 short *delay_slots)
69 {
70- const struct op_code_struct *op;
71+ struct op_code_struct *op;
72 *isunsignedimm = false;
73
74 /* Just a linear search of the table. */
75@@ -560,7 +560,7 @@ microblaze_get_target_address (long inst, bool immfound, int immval,
76 bool *targetvalid,
77 bool *unconditionalbranch)
78 {
79- const struct op_code_struct *op;
80+ struct op_code_struct *op;
81 long targetaddr = 0;
82
83 *unconditionalbranch = false;
84diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
85index f46fc76a94a..9f6d5456701 100644
86--- a/opcodes/microblaze-opc.h
87+++ b/opcodes/microblaze-opc.h
88@@ -153,7 +153,7 @@
89
90 #define MAX_OPCODES 424
91
92-const struct op_code_struct
93+struct op_code_struct
94 {
95 const char * name;
96 short inst_type; /* Registers and immediate values involved. */
97--
982.34.1
99
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-port-of-core-reading-support-Added-support-f.patch
new file mode 100644
index 00000000..06fefe2f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0039-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -0,0 +1,89 @@
1From ac87f4a6b9e35083a0403f188b61a317b53cfdbc Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 39/53] Initial port of core reading support Added support for
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.
7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 gdb/microblaze-linux-tdep.c | 11 +++++++++++
14 gdb/microblaze-tdep.c | 37 +++++++++++++++++++++++++++++++++++++
15 2 files changed, 48 insertions(+)
16
17diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
18index f34b0fa9fd4..babc9020f0f 100644
19--- a/gdb/microblaze-linux-tdep.c
20+++ b/gdb/microblaze-linux-tdep.c
21@@ -193,6 +193,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
22 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
23 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
24
25+ /* BFD target for core files. */
26+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
27+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
28+ else
29+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
30+
31+
32+ /* Shared library handling. */
33+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
34+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
35+
36 /* Enable TLS support. */
37 set_gdbarch_fetch_tls_load_module_address (gdbarch,
38 svr4_fetch_objfile_link_map);
39diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
40index f9cb3dfda33..fdea9721b17 100644
41--- a/gdb/microblaze-tdep.c
42+++ b/gdb/microblaze-tdep.c
43@@ -957,6 +957,43 @@ make_regs (struct gdbarch *arch)
44 }
45 #endif
46
47+void
48+microblaze_supply_gregset (const struct regset *regset,
49+ struct regcache *regcache,
50+ int regnum, const void *gregs)
51+{
52+ const unsigned int *regs = (const unsigned int *)gregs;
53+ if (regnum >= 0)
54+ regcache->raw_supply (regnum, regs + regnum);
55+
56+ if (regnum == -1) {
57+ int i;
58+
59+ for (i = 0; i < 50; i++) {
60+ regcache->raw_supply (i, regs + i);
61+ }
62+ }
63+}
64+
65+
66+/* Return the appropriate register set for the core section identified
67+ by SECT_NAME and SECT_SIZE. */
68+
69+static void
70+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
71+ iterate_over_regset_sections_cb *cb,
72+ void *cb_data,
73+ const struct regcache *regcache)
74+{
75+ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
76+
77+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
78+
79+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
80+}
81+
82+
83+
84 static struct gdbarch *
85 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
86 {
87--
882.34.1
89
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
new file mode 100644
index 00000000..85ae3f02
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
@@ -0,0 +1,185 @@
1From fc4d292d4154cad199cbe1635790867c98a84fc6 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 10:41:33 +0530
4Subject: [PATCH 40/53] Fix build issues after Xilinx 2023.2 binutils merge
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 10 ------
10 gdb/microblaze-tdep.c | 71 ++++++++++++++--------------------------
11 opcodes/microblaze-dis.c | 10 ------
12 3 files changed, 25 insertions(+), 66 deletions(-)
13
14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
15index 8b2815d7303..cfab5c99b76 100644
16--- a/bfd/bfd-in2.h
17+++ b/bfd/bfd-in2.h
18@@ -6456,11 +6456,6 @@ done here - only used for relaxing */
19 * +done here - only used for relaxing */
20 BFD_RELOC_MICROBLAZE_64_PCREL,
21
22-/* This is a 64 bit reloc that stores the 32 bit relative
23- * +value in two words (with an imml instruction). No relocation is
24- * +done here - only used for relaxing */
25- BFD_RELOC_MICROBLAZE_64,
26-
27 /* This is a 64 bit reloc that stores the 32 bit relative
28 * +value in two words (with an imml instruction). No relocation is
29 * +done here - only used for relaxing */
30@@ -6486,11 +6481,6 @@ value in two words (with an imml instruction). The relocation is
31 PC-relative GOT offset */
32 BFD_RELOC_MICROBLAZE_64_GPC,
33
34-/* This is a 64 bit reloc that stores the 32 bit pc relative
35-value in two words (with an imml instruction). The relocation is
36-PC-relative GOT offset */
37- BFD_RELOC_MICROBLAZE_64_GPC,
38-
39 /* This is a 64 bit reloc that stores the 32 bit pc relative
40 value in two words (with an imm instruction). The relocation is
41 GOT offset */
42diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
43index fdea9721b17..d83e508b82b 100644
44--- a/gdb/microblaze-tdep.c
45+++ b/gdb/microblaze-tdep.c
46@@ -70,6 +70,7 @@ static const char *microblaze_abi_string;
47 static const char *const microblaze_abi_strings[] = {
48 "auto",
49 "m64",
50+ NULL
51 };
52
53 enum microblaze_abi
54@@ -105,7 +106,7 @@ global_microblaze_abi (void)
55 if (microblaze_abi_strings[i] == microblaze_abi_string)
56 return (enum microblaze_abi) i;
57
58-// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
59+ internal_error (__FILE__, __LINE__, _("unknown ABI string"));
60 }
61
62 static void
63@@ -894,16 +895,31 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
64 }
65
66 static void
67-microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
68+microblaze_register_g_packet_guesses (struct gdbarch *gdbarch, enum microblaze_abi abi)
69 {
70
71- register_remote_g_packet_guess (gdbarch,
72- 4 * MICROBLAZE_NUM_CORE_REGS,
73- tdesc_microblaze64);
74+ if (abi == MICROBLAZE_ABI_M64)
75+ {
76+
77+ register_remote_g_packet_guess (gdbarch,
78+ 8 * MICROBLAZE_NUM_CORE_REGS,
79+ tdesc_microblaze64);
80+
81+ register_remote_g_packet_guess (gdbarch,
82+ 8 * MICROBLAZE_NUM_REGS,
83+ tdesc_microblaze64_with_stack_protect);
84+ }
85+ else
86+ {
87+
88+ register_remote_g_packet_guess (gdbarch,
89+ 4 * MICROBLAZE_NUM_CORE_REGS,
90+ tdesc_microblaze);
91
92- register_remote_g_packet_guess (gdbarch,
93- 4 * MICROBLAZE_NUM_REGS,
94- tdesc_microblaze64_with_stack_protect);
95+ register_remote_g_packet_guess (gdbarch,
96+ 4 * MICROBLAZE_NUM_REGS,
97+ tdesc_microblaze_with_stack_protect);
98+ }
99 }
100
101 void
102@@ -957,43 +973,6 @@ make_regs (struct gdbarch *arch)
103 }
104 #endif
105
106-void
107-microblaze_supply_gregset (const struct regset *regset,
108- struct regcache *regcache,
109- int regnum, const void *gregs)
110-{
111- const unsigned int *regs = (const unsigned int *)gregs;
112- if (regnum >= 0)
113- regcache->raw_supply (regnum, regs + regnum);
114-
115- if (regnum == -1) {
116- int i;
117-
118- for (i = 0; i < 50; i++) {
119- regcache->raw_supply (i, regs + i);
120- }
121- }
122-}
123-
124-
125-/* Return the appropriate register set for the core section identified
126- by SECT_NAME and SECT_SIZE. */
127-
128-static void
129-microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
130- iterate_over_regset_sections_cb *cb,
131- void *cb_data,
132- const struct regcache *regcache)
133-{
134- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
135-
136- cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
137-
138- cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
139-}
140-
141-
142-
143 static struct gdbarch *
144 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
145 {
146@@ -1134,7 +1113,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
147
148 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
149
150- //microblaze_register_g_packet_guesses (gdbarch);
151+ // microblaze_register_g_packet_guesses (gdbarch, microblaze_abi);
152
153 frame_base_set_default (gdbarch, &microblaze_frame_base);
154
155diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
156index d61d6bcfeba..692c977ac00 100644
157--- a/opcodes/microblaze-dis.c
158+++ b/opcodes/microblaze-dis.c
159@@ -466,10 +466,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
160 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
161 get_field_r2 (&buf, inst));
162 break;
163- case INST_TYPE_IMML:
164- print_func (stream, "\t%s", get_field_imml (&buf, inst));
165- /* TODO: Also print symbol */
166- break;
167 case INST_TYPE_RD_IMM15:
168 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
169 get_field_imm15 (&buf, inst));
170@@ -484,12 +480,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
171 case INST_TYPE_RD_IMML:
172 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
173 break;
174- /* For bit field insns. */
175- case INST_TYPE_RD_R1_IMMW_IMMS:
176- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
177- get_field_immw (&buf, inst), get_field_imms (&buf, inst));
178- break;
179- /* For bit field insns. */
180 case INST_TYPE_RD_R1_IMMW_IMMS:
181 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));
182 break;
183--
1842.34.1
185
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0041-disable-truncated-register-warning-gdb-remote.c.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0041-disable-truncated-register-warning-gdb-remote.c.patch
new file mode 100644
index 00000000..5a7e4dc3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0041-disable-truncated-register-warning-gdb-remote.c.patch
@@ -0,0 +1,26 @@
1From 0dc1b1aebeba31dff808a20fcc6444c9acfb99a3 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 15:44:56 +0530
4Subject: [PATCH 41/53] disable truncated register warning (gdb/remote.c)
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gdb/remote.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/gdb/remote.c b/gdb/remote.c
12index 72f14e28f54..cb99e5bc7b1 100644
13--- a/gdb/remote.c
14+++ b/gdb/remote.c
15@@ -8857,7 +8857,7 @@ remote_target::process_g_packet (struct regcache *regcache)
16 if (rsa->regs[i].pnum == -1)
17 continue;
18
19- if (offset >= sizeof_g_packet)
20+ if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
21 rsa->regs[i].in_g_packet = 0;
22 else if (offset + reg_size > sizeof_g_packet)
23 error (_("Truncated register %d in remote 'g' packet"), i);
24--
252.34.1
26
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
new file mode 100644
index 00000000..88aefa2f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
@@ -0,0 +1,42 @@
1From 81f86c3d6f787a9694e1c95625736f7c921b74df Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:20:48 +0530
4Subject: [PATCH 42/53] Fix unresolved conflicts from binutils_2_42_merge
5
6opcodes/microblaze-dis.c
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 opcodes/microblaze-dis.c | 15 ++++++++++-----
12 1 file changed, 10 insertions(+), 5 deletions(-)
13
14diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
15index 692c977ac00..912fa31be79 100644
16--- a/opcodes/microblaze-dis.c
17+++ b/opcodes/microblaze-dis.c
18@@ -478,11 +478,16 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
19 case INST_TYPE_NONE:
20 break;
21 case INST_TYPE_RD_IMML:
22- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
23- break;
24- case INST_TYPE_RD_R1_IMMW_IMMS:
25- 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));
26- break;
27+ print_func (stream, "\t%s, %s",
28+ get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
29+ break;
30+ case INST_TYPE_RD_R1_IMMW_IMMS:
31+ print_func (stream, "\t%s, %s, %s, %s",
32+ get_field_rd (&buf, inst),
33+ get_field_r1(&buf, inst),
34+ get_field_immw (&buf, inst),
35+ get_field_imms (&buf, inst));
36+ break;
37 /* For tuqula instruction */
38 case INST_TYPE_RD:
39 print_func (stream, "\t%s", get_field_rd (&buf, inst));
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
new file mode 100644
index 00000000..c5fa72d8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
@@ -0,0 +1,177 @@
1From a949ac58b5a3e6cbef03fc431f64052827fc9640 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:59:40 +0530
4Subject: [PATCH 43/53] microblaze_gdbarch_init: set microblaze_abi based on
5 wanted_abi and found_abi
6
7Earlier found_abi was declared but not set, instead gdbarch_info info
8was checked every time. Also, microblaze_abi remained undefined for 32-bit
9machines. As a result, gdb would show 64-bit registers when connecting
10to 32-bit targets with all register values garbled (r5 ended up in r2).
11This defect is fixed. found_abi is set from gdbarch_info, microblaze_abi
12is set based on wanted_abi and found_abi. Now upon connecting to a 32-bit
13remote target (mb-qemu) registers have the correct 32-bit size.
14
15Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
16Signed-off-by: Aayush Misra <aayushm@amd.com>
17---
18 gdb/microblaze-tdep.c | 73 +++++++++++++++++++------------------------
19 1 file changed, 33 insertions(+), 40 deletions(-)
20
21diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
22index d83e508b82b..6dcdeee76b3 100644
23--- a/gdb/microblaze-tdep.c
24+++ b/gdb/microblaze-tdep.c
25@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
26 const char *ignored_value)
27 {
28 enum microblaze_abi global_abi = global_microblaze_abi ();
29- enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
30+ enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
31 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
32
33 #if 1
34@@ -203,6 +203,13 @@ microblaze_register_name (struct gdbarch *gdbarch, int regnum)
35 static struct type *
36 microblaze_register_type (struct gdbarch *gdbarch, int regnum)
37 {
38+
39+ int mb_reg_size = microblaze_abi_regsize(gdbarch);
40+
41+ if (gdbarch_debug)
42+ gdb_printf (gdb_stdlog, "microblaze_register_type: reg_size = %d\n",
43+ mb_reg_size);
44+
45 if (regnum == MICROBLAZE_SP_REGNUM)
46 return builtin_type (gdbarch)->builtin_data_ptr;
47
48@@ -980,34 +987,38 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
49 enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
50 const struct target_desc *tdesc = info.target_desc;
51
52+ /* If there is already a candidate, use it. */
53+ arches = gdbarch_list_lookup_by_info (arches, &info);
54+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
55+ return arches->gdbarch;
56+
57 /* What has the user specified from the command line? */
58 wanted_abi = global_microblaze_abi ();
59 if (gdbarch_debug)
60 gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
61 wanted_abi);
62+
63+ found_abi = MICROBLAZE_ABI_AUTO;
64+
65+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
66+ found_abi = MICROBLAZE_ABI_M64;
67+
68 if (wanted_abi != MICROBLAZE_ABI_AUTO)
69 microblaze_abi = wanted_abi;
70-
71- /* If there is already a candidate, use it. */
72- arches = gdbarch_list_lookup_by_info (arches, &info);
73- if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
74- return arches->gdbarch;
75+ else
76+ microblaze_abi = found_abi;
77
78 if (microblaze_abi == MICROBLAZE_ABI_M64)
79 {
80- tdesc = tdesc_microblaze64;
81- reg_size = 8;
82+ tdesc = tdesc_microblaze64;
83+ reg_size = 8;
84 }
85- if (tdesc == NULL)
86+ else
87 {
88- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
89- {
90- tdesc = tdesc_microblaze64;
91- reg_size = 8;
92- }
93- else
94- tdesc = tdesc_microblaze;
95+ tdesc = tdesc_microblaze;
96+ reg_size = 4;
97 }
98+
99 /* Check any target description for validity. */
100 if (tdesc_has_registers (tdesc))
101 {
102@@ -1015,7 +1026,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
103 int valid_p;
104 int i;
105
106- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
107+ if (microblaze_abi == MICROBLAZE_ABI_M64)
108 feature = tdesc_find_feature (tdesc,
109 "org.gnu.gdb.microblaze64.core");
110 else
111@@ -1029,7 +1040,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
112 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
113 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
114 microblaze_register_names[i]);
115- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
116+ if (microblaze_abi == MICROBLAZE_ABI_M64)
117 feature = tdesc_find_feature (tdesc,
118 "org.gnu.gdb.microblaze64.stack-protect");
119 else
120@@ -1075,15 +1086,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
121
122 /* Register set.
123 make_regs (gdbarch); */
124- switch (info.bfd_arch_info->mach)
125- {
126- case bfd_mach_microblaze64:
127- set_gdbarch_ptr_bit (gdbarch, 64);
128- break;
129- }
130- if(microblaze_abi == MICROBLAZE_ABI_M64)
131+ if (microblaze_abi == MICROBLAZE_ABI_M64)
132 set_gdbarch_ptr_bit (gdbarch, 64);
133-
134+ else
135+ set_gdbarch_ptr_bit (gdbarch, 32);
136+
137 /* Map Dwarf2 registers to GDB registers. */
138 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
139
140@@ -1105,8 +1112,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
141 microblaze_breakpoint::bp_from_kind);
142 // set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
143
144-// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
145-
146 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
147
148 set_gdbarch_frame_args_skip (gdbarch, 8);
149@@ -1145,9 +1150,6 @@ _initialize_microblaze_tdep ()
150
151 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
152
153-// static struct cmd_list_element *setmicroblazecmdlist = NULL;
154-// static struct cmd_list_element *showmicroblazecmdlist = NULL;
155-
156 /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
157
158 add_setshow_prefix_cmd ("microblaze", no_class,
159@@ -1155,15 +1157,6 @@ _initialize_microblaze_tdep ()
160 _("Various microblaze specific commands."),
161 &setmicroblazecmdlist,&showmicroblazecmdlist,
162 &setlist,&showlist);
163-#if 0
164- add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
165- _("Various microblaze specific commands."),
166- &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
167-
168- add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
169- _("Various microblaze specific commands."),
170- &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
171-#endif
172
173 /* Allow the user to override the ABI. */
174 add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
175--
1762.34.1
177
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
new file mode 100644
index 00000000..a22fdb26
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
@@ -0,0 +1,32 @@
1From 70d94c8a627a91b7a59d99abf5c137f650a687d3 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 11:36:32 +0530
4Subject: [PATCH 44/53] Start bfd_mach_microblaze values from 0 (0,1) instead
5 of (1,2)
6
7Before 64-bit support there was only bfd_mach_microblaze (implicitly set to 0),
8setting microblaze_mach_microblaze64 to 1
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/archures.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/bfd/archures.c b/bfd/archures.c
16index b9db26627ea..604e65b7256 100644
17--- a/bfd/archures.c
18+++ b/bfd/archures.c
19@@ -515,8 +515,8 @@ DESCRIPTION
20 . bfd_arch_lm32, {* Lattice Mico32. *}
21 .#define bfd_mach_lm32 1
22 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
23-.#define bfd_mach_microblaze 1
24-.#define bfd_mach_microblaze64 2
25+.#define bfd_mach_microblaze 0
26+.#define bfd_mach_microblaze64 1
27 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
28 .#define bfd_mach_kv3_unknown 0
29 .#define bfd_mach_kv3_1 1
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
new file mode 100644
index 00000000..a9f96637
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
@@ -0,0 +1,61 @@
1From 8fd6902a818f28422bd98b18ff3f0fe9b872e5cf Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:37:11 +0530
4Subject: [PATCH 45/53] Fix build issues - bfd/reloc.c add missing relocs used
5 elsewhere
6
7 BFD_RELOC_MICROBLAZE_EA64
8 BFD_RELOC_MICROBLAZE_64_GPC
9
10Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/reloc.c | 16 +++++++++++-----
14 1 file changed, 11 insertions(+), 5 deletions(-)
15
16diff --git a/bfd/reloc.c b/bfd/reloc.c
17index b6c9c22a0be..86ca1283582 100644
18--- a/bfd/reloc.c
19+++ b/bfd/reloc.c
20@@ -6637,13 +6637,19 @@ ENUMDOC
21 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
22 to two words (uses imml instruction).
23 ENUM
24-BFD_RELOC_MICROBLAZE_64,
25+BFD_RELOC_MICROBLAZE_64
26 ENUMDOC
27 This is a 64 bit reloc that stores the 64 bit pc relative
28 value in two words (with an imml instruction). No relocation is
29 done here - only used for relaxing
30 ENUM
31-BFD_RELOC_MICROBLAZE_64_PCREL,
32+BFD_RELOC_MICROBLAZE_EA64
33+ENUMDOC
34+ This is a 64 bit reloc that stores the 64 bit pc relative
35+ value in two words (with an imml instruction). No relocation is
36+ done here - only used for relaxing
37+ENUM
38+BFD_RELOC_MICROBLAZE_64_PCREL
39 ENUMDOC
40 This is a 32 bit reloc that stores the 32 bit pc relative
41 value in two words (with an imml instruction). No relocation is
42@@ -6686,13 +6692,13 @@ ENUMDOC
43 two words (with an imm instruction). No relocation is done here -
44 only used for relaxing.
45 ENUM
46-BFD_RELOC_MICROBLAZE_64_PCREL,
47+BFD_RELOC_MICROBLAZE_64_GOTPC
48 ENUMDOC
49- This is a 32 bit reloc that stores the 32 bit pc relative
50+ This is a 64 bit reloc that stores the 32 bit pc relative
51 value in two words (with an imml instruction). No relocation is
52 done here - only used for relaxing
53 ENUM
54- BFD_RELOC_MICROBLAZE_64_GOTPC
55+ BFD_RELOC_MICROBLAZE_64_GPC
56 ENUMDOC
57 This is a 64 bit reloc that stores the 32 bit pc relative
58 value in two words (with an imml instruction). No relocation is
59--
602.34.1
61
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
new file mode 100644
index 00000000..3e6be541
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
@@ -0,0 +1,116 @@
1From 84bb72aa81dddd5f21ac49ddf7b38bce74942cdf Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:47:56 +0530
4Subject: [PATCH 46/53] Regenerate - bfd/bfd-in2.h bfd/libbfd.h
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 70 +++++++++++++++++++++++++--------------------------
10 1 file changed, 35 insertions(+), 35 deletions(-)
11
12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
13index cfab5c99b76..96949605e50 100644
14--- a/bfd/bfd-in2.h
15+++ b/bfd/bfd-in2.h
16@@ -1771,8 +1771,8 @@ enum bfd_architecture
17 bfd_arch_lm32, /* Lattice Mico32. */
18 #define bfd_mach_lm32 1
19 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
20-#define bfd_mach_microblaze 1
21-#define bfd_mach_microblaze64 2
22+#define bfd_mach_microblaze 0
23+#define bfd_mach_microblaze64 1
24 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
25 #define bfd_mach_kv3_unknown 0
26 #define bfd_mach_kv3_1 1
27@@ -6426,8 +6426,23 @@ enum bfd_reloc_code_real
28 /* Address of a GOT entry. */
29 BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT,
30
31- /* This is a 32 bit reloc for the microblaze that stores the low 16
32- bits of a value. */
33+ /* This is a 64 bit reloc that stores the 64 bit pc relative
34+ value in two words (with an imml instruction). No relocation is
35+ done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_64,
37+
38+ /* This is a 64 bit reloc that stores the 64 bit pc relative
39+ value in two words (with an imml instruction). No relocation is
40+ done here - only used for relaxing */
41+ BFD_RELOC_MICROBLAZE_EA64,
42+
43+ /* This is a 32 bit reloc that stores the 32 bit pc relative
44+ value in two words (with an imml instruction). No relocation is
45+ done here - only used for relaxing */
46+ BFD_RELOC_MICROBLAZE_64_PCREL,
47+
48+ /* This is a 32 bit reloc for the microblaze that stores the
49+ low 16 bits of a value */
50 BFD_RELOC_MICROBLAZE_32_LO,
51
52 /* This is a 32 bit pc-relative reloc for the microblaze that stores
53@@ -6446,44 +6461,29 @@ enum bfd_reloc_code_real
54 the form "Symbol Op Symbol". */
55 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
56
57-/* This is a 32 bit reloc that stores the 32 bit pc relative
58-value in two words (with an imm instruction). No relocation is
59-done here - only used for relaxing */
60+ /* This is a 32 bit reloc that stores the 32 bit pc relative
61+ value in two words (with an imm instruction). No relocation is
62+ done here - only used for relaxing */
63 BFD_RELOC_MICROBLAZE_32_NONE,
64
65-/* This is a 64 bit reloc that stores the 32 bit pc relative
66- * +value in two words (with an imml instruction). No relocation is
67- * +done here - only used for relaxing */
68- BFD_RELOC_MICROBLAZE_64_PCREL,
69-
70-/* This is a 64 bit reloc that stores the 32 bit relative
71- * +value in two words (with an imml instruction). No relocation is
72- * +done here - only used for relaxing */
73- BFD_RELOC_MICROBLAZE_EA64,
74-
75-/* This is a 64 bit reloc that stores the 32 bit pc relative
76- * +value in two words (with an imm instruction). No relocation is
77- * +done here - only used for relaxing */
78- BFD_RELOC_MICROBLAZE_64_NONE,
79-
80- /* This is a 64 bit reloc that stores the 32 bit pc relative value in
81- two words (with an imm instruction). No relocation is done here
82- only used for relaxing */
83- BFD_RELOC_MICROBLAZE_64,
84+ /* This is a 32 bit reloc that stores the 32 bit pc relative
85+ value in two words (with an imml instruction). No relocation is
86+ done here - only used for relaxing */
87+ BFD_RELOC_MICROBLAZE_64_NONE,
88
89-/* This is a 64 bit reloc that stores the 32 bit pc relative
90-value in two words (with an imm instruction). The relocation is
91-PC-relative GOT offset */
92+ /* This is a 64 bit reloc that stores the 32 bit pc relative
93+ value in two words (with an imm instruction). The relocation is
94+ PC-relative GOT offset */
95 BFD_RELOC_MICROBLAZE_64_GOTPC,
96
97-/* This is a 64 bit reloc that stores the 32 bit pc relative
98-value in two words (with an imml instruction). The relocation is
99-PC-relative GOT offset */
100+ /* This is a 64 bit reloc that stores the 32 bit pc relative
101+ value in two words (with an imml instruction). No relocation is
102+ done here - only used for relaxing */
103 BFD_RELOC_MICROBLAZE_64_GPC,
104
105-/* This is a 64 bit reloc that stores the 32 bit pc relative
106-value in two words (with an imm instruction). The relocation is
107-GOT offset */
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 */
111 BFD_RELOC_MICROBLAZE_64_GOT,
112
113 /* This is a 64 bit reloc that stores the 32 bit pc relative value in
114--
1152.34.1
116
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
new file mode 100644
index 00000000..bf82b0ef
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
@@ -0,0 +1,32 @@
1From 8deda21efd527564a262dc07a519f8bd03095b3c Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 16:32:22 +0530
4Subject: [PATCH 47/53] gdb/remote.c - revert earlier change to
5 process_g_packet
6
7When connecting to remote target, gdb (microblaze-xilinx-elf) was
8generating Truncated register 29 error when parsing the g packet,
9workaround added being reverted.
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/remote.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/gdb/remote.c b/gdb/remote.c
18index cb99e5bc7b1..72f14e28f54 100644
19--- a/gdb/remote.c
20+++ b/gdb/remote.c
21@@ -8857,7 +8857,7 @@ remote_target::process_g_packet (struct regcache *regcache)
22 if (rsa->regs[i].pnum == -1)
23 continue;
24
25- if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
26+ if (offset >= sizeof_g_packet)
27 rsa->regs[i].in_g_packet = 0;
28 else if (offset + reg_size > sizeof_g_packet)
29 error (_("Truncated register %d in remote 'g' packet"), i);
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
new file mode 100644
index 00000000..6c40a7e4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
@@ -0,0 +1,465 @@
1From e372266dde792b03fb1754769a9615c818336171 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Mon, 1 Apr 2024 16:21:28 +0530
4Subject: [PATCH 48/53] Fix build issues after Xilinx 2023.2 binutils patch
5 merge
6
7binutils/readelf.c - duplicate case statement
8gas/config/tc-microblaze.c - Missing , between array elements
9gas/config/tc-microblaze.c - A whole hunk ended up in wrong function/switch
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/libbfd.h | 6 +-
14 binutils/readelf.c | 5 -
15 gas/config/tc-microblaze.c | 375 +++++++++++++++++++------------------
16 3 files changed, 192 insertions(+), 194 deletions(-)
17
18diff --git a/bfd/libbfd.h b/bfd/libbfd.h
19index 7a3e558d70a..5f78d16db18 100644
20--- a/bfd/libbfd.h
21+++ b/bfd/libbfd.h
22@@ -2998,6 +2998,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
23 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGE21",
24 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12",
25 "BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT",
26+ "BFD_RELOC_MICROBLAZE_64",
27+ "BFD_RELOC_MICROBLAZE_EA64",
28+ "BFD_RELOC_MICROBLAZE_64_PCREL",
29 "BFD_RELOC_MICROBLAZE_32_LO",
30 "BFD_RELOC_MICROBLAZE_32_LO_PCREL",
31 "BFD_RELOC_MICROBLAZE_32_ROSDA",
32@@ -3006,13 +3009,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
33 "BFD_RELOC_MICROBLAZE_32_NONE",
34 "BFD_RELOC_MICROBLAZE_64_NONE",
35 "BFD_RELOC_MICROBLAZE_64_GOTPC",
36+ "BFD_RELOC_MICROBLAZE_64_GPC",
37 "BFD_RELOC_MICROBLAZE_64_GOT",
38 "BFD_RELOC_MICROBLAZE_64_PLT",
39 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
40 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
41 "BFD_RELOC_MICROBLAZE_COPY",
42- "BFD_RELOC_MICROBLAZE_64",
43- "BFD_RELOC_MICROBLAZE_64_PCREL",
44 "BFD_RELOC_MICROBLAZE_64_TLS",
45 "BFD_RELOC_MICROBLAZE_64_TLSGD",
46 "BFD_RELOC_MICROBLAZE_64_TLSLD",
47diff --git a/binutils/readelf.c b/binutils/readelf.c
48index 3ca9f3697d1..5e4ad6ea6ad 100644
49--- a/binutils/readelf.c
50+++ b/binutils/readelf.c
51@@ -15288,11 +15288,6 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
52 || reloc_type == 9 /* R_MICROBLAZE_64_NONE. */);
53 default:
54 return false;
55- /* REVISIT microblaze-binutils-merge */
56- case EM_MICROBLAZE:
57- return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */
58- || reloc_type == 0 /* R_MICROBLAZE_NONE. */
59- || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
60 }
61 }
62
63diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
64index 686b1a00177..d3d1e334bb5 100644
65--- a/gas/config/tc-microblaze.c
66+++ b/gas/config/tc-microblaze.c
67@@ -118,7 +118,7 @@ const relax_typeS md_relax_table[] =
68 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
69 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
70 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
71- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
72+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
73 { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */
74 { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
75 };
76@@ -2263,6 +2263,193 @@ md_assemble (char * str)
77 inst |= (immed << IMM_MBAR);
78 break;
79
80+ /* For 64-bit instructions */
81+ case INST_TYPE_RD_R1_IMML:
82+ if (strcmp (op_end, ""))
83+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
84+ else
85+ {
86+ as_fatal (_("Error in statement syntax"));
87+ reg1 = 0;
88+ }
89+ if (strcmp (op_end, ""))
90+ op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
91+ else
92+ {
93+ as_fatal (_("Error in statement syntax"));
94+ reg2 = 0;
95+ }
96+ if (strcmp (op_end, ""))
97+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
98+ else
99+ as_fatal (_("Error in statement syntax"));
100+
101+ /* Check for spl registers. */
102+ if (check_spl_reg (& reg1))
103+ as_fatal (_("Cannot use special register with this instruction"));
104+ if (check_spl_reg (& reg2))
105+ as_fatal (_("Cannot use special register with this instruction"));
106+
107+ if (exp.X_op != O_constant)
108+ {
109+ char *opc = NULL;
110+ //char *opc = str_microblaze_64;
111+ relax_substateT subtype;
112+
113+ if (exp.X_md != 0)
114+ subtype = get_imm_otype(exp.X_md);
115+ else
116+ subtype = opcode->inst_offset_type;
117+
118+ output = frag_var (rs_machine_dependent,
119+ isize * 2, /* maxm of 2 words. */
120+ isize * 2, /* minm of 2 words. */
121+ subtype, /* PC-relative or not. */
122+ exp.X_add_symbol,
123+ exp.X_add_number,
124+ (char *) opc);
125+ immedl = 0L;
126+ }
127+ else
128+ {
129+ output = frag_more (isize);
130+ immedl = exp.X_add_number;
131+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
132+ {
133+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
134+ if (opcode1 == NULL)
135+ {
136+ as_bad (_("unknown opcode \"%s\""), "imml");
137+ return;
138+ }
139+ inst1 = opcode1->bit_sequence;
140+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
141+ output[0] = INST_BYTE0 (inst1);
142+ output[1] = INST_BYTE1 (inst1);
143+ output[2] = INST_BYTE2 (inst1);
144+ output[3] = INST_BYTE3 (inst1);
145+ output = frag_more (isize);
146+ }
147+ else {
148+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
149+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
150+ if (opcode2 == NULL || opcode1 == NULL)
151+ {
152+ as_bad (_("unknown opcode \"%s\""), "imml");
153+ return;
154+ }
155+ inst1 = opcode2->bit_sequence;
156+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
157+ output[0] = INST_BYTE0 (inst1);
158+ output[1] = INST_BYTE1 (inst1);
159+ output[2] = INST_BYTE2 (inst1);
160+ output[3] = INST_BYTE3 (inst1);
161+ output = frag_more (isize);
162+ inst1 = opcode1->bit_sequence;
163+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
164+ output[0] = INST_BYTE0 (inst1);
165+ output[1] = INST_BYTE1 (inst1);
166+ output[2] = INST_BYTE2 (inst1);
167+ output[3] = INST_BYTE3 (inst1);
168+ output = frag_more (isize);
169+ }
170+ }
171+
172+ inst |= (reg1 << RD_LOW) & RD_MASK;
173+ inst |= (reg2 << RA_LOW) & RA_MASK;
174+ inst |= (immedl << IMM_LOW) & IMM_MASK;
175+ break;
176+
177+ case INST_TYPE_R1_IMML:
178+ if (strcmp (op_end, ""))
179+ op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
180+ else
181+ {
182+ as_fatal (_("Error in statement syntax"));
183+ reg1 = 0;
184+ }
185+ if (strcmp (op_end, ""))
186+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
187+ else
188+ as_fatal (_("Error in statement syntax"));
189+
190+ /* Check for spl registers. */
191+ if (check_spl_reg (&reg1))
192+ as_fatal (_("Cannot use special register with this instruction"));
193+
194+ if (exp.X_op != O_constant)
195+ {
196+ //char *opc = NULL;
197+ char *opc = str_microblaze_64;
198+ relax_substateT subtype;
199+
200+ if (exp.X_md != 0)
201+ subtype = get_imm_otype(exp.X_md);
202+ else
203+ subtype = opcode->inst_offset_type;
204+
205+ output = frag_var (rs_machine_dependent,
206+ isize * 2, /* maxm of 2 words. */
207+ isize * 2, /* minm of 2 words. */
208+ subtype, /* PC-relative or not. */
209+ exp.X_add_symbol,
210+ exp.X_add_number,
211+ (char *) opc);
212+ immedl = 0L;
213+ }
214+ else
215+ {
216+ output = frag_more (isize);
217+ immedl = exp.X_add_number;
218+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
219+ {
220+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
221+ if (opcode1 == NULL)
222+ {
223+ as_bad (_("unknown opcode \"%s\""), "imml");
224+ return;
225+ }
226+ inst1 = opcode1->bit_sequence;
227+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
228+ output[0] = INST_BYTE0 (inst1);
229+ output[1] = INST_BYTE1 (inst1);
230+ output[2] = INST_BYTE2 (inst1);
231+ output[3] = INST_BYTE3 (inst1);
232+ output = frag_more (isize);
233+ }
234+ else {
235+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
236+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
237+ if (opcode2 == NULL || opcode1 == NULL)
238+ {
239+ as_bad (_("unknown opcode \"%s\""), "imml");
240+ return;
241+ }
242+ inst1 = opcode2->bit_sequence;
243+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
244+ output[0] = INST_BYTE0 (inst1);
245+ output[1] = INST_BYTE1 (inst1);
246+ output[2] = INST_BYTE2 (inst1);
247+ output[3] = INST_BYTE3 (inst1);
248+ output = frag_more (isize);
249+ inst1 = opcode1->bit_sequence;
250+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
251+ output[0] = INST_BYTE0 (inst1);
252+ output[1] = INST_BYTE1 (inst1);
253+ output[2] = INST_BYTE2 (inst1);
254+ output[3] = INST_BYTE3 (inst1);
255+ output = frag_more (isize);
256+ }
257+ }
258+
259+ inst |= (reg1 << RA_LOW) & RA_MASK;
260+ inst |= (immedl << IMM_LOW) & IMM_MASK;
261+ break;
262+
263+ case INST_TYPE_IMML:
264+ as_fatal (_("An IMML instruction should not be present in the .s file"));
265+ break;
266+
267 default:
268 as_fatal (_("unimplemented opcode \"%s\""), name);
269 }
270@@ -3177,192 +3364,6 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
271 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
272 code = fixp->fx_r_type;
273 break;
274- /* For 64-bit instructions */
275- case INST_TYPE_RD_R1_IMML:
276- if (strcmp (op_end, ""))
277- op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
278- else
279- {
280- as_fatal (_("Error in statement syntax"));
281- reg1 = 0;
282- }
283- if (strcmp (op_end, ""))
284- op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
285- else
286- {
287- as_fatal (_("Error in statement syntax"));
288- reg2 = 0;
289- }
290- if (strcmp (op_end, ""))
291- op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
292- else
293- as_fatal (_("Error in statement syntax"));
294-
295- /* Check for spl registers. */
296- if (check_spl_reg (& reg1))
297- as_fatal (_("Cannot use special register with this instruction"));
298- if (check_spl_reg (& reg2))
299- as_fatal (_("Cannot use special register with this instruction"));
300-
301- if (exp.X_op != O_constant)
302- {
303- char *opc = NULL;
304- //char *opc = str_microblaze_64;
305- relax_substateT subtype;
306-
307- if (exp.X_md != 0)
308- subtype = get_imm_otype(exp.X_md);
309- else
310- subtype = opcode->inst_offset_type;
311-
312- output = frag_var (rs_machine_dependent,
313- isize * 2, /* maxm of 2 words. */
314- isize * 2, /* minm of 2 words. */
315- subtype, /* PC-relative or not. */
316- exp.X_add_symbol,
317- exp.X_add_number,
318- (char *) opc);
319- immedl = 0L;
320- }
321- else
322- {
323- output = frag_more (isize);
324- immedl = exp.X_add_number;
325- if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
326- {
327- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
328- if (opcode1 == NULL)
329- {
330- as_bad (_("unknown opcode \"%s\""), "imml");
331- return;
332- }
333- inst1 = opcode1->bit_sequence;
334- inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
335- output[0] = INST_BYTE0 (inst1);
336- output[1] = INST_BYTE1 (inst1);
337- output[2] = INST_BYTE2 (inst1);
338- output[3] = INST_BYTE3 (inst1);
339- output = frag_more (isize);
340- }
341- else {
342- opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
343- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
344- if (opcode2 == NULL || opcode1 == NULL)
345- {
346- as_bad (_("unknown opcode \"%s\""), "imml");
347- return;
348- }
349- inst1 = opcode2->bit_sequence;
350- inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
351- output[0] = INST_BYTE0 (inst1);
352- output[1] = INST_BYTE1 (inst1);
353- output[2] = INST_BYTE2 (inst1);
354- output[3] = INST_BYTE3 (inst1);
355- output = frag_more (isize);
356- inst1 = opcode1->bit_sequence;
357- inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
358- output[0] = INST_BYTE0 (inst1);
359- output[1] = INST_BYTE1 (inst1);
360- output[2] = INST_BYTE2 (inst1);
361- output[3] = INST_BYTE3 (inst1);
362- output = frag_more (isize);
363- }
364- }
365-
366- inst |= (reg1 << RD_LOW) & RD_MASK;
367- inst |= (reg2 << RA_LOW) & RA_MASK;
368- inst |= (immedl << IMM_LOW) & IMM_MASK;
369- break;
370-
371- case INST_TYPE_R1_IMML:
372- if (strcmp (op_end, ""))
373- op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
374- else
375- {
376- as_fatal (_("Error in statement syntax"));
377- reg1 = 0;
378- }
379- if (strcmp (op_end, ""))
380- op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
381- else
382- as_fatal (_("Error in statement syntax"));
383-
384- /* Check for spl registers. */
385- if (check_spl_reg (&reg1))
386- as_fatal (_("Cannot use special register with this instruction"));
387-
388- if (exp.X_op != O_constant)
389- {
390- //char *opc = NULL;
391- char *opc = str_microblaze_64;
392- relax_substateT subtype;
393-
394- if (exp.X_md != 0)
395- subtype = get_imm_otype(exp.X_md);
396- else
397- subtype = opcode->inst_offset_type;
398-
399- output = frag_var (rs_machine_dependent,
400- isize * 2, /* maxm of 2 words. */
401- isize * 2, /* minm of 2 words. */
402- subtype, /* PC-relative or not. */
403- exp.X_add_symbol,
404- exp.X_add_number,
405- (char *) opc);
406- immedl = 0L;
407- }
408- else
409- {
410- output = frag_more (isize);
411- immedl = exp.X_add_number;
412- if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
413- {
414- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
415- if (opcode1 == NULL)
416- {
417- as_bad (_("unknown opcode \"%s\""), "imml");
418- return;
419- }
420- inst1 = opcode1->bit_sequence;
421- inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
422- output[0] = INST_BYTE0 (inst1);
423- output[1] = INST_BYTE1 (inst1);
424- output[2] = INST_BYTE2 (inst1);
425- output[3] = INST_BYTE3 (inst1);
426- output = frag_more (isize);
427- }
428- else {
429- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
430- opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
431- if (opcode2 == NULL || opcode1 == NULL)
432- {
433- as_bad (_("unknown opcode \"%s\""), "imml");
434- return;
435- }
436- inst1 = opcode2->bit_sequence;
437- inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
438- output[0] = INST_BYTE0 (inst1);
439- output[1] = INST_BYTE1 (inst1);
440- output[2] = INST_BYTE2 (inst1);
441- output[3] = INST_BYTE3 (inst1);
442- output = frag_more (isize);
443- inst1 = opcode1->bit_sequence;
444- inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
445- output[0] = INST_BYTE0 (inst1);
446- output[1] = INST_BYTE1 (inst1);
447- output[2] = INST_BYTE2 (inst1);
448- output[3] = INST_BYTE3 (inst1);
449- output = frag_more (isize);
450- }
451- }
452-
453- inst |= (reg1 << RA_LOW) & RA_MASK;
454- inst |= (immedl << IMM_LOW) & IMM_MASK;
455- break;
456-
457- case INST_TYPE_IMML:
458- as_fatal (_("An IMML instruction should not be present in the .s file"));
459- break;
460
461 default:
462 switch (F (fixp->fx_size, fixp->fx_pcrel))
463--
4642.34.1
465
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0049-When-unwinding-pc-value-adjust-return-pc-value.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0049-When-unwinding-pc-value-adjust-return-pc-value.patch
new file mode 100644
index 00000000..f7869532
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0049-When-unwinding-pc-value-adjust-return-pc-value.patch
@@ -0,0 +1,92 @@
1From 21527b2edc1359417cc7978558167ef9c8c92afd Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Wed, 1 May 2024 11:12:32 +0530
4Subject: [PATCH 49/53] When unwinding pc value, adjust return pc value
5
6A call (branch and link) instruction can include a delay slot, the
7value of pc stored in the link register for Microblaze architecture
8is the pc value corresponding to last executed instruction (call)
9in the caller. The return instruction (branch reg) includes an
10offset of 8 so that when function returns execution continues from
11the address at : link register + 8, as the instruction in delay slot
12(link register + 4) is already executed at the time of call.
13
14Handle this by adjusting pc value during unwind-pc.
15
16Basically restoring code to do this that seems to have been removed
17as part of a gdb patch (gdb patch #8, Xilinx Yocto 2023.2)
18
19That patch caused hundreds of regressions in gdb testuite, including
20gdb.base/advance.exp, which is now fixed.
21
22Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdb/microblaze-tdep.c | 24 ++++++++++++++++++------
26 1 file changed, 18 insertions(+), 6 deletions(-)
27
28diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
29index 6dcdeee76b3..2507cfe540f 100644
30--- a/gdb/microblaze-tdep.c
31+++ b/gdb/microblaze-tdep.c
32@@ -523,6 +523,12 @@ microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
33 {
34 CORE_ADDR pc;
35 pc=frame_unwind_register_unsigned (next_frame, MICROBLAZE_PC_REGNUM);
36+ /* For sentinel frame, return address is actual PC. For other frames,
37+ return address is pc+8. This is a workaround because gcc does not
38+ generate correct return address in CIE. */
39+ if (frame_relative_level (next_frame) >= 0)
40+ pc = pc + 8;
41+ microblaze_debug ("unwind pc = 0x%x\n", (int) pc);
42 return pc;
43 }
44
45@@ -615,6 +621,7 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
46 struct microblaze_frame_cache *cache =
47 microblaze_frame_cache (this_frame, this_cache);
48
49+#if 1
50 if ((regnum == MICROBLAZE_SP_REGNUM &&
51 cache->register_offsets[MICROBLAZE_SP_REGNUM])
52 || (regnum == MICROBLAZE_FP_REGNUM &&
53@@ -625,15 +632,22 @@ if ((regnum == MICROBLAZE_SP_REGNUM &&
54
55 if (regnum == MICROBLAZE_PC_REGNUM)
56 {
57- regnum = 15;
58+ regnum = MICROBLAZE_PREV_PC_REGNUM;
59+
60+ microblaze_debug ("prev pc is r15 @ frame offset 0x%x\n",
61+ (int) cache->register_offsets[regnum] );
62+
63 return frame_unwind_got_memory (this_frame, regnum,
64 cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
65-
66 }
67+
68 if (regnum == MICROBLAZE_SP_REGNUM)
69 regnum = 1;
70-#if 0
71
72+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
73+ regnum);
74+
75+#else
76 if (cache->frameless_p)
77 {
78 if (regnum == MICROBLAZE_PC_REGNUM)
79@@ -646,9 +660,7 @@ if (regnum == MICROBLAZE_SP_REGNUM)
80 else
81 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
82 regnum);
83-#endif
84- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
85- regnum);
86+#endif
87 }
88
89 static const struct frame_unwind microblaze_frame_unwind =
90--
912.34.1
92
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0050-info-reg-pc-does-not-print-symbolic-value.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0050-info-reg-pc-does-not-print-symbolic-value.patch
new file mode 100644
index 00000000..c9bca41d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0050-info-reg-pc-does-not-print-symbolic-value.patch
@@ -0,0 +1,116 @@
1From 54a6eedd59d70a80be5dc8b4a5abe642113ea291 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:30:22 +0530
4Subject: [PATCH 50/53] info reg pc does not print symbolic value
5
6Problem - Test gdb.base/pc-fp.exp fails
7Fix - Change feature/microblaze-core.xml add type=code_ptr for pc
8
9Files changed
10 features/microblaze-core.xml
11 features/microblaze.c (generated)
12 features/microblaze-with-stack-protect.c (generated)
13
14Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
15Signed-off-by: Aayush Misra <aayushm@amd.com>
16---
17 gdb/features/microblaze-core.xml | 4 ++--
18 gdb/features/microblaze-with-stack-protect.c | 10 ++++++----
19 gdb/features/microblaze.c | 8 ++++----
20 3 files changed, 12 insertions(+), 10 deletions(-)
21
22diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
23index 4d77d9d898f..f49d048fc73 100644
24--- a/gdb/features/microblaze-core.xml
25+++ b/gdb/features/microblaze-core.xml
26@@ -8,7 +8,7 @@
27 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
28 <feature name="org.gnu.gdb.microblaze.core">
29 <reg name="r0" bitsize="32" regnum="0"/>
30- <reg name="r1" bitsize="32"/>
31+ <reg name="r1" bitsize="32" type="data_ptr"/>
32 <reg name="r2" bitsize="32"/>
33 <reg name="r3" bitsize="32"/>
34 <reg name="r4" bitsize="32"/>
35@@ -39,7 +39,7 @@
36 <reg name="r29" bitsize="32"/>
37 <reg name="r30" bitsize="32"/>
38 <reg name="r31" bitsize="32"/>
39- <reg name="rpc" bitsize="32"/>
40+ <reg name="rpc" bitsize="32" type="code_ptr"/>
41 <reg name="rmsr" bitsize="32"/>
42 <reg name="rear" bitsize="32"/>
43 <reg name="resr" bitsize="32"/>
44diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
45index 8ab9565a047..95e3eed1a4e 100644
46--- a/gdb/features/microblaze-with-stack-protect.c
47+++ b/gdb/features/microblaze-with-stack-protect.c
48@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
49
50 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
51 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
52- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
53+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
54 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
55 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
56 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
57@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
58 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
59 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
60 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
61- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
62+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
63 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
64 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
65 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
66@@ -70,10 +70,12 @@ initialize_tdesc_microblaze_with_stack_protect (void)
67 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
68 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
69 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
70-
71- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
72 tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
73 tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
74
75+ feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
76+ tdesc_create_reg (feature, "slr", 59, 1, NULL, 32, "int");
77+ tdesc_create_reg (feature, "shr", 60, 1, NULL, 32, "int");
78+
79 tdesc_microblaze_with_stack_protect = result.release ();
80 }
81diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
82index ed12e5bcfd2..ff4865b2acc 100644
83--- a/gdb/features/microblaze.c
84+++ b/gdb/features/microblaze.c
85@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
86
87 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
88 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
89- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
90+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
91 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
92 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
93 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
94@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
95 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
96 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
97 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
98- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
99+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
100 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
101 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
102 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
103@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
104 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
105 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
106 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
107- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
108- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
109+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
110+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
111
112 tdesc_microblaze = result.release ();
113 }
114--
1152.34.1
116
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0051-Wrong-target-description-accepted-by-microblaze-arch.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0051-Wrong-target-description-accepted-by-microblaze-arch.patch
new file mode 100644
index 00000000..65993021
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0051-Wrong-target-description-accepted-by-microblaze-arch.patch
@@ -0,0 +1,51 @@
1From 80f3d1ca2ece1ef143f00365b938e0d0b575d239 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:34:04 +0530
4Subject: [PATCH 51/53] Wrong target description accepted by microblaze
5 architecture
6
7Fix - Modify microblaze_gdbarch_init, set tdesc only when it is NULL
8
9Files changed - gdb/microblaze-tdep.c
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/microblaze-tdep.c | 21 ++++++++++++---------
15 1 file changed, 12 insertions(+), 9 deletions(-)
16
17diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
18index 2507cfe540f..cc80e4f0e6b 100644
19--- a/gdb/microblaze-tdep.c
20+++ b/gdb/microblaze-tdep.c
21@@ -1020,15 +1020,18 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
22 else
23 microblaze_abi = found_abi;
24
25- if (microblaze_abi == MICROBLAZE_ABI_M64)
26- {
27- tdesc = tdesc_microblaze64;
28- reg_size = 8;
29- }
30- else
31- {
32- tdesc = tdesc_microblaze;
33- reg_size = 4;
34+ if (tdesc == NULL)
35+ {
36+ if (microblaze_abi == MICROBLAZE_ABI_M64)
37+ {
38+ tdesc = tdesc_microblaze64;
39+ reg_size = 8;
40+ }
41+ else
42+ {
43+ tdesc = tdesc_microblaze;
44+ reg_size = 4;
45+ }
46 }
47
48 /* Check any target description for validity. */
49--
502.34.1
51
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0052-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0052-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
new file mode 100644
index 00000000..f358e45e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0052-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
@@ -0,0 +1,42 @@
1From 2e4370f257fae84d18d1f6ef3a756795d77d5707 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 23 May 2024 16:02:59 +0530
4Subject: [PATCH 52/53] Merge gdb/microblaze-linux-tdep.c to gdb-14 and fix
5 compilation issues.
6
7Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 gdb/microblaze-linux-tdep.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
14index babc9020f0f..00112b8f540 100644
15--- a/gdb/microblaze-linux-tdep.c
16+++ b/gdb/microblaze-linux-tdep.c
17@@ -48,10 +48,12 @@ microblaze_debug (const char *fmt, ...)
18 if (microblaze_debug_flag)
19 {
20 va_list args;
21+ string_file file (gdb_stdout->can_emit_style_escape ());
22
23 va_start (args, fmt);
24 printf_unfiltered ("MICROBLAZE LINUX: ");
25- vprintf_unfiltered (fmt, args);
26+ file.vprintf (fmt, args);
27+ gdb_stdout->puts_unfiltered (file.string ().c_str ());
28 va_end (args);
29 }
30 }
31@@ -145,7 +147,7 @@ static void
32 microblaze_linux_init_abi (struct gdbarch_info info,
33 struct gdbarch *gdbarch)
34 {
35- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
36+ struct microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
37
38 tdep->sizeof_gregset = 200;
39
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0053-Roll-back-an-improvement-which-inlines-target_gdbarc.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0053-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
new file mode 100644
index 00000000..f7d32927
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0053-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
@@ -0,0 +1,29 @@
1From 13146f53b89c03b086e883e1f4bd9e14c32e6943 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Fri, 19 Jul 2024 12:39:24 +0530
4Subject: [PATCH 53/53] Roll back an improvement which inlines target_gdbarch
5 () inherited from binutils 2.42 merge that causes compilation issues on gdb
6 14.2
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gdb/microblaze-tdep.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
15index cc80e4f0e6b..86dedafdbd6 100644
16--- a/gdb/microblaze-tdep.c
17+++ b/gdb/microblaze-tdep.c
18@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
19 const char *ignored_value)
20 {
21 enum microblaze_abi global_abi = global_microblaze_abi ();
22- enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
23+ enum microblaze_abi actual_abi = microblaze_abi ( target_gdbarch () );
24 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
25
26 #if 1
27--
282.34.1
29
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc b/meta-microblaze/recipes-devtools/gcc/gcc-13.3.inc
index 82867489..90f5ef88 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13.3.inc
@@ -2,15 +2,15 @@ require gcc-common.inc
2 2
3# Third digit in PV should be incremented after a minor release 3# Third digit in PV should be incremented after a minor release
4 4
5PV = "12.2.0" 5PV = "13.3.0"
6 6
7# BINV should be incremented to a revision after a minor gcc release 7# BINV should be incremented to a revision after a minor gcc release
8 8
9BINV = "12.2.0" 9BINV = "13.3.0"
10 10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" 11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
12 12
13DEPENDS =+ "mpfr gmp libmpc zlib flex-native" 13DEPENDS =+ "mpfr gmp libmpc zlib zstd flex-native"
14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native" 14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
15 15
16LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only" 16LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
@@ -22,13 +22,15 @@ LIC_FILES_CHKSUM = "\
22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ 22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \ 23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
24" 24"
25# from git 25# snapshot from git
26#RELEASE ?= "7092b7aea122a91824d048aeb23834cf1d19b1a1" 26#RELEASE ?= "9b6bf076c11cba0f9ccdace63e8b4044b1a858ea"
27#BASEURI ?= "https://git.linaro.org/toolchain/gcc.git/snapshot/gcc-${RELEASE}.tar.gz"
28#SOURCEDIR = "gcc-${RELEASE}"
27#BASEURI ?= "https://repo.or.cz/official-gcc.git/snapshot/${RELEASE}.tar.gz;downloadfilename=gcc-${PV}-${RELEASE}.tar.gz" 29#BASEURI ?= "https://repo.or.cz/official-gcc.git/snapshot/${RELEASE}.tar.gz;downloadfilename=gcc-${PV}-${RELEASE}.tar.gz"
28#SOURCEDIR ?= "official-gcc-${@'${RELEASE}'[0:7]}" 30#SOURCEDIR ?= "official-gcc-${@'${RELEASE}'[0:7]}"
29 31
30# from snapshot 32# from snapshot
31#RELEASE ?= "12.1.0-RC-20220429" 33#RELEASE ?= "13-20230520"
32#SOURCEDIR ?= "gcc-${RELEASE}" 34#SOURCEDIR ?= "gcc-${RELEASE}"
33#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz" 35#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
34 36
@@ -48,7 +50,8 @@ SRC_URI = "${BASEURI} \
48 file://0008-libtool.patch \ 50 file://0008-libtool.patch \
49 file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \ 51 file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
50 file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \ 52 file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
51 file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \ 53 file://0011-aarch64-Fix-include-paths-when-S-B.patch \
54 file://0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
52 file://0013-Ensure-target-gcc-headers-can-be-included.patch \ 55 file://0013-Ensure-target-gcc-headers-can-be-included.patch \
53 file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \ 56 file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
54 file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \ 57 file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
@@ -58,13 +61,13 @@ SRC_URI = "${BASEURI} \
58 file://0019-Re-introduce-spe-commandline-options.patch \ 61 file://0019-Re-introduce-spe-commandline-options.patch \
59 file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ 62 file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
60 file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \ 63 file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
61 file://0023-libatomic-Do-not-enforce-march-on-aarch64.patch \ 64 file://0022-libatomic-Do-not-enforce-march-on-aarch64.patch \
62 file://0024-Fix-install-path-of-linux64.h.patch \ 65 file://0023-Fix-install-path-of-linux64.h.patch \
63 file://0026-rust-recursion-limit.patch \ 66 file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \
64 file://prefix-map-realpath.patch \ 67 file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \
65 file://hardcoded-paths.patch \ 68 file://0027-Fix-gcc-vect-module-testcases.patch \
66" 69"
67SRC_URI[sha256sum] = "e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff" 70SRC_URI[sha256sum] = "0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083"
68 71
69S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}" 72S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
70B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" 73B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
@@ -110,5 +113,5 @@ EXTRA_OECONF_PATHS = "\
110 --with-build-sysroot=${STAGING_DIR_TARGET} \ 113 --with-build-sysroot=${STAGING_DIR_TARGET} \
111" 114"
112 115
113# Is a binutils 2.26 issue, not gcc
114CVE_STATUS[CVE-2021-37322] = "cpe-incorrect: Is a binutils 2.26 issue, not gcc" 116CVE_STATUS[CVE-2021-37322] = "cpe-incorrect: Is a binutils 2.26 issue, not gcc"
117CVE_STATUS[CVE-2023-4039] = "fixed-version: Fixed via CVE-2023-4039.patch included here. Set the status explictly to deal with all recipes that share the gcc-source"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0001-LOCAL-Testsuite-builtins-tests-require-fpic-Signed-o.patch
index f8985752..8b9c6177 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0001-LOCAL-Testsuite-builtins-tests-require-fpic-Signed-o.patch
@@ -1,9 +1,7 @@
1From 376b0ee790231a99fe50b50e20070c104bbba0d8 Mon Sep 17 00:00:00 2001 1From 8beb2e85436c77db197ce22626c7b7037d41d595 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 11 Jan 2017 13:13:57 +0530 3Date: Wed, 11 Jan 2017 13:13:57 +0530
4Subject: [PATCH 01/53] LOCAL]: Testsuite - builtins tests require fpic 4Subject: [PATCH 01/54] LOCAL]: Testsuite - builtins tests require fpic
5Upstream-Status: Pending
6
7 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 5 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
8 6
9Conflicts: 7Conflicts:
@@ -14,7 +12,7 @@ Conflicts:
14 1 file changed, 8 insertions(+) 12 1 file changed, 8 insertions(+)
15 13
16diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 14diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
17index fb47f51f90c..d9ecf045554 100644 15index fa762d33232..ce8545fc460 100644
18--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 16--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
19+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 17+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
20@@ -48,6 +48,14 @@ if { [istarget *-*-eabi*] 18@@ -48,6 +48,14 @@ if { [istarget *-*-eabi*]
@@ -33,5 +31,5 @@ index fb47f51f90c..d9ecf045554 100644
33 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} { 31 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} {
34 c-torture-execute [list $src \ 32 c-torture-execute [list $src \
35-- 33--
362.37.1 (Apple Git-137.1) 342.34.1
37 35
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0002-Quick-fail-g-.dg-opt-memcpy1.C-This-particular-testc.patch
index 5302b942..94970e7b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0002-Quick-fail-g-.dg-opt-memcpy1.C-This-particular-testc.patch
@@ -1,12 +1,10 @@
1From b1aea8e71692065497ee3e9be5a9f1fccecf5685 Mon Sep 17 00:00:00 2001 1From 4a2d958fe0d54c78b7a131b9cde1c74165533aaf Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 11 Jan 2017 14:31:10 +0530 3Date: Wed, 11 Jan 2017 14:31:10 +0530
4Subject: [PATCH 02/53] [LOCAL]: Quick fail g++.dg/opt/memcpy1.C This 4Subject: [PATCH 02/54] Quick fail g++.dg/opt/memcpy1.C This particular
5 particular testcase fails with a timeout. Instead, fail it at compile-time 5 testcase fails with a timeout. Instead, fail it at compile-time for
6 for microblaze. This speeds up the testsuite without removing it from the 6 microblaze. This speeds up the testsuite without removing it from the FAIL
7 FAIL reports. 7 reports.
8
9Upstream-Status: Pending
10 8
11Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 9Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12--- 10---
@@ -29,5 +27,5 @@ index 3862756083d..db9f990f781 100644
29 typedef uint8_t uint8; 27 typedef uint8_t uint8;
30 __extension__ typedef __SIZE_TYPE__ size_t; 28 __extension__ typedef __SIZE_TYPE__ size_t;
31-- 29--
322.37.1 (Apple Git-137.1) 302.34.1
33 31
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0003-For-dejagnu-static-testing-on-qemu-suppress-warnings.patch
index 89fe0ff6..5b4466d8 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0003-For-dejagnu-static-testing-on-qemu-suppress-warnings.patch
@@ -1,20 +1,18 @@
1From af78edb2cb91c55f54ac2d720cee9871da13b845 Mon Sep 17 00:00:00 2001 1From 0b4ec0cbfc13f5a40a20663da9c074ac81c5ec3f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 11 Jan 2017 15:46:28 +0530 3Date: Wed, 11 Jan 2017 15:46:28 +0530
4Subject: [PATCH 03/53] [LOCAL]: For dejagnu static testing on qemu, suppress 4Subject: [PATCH 03/54] For dejagnu static testing on qemu, suppress warnings
5 warnings about multiple definitions from the test function and libc in line 5 about multiple definitions from the test function and libc in line with
6 with method used by powerpc. Dynamic linking and using a qemu binary which 6 method used by powerpc. Dynamic linking and using a qemu binary which
7 understands sysroot resolves all test failures with builtins 7 understands sysroot resolves all test failures with builtins
8 8
9Upstream-Status: Pending
10
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 9Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12--- 10---
13 gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 4 ---- 11 gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 4 ----
14 1 file changed, 4 deletions(-) 12 1 file changed, 4 deletions(-)
15 13
16diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 14diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
17index d9ecf045554..d6c2b04f286 100644 15index ce8545fc460..72fd697d855 100644
18--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 16--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
19+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp 17+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
20@@ -48,14 +48,10 @@ if { [istarget *-*-eabi*] 18@@ -48,14 +48,10 @@ if { [istarget *-*-eabi*]
@@ -33,5 +31,5 @@ index d9ecf045554..d6c2b04f286 100644
33 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} { 31 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} {
34 c-torture-execute [list $src \ 32 c-torture-execute [list $src \
35-- 33--
362.37.1 (Apple Git-137.1) 342.34.1
37 35
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0004-Add-MicroBlaze-to-target-supports-for-atomic-buil.-..patch
index 39c9c17e..87adeaf4 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0004-Add-MicroBlaze-to-target-supports-for-atomic-buil.-..patch
@@ -1,8 +1,8 @@
1From 34b7dd28e3fe40f55ec7f6df3f000dd797d6c1cc Mon Sep 17 00:00:00 2001 1From dcb106f7cb2fb68f3117677b12df2b01f3929f7b Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 11 Jan 2017 15:50:35 +0530 3Date: Wed, 11 Jan 2017 15:50:35 +0530
4Subject: [PATCH 04/53] [Patch, testsuite]: Add MicroBlaze to target-supports 4Subject: [PATCH 04/54] Add MicroBlaze to target-supports for atomic buil. .tin
5 for atomic buil. .tin tests 5 tests
6 6
7MicroBlaze added to supported targets for atomic builtin tests. 7MicroBlaze added to supported targets for atomic builtin tests.
8 8
@@ -13,18 +13,16 @@ Changelog/testsuite
13 * gcc/testsuite/lib/target-supports.exp: Add microblaze to 13 * gcc/testsuite/lib/target-supports.exp: Add microblaze to
14 check_effective_target_sync_int_long. 14 check_effective_target_sync_int_long.
15 15
16Upstream-Status: Pending
17
18Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
19--- 17---
20 gcc/testsuite/lib/target-supports.exp | 1 + 18 gcc/testsuite/lib/target-supports.exp | 1 +
21 1 file changed, 1 insertion(+) 19 1 file changed, 1 insertion(+)
22 20
23diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp 21diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
24index 244fe2306f4..c19f251f0d2 100644 22index 40f71e9ed8b..32e29706fcd 100644
25--- a/gcc/testsuite/lib/target-supports.exp 23--- a/gcc/testsuite/lib/target-supports.exp
26+++ b/gcc/testsuite/lib/target-supports.exp 24+++ b/gcc/testsuite/lib/target-supports.exp
27@@ -8639,6 +8639,7 @@ proc check_effective_target_sync_int_long { } { 25@@ -8947,6 +8947,7 @@ proc check_effective_target_sync_int_long { } {
28 && [check_effective_target_arm_acq_rel]) 26 && [check_effective_target_arm_acq_rel])
29 || [istarget bfin*-*linux*] 27 || [istarget bfin*-*linux*]
30 || [istarget hppa*-*linux*] 28 || [istarget hppa*-*linux*]
@@ -33,5 +31,5 @@ index 244fe2306f4..c19f251f0d2 100644
33 || [istarget powerpc*-*-*] 31 || [istarget powerpc*-*-*]
34 || [istarget cris-*-*] 32 || [istarget cris-*-*]
35-- 33--
362.37.1 (Apple Git-137.1) 342.34.1
37 35
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0005-Update-MicroBlaze-strings-test-for-new-scan-assembly.patch
index d127a03e..9a8d0a86 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0005-Update-MicroBlaze-strings-test-for-new-scan-assembly.patch
@@ -1,8 +1,8 @@
1From 2d0b5d68aff95a95dfb4ed0b207849658502bd53 Mon Sep 17 00:00:00 2001 1From 68bc05ae258334f591c336dbed6dc907969e90fc Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 11 Jan 2017 16:20:01 +0530 3Date: Wed, 11 Jan 2017 16:20:01 +0530
4Subject: [PATCH 05/53] [Patch, testsuite]: Update MicroBlaze strings test for 4Subject: [PATCH 05/54] Update MicroBlaze strings test for new scan-assembly
5 new scan-assembly output resulting in use of $LC label 5 output resulting in use of $LC label
6 6
7ChangeLog/testsuite 7ChangeLog/testsuite
8 8
@@ -11,8 +11,6 @@ ChangeLog/testsuite
11 * gcc/testsuite/gcc.target/microblaze/others/strings1.c: Update 11 * gcc/testsuite/gcc.target/microblaze/others/strings1.c: Update
12 to include $LC label. 12 to include $LC label.
13 13
14Upstream-Status: Pending
15
16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
17--- 15---
18 gcc/testsuite/gcc.target/microblaze/others/strings1.c | 4 ++++ 16 gcc/testsuite/gcc.target/microblaze/others/strings1.c | 4 ++++
@@ -34,5 +32,5 @@ index efaf3c660ea..347872360d3 100644
34 32
35 extern void somefunc (char *); 33 extern void somefunc (char *);
36-- 34--
372.37.1 (Apple Git-137.1) 352.34.1
38 36
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0006-Allow-MicroBlaze-.weakext-pattern-in-regex-match-Ext.patch
index 3c412471..c32a8bab 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0006-Allow-MicroBlaze-.weakext-pattern-in-regex-match-Ext.patch
@@ -1,9 +1,9 @@
1From 20b6479f240bfebb46daad06839286a7abcff56c Mon Sep 17 00:00:00 2001 1From 7b07ae9c8086973b7baa031b09889146057de8ab Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:14:15 +0530 3Date: Thu, 12 Jan 2017 16:14:15 +0530
4Subject: [PATCH 06/53] [Patch, testsuite]: Allow MicroBlaze .weakext pattern 4Subject: [PATCH 06/54] Allow MicroBlaze .weakext pattern in regex match Extend
5 in regex match Extend regex pattern to include optional ext at the end of 5 regex pattern to include optional ext at the end of .weak to match the
6 .weak to match the MicroBlaze weak label .weakext 6 MicroBlaze weak label .weakext
7 7
8ChangeLog/testsuite 8ChangeLog/testsuite
9 9
@@ -13,8 +13,6 @@ ChangeLog/testsuite
13 pattern to take optional ext after .weak. 13 pattern to take optional ext after .weak.
14 * gcc/testsuite/g++.dg/abi/thunk4.C: Likewise. 14 * gcc/testsuite/g++.dg/abi/thunk4.C: Likewise.
15 15
16Upstream-Status: Pending
17
18Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
19 17
20Conflicts: 18Conflicts:
@@ -65,5 +63,5 @@ index 6e8f124bc5e..d1d34fe1e4a 100644
65 63
66 struct Base 64 struct Base
67-- 65--
682.37.1 (Apple Git-137.1) 662.34.1
69 67
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0007-Add-MicroBlaze-to-check_profiling_available-Testsuit.patch
index 89d3b75a..5de0bfd8 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0007-Add-MicroBlaze-to-check_profiling_available-Testsuit.patch
@@ -1,12 +1,9 @@
1From 0efefd8ac71dd084c745402afdf07319de9774c6 Mon Sep 17 00:00:00 2001 1From 6de628ecccf3739891052a2fbaf97048384c6190 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:34:27 +0530 3Date: Thu, 12 Jan 2017 16:34:27 +0530
4Subject: [PATCH 07/53] [Patch, testsuite]: Add MicroBlaze to 4Subject: [PATCH 07/54] Add MicroBlaze to check_profiling_available Testsuite,
5 check_profiling_available Testsuite, add microblaze*-*-* target in 5 add microblaze*-*-* target in check_profiling_available inline with other
6 check_profiling_available inline with other archs setting 6 archs setting profiling_available_saved to 0
7 profiling_available_saved to 0
8
9Upstream-Status: Pending
10 7
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 8Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12--- 9---
@@ -14,10 +11,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
14 1 file changed, 1 insertion(+) 11 1 file changed, 1 insertion(+)
15 12
16diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp 13diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
17index c19f251f0d2..c136c93e673 100644 14index 32e29706fcd..47233563339 100644
18--- a/gcc/testsuite/lib/target-supports.exp 15--- a/gcc/testsuite/lib/target-supports.exp
19+++ b/gcc/testsuite/lib/target-supports.exp 16+++ b/gcc/testsuite/lib/target-supports.exp
20@@ -729,6 +729,7 @@ proc check_profiling_available { test_what } { 17@@ -804,6 +804,7 @@ proc check_profiling_available { test_what } {
21 || [istarget m68k-*-elf] 18 || [istarget m68k-*-elf]
22 || [istarget m68k-*-uclinux*] 19 || [istarget m68k-*-uclinux*]
23 || [istarget mips*-*-elf*] 20 || [istarget mips*-*-elf*]
@@ -26,5 +23,5 @@ index c19f251f0d2..c136c93e673 100644
26 || [istarget mn10300-*-elf*] 23 || [istarget mn10300-*-elf*]
27 || [istarget moxie-*-elf*] 24 || [istarget moxie-*-elf*]
28-- 25--
292.37.1 (Apple Git-137.1) 262.34.1
30 27
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch
index 21747726..e554e660 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch
@@ -1,13 +1,10 @@
1From 42ab0f7a2e6834feed456d00b3e2ec0ae2532a41 Mon Sep 17 00:00:00 2001 1From cd3db73d253df229054863e5f920e59e60b84c45 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:41:43 +0530 3Date: Thu, 12 Jan 2017 16:41:43 +0530
4Subject: [PATCH 08/53] [Patch, microblaze]: Fix atomic side effects. In 4Subject: [PATCH 08/54] Fix atomic side effects. In atomic_compare_and_swapsi,
5 atomic_compare_and_swapsi, add side effects to prevent incorrect assumptions 5 add side effects to prevent incorrect assumptions during optimization.
6 during optimization. Previously, the outputs were considered unused; this 6 Previously, the outputs were considered unused; this generated assembly code
7 generated assembly code with undefined side effects after invocation of the 7 with undefined side effects after invocation of the atomic.
8 atomic.
9
10Upstream-Status: Pending
11 8
12Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> 9Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
13Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 10Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
@@ -20,7 +17,7 @@ Conflicts:
20 2 files changed, 16 insertions(+), 8 deletions(-) 17 2 files changed, 16 insertions(+), 8 deletions(-)
21 18
22diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 19diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
23index 0765ff930c6..ea7f74f1dff 100644 20index 671667b537c..dfd7395432b 100644
24--- a/gcc/config/microblaze/microblaze.md 21--- a/gcc/config/microblaze/microblaze.md
25+++ b/gcc/config/microblaze/microblaze.md 22+++ b/gcc/config/microblaze/microblaze.md
26@@ -43,6 +43,9 @@ 23@@ -43,6 +43,9 @@
@@ -34,7 +31,7 @@ index 0765ff930c6..ea7f74f1dff 100644
34 31
35 (define_c_enum "unspec" [ 32 (define_c_enum "unspec" [
36diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md 33diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md
37index ae8955ce691..77c3ce8ff27 100644 34index c84bac94101..587f852b3a0 100644
38--- a/gcc/config/microblaze/sync.md 35--- a/gcc/config/microblaze/sync.md
39+++ b/gcc/config/microblaze/sync.md 36+++ b/gcc/config/microblaze/sync.md
40@@ -18,14 +18,19 @@ 37@@ -18,14 +18,19 @@
@@ -66,5 +63,5 @@ index ae8955ce691..77c3ce8ff27 100644
66 "" 63 ""
67 { 64 {
68-- 65--
692.37.1 (Apple Git-137.1) 662.34.1
70 67
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0009-Fix-atomic-boolean-return-value.-In-atomic_compare_a.patch
index 97f35569..617b10f3 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0009-Fix-atomic-boolean-return-value.-In-atomic_compare_a.patch
@@ -1,11 +1,9 @@
1From a1b8136a157c549f0f65c14d628e694310ca0d23 Mon Sep 17 00:00:00 2001 1From 7eca0d5cf7bc603c5a359b70521861c11faf6038 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:45:45 +0530 3Date: Thu, 12 Jan 2017 16:45:45 +0530
4Subject: [PATCH 09/53] [Patch, microblaze]: Fix atomic boolean return value. 4Subject: [PATCH 09/54] Fix atomic boolean return value. In
5 In atomic_compare_and_swapsi, fix boolean return value. Previously, it 5 atomic_compare_and_swapsi, fix boolean return value. Previously, it contained
6 contained zero if successful and non-zero if unsuccessful. 6 zero if successful and non-zero if unsuccessful.
7
8Upstream-Status: Pending
9 7
10Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> 8Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 9Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
@@ -14,7 +12,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
14 1 file changed, 4 insertions(+), 3 deletions(-) 12 1 file changed, 4 insertions(+), 3 deletions(-)
15 13
16diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md 14diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md
17index 77c3ce8ff27..573ce4765a0 100644 15index 587f852b3a0..230699bf280 100644
18--- a/gcc/config/microblaze/sync.md 16--- a/gcc/config/microblaze/sync.md
19+++ b/gcc/config/microblaze/sync.md 17+++ b/gcc/config/microblaze/sync.md
20@@ -34,15 +34,16 @@ 18@@ -34,15 +34,16 @@
@@ -38,5 +36,5 @@ index 77c3ce8ff27..573ce4765a0 100644
38 } 36 }
39 ) 37 )
40-- 38--
412.37.1 (Apple Git-137.1) 392.34.1
42 40
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0010-Fix-the-Microblaze-crash-with-msmall-divides-flag-Co.patch
index 62bb02a9..42b9d575 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0010-Fix-the-Microblaze-crash-with-msmall-divides-flag-Co.patch
@@ -1,15 +1,12 @@
1From 1ab5b8af098d100a1d7af05cca680b3c7181549d Mon Sep 17 00:00:00 2001 1From 72cdba90d70131c092918c5d5c18eb800f0f9dfb Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:50:17 +0530 3Date: Thu, 12 Jan 2017 16:50:17 +0530
4Subject: [PATCH 10/53] [Patch, microblaze]: Fix the Microblaze crash with 4Subject: [PATCH 10/54] Fix the Microblaze crash with msmall-divides flag
5 msmall-divides flag Compiler is crashing when we use msmall-divides and 5 Compiler is crashing when we use msmall-divides and mxl-barrel-shift flag.
6 mxl-barrel-shift flag. This is because when use above flags 6 This is because when use above flags microblaze_expand_divide function will
7 microblaze_expand_divide function will be called for division operation. In 7 be called for division operation. In microblaze_expand_divide function we are
8 microblaze_expand_divide function we are using sub_reg but MicroBlaze doesn't 8 using sub_reg but MicroBlaze doesn't have subreg register due to this
9 have subreg register due to this compiler was crashing. Changed the logic to 9 compiler was crashing. Changed the logic to avoid sub_reg call
10 avoid sub_reg call
11
12Upstream-Status: Pending
13 10
14Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> 11Signed-off-by:Nagaraju Mekala <nmekala@xilix.com>
15 12
@@ -20,10 +17,10 @@ Conflicts:
20 1 file changed, 1 insertion(+), 2 deletions(-) 17 1 file changed, 1 insertion(+), 2 deletions(-)
21 18
22diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 19diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
23index f32effecfb6..6922dd94af7 100644 20index 6df2c712cab..11e34b3fdae 100644
24--- a/gcc/config/microblaze/microblaze.cc 21--- a/gcc/config/microblaze/microblaze.cc
25+++ b/gcc/config/microblaze/microblaze.cc 22+++ b/gcc/config/microblaze/microblaze.cc
26@@ -3710,8 +3710,7 @@ microblaze_expand_divide (rtx operands[]) 23@@ -3719,8 +3719,7 @@ microblaze_expand_divide (rtx operands[])
27 mem_rtx = gen_rtx_MEM (QImode, 24 mem_rtx = gen_rtx_MEM (QImode,
28 gen_rtx_PLUS (Pmode, regt1, div_table_rtx)); 25 gen_rtx_PLUS (Pmode, regt1, div_table_rtx));
29 26
@@ -34,5 +31,5 @@ index f32effecfb6..6922dd94af7 100644
34 JUMP_LABEL (jump) = div_end_label; 31 JUMP_LABEL (jump) = div_end_label;
35 LABEL_NUSES (div_end_label) = 1; 32 LABEL_NUSES (div_end_label) = 1;
36-- 33--
372.37.1 (Apple Git-137.1) 342.34.1
38 35
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0011-Added-ashrsi3_with_size_opt-Added-ashrsi3_with_size_.patch
index 09ebfca6..8988e23b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0011-Added-ashrsi3_with_size_opt-Added-ashrsi3_with_size_.patch
@@ -1,12 +1,10 @@
1From 7dd4ae2ad891094aa85a907b168cbdce744789e9 Mon Sep 17 00:00:00 2001 1From 41d8b3677d64bf9408925667c103a04b176050d5 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 16:52:56 +0530 3Date: Thu, 12 Jan 2017 16:52:56 +0530
4Subject: [PATCH 11/53] [Patch, microblaze]: Added ashrsi3_with_size_opt Added 4Subject: [PATCH 11/54] Added ashrsi3_with_size_opt Added ashrsi3_with_size_opt
5 ashrsi3_with_size_opt pattern to optimize the sra instructions when the -Os 5 pattern to optimize the sra instructions when the -Os optimization is used.
6 optimization is used. lshrsi3_with_size_opt is being removed as it has 6 lshrsi3_with_size_opt is being removed as it has conflicts with unsigned int
7 conflicts with unsigned int variables 7 variables
8
9Upstream-Status: Pending
10 8
11Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> 9Signed-off-by:Nagaraju Mekala <nmekala@xilix.com>
12--- 10---
@@ -14,7 +12,7 @@ Signed-off-by:Nagaraju Mekala <nmekala@xilix.com>
14 1 file changed, 21 insertions(+) 12 1 file changed, 21 insertions(+)
15 13
16diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 14diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
17index ea7f74f1dff..9fbb3113f3c 100644 15index dfd7395432b..4f20b8efe33 100644
18--- a/gcc/config/microblaze/microblaze.md 16--- a/gcc/config/microblaze/microblaze.md
19+++ b/gcc/config/microblaze/microblaze.md 17+++ b/gcc/config/microblaze/microblaze.md
20@@ -1508,6 +1508,27 @@ 18@@ -1508,6 +1508,27 @@
@@ -46,5 +44,5 @@ index ea7f74f1dff..9fbb3113f3c 100644
46 [(set (match_operand:SI 0 "register_operand" "=&d") 44 [(set (match_operand:SI 0 "register_operand" "=&d")
47 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") 45 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
48-- 46--
492.37.1 (Apple Git-137.1) 472.34.1
50 48
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0012-Use-bralid-for-profiler-calls-Signed-off-by-Edgar-E..patch
index c26d46d4..46a8699a 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0012-Use-bralid-for-profiler-calls-Signed-off-by-Edgar-E..patch
@@ -1,17 +1,15 @@
1From 12d7e086376916ef61e2c48639671fd0f7c8fbbf Mon Sep 17 00:00:00 2001 1From 9dc1f7291c4c7abfe254ca4e86a6ba0975a74960 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 10:57:19 +0530 3Date: Tue, 17 Jan 2017 10:57:19 +0530
4Subject: [PATCH 12/53] [Patch, microblaze]: Use bralid for profiler calls 4Subject: [PATCH 12/54] Use bralid for profiler calls Signed-off-by: Edgar E.
5Upstream-Status: Pending 5 Iglesias <edgar.iglesias@gmail.com>
6
7 Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
8 6
9--- 7---
10 gcc/config/microblaze/microblaze.h | 2 +- 8 gcc/config/microblaze/microblaze.h | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-) 9 1 file changed, 1 insertion(+), 1 deletion(-)
12 10
13diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 11diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
14index d28bc766de8..cd544f2030e 100644 12index 0398902362b..49e7fbedd5a 100644
15--- a/gcc/config/microblaze/microblaze.h 13--- a/gcc/config/microblaze/microblaze.h
16+++ b/gcc/config/microblaze/microblaze.h 14+++ b/gcc/config/microblaze/microblaze.h
17@@ -486,7 +486,7 @@ typedef struct microblaze_args 15@@ -486,7 +486,7 @@ typedef struct microblaze_args
@@ -24,5 +22,5 @@ index d28bc766de8..cd544f2030e 100644
24 } 22 }
25 23
26-- 24--
272.37.1 (Apple Git-137.1) 252.34.1
28 26
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0013-Removed-moddi3-routinue-Using-the-default-moddi3-fun.patch
index 8739e6ea..26c24a49 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0013-Removed-moddi3-routinue-Using-the-default-moddi3-fun.patch
@@ -1,10 +1,8 @@
1From cd8c9f3c43b266628d1585b74fc78f3e34a33c44 Mon Sep 17 00:00:00 2001 1From a2dbb662c573d2bf1a6a9192eb0d7f453ad20c59 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 12 Jan 2017 17:36:16 +0530 3Date: Thu, 12 Jan 2017 17:36:16 +0530
4Subject: [PATCH 13/53] [Patch, microblaze]: Removed moddi3 routinue Using the 4Subject: [PATCH 13/54] Removed moddi3 routinue Using the default moddi3
5 default moddi3 function as the existing implementation has many bugs 5 function as the existing implementation has many bugs
6
7Upstream-Status: Pending
8 6
9Signed-off-by:Nagaraju <nmekala@xilix.com> 7Signed-off-by:Nagaraju <nmekala@xilix.com>
10 8
@@ -18,13 +16,13 @@ Conflicts:
18 16
19diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S 17diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S
20deleted file mode 100644 18deleted file mode 100644
21index 9b77865df38..00000000000 19index b3e4bf6182e..00000000000
22--- a/libgcc/config/microblaze/moddi3.S 20--- a/libgcc/config/microblaze/moddi3.S
23+++ /dev/null 21+++ /dev/null
24@@ -1,121 +0,0 @@ 22@@ -1,121 +0,0 @@
25-################################### 23-###################################
26-# 24-#
27-# Copyright (C) 2009-2022 Free Software Foundation, Inc. 25-# Copyright (C) 2009-2023 Free Software Foundation, Inc.
28-# 26-#
29-# Contributed by Michael Eager <eager@eagercon.com>. 27-# Contributed by Michael Eager <eager@eagercon.com>.
30-# 28-#
@@ -158,5 +156,5 @@ index 96959f0292b..8d954a49575 100644
158 $(srcdir)/config/microblaze/muldi3_hard.S \ 156 $(srcdir)/config/microblaze/muldi3_hard.S \
159 $(srcdir)/config/microblaze/mulsi3.S \ 157 $(srcdir)/config/microblaze/mulsi3.S \
160-- 158--
1612.37.1 (Apple Git-137.1) 1592.34.1
162 160
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0014-Add-INIT_PRIORITY-support-Added-TARGET_ASM_CONSTRUCT.patch
index 472c543c..9e4348ad 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0014-Add-INIT_PRIORITY-support-Added-TARGET_ASM_CONSTRUCT.patch
@@ -1,8 +1,8 @@
1From 30aa7cef2dd076637155384fba539838ddaf0163 Mon Sep 17 00:00:00 2001 1From 40dd974a6cd608567f1746a934c9743b80ca1e3f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 12 Sep 2022 20:20:00 +0530 3Date: Mon, 12 Sep 2022 20:20:00 +0530
4Subject: [PATCH 14/53] [Patch, microblaze]: Add INIT_PRIORITY support Added 4Subject: [PATCH 14/54] Add INIT_PRIORITY support Added TARGET_ASM_CONSTRUCTOR
5 TARGET_ASM_CONSTRUCTOR and TARGET_ASM_DESTRUCTOR macros. 5 and TARGET_ASM_DESTRUCTOR macros.
6 6
7These macros allows users to control the order of initialization 7These macros allows users to control the order of initialization
8of objects defined at namespace scope with the init_priority 8of objects defined at namespace scope with the init_priority
@@ -10,19 +10,15 @@ attribute by specifying a relative priority, a constant integral
10expression currently bounded between 101 and 65535 inclusive. 10expression currently bounded between 101 and 65535 inclusive.
11 11
12Lower numbers indicate a higher priority. 12Lower numbers indicate a higher priority.
13Upstream-Status: Pending
14
15Signed-off-by: Mark Hatle <mark.hatle@amd.com>
16
17--- 13---
18 gcc/config/microblaze/microblaze.cc | 53 +++++++++++++++++++++++++++++ 14 gcc/config/microblaze/microblaze.cc | 53 +++++++++++++++++++++++++++++
19 1 file changed, 53 insertions(+) 15 1 file changed, 53 insertions(+)
20 16
21diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 17diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
22index 6922dd94af7..4b0621db168 100644 18index 11e34b3fdae..3fb402b87d4 100644
23--- a/gcc/config/microblaze/microblaze.cc 19--- a/gcc/config/microblaze/microblaze.cc
24+++ b/gcc/config/microblaze/microblaze.cc 20+++ b/gcc/config/microblaze/microblaze.cc
25@@ -2635,6 +2635,53 @@ print_operand_address (FILE * file, rtx addr) 21@@ -2640,6 +2640,53 @@ print_operand_address (FILE * file, rtx addr)
26 } 22 }
27 } 23 }
28 24
@@ -76,7 +72,7 @@ index 6922dd94af7..4b0621db168 100644
76 /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol 72 /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
77 is used, so that we don't emit an .extern for it in 73 is used, so that we don't emit an .extern for it in
78 microblaze_asm_file_end. */ 74 microblaze_asm_file_end. */
79@@ -3976,6 +4023,12 @@ microblaze_starting_frame_offset (void) 75@@ -3985,6 +4032,12 @@ microblaze_starting_frame_offset (void)
80 #undef TARGET_ATTRIBUTE_TABLE 76 #undef TARGET_ATTRIBUTE_TABLE
81 #define TARGET_ATTRIBUTE_TABLE microblaze_attribute_table 77 #define TARGET_ATTRIBUTE_TABLE microblaze_attribute_table
82 78
@@ -90,5 +86,5 @@ index 6922dd94af7..4b0621db168 100644
90 #define TARGET_IN_SMALL_DATA_P microblaze_elf_in_small_data_p 86 #define TARGET_IN_SMALL_DATA_P microblaze_elf_in_small_data_p
91 87
92-- 88--
932.37.1 (Apple Git-137.1) 892.34.1
94 90
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0015-Add-optimized-lshrsi3-When-barrel-shifter-is-not-pre.patch
index 7ce5ebc0..fac95b7b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0015-Add-optimized-lshrsi3-When-barrel-shifter-is-not-pre.patch
@@ -1,9 +1,9 @@
1From b9bb669d9404bd04676f09c793310e1b7f228674 Mon Sep 17 00:00:00 2001 1From d0f1a493d130e06816df4d11f31421a8691761e0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 15:23:57 +0530 3Date: Tue, 17 Jan 2017 15:23:57 +0530
4Subject: [PATCH 15/53] [Patch, microblaze]: Add optimized lshrsi3 When barrel 4Subject: [PATCH 15/54] Add optimized lshrsi3 When barrel shifter is not
5 shifter is not present, the immediate value is greater than #5 and 5 present, the immediate value is greater than #5 and optimization is -OS, the
6 optimization is -OS, the compiler will generate shift operation using loop. 6 compiler will generate shift operation using loop.
7 7
8Changelog 8Changelog
9 9
@@ -17,8 +17,6 @@ ChangeLog/testsuite
17 17
18 * gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c: New test. 18 * gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c: New test.
19 19
20Upstream-Status: Pending
21
22Signed-off-by:Nagaraju <nmekala@xilix.com> 20Signed-off-by:Nagaraju <nmekala@xilix.com>
23Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 21Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
24--- 22---
@@ -28,7 +26,7 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
28 create mode 100644 gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c 26 create mode 100644 gcc/testsuite/gcc.target/microblaze/others/lshrsi_Os_1.c
29 27
30diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 28diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
31index 9fbb3113f3c..52308cce0cb 100644 29index 4f20b8efe33..5d65ad84449 100644
32--- a/gcc/config/microblaze/microblaze.md 30--- a/gcc/config/microblaze/microblaze.md
33+++ b/gcc/config/microblaze/microblaze.md 31+++ b/gcc/config/microblaze/microblaze.md
34@@ -1618,6 +1618,27 @@ 32@@ -1618,6 +1618,27 @@
@@ -79,5 +77,5 @@ index 00000000000..32a3be7c76a
79+/* { dg-final { scan-assembler "bneid\tr18,.-4" } } */ 77+/* { dg-final { scan-assembler "bneid\tr18,.-4" } } */
80+/* { dg-final { scan-assembler "\srl\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])" } } */ 78+/* { dg-final { scan-assembler "\srl\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])" } } */
81-- 79--
822.37.1 (Apple Git-137.1) 802.34.1
83 81
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0016-Add-cbranchsi4_reg-This-patch-optimizes-the-generati.patch
index dc645c30..298765dc 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0016-Add-cbranchsi4_reg-This-patch-optimizes-the-generati.patch
@@ -1,12 +1,9 @@
1From 08d7bb4062024f3e34fbb17d695f8fa2c9e1b305 Mon Sep 17 00:00:00 2001 1From e94d406c9fa0d7b99532bd8cf4b2a4580cdb02b7 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 17:04:37 +0530 3Date: Tue, 17 Jan 2017 17:04:37 +0530
4Subject: [PATCH 16/53] [Patch, microblaze]: Add cbranchsi4_reg This patch 4Subject: [PATCH 16/54] Add cbranchsi4_reg This patch optimizes the generation
5 optimizes the generation of pcmpne/pcmpeq instruction if the compare 5 of pcmpne/pcmpeq instruction if the compare instruction has no immediate
6 instruction has no immediate values.For the immediate values the xor 6 values.For the immediate values the xor instruction is generated
7 instruction is generated
8
9Upstream-Status: Pending
10 7
11Signed-off-by: Nagaraju Mekala <nmekala@xilix.com> 8Signed-off-by: Nagaraju Mekala <nmekala@xilix.com>
12Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com> 9Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com>
@@ -32,7 +29,7 @@ Conflicts:
32 7 files changed, 18 insertions(+), 18 deletions(-) 29 7 files changed, 18 insertions(+), 18 deletions(-)
33 30
34diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h 31diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
35index d67355697b5..848cd509003 100644 32index 31a6515176b..41557af0f3c 100644
36--- a/gcc/config/microblaze/microblaze-protos.h 33--- a/gcc/config/microblaze/microblaze-protos.h
37+++ b/gcc/config/microblaze/microblaze-protos.h 34+++ b/gcc/config/microblaze/microblaze-protos.h
38@@ -33,7 +33,7 @@ extern int microblaze_expand_shift (rtx *); 35@@ -33,7 +33,7 @@ extern int microblaze_expand_shift (rtx *);
@@ -145,5 +142,5 @@ index 1d6ba807b12..532c035adfd 100644
145 142
146 } 143 }
147-- 144--
1482.37.1 (Apple Git-137.1) 1452.34.1
149 146
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0017-Inline-Expansion-of-fsqrt-builtin.-The-changes-are-m.patch
index b0d33516..91ca87fc 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0017-Inline-Expansion-of-fsqrt-builtin.-The-changes-are-m.patch
@@ -1,19 +1,19 @@
1From 1593e5a9839b7cade95e9f55ba3cff66d64d0e84 Mon Sep 17 00:00:00 2001 1From 0760cd661f6c09cda8327288f79314319a0b9b14 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 17:11:04 +0530 3Date: Tue, 17 Jan 2017 17:11:04 +0530
4Subject: [PATCH 17/53] [Patch,microblaze]: Inline Expansion of fsqrt builtin. 4Subject: [PATCH 17/54] Inline Expansion of fsqrt builtin. The changes are made
5 The changes are made in the patch for the inline expansion of the fsqrt 5 in the patch for the inline expansion of the fsqrt builtin with fqrt
6 builtin with fqrt instruction. The sqrt math function takes double as 6 instruction. The sqrt math function takes double as argument and return
7 argument and return double as argument. The pattern is selected while 7 double as argument. The pattern is selected while expanding the unary op
8 expanding the unary op through expand_unop which passes DFmode and the DFmode 8 through expand_unop which passes DFmode and the DFmode pattern was not there
9 pattern was not there returning zero. Thus the sqrt math function is not 9 returning zero. Thus the sqrt math function is not inlined and expanded. The
10 inlined and expanded. The pattern with DFmode argument is added. Also the 10 pattern with DFmode argument is added. Also the source and destination
11 source and destination argument is not same the DF through two different 11 argument is not same the DF through two different consecutive registers with
12 consecutive registers with lower 32 bit is the argument passed to sqrt and 12 lower 32 bit is the argument passed to sqrt and the higher 32 bit is zero. If
13 the higher 32 bit is zero. If the source and destinations are different the 13 the source and destinations are different the DFmode 64 bits registers is not
14 DFmode 64 bits registers is not set properly giving the problem in runtime. 14 set properly giving the problem in runtime. Such changes are taken care in
15 Such changes are taken care in the implementation of the pattern for DFmode 15 the implementation of the pattern for DFmode for inline expansion of the
16 for inline expansion of the sqrt. 16 sqrt.
17 17
18ChangeLog: 18ChangeLog:
192015-06-16 Ajit Agarwal <ajitkum@xilinx.com> 192015-06-16 Ajit Agarwal <ajitkum@xilinx.com>
@@ -22,8 +22,6 @@ ChangeLog:
22 * config/microblaze/microblaze.md (sqrtdf2): New 22 * config/microblaze/microblaze.md (sqrtdf2): New
23 pattern. 23 pattern.
24 24
25Upstream-Status: Pending
26
27Signed-off-by:Ajit Agarwal ajitkum@xilinx.com 25Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
28 Nagaraju Mekala nmekala@xilinx.com 26 Nagaraju Mekala nmekala@xilinx.com
29--- 27---
@@ -31,7 +29,7 @@ Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
31 1 file changed, 14 insertions(+) 29 1 file changed, 14 insertions(+)
32 30
33diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 31diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
34index 52308cce0cb..0e5ef4d7649 100644 32index 5d65ad84449..0597ed8d75a 100644
35--- a/gcc/config/microblaze/microblaze.md 33--- a/gcc/config/microblaze/microblaze.md
36+++ b/gcc/config/microblaze/microblaze.md 34+++ b/gcc/config/microblaze/microblaze.md
37@@ -451,6 +451,20 @@ 35@@ -451,6 +451,20 @@
@@ -56,5 +54,5 @@ index 52308cce0cb..0e5ef4d7649 100644
56 [(set (match_operand:SI 0 "register_operand" "=d") 54 [(set (match_operand:SI 0 "register_operand" "=d")
57 (fix:SI (match_operand:SF 1 "register_operand" "d")))] 55 (fix:SI (match_operand:SF 1 "register_operand" "d")))]
58-- 56--
592.37.1 (Apple Git-137.1) 572.34.1
60 58
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0018-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch
index 94235be6..f388e9b5 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0018-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch
@@ -1,9 +1,9 @@
1From 9002b7d4c295bef95a3fc28c05f86dde5087dde1 Mon Sep 17 00:00:00 2001 1From 0a7299e82a8f463e9e7cd6297c5bdc0aac3a0ec4 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 18:07:24 +0530 3Date: Tue, 17 Jan 2017 18:07:24 +0530
4Subject: [PATCH 18/53] [PATCH] microblaze.md: Improve 'adddi3' and 'subdi3' 4Subject: [PATCH 18/54] microblaze.md: Improve 'adddi3' and 'subdi3' insn
5 insn definitions Change adddi3 to handle DI immediates as the second operand, 5 definitions Change adddi3 to handle DI immediates as the second operand, this
6 this requires modification to the output template however reduces the need to 6 requires modification to the output template however reduces the need to
7 specify seperate templates for 16-bit positive/negative immediate operands. 7 specify seperate templates for 16-bit positive/negative immediate operands.
8 The use of 32-bit immediates for the addi and addic instructions is handled 8 The use of 32-bit immediates for the addi and addic instructions is handled
9 by the assembler, which will emit the imm instructions when required. This 9 by the assembler, which will emit the imm instructions when required. This
@@ -17,15 +17,13 @@ implement purely with instructions as microblaze does not provide an
17instruction to perform a forward arithmetic subtraction (it only 17instruction to perform a forward arithmetic subtraction (it only
18provides reverse 'rD = IMM - rA'). 18provides reverse 'rD = IMM - rA').
19 19
20Upstream-Status: Pending
21
22Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> 20Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
23--- 21---
24 gcc/config/microblaze/microblaze.md | 13 ++++++------- 22 gcc/config/microblaze/microblaze.md | 13 ++++++-------
25 1 file changed, 6 insertions(+), 7 deletions(-) 23 1 file changed, 6 insertions(+), 7 deletions(-)
26 24
27diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 25diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
28index 0e5ef4d7649..effb9774c32 100644 26index 0597ed8d75a..498926a4a75 100644
29--- a/gcc/config/microblaze/microblaze.md 27--- a/gcc/config/microblaze/microblaze.md
30+++ b/gcc/config/microblaze/microblaze.md 28+++ b/gcc/config/microblaze/microblaze.md
31@@ -502,17 +502,16 @@ 29@@ -502,17 +502,16 @@
@@ -61,5 +59,5 @@ index 0e5ef4d7649..effb9774c32 100644
61 "rsub\t%L0,%L2,%L1\;rsubc\t%M0,%M2,%M1" 59 "rsub\t%L0,%L2,%L1\;rsubc\t%M0,%M2,%M1"
62 [(set_attr "type" "darith") 60 [(set_attr "type" "darith")
63-- 61--
642.37.1 (Apple Git-137.1) 622.34.1
65 63
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0019-Update-ashlsi3-movsf-patterns-This-patch-removes-the.patch
index e955938e..0f388f70 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0019-Update-ashlsi3-movsf-patterns-This-patch-removes-the.patch
@@ -1,10 +1,10 @@
1From ef94a8b2110f5a3becefb00c1f7c0c3adac6fcac Mon Sep 17 00:00:00 2001 1From a969ab3f04de077eca6d928dd651e3c6b042367d Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 17 Jan 2017 18:18:41 +0530 3Date: Tue, 17 Jan 2017 18:18:41 +0530
4Subject: [PATCH 19/53] [Patch, microblaze]: Update ashlsi3 & movsf patterns 4Subject: [PATCH 19/54] Update ashlsi3 & movsf patterns This patch removes the
5 This patch removes the use of HOST_WIDE_INT_PRINT_HEX macro in print_operand 5 use of HOST_WIDE_INT_PRINT_HEX macro in print_operand of
6 of ashlsi3_with_mul_nodelay,ashlsi3_with_mul_delay and movsf_internal 6 ashlsi3_with_mul_nodelay,ashlsi3_with_mul_delay and movsf_internal patterns
7 patterns beacuse HOST_WIDE_INT_PRINT_HEX is generating 64-bit value which our 7 beacuse HOST_WIDE_INT_PRINT_HEX is generating 64-bit value which our
8 instruction doesn't support so using gen_int_mode function 8 instruction doesn't support so using gen_int_mode function
9 9
10Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 10Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
@@ -24,20 +24,16 @@ ChangeLog:
24 24
25Conflicts: 25Conflicts:
26 gcc/config/microblaze/microblaze.c 26 gcc/config/microblaze/microblaze.c
27Upstream-Status: Pending
28
29Signed-off-by: Mark Hatle <mark.hatle@amd.com>
30
31--- 27---
32 gcc/config/microblaze/microblaze.cc | 2 +- 28 gcc/config/microblaze/microblaze.cc | 2 +-
33 gcc/config/microblaze/microblaze.md | 10 ++++++++-- 29 gcc/config/microblaze/microblaze.md | 10 ++++++++--
34 2 files changed, 9 insertions(+), 3 deletions(-) 30 2 files changed, 9 insertions(+), 3 deletions(-)
35 31
36diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 32diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
37index 4b0621db168..c23061c4e4a 100644 33index 3fb402b87d4..ff64e0ca342 100644
38--- a/gcc/config/microblaze/microblaze.cc 34--- a/gcc/config/microblaze/microblaze.cc
39+++ b/gcc/config/microblaze/microblaze.cc 35+++ b/gcc/config/microblaze/microblaze.cc
40@@ -2469,7 +2469,7 @@ print_operand (FILE * file, rtx op, int letter) 36@@ -2474,7 +2474,7 @@ print_operand (FILE * file, rtx op, int letter)
41 unsigned long value_long; 37 unsigned long value_long;
42 REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op), 38 REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (op),
43 value_long); 39 value_long);
@@ -47,7 +43,7 @@ index 4b0621db168..c23061c4e4a 100644
47 else 43 else
48 { 44 {
49diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 45diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
50index effb9774c32..a4d7ea29219 100644 46index 498926a4a75..0448101de8a 100644
51--- a/gcc/config/microblaze/microblaze.md 47--- a/gcc/config/microblaze/microblaze.md
52+++ b/gcc/config/microblaze/microblaze.md 48+++ b/gcc/config/microblaze/microblaze.md
53@@ -1368,7 +1368,10 @@ 49@@ -1368,7 +1368,10 @@
@@ -75,5 +71,5 @@ index effb9774c32..a4d7ea29219 100644
75 [(set_attr "type" "no_delay_arith") 71 [(set_attr "type" "no_delay_arith")
76 (set_attr "mode" "SI") 72 (set_attr "mode" "SI")
77-- 73--
782.37.1 (Apple Git-137.1) 742.34.1
79 75
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0020-8-stage-pipeline-for-microblaze-This-patch-adds-the-.patch
index 2d384b78..002e60be 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0020-8-stage-pipeline-for-microblaze-This-patch-adds-the-.patch
@@ -1,15 +1,11 @@
1From 65574bdca9006fda7654e33a0081eeecfcd9976b Mon Sep 17 00:00:00 2001 1From 21daca8e01515b2e73463adbf9488b63bb0ccf54 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 12 Sep 2022 21:05:51 +0530 3Date: Mon, 12 Sep 2022 21:05:51 +0530
4Subject: [PATCH 20/53] [Patch, microblaze]: 8-stage pipeline for microblaze 4Subject: [PATCH 20/54] 8-stage pipeline for microblaze This patch adds the
5 This patch adds the support for the 8-stage pipeline. The new 8-stage 5 support for the 8-stage pipeline. The new 8-stage pipeline reduces the
6 pipeline reduces the latencies of float & integer division drastically 6 latencies of float & integer division drastically
7 7
8Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 8Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
9Upstream-Status: Pending
10
11Signed-off-by: Mark Hatle <mark.hatle@amd.com>
12
13--- 9---
14 gcc/config/microblaze/microblaze.cc | 11 ++++ 10 gcc/config/microblaze/microblaze.cc | 11 ++++
15 gcc/config/microblaze/microblaze.h | 3 +- 11 gcc/config/microblaze/microblaze.h | 3 +-
@@ -18,10 +14,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
18 4 files changed, 94 insertions(+), 3 deletions(-) 14 4 files changed, 94 insertions(+), 3 deletions(-)
19 15
20diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 16diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
21index c23061c4e4a..bd394c411b8 100644 17index ff64e0ca342..a58a5b2a1b0 100644
22--- a/gcc/config/microblaze/microblaze.cc 18--- a/gcc/config/microblaze/microblaze.cc
23+++ b/gcc/config/microblaze/microblaze.cc 19+++ b/gcc/config/microblaze/microblaze.cc
24@@ -1841,6 +1841,17 @@ microblaze_option_override (void) 20@@ -1846,6 +1846,17 @@ microblaze_option_override (void)
25 "%<-mcpu=v8.30.a%>"); 21 "%<-mcpu=v8.30.a%>");
26 TARGET_REORDER = 0; 22 TARGET_REORDER = 0;
27 } 23 }
@@ -40,7 +36,7 @@ index c23061c4e4a..bd394c411b8 100644
40 if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL) 36 if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
41 error ("%<-mxl-multiply-high%> requires %<-mno-xl-soft-mul%>"); 37 error ("%<-mxl-multiply-high%> requires %<-mno-xl-soft-mul%>");
42diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 38diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
43index cd544f2030e..640ae6ea9a3 100644 39index 49e7fbedd5a..e4faa9c681f 100644
44--- a/gcc/config/microblaze/microblaze.h 40--- a/gcc/config/microblaze/microblaze.h
45+++ b/gcc/config/microblaze/microblaze.h 41+++ b/gcc/config/microblaze/microblaze.h
46@@ -27,7 +27,8 @@ 42@@ -27,7 +27,8 @@
@@ -54,7 +50,7 @@ index cd544f2030e..640ae6ea9a3 100644
54 50
55 #define MICROBLAZE_MASK_NO_UNSAFE_DELAY 0x00000001 51 #define MICROBLAZE_MASK_NO_UNSAFE_DELAY 0x00000001
56diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 52diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
57index a4d7ea29219..9e9dfb1ccb0 100644 53index 0448101de8a..7a01b28d8f0 100644
58--- a/gcc/config/microblaze/microblaze.md 54--- a/gcc/config/microblaze/microblaze.md
59+++ b/gcc/config/microblaze/microblaze.md 55+++ b/gcc/config/microblaze/microblaze.md
60@@ -35,6 +35,7 @@ 56@@ -35,6 +35,7 @@
@@ -165,7 +161,7 @@ index a4d7ea29219..9e9dfb1ccb0 100644
165 (set_attr "length" "4")]) 161 (set_attr "length" "4")])
166 162
167diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt 163diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt
168index 9f47e67cf2a..cc009363f87 100644 164index dbf6390ef4b..37aaaf9ffda 100644
169--- a/gcc/config/microblaze/microblaze.opt 165--- a/gcc/config/microblaze/microblaze.opt
170+++ b/gcc/config/microblaze/microblaze.opt 166+++ b/gcc/config/microblaze/microblaze.opt
171@@ -133,3 +133,7 @@ Data referenced by offset from start of text instead of GOT (with -fPIC/-fPIE). 167@@ -133,3 +133,7 @@ Data referenced by offset from start of text instead of GOT (with -fPIC/-fPIE).
@@ -177,5 +173,5 @@ index 9f47e67cf2a..cc009363f87 100644
177+Target Mask(AREA_OPTIMIZED_2) 173+Target Mask(AREA_OPTIMIZED_2)
178+Use 8 stage pipeline (frequency optimization) 174+Use 8 stage pipeline (frequency optimization)
179-- 175--
1802.37.1 (Apple Git-137.1) 1762.34.1
181 177
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0021-Correct-the-const-high-double-immediate-value-with-t.patch
index 1b8d924c..2e8182d1 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0021-Correct-the-const-high-double-immediate-value-with-t.patch
@@ -1,18 +1,14 @@
1From 1d56bfb436b008422b4a7d4d4e3180667130c840 Mon Sep 17 00:00:00 2001 1From 1cda2f5772650aa65853e6a3e9d8162498c2f469 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 11:49:11 +0530 3Date: Tue, 13 Sep 2022 11:49:11 +0530
4Subject: [PATCH 21/53] [PATCH 21/53] [Patch, microblaze]: Correct the const 4Subject: [PATCH 21/54] Correct the const high double immediate value with this
5 high double immediate value with this patch the loading of the DI mode 5 patch the loading of the DI mode immediate values will be using
6 immediate values will be using REAL_VALUE_FROM_CONST_DOUBLE and 6 REAL_VALUE_FROM_CONST_DOUBLE and REAL_VALUE_TO_TARGET_DOUBLE functions, as
7 REAL_VALUE_TO_TARGET_DOUBLE functions, as CONST_DOUBLE_HIGH was returning 7 CONST_DOUBLE_HIGH was returning the sign extension value even of the unsigned
8 the sign extension value even of the unsigned long long constants also 8 long long constants also
9 9
10Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 10Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11 Ajit Agarwal <ajitkum@xilinx.com> 11 Ajit Agarwal <ajitkum@xilinx.com>
12Upstream-Status: Pending
13
14Signed-off-by: Mark Hatle <mark.hatle@amd.com>
15
16--- 12---
17 gcc/config/microblaze/microblaze.cc | 6 ++++-- 13 gcc/config/microblaze/microblaze.cc | 6 ++++--
18 gcc/testsuite/gcc.target/microblaze/others/long.c | 9 +++++++++ 14 gcc/testsuite/gcc.target/microblaze/others/long.c | 9 +++++++++
@@ -20,10 +16,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20 create mode 100644 gcc/testsuite/gcc.target/microblaze/others/long.c 16 create mode 100644 gcc/testsuite/gcc.target/microblaze/others/long.c
21 17
22diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 18diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
23index bd394c411b8..7c648cda1b2 100644 19index a58a5b2a1b0..af5c2371740 100644
24--- a/gcc/config/microblaze/microblaze.cc 20--- a/gcc/config/microblaze/microblaze.cc
25+++ b/gcc/config/microblaze/microblaze.cc 21+++ b/gcc/config/microblaze/microblaze.cc
26@@ -2453,14 +2453,16 @@ print_operand (FILE * file, rtx op, int letter) 22@@ -2458,14 +2458,16 @@ print_operand (FILE * file, rtx op, int letter)
27 else if (letter == 'h' || letter == 'j') 23 else if (letter == 'h' || letter == 'j')
28 { 24 {
29 long val[2]; 25 long val[2];
@@ -58,5 +54,5 @@ index 00000000000..b6b55d5ad65
58+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */ 54+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x00000000" } } */
59+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */ 55+/* { dg-final { scan-assembler "addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf0000000" } } */
60-- 56--
612.37.1 (Apple Git-137.1) 572.34.1
62 58
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0022-Fix-internal-compiler-error-with-msmall-divides-This.patch
index a5917947..599bd71e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0022-Fix-internal-compiler-error-with-msmall-divides-This.patch
@@ -1,27 +1,23 @@
1From cd60ea1bd88ac47856ac66266a0771478ac73bad Mon Sep 17 00:00:00 2001 1From a88796930d8ef1b97056217ffdcc9f86326cdc98 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 11:58:14 +0530 3Date: Tue, 13 Sep 2022 11:58:14 +0530
4Subject: [PATCH 22/53] [Fix, microblaze]: Fix internal compiler error with 4Subject: [PATCH 22/54] Fix internal compiler error with msmall-divides This
5 msmall-divides This patch will fix the internal error 5 patch will fix the internal error microblaze_expand_divide function which
6 microblaze_expand_divide function which come of rtx PLUS where the 6 come of rtx PLUS where the mem_rtx is of type SI and the operand is of type
7 mem_rtx is of type SI and the operand is of type QImode. This patch 7 QImode. This patch modifies the mem_rtx as QImode and Plus as QImode to fix
8 modifies the mem_rtx as QImode and Plus as QImode to fix the error. 8 the error.
9 9
10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11 Ajit Agarwal <ajitkum@xilinx.com> 11 Ajit Agarwal <ajitkum@xilinx.com>
12Upstream-Status: Pending
13
14Signed-off-by: Mark Hatle <mark.hatle@amd.com>
15
16--- 12---
17 gcc/config/microblaze/microblaze.cc | 2 +- 13 gcc/config/microblaze/microblaze.cc | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-) 14 1 file changed, 1 insertion(+), 1 deletion(-)
19 15
20diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 16diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
21index 7c648cda1b2..907c0afa9b8 100644 17index af5c2371740..4967d6a0133 100644
22--- a/gcc/config/microblaze/microblaze.cc 18--- a/gcc/config/microblaze/microblaze.cc
23+++ b/gcc/config/microblaze/microblaze.cc 19+++ b/gcc/config/microblaze/microblaze.cc
24@@ -3768,7 +3768,7 @@ microblaze_expand_divide (rtx operands[]) 20@@ -3777,7 +3777,7 @@ microblaze_expand_divide (rtx operands[])
25 emit_insn (gen_ashlsi3_bshift (regt1, operands[1], GEN_INT(4))); 21 emit_insn (gen_ashlsi3_bshift (regt1, operands[1], GEN_INT(4)));
26 emit_insn (gen_addsi3 (regt1, regt1, operands[2])); 22 emit_insn (gen_addsi3 (regt1, regt1, operands[2]));
27 mem_rtx = gen_rtx_MEM (QImode, 23 mem_rtx = gen_rtx_MEM (QImode,
@@ -31,5 +27,5 @@ index 7c648cda1b2..907c0afa9b8 100644
31 insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx)); 27 insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx));
32 jump = emit_jump_insn_after (gen_jump (div_end_label), insn); 28 jump = emit_jump_insn_after (gen_jump (div_end_label), insn);
33-- 29--
342.37.1 (Apple Git-137.1) 302.34.1
35 31
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0023-Fix-the-calculation-of-high-word-in-a-long-long-64-b.patch
index ae05e791..65f283ad 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0023-Fix-the-calculation-of-high-word-in-a-long-long-64-b.patch
@@ -1,8 +1,7 @@
1From b98cddb206ce84994425ede4b116365977768e37 Mon Sep 17 00:00:00 2001 1From f9871617fe69a105ebc4aa4838c682bfe40e4f2c Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 12:03:08 +0530 3Date: Tue, 13 Sep 2022 12:03:08 +0530
4Subject: [PATCH 23/53] [patch,microblaze]: Fix the calculation of high word in 4Subject: [PATCH 23/54] Fix the calculation of high word in a long long 64-bit
5 a long long 64-bit
6 5
7 This patch will change the calculation of high word in a long long 64-bit. 6 This patch will change the calculation of high word in a long long 64-bit.
8 Earlier to this patch the high word of long long word (0xF0000000ULL) is 7 Earlier to this patch the high word of long long word (0xF0000000ULL) is
@@ -14,19 +13,15 @@ Subject: [PATCH 23/53] [patch,microblaze]: Fix the calculation of high word in
14 13
15 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 14 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
16 Ajit Agarwal <ajitkum@xilinx.com> 15 Ajit Agarwal <ajitkum@xilinx.com>
17Upstream-Status: Pending
18
19Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20
21--- 16---
22 gcc/config/microblaze/microblaze.cc | 3 --- 17 gcc/config/microblaze/microblaze.cc | 3 ---
23 1 file changed, 3 deletions(-) 18 1 file changed, 3 deletions(-)
24 19
25diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 20diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
26index 907c0afa9b8..f75eaff4b49 100644 21index 4967d6a0133..2d516724acc 100644
27--- a/gcc/config/microblaze/microblaze.cc 22--- a/gcc/config/microblaze/microblaze.cc
28+++ b/gcc/config/microblaze/microblaze.cc 23+++ b/gcc/config/microblaze/microblaze.cc
29@@ -2469,9 +2469,6 @@ print_operand (FILE * file, rtx op, int letter) 24@@ -2474,9 +2474,6 @@ print_operand (FILE * file, rtx op, int letter)
30 { 25 {
31 val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32; 26 val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32;
32 val[1] = INTVAL (op) & 0x00000000ffffffffLL; 27 val[1] = INTVAL (op) & 0x00000000ffffffffLL;
@@ -37,5 +32,5 @@ index 907c0afa9b8..f75eaff4b49 100644
37 fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]); 32 fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]);
38 } 33 }
39-- 34--
402.37.1 (Apple Git-137.1) 352.34.1
41 36
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0024-this-patch-has-1.Fixed-the-bug-in-version-calculatio.patch
index 444c9397..0356657b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0024-this-patch-has-1.Fixed-the-bug-in-version-calculatio.patch
@@ -1,14 +1,10 @@
1From 89269c9b8d2047ebbc13e98c45e94746edc63de6 Mon Sep 17 00:00:00 2001 1From a8991be91d79cf0bd17b7d303a10ec5edd7408c6 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 12:23:54 +0530 3Date: Tue, 13 Sep 2022 12:23:54 +0530
4Subject: [PATCH 24/53] [Patch,MicroBlaze] : this patch has 1.Fixed the bug in 4Subject: [PATCH 24/54] this patch has 1.Fixed the bug in version calculation.
5 version calculation. 2.Add new bitfield instructions. 5 2.Add new bitfield instructions.
6 6
7Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com> 7Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com>
8Upstream-Status: Pending
9
10Signed-off-by: Mark Hatle <mark.hatle@amd.com>
11
12--- 8---
13 gcc/config/microblaze/microblaze.cc | 154 ++++++++++++++-------------- 9 gcc/config/microblaze/microblaze.cc | 154 ++++++++++++++--------------
14 gcc/config/microblaze/microblaze.h | 2 + 10 gcc/config/microblaze/microblaze.h | 2 +
@@ -16,7 +12,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
16 3 files changed, 147 insertions(+), 78 deletions(-) 12 3 files changed, 147 insertions(+), 78 deletions(-)
17 13
18diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 14diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
19index f75eaff4b49..3abfc834ff2 100644 15index 2d516724acc..e28ab593c3e 100644
20--- a/gcc/config/microblaze/microblaze.cc 16--- a/gcc/config/microblaze/microblaze.cc
21+++ b/gcc/config/microblaze/microblaze.cc 17+++ b/gcc/config/microblaze/microblaze.cc
22@@ -165,6 +165,9 @@ int microblaze_no_unsafe_delay; 18@@ -165,6 +165,9 @@ int microblaze_no_unsafe_delay;
@@ -93,7 +89,7 @@ index f75eaff4b49..3abfc834ff2 100644
93 /* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */ 89 /* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */
94 static bool 90 static bool
95 microblaze_const_double_ok (rtx op, machine_mode mode) 91 microblaze_const_double_ok (rtx op, machine_mode mode)
96@@ -1339,8 +1399,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, 92@@ -1344,8 +1404,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
97 { 93 {
98 if (TARGET_BARREL_SHIFT) 94 if (TARGET_BARREL_SHIFT)
99 { 95 {
@@ -103,7 +99,7 @@ index f75eaff4b49..3abfc834ff2 100644
103 *total = COSTS_N_INSNS (1); 99 *total = COSTS_N_INSNS (1);
104 else 100 else
105 *total = COSTS_N_INSNS (2); 101 *total = COSTS_N_INSNS (2);
106@@ -1401,8 +1460,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, 102@@ -1406,8 +1465,7 @@ microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
107 } 103 }
108 else if (!TARGET_SOFT_MUL) 104 else if (!TARGET_SOFT_MUL)
109 { 105 {
@@ -113,7 +109,7 @@ index f75eaff4b49..3abfc834ff2 100644
113 *total = COSTS_N_INSNS (1); 109 *total = COSTS_N_INSNS (1);
114 else 110 else
115 *total = COSTS_N_INSNS (3); 111 *total = COSTS_N_INSNS (3);
116@@ -1675,72 +1733,13 @@ function_arg_partial_bytes (cumulative_args_t cum_v, 112@@ -1680,72 +1738,13 @@ function_arg_partial_bytes (cumulative_args_t cum_v,
117 return 0; 113 return 0;
118 } 114 }
119 115
@@ -187,7 +183,7 @@ index f75eaff4b49..3abfc834ff2 100644
187 183
188 microblaze_section_threshold = (OPTION_SET_P (g_switch_value) 184 microblaze_section_threshold = (OPTION_SET_P (g_switch_value)
189 ? g_switch_value 185 ? g_switch_value
190@@ -1761,13 +1760,13 @@ microblaze_option_override (void) 186@@ -1766,13 +1765,13 @@ microblaze_option_override (void)
191 /* Check the MicroBlaze CPU version for any special action to be done. */ 187 /* Check the MicroBlaze CPU version for any special action to be done. */
192 if (microblaze_select_cpu == NULL) 188 if (microblaze_select_cpu == NULL)
193 microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU; 189 microblaze_select_cpu = MICROBLAZE_DEFAULT_CPU;
@@ -204,7 +200,7 @@ index f75eaff4b49..3abfc834ff2 100644
204 if (ver < 0) 200 if (ver < 0)
205 { 201 {
206 /* No hardware exceptions in earlier versions. So no worries. */ 202 /* No hardware exceptions in earlier versions. So no worries. */
207@@ -1778,8 +1777,7 @@ microblaze_option_override (void) 203@@ -1783,8 +1782,7 @@ microblaze_option_override (void)
208 microblaze_pipe = MICROBLAZE_PIPE_3; 204 microblaze_pipe = MICROBLAZE_PIPE_3;
209 } 205 }
210 else if (ver == 0 206 else if (ver == 0
@@ -214,7 +210,7 @@ index f75eaff4b49..3abfc834ff2 100644
214 { 210 {
215 #if 0 211 #if 0
216 microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY); 212 microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY);
217@@ -1796,11 +1794,9 @@ microblaze_option_override (void) 213@@ -1801,11 +1799,9 @@ microblaze_option_override (void)
218 #endif 214 #endif
219 microblaze_no_unsafe_delay = 0; 215 microblaze_no_unsafe_delay = 0;
220 microblaze_pipe = MICROBLAZE_PIPE_5; 216 microblaze_pipe = MICROBLAZE_PIPE_5;
@@ -229,7 +225,7 @@ index f75eaff4b49..3abfc834ff2 100644
229 { 225 {
230 /* Pattern compares are to be turned on by default only when 226 /* Pattern compares are to be turned on by default only when
231 compiling for MB v5.00.'z'. */ 227 compiling for MB v5.00.'z'. */
232@@ -1808,7 +1804,7 @@ microblaze_option_override (void) 228@@ -1813,7 +1809,7 @@ microblaze_option_override (void)
233 } 229 }
234 } 230 }
235 231
@@ -238,7 +234,7 @@ index f75eaff4b49..3abfc834ff2 100644
238 if (ver < 0) 234 if (ver < 0)
239 { 235 {
240 if (TARGET_MULTIPLY_HIGH) 236 if (TARGET_MULTIPLY_HIGH)
241@@ -1817,7 +1813,7 @@ microblaze_option_override (void) 237@@ -1822,7 +1818,7 @@ microblaze_option_override (void)
242 "%<-mcpu=v6.00.a%> or greater"); 238 "%<-mcpu=v6.00.a%> or greater");
243 } 239 }
244 240
@@ -247,7 +243,7 @@ index f75eaff4b49..3abfc834ff2 100644
247 microblaze_has_clz = 1; 243 microblaze_has_clz = 1;
248 if (ver < 0) 244 if (ver < 0)
249 { 245 {
250@@ -1826,7 +1822,7 @@ microblaze_option_override (void) 246@@ -1831,7 +1827,7 @@ microblaze_option_override (void)
251 } 247 }
252 248
253 /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified. */ 249 /* TARGET_REORDER defaults to 2 if -mxl-reorder not specified. */
@@ -256,7 +252,7 @@ index f75eaff4b49..3abfc834ff2 100644
256 if (ver < 0) 252 if (ver < 0)
257 { 253 {
258 if (TARGET_REORDER == 1) 254 if (TARGET_REORDER == 1)
259@@ -1841,7 +1837,7 @@ microblaze_option_override (void) 255@@ -1846,7 +1842,7 @@ microblaze_option_override (void)
260 "%<-mcpu=v8.30.a%>"); 256 "%<-mcpu=v8.30.a%>");
261 TARGET_REORDER = 0; 257 TARGET_REORDER = 0;
262 } 258 }
@@ -265,7 +261,7 @@ index f75eaff4b49..3abfc834ff2 100644
265 if (ver < 0) 261 if (ver < 0)
266 { 262 {
267 if (TARGET_AREA_OPTIMIZED_2) 263 if (TARGET_AREA_OPTIMIZED_2)
268@@ -1851,6 +1847,8 @@ microblaze_option_override (void) 264@@ -1856,6 +1852,8 @@ microblaze_option_override (void)
269 { 265 {
270 if (TARGET_AREA_OPTIMIZED_2) 266 if (TARGET_AREA_OPTIMIZED_2)
271 microblaze_pipe = MICROBLAZE_PIPE_8; 267 microblaze_pipe = MICROBLAZE_PIPE_8;
@@ -275,10 +271,10 @@ index f75eaff4b49..3abfc834ff2 100644
275 271
276 if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL) 272 if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
277diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 273diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
278index 640ae6ea9a3..67015058198 100644 274index e4faa9c681f..94d96bf6b5d 100644
279--- a/gcc/config/microblaze/microblaze.h 275--- a/gcc/config/microblaze/microblaze.h
280+++ b/gcc/config/microblaze/microblaze.h 276+++ b/gcc/config/microblaze/microblaze.h
281@@ -44,6 +44,7 @@ extern int microblaze_dbx_regno[]; 277@@ -44,6 +44,7 @@ extern int microblaze_debugger_regno[];
282 278
283 extern int microblaze_no_unsafe_delay; 279 extern int microblaze_no_unsafe_delay;
284 extern int microblaze_has_clz; 280 extern int microblaze_has_clz;
@@ -295,7 +291,7 @@ index 640ae6ea9a3..67015058198 100644
295 #define TARGET_SUPPORTS_PIC 1 291 #define TARGET_SUPPORTS_PIC 1
296 292
297diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 293diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
298index 9e9dfb1ccb0..dede4d068d3 100644 294index 7a01b28d8f0..a76287ab4fd 100644
299--- a/gcc/config/microblaze/microblaze.md 295--- a/gcc/config/microblaze/microblaze.md
300+++ b/gcc/config/microblaze/microblaze.md 296+++ b/gcc/config/microblaze/microblaze.md
301@@ -2491,4 +2491,73 @@ 297@@ -2491,4 +2491,73 @@
@@ -373,5 +369,5 @@ index 9e9dfb1ccb0..dede4d068d3 100644
373+ 369+
374 (include "sync.md") 370 (include "sync.md")
375-- 371--
3762.37.1 (Apple Git-137.1) 3722.34.1
377 373
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0025-Fixing-the-issue-with-the-builtin_alloc.-register-r1.patch
index 2800dee7..cd286818 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0025-Fixing-the-issue-with-the-builtin_alloc.-register-r1.patch
@@ -1,21 +1,17 @@
1From 101f47dedd82fc09bcefd5db986e6d6b0a1761ad Mon Sep 17 00:00:00 2001 1From 85273a514d0ab3b243b947633ab46705a0d946bc Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 23 Feb 2017 17:09:04 +0530 3Date: Thu, 23 Feb 2017 17:09:04 +0530
4Subject: [PATCH 25/53] Fixing the issue with the builtin_alloc. register r18 4Subject: [PATCH 25/54] Fixing the issue with the builtin_alloc. register r18
5 was not properly handling the stack pattern which was resolved by using free 5 was not properly handling the stack pattern which was resolved by using free
6 available register 6 available register
7 7
8signed-off-by:nagaraju mekala <nmekala@xilinx.com> 8signed-off-by:nagaraju mekala <nmekala@xilinx.com>
9Upstream-Status: Pending
10
11Signed-off-by: Mark Hatle <mark.hatle@amd.com>
12
13--- 9---
14 gcc/config/microblaze/microblaze.md | 8 ++++---- 10 gcc/config/microblaze/microblaze.md | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-) 11 1 file changed, 4 insertions(+), 4 deletions(-)
16 12
17diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 13diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
18index dede4d068d3..c6d8a87e9d1 100644 14index a76287ab4fd..12270f135cf 100644
19--- a/gcc/config/microblaze/microblaze.md 15--- a/gcc/config/microblaze/microblaze.md
20+++ b/gcc/config/microblaze/microblaze.md 16+++ b/gcc/config/microblaze/microblaze.md
21@@ -2075,10 +2075,10 @@ 17@@ -2075,10 +2075,10 @@
@@ -44,5 +40,5 @@ index dede4d068d3..c6d8a87e9d1 100644
44 } 40 }
45 ) 41 )
46-- 42--
472.37.1 (Apple Git-137.1) 432.34.1
48 44
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0026-Removed-fsqrt-generation-for-double-values.patch
index a1e4fb36..02cc5a1e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0026-Removed-fsqrt-generation-for-double-values.patch
@@ -1,19 +1,14 @@
1From b3e51ca34dc4048445b178253051ad4bbdfc5ec4 Mon Sep 17 00:00:00 2001 1From aba85eba7bc5cc19edafe54379fb1f1794dc3844 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 4 Jun 2018 10:10:18 +0530 3Date: Mon, 4 Jun 2018 10:10:18 +0530
4Subject: [PATCH 26/53] [Patch,Microblaze] : Removed fsqrt generation for 4Subject: [PATCH 26/54] Removed fsqrt generation for double values.
5 double values.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 5
11--- 6---
12 gcc/config/microblaze/microblaze.md | 14 -------------- 7 gcc/config/microblaze/microblaze.md | 14 --------------
13 1 file changed, 14 deletions(-) 8 1 file changed, 14 deletions(-)
14 9
15diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 10diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
16index c6d8a87e9d1..f23a85c7ac7 100644 11index 12270f135cf..b05f7da30b4 100644
17--- a/gcc/config/microblaze/microblaze.md 12--- a/gcc/config/microblaze/microblaze.md
18+++ b/gcc/config/microblaze/microblaze.md 13+++ b/gcc/config/microblaze/microblaze.md
19@@ -526,20 +526,6 @@ 14@@ -526,20 +526,6 @@
@@ -38,5 +33,5 @@ index c6d8a87e9d1..f23a85c7ac7 100644
38 [(set (match_operand:SI 0 "register_operand" "=d") 33 [(set (match_operand:SI 0 "register_operand" "=d")
39 (fix:SI (match_operand:SF 1 "register_operand" "d")))] 34 (fix:SI (match_operand:SF 1 "register_operand" "d")))]
40-- 35--
412.37.1 (Apple Git-137.1) 362.34.1
42 37
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0027-Intial-commit-of-64-bit-Microblaze.patch
index a9222e54..c998d5eb 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0027-Intial-commit-of-64-bit-Microblaze.patch
@@ -1,14 +1,10 @@
1From cf9ab9693d02212e1a49465e55d759a01acc507a Mon Sep 17 00:00:00 2001 1From dd3eee641d2bf28216bf02f324cf8b81d4a61e43 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 13:56:52 +0530 3Date: Tue, 13 Sep 2022 13:56:52 +0530
4Subject: [PATCH 27/53] [Patch,MicroBlaze]: Intial commit of 64-bit Microblaze 4Subject: [PATCH 27/54] Intial commit of 64-bit Microblaze
5 5
6 Conflicts: 6 Conflicts:
7 gcc/config/microblaze/microblaze.md 7 gcc/config/microblaze/microblaze.md
8Upstream-Status: Pending
9
10Signed-off-by: Mark Hatle <mark.hatle@amd.com>
11
12--- 8---
13 gcc/config/microblaze/constraints.md | 6 + 9 gcc/config/microblaze/constraints.md | 6 +
14 gcc/config/microblaze/microblaze-protos.h | 1 + 10 gcc/config/microblaze/microblaze-protos.h | 1 +
@@ -20,7 +16,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20 7 files changed, 456 insertions(+), 30 deletions(-) 16 7 files changed, 456 insertions(+), 30 deletions(-)
21 17
22diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md 18diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md
23index a8934d305ee..2133650147e 100644 19index aae4be73ae3..26742d34980 100644
24--- a/gcc/config/microblaze/constraints.md 20--- a/gcc/config/microblaze/constraints.md
25+++ b/gcc/config/microblaze/constraints.md 21+++ b/gcc/config/microblaze/constraints.md
26@@ -52,6 +52,12 @@ 22@@ -52,6 +52,12 @@
@@ -37,7 +33,7 @@ index a8934d305ee..2133650147e 100644
37 33
38 (define_constraint "G" 34 (define_constraint "G"
39diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h 35diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
40index 848cd509003..7f575c2adec 100644 36index 41557af0f3c..0e9f783c4a4 100644
41--- a/gcc/config/microblaze/microblaze-protos.h 37--- a/gcc/config/microblaze/microblaze-protos.h
42+++ b/gcc/config/microblaze/microblaze-protos.h 38+++ b/gcc/config/microblaze/microblaze-protos.h
43@@ -36,6 +36,7 @@ extern void microblaze_expand_divide (rtx *); 39@@ -36,6 +36,7 @@ extern void microblaze_expand_divide (rtx *);
@@ -49,10 +45,10 @@ index 848cd509003..7f575c2adec 100644
49 extern void print_operand (FILE *, rtx, int); 45 extern void print_operand (FILE *, rtx, int);
50 extern void print_operand_address (FILE *, rtx); 46 extern void print_operand_address (FILE *, rtx);
51diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 47diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
52index 3abfc834ff2..1ac889041b8 100644 48index e28ab593c3e..7975bc182f2 100644
53--- a/gcc/config/microblaze/microblaze.cc 49--- a/gcc/config/microblaze/microblaze.cc
54+++ b/gcc/config/microblaze/microblaze.cc 50+++ b/gcc/config/microblaze/microblaze.cc
55@@ -3433,11 +3433,11 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) 51@@ -3438,11 +3438,11 @@ microblaze_expand_move (machine_mode mode, rtx operands[])
56 op0 = operands[0]; 52 op0 = operands[0];
57 op1 = operands[1]; 53 op1 = operands[1];
58 54
@@ -67,7 +63,7 @@ index 3abfc834ff2..1ac889041b8 100644
67 emit_move_insn (op0, temp); 63 emit_move_insn (op0, temp);
68 return true; 64 return true;
69 } 65 }
70@@ -3502,12 +3502,12 @@ microblaze_expand_move (machine_mode mode, rtx operands[]) 66@@ -3511,12 +3511,12 @@ microblaze_expand_move (machine_mode mode, rtx operands[])
71 && (flag_pic == 2 || microblaze_tls_symbol_p (p0) 67 && (flag_pic == 2 || microblaze_tls_symbol_p (p0)
72 || !SMALL_INT (p1))))) 68 || !SMALL_INT (p1)))))
73 { 69 {
@@ -82,7 +78,7 @@ index 3abfc834ff2..1ac889041b8 100644
82 return true; 78 return true;
83 } 79 }
84 } 80 }
85@@ -3638,7 +3638,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) 81@@ -3647,7 +3647,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[])
86 rtx cmp_op0 = operands[1]; 82 rtx cmp_op0 = operands[1];
87 rtx cmp_op1 = operands[2]; 83 rtx cmp_op1 = operands[2];
88 rtx label1 = operands[3]; 84 rtx label1 = operands[3];
@@ -91,7 +87,7 @@ index 3abfc834ff2..1ac889041b8 100644
91 rtx condition; 87 rtx condition;
92 88
93 gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG)); 89 gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG));
94@@ -3647,23 +3647,36 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) 90@@ -3656,23 +3656,36 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[])
95 if (cmp_op1 == const0_rtx) 91 if (cmp_op1 == const0_rtx)
96 { 92 {
97 comp_reg = cmp_op0; 93 comp_reg = cmp_op0;
@@ -134,7 +130,7 @@ index 3abfc834ff2..1ac889041b8 100644
134 } 130 }
135 } 131 }
136 132
137@@ -3674,7 +3687,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) 133@@ -3683,7 +3696,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[])
138 rtx cmp_op0 = operands[1]; 134 rtx cmp_op0 = operands[1];
139 rtx cmp_op1 = operands[2]; 135 rtx cmp_op1 = operands[2];
140 rtx label1 = operands[3]; 136 rtx label1 = operands[3];
@@ -143,7 +139,7 @@ index 3abfc834ff2..1ac889041b8 100644
143 rtx condition; 139 rtx condition;
144 140
145 gcc_assert ((GET_CODE (cmp_op0) == REG) 141 gcc_assert ((GET_CODE (cmp_op0) == REG)
146@@ -3685,30 +3698,63 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) 142@@ -3694,30 +3707,63 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[])
147 { 143 {
148 comp_reg = cmp_op0; 144 comp_reg = cmp_op0;
149 condition = gen_rtx_fmt_ee (signed_condition (code), 145 condition = gen_rtx_fmt_ee (signed_condition (code),
@@ -219,7 +215,7 @@ index 3abfc834ff2..1ac889041b8 100644
219 } 215 }
220 } 216 }
221 217
222@@ -3725,6 +3771,19 @@ microblaze_expand_conditional_branch_sf (rtx operands[]) 218@@ -3734,6 +3780,19 @@ microblaze_expand_conditional_branch_sf (rtx operands[])
223 emit_jump_insn (gen_condjump (condition, operands[3])); 219 emit_jump_insn (gen_condjump (condition, operands[3]));
224 } 220 }
225 221
@@ -240,7 +236,7 @@ index 3abfc834ff2..1ac889041b8 100644
240 236
241 static bool 237 static bool
242diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 238diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
243index 67015058198..885abc6e5a1 100644 239index 94d96bf6b5d..f35f7075ce3 100644
244--- a/gcc/config/microblaze/microblaze.h 240--- a/gcc/config/microblaze/microblaze.h
245+++ b/gcc/config/microblaze/microblaze.h 241+++ b/gcc/config/microblaze/microblaze.h
246@@ -102,6 +102,7 @@ extern enum pipeline_type microblaze_pipe; 242@@ -102,6 +102,7 @@ extern enum pipeline_type microblaze_pipe;
@@ -269,7 +265,7 @@ index 67015058198..885abc6e5a1 100644
269 #define FLOAT_TYPE_SIZE 32 265 #define FLOAT_TYPE_SIZE 32
270 #define DOUBLE_TYPE_SIZE 64 266 #define DOUBLE_TYPE_SIZE 64
271diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 267diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
272index f23a85c7ac7..40711fe224b 100644 268index b05f7da30b4..3f572fe2351 100644
273--- a/gcc/config/microblaze/microblaze.md 269--- a/gcc/config/microblaze/microblaze.md
274+++ b/gcc/config/microblaze/microblaze.md 270+++ b/gcc/config/microblaze/microblaze.md
275@@ -497,7 +497,6 @@ 271@@ -497,7 +497,6 @@
@@ -751,7 +747,7 @@ index f23a85c7ac7..40711fe224b 100644
751 ;; Unconditional branches 747 ;; Unconditional branches
752 ;;---------------------------------------------------------------- 748 ;;----------------------------------------------------------------
753diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt 749diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt
754index cc009363f87..10910dbb83f 100644 750index 37aaaf9ffda..96615a6d2c4 100644
755--- a/gcc/config/microblaze/microblaze.opt 751--- a/gcc/config/microblaze/microblaze.opt
756+++ b/gcc/config/microblaze/microblaze.opt 752+++ b/gcc/config/microblaze/microblaze.opt
757@@ -136,4 +136,9 @@ Target 753@@ -136,4 +136,9 @@ Target
@@ -784,5 +780,5 @@ index 7e2fc5dcef8..4c25cfe15e7 100644
784 # Extra files 780 # Extra files
785 microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.cc \ 781 microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.cc \
786-- 782--
7872.37.1 (Apple Git-137.1) 7832.34.1
788 784
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0028-Intial-commit-for-64bit-MB-sources.-Need-to-cleanup-.patch
index c36e246a..58bb6fd8 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0028-Intial-commit-for-64bit-MB-sources.-Need-to-cleanup-.patch
@@ -1,12 +1,8 @@
1From da40b160857d0b6a56b6f6c9c81d61dabb5255db Mon Sep 17 00:00:00 2001 1From fcec4be11de1c646bdcd6dcfc3844b7deb42898e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 14:38:48 +0530 3Date: Tue, 13 Sep 2022 14:38:48 +0530
4Subject: [PATCH 28/53] Intial commit for 64bit-MB sources. Need to cleanup 4Subject: [PATCH 28/54] Intial commit for 64bit-MB sources. Need to cleanup the
5 the code later. 5 code later.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 6
11--- 7---
12 gcc/config/microblaze/constraints.md | 2 +- 8 gcc/config/microblaze/constraints.md | 2 +-
@@ -33,7 +29,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
33 create mode 100644 libgcc/config/microblaze/umoddi3.S 29 create mode 100644 libgcc/config/microblaze/umoddi3.S
34 30
35diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md 31diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md
36index 2133650147e..0ced155340d 100644 32index 26742d34980..7bb1e0b4c8d 100644
37--- a/gcc/config/microblaze/constraints.md 33--- a/gcc/config/microblaze/constraints.md
38+++ b/gcc/config/microblaze/constraints.md 34+++ b/gcc/config/microblaze/constraints.md
39@@ -55,7 +55,7 @@ 35@@ -55,7 +55,7 @@
@@ -46,7 +42,7 @@ index 2133650147e..0ced155340d 100644
46 42
47 ;; Define floating point constraints 43 ;; Define floating point constraints
48diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc 44diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc
49index caabe99b993..ef8d2430565 100644 45index 065351ad218..af73de0709c 100644
50--- a/gcc/config/microblaze/microblaze-c.cc 46--- a/gcc/config/microblaze/microblaze-c.cc
51+++ b/gcc/config/microblaze/microblaze-c.cc 47+++ b/gcc/config/microblaze/microblaze-c.cc
52@@ -100,4 +100,10 @@ microblaze_cpp_define (cpp_reader *pfile) 48@@ -100,4 +100,10 @@ microblaze_cpp_define (cpp_reader *pfile)
@@ -61,7 +57,7 @@ index caabe99b993..ef8d2430565 100644
61+ } 57+ }
62 } 58 }
63diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 59diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
64index 1ac889041b8..9d3628c6816 100644 60index 7975bc182f2..46bbf8a21e7 100644
65--- a/gcc/config/microblaze/microblaze.cc 61--- a/gcc/config/microblaze/microblaze.cc
66+++ b/gcc/config/microblaze/microblaze.cc 62+++ b/gcc/config/microblaze/microblaze.cc
67@@ -384,10 +384,10 @@ simple_memory_operand (rtx op, machine_mode mode ATTRIBUTE_UNUSED) 63@@ -384,10 +384,10 @@ simple_memory_operand (rtx op, machine_mode mode ATTRIBUTE_UNUSED)
@@ -104,7 +100,7 @@ index 1ac889041b8..9d3628c6816 100644
104 info->type = ADDRESS_GOTOFF; 100 info->type = ADDRESS_GOTOFF;
105 } 101 }
106 else if (XINT (x, 1) == UNSPEC_PLT) 102 else if (XINT (x, 1) == UNSPEC_PLT)
107@@ -1303,8 +1303,16 @@ microblaze_block_move_loop (rtx dest, rtx src, HOST_WIDE_INT length) 103@@ -1308,8 +1308,16 @@ microblaze_block_move_loop (rtx dest, rtx src, HOST_WIDE_INT length)
108 emit_move_insn (dest_reg, plus_constant (Pmode, dest_reg, MAX_MOVE_BYTES)); 104 emit_move_insn (dest_reg, plus_constant (Pmode, dest_reg, MAX_MOVE_BYTES));
109 105
110 /* Emit the test & branch. */ 106 /* Emit the test & branch. */
@@ -122,7 +118,7 @@ index 1ac889041b8..9d3628c6816 100644
122 118
123 /* Mop up any left-over bytes. */ 119 /* Mop up any left-over bytes. */
124 if (leftover) 120 if (leftover)
125@@ -1634,14 +1642,20 @@ microblaze_function_arg_advance (cumulative_args_t cum_v, 121@@ -1639,14 +1647,20 @@ microblaze_function_arg_advance (cumulative_args_t cum_v,
126 break; 122 break;
127 123
128 case E_DFmode: 124 case E_DFmode:
@@ -145,7 +141,7 @@ index 1ac889041b8..9d3628c6816 100644
145 break; 141 break;
146 142
147 case E_QImode: 143 case E_QImode:
148@@ -2156,7 +2170,7 @@ compute_frame_size (HOST_WIDE_INT size) 144@@ -2161,7 +2175,7 @@ compute_frame_size (HOST_WIDE_INT size)
149 145
150 if (regno != MB_ABI_SUB_RETURN_ADDR_REGNUM) 146 if (regno != MB_ABI_SUB_RETURN_ADDR_REGNUM)
151 /* Don't account for link register. It is accounted specially below. */ 147 /* Don't account for link register. It is accounted specially below. */
@@ -154,7 +150,7 @@ index 1ac889041b8..9d3628c6816 100644
154 150
155 mask |= (1L << (regno - GP_REG_FIRST)); 151 mask |= (1L << (regno - GP_REG_FIRST));
156 } 152 }
157@@ -2425,7 +2439,7 @@ print_operand (FILE * file, rtx op, int letter) 153@@ -2430,7 +2444,7 @@ print_operand (FILE * file, rtx op, int letter)
158 154
159 if ((letter == 'M' && !WORDS_BIG_ENDIAN) 155 if ((letter == 'M' && !WORDS_BIG_ENDIAN)
160 || (letter == 'L' && WORDS_BIG_ENDIAN) || letter == 'D') 156 || (letter == 'L' && WORDS_BIG_ENDIAN) || letter == 'D')
@@ -163,7 +159,7 @@ index 1ac889041b8..9d3628c6816 100644
163 159
164 fprintf (file, "%s", reg_names[regnum]); 160 fprintf (file, "%s", reg_names[regnum]);
165 } 161 }
166@@ -2451,6 +2465,7 @@ print_operand (FILE * file, rtx op, int letter) 162@@ -2456,6 +2470,7 @@ print_operand (FILE * file, rtx op, int letter)
167 else if (letter == 'h' || letter == 'j') 163 else if (letter == 'h' || letter == 'j')
168 { 164 {
169 long val[2]; 165 long val[2];
@@ -171,7 +167,7 @@ index 1ac889041b8..9d3628c6816 100644
171 long l[2]; 167 long l[2];
172 if (code == CONST_DOUBLE) 168 if (code == CONST_DOUBLE)
173 { 169 {
174@@ -2463,12 +2478,12 @@ print_operand (FILE * file, rtx op, int letter) 170@@ -2468,12 +2483,12 @@ print_operand (FILE * file, rtx op, int letter)
175 val[0] = l[WORDS_BIG_ENDIAN != 0]; 171 val[0] = l[WORDS_BIG_ENDIAN != 0];
176 } 172 }
177 } 173 }
@@ -188,7 +184,7 @@ index 1ac889041b8..9d3628c6816 100644
188 } 184 }
189 else if (code == CONST_DOUBLE) 185 else if (code == CONST_DOUBLE)
190 { 186 {
191@@ -2662,7 +2677,10 @@ microblaze_asm_constructor (rtx symbol ATTRIBUTE_UNUSED, int priority) 187@@ -2667,7 +2682,10 @@ microblaze_asm_constructor (rtx symbol ATTRIBUTE_UNUSED, int priority)
192 188
193 switch_to_section (get_section (section, 0, NULL)); 189 switch_to_section (get_section (section, 0, NULL));
194 assemble_align (POINTER_SIZE); 190 assemble_align (POINTER_SIZE);
@@ -200,7 +196,7 @@ index 1ac889041b8..9d3628c6816 100644
200 output_addr_const (asm_out_file, symbol); 196 output_addr_const (asm_out_file, symbol);
201 fputs ("\n", asm_out_file); 197 fputs ("\n", asm_out_file);
202 } 198 }
203@@ -2685,7 +2703,10 @@ microblaze_asm_destructor (rtx symbol, int priority) 199@@ -2690,7 +2708,10 @@ microblaze_asm_destructor (rtx symbol, int priority)
204 200
205 switch_to_section (get_section (section, 0, NULL)); 201 switch_to_section (get_section (section, 0, NULL));
206 assemble_align (POINTER_SIZE); 202 assemble_align (POINTER_SIZE);
@@ -212,7 +208,7 @@ index 1ac889041b8..9d3628c6816 100644
212 output_addr_const (asm_out_file, symbol); 208 output_addr_const (asm_out_file, symbol);
213 fputs ("\n", asm_out_file); 209 fputs ("\n", asm_out_file);
214 } 210 }
215@@ -2751,7 +2772,7 @@ save_restore_insns (int prologue) 211@@ -2756,7 +2777,7 @@ save_restore_insns (int prologue)
216 /* For interrupt_handlers, need to save/restore the MSR. */ 212 /* For interrupt_handlers, need to save/restore the MSR. */
217 if (microblaze_is_interrupt_variant ()) 213 if (microblaze_is_interrupt_variant ())
218 { 214 {
@@ -221,7 +217,7 @@ index 1ac889041b8..9d3628c6816 100644
221 gen_rtx_PLUS (Pmode, base_reg_rtx, 217 gen_rtx_PLUS (Pmode, base_reg_rtx,
222 GEN_INT (current_frame_info. 218 GEN_INT (current_frame_info.
223 gp_offset - 219 gp_offset -
224@@ -2759,8 +2780,8 @@ save_restore_insns (int prologue) 220@@ -2764,8 +2785,8 @@ save_restore_insns (int prologue)
225 221
226 /* Do not optimize in flow analysis. */ 222 /* Do not optimize in flow analysis. */
227 MEM_VOLATILE_P (isr_mem_rtx) = 1; 223 MEM_VOLATILE_P (isr_mem_rtx) = 1;
@@ -232,7 +228,7 @@ index 1ac889041b8..9d3628c6816 100644
232 } 228 }
233 229
234 if (microblaze_is_interrupt_variant () && !prologue) 230 if (microblaze_is_interrupt_variant () && !prologue)
235@@ -2768,8 +2789,8 @@ save_restore_insns (int prologue) 231@@ -2773,8 +2794,8 @@ save_restore_insns (int prologue)
236 emit_move_insn (isr_reg_rtx, isr_mem_rtx); 232 emit_move_insn (isr_reg_rtx, isr_mem_rtx);
237 emit_move_insn (isr_msr_rtx, isr_reg_rtx); 233 emit_move_insn (isr_msr_rtx, isr_reg_rtx);
238 /* Do not optimize in flow analysis. */ 234 /* Do not optimize in flow analysis. */
@@ -243,7 +239,7 @@ index 1ac889041b8..9d3628c6816 100644
243 } 239 }
244 240
245 for (regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++) 241 for (regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++)
246@@ -2780,9 +2801,9 @@ save_restore_insns (int prologue) 242@@ -2785,9 +2806,9 @@ save_restore_insns (int prologue)
247 /* Don't handle here. Already handled as the first register. */ 243 /* Don't handle here. Already handled as the first register. */
248 continue; 244 continue;
249 245
@@ -255,7 +251,7 @@ index 1ac889041b8..9d3628c6816 100644
255 if (microblaze_is_interrupt_variant () || save_volatiles) 251 if (microblaze_is_interrupt_variant () || save_volatiles)
256 /* Do not optimize in flow analysis. */ 252 /* Do not optimize in flow analysis. */
257 MEM_VOLATILE_P (mem_rtx) = 1; 253 MEM_VOLATILE_P (mem_rtx) = 1;
258@@ -2797,7 +2818,7 @@ save_restore_insns (int prologue) 254@@ -2802,7 +2823,7 @@ save_restore_insns (int prologue)
259 insn = emit_move_insn (reg_rtx, mem_rtx); 255 insn = emit_move_insn (reg_rtx, mem_rtx);
260 } 256 }
261 257
@@ -264,7 +260,7 @@ index 1ac889041b8..9d3628c6816 100644
264 } 260 }
265 } 261 }
266 262
267@@ -2807,8 +2828,8 @@ save_restore_insns (int prologue) 263@@ -2812,8 +2833,8 @@ save_restore_insns (int prologue)
268 emit_move_insn (isr_mem_rtx, isr_reg_rtx); 264 emit_move_insn (isr_mem_rtx, isr_reg_rtx);
269 265
270 /* Do not optimize in flow analysis. */ 266 /* Do not optimize in flow analysis. */
@@ -275,7 +271,7 @@ index 1ac889041b8..9d3628c6816 100644
275 } 271 }
276 272
277 /* Done saving and restoring */ 273 /* Done saving and restoring */
278@@ -2898,7 +2919,10 @@ microblaze_elf_asm_cdtor (rtx symbol, int priority, bool is_ctor) 274@@ -2903,7 +2924,10 @@ microblaze_elf_asm_cdtor (rtx symbol, int priority, bool is_ctor)
279 275
280 switch_to_section (s); 276 switch_to_section (s);
281 assemble_align (POINTER_SIZE); 277 assemble_align (POINTER_SIZE);
@@ -287,7 +283,7 @@ index 1ac889041b8..9d3628c6816 100644
287 output_addr_const (asm_out_file, symbol); 283 output_addr_const (asm_out_file, symbol);
288 fputs ("\n", asm_out_file); 284 fputs ("\n", asm_out_file);
289 } 285 }
290@@ -3042,10 +3066,10 @@ microblaze_expand_prologue (void) 286@@ -3047,10 +3071,10 @@ microblaze_expand_prologue (void)
291 { 287 {
292 if (offset != 0) 288 if (offset != 0)
293 ptr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset)); 289 ptr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (offset));
@@ -301,7 +297,7 @@ index 1ac889041b8..9d3628c6816 100644
301 } 297 }
302 } 298 }
303 299
304@@ -3054,15 +3078,23 @@ microblaze_expand_prologue (void) 300@@ -3059,15 +3083,23 @@ microblaze_expand_prologue (void)
305 rtx fsiz_rtx = GEN_INT (fsiz); 301 rtx fsiz_rtx = GEN_INT (fsiz);
306 302
307 rtx_insn *insn = NULL; 303 rtx_insn *insn = NULL;
@@ -327,7 +323,7 @@ index 1ac889041b8..9d3628c6816 100644
327 gen_rtx_PLUS (Pmode, stack_pointer_rtx, 323 gen_rtx_PLUS (Pmode, stack_pointer_rtx,
328 const0_rtx)); 324 const0_rtx));
329 325
330@@ -3070,7 +3102,7 @@ microblaze_expand_prologue (void) 326@@ -3075,7 +3107,7 @@ microblaze_expand_prologue (void)
331 /* Do not optimize in flow analysis. */ 327 /* Do not optimize in flow analysis. */
332 MEM_VOLATILE_P (mem_rtx) = 1; 328 MEM_VOLATILE_P (mem_rtx) = 1;
333 329
@@ -336,7 +332,7 @@ index 1ac889041b8..9d3628c6816 100644
336 insn = emit_move_insn (mem_rtx, reg_rtx); 332 insn = emit_move_insn (mem_rtx, reg_rtx);
337 RTX_FRAME_RELATED_P (insn) = 1; 333 RTX_FRAME_RELATED_P (insn) = 1;
338 } 334 }
339@@ -3180,12 +3212,12 @@ microblaze_expand_epilogue (void) 335@@ -3185,12 +3217,12 @@ microblaze_expand_epilogue (void)
340 if (!crtl->is_leaf || interrupt_handler) 336 if (!crtl->is_leaf || interrupt_handler)
341 { 337 {
342 mem_rtx = 338 mem_rtx =
@@ -351,7 +347,7 @@ index 1ac889041b8..9d3628c6816 100644
351 emit_move_insn (reg_rtx, mem_rtx); 347 emit_move_insn (reg_rtx, mem_rtx);
352 } 348 }
353 349
354@@ -3201,15 +3233,25 @@ microblaze_expand_epilogue (void) 350@@ -3206,15 +3238,25 @@ microblaze_expand_epilogue (void)
355 /* _restore_ registers for epilogue. */ 351 /* _restore_ registers for epilogue. */
356 save_restore_insns (0); 352 save_restore_insns (0);
357 emit_insn (gen_blockage ()); 353 emit_insn (gen_blockage ());
@@ -381,7 +377,7 @@ index 1ac889041b8..9d3628c6816 100644
381 emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST + 377 emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
382 MB_ABI_SUB_RETURN_ADDR_REGNUM))); 378 MB_ABI_SUB_RETURN_ADDR_REGNUM)));
383 } 379 }
384@@ -3376,9 +3418,14 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, 380@@ -3381,9 +3423,14 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
385 else 381 else
386 this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM); 382 this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM);
387 383
@@ -398,7 +394,7 @@ index 1ac889041b8..9d3628c6816 100644
398 394
399 /* Apply the offset from the vtable, if required. */ 395 /* Apply the offset from the vtable, if required. */
400 if (vcall_offset) 396 if (vcall_offset)
401@@ -3391,7 +3438,10 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, 397@@ -3396,7 +3443,10 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
402 rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx); 398 rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx);
403 emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc)); 399 emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc));
404 400
@@ -410,7 +406,7 @@ index 1ac889041b8..9d3628c6816 100644
410 } 406 }
411 407
412 /* Generate a tail call to the target function. */ 408 /* Generate a tail call to the target function. */
413@@ -3622,9 +3672,9 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) 409@@ -3631,9 +3681,9 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
414 emit_block_move (m_tramp, assemble_trampoline_template (), 410 emit_block_move (m_tramp, assemble_trampoline_template (),
415 GEN_INT (6*UNITS_PER_WORD), BLOCK_OP_NORMAL); 411 GEN_INT (6*UNITS_PER_WORD), BLOCK_OP_NORMAL);
416 412
@@ -422,7 +418,7 @@ index 1ac889041b8..9d3628c6816 100644
422 emit_move_insn (mem, fnaddr); 418 emit_move_insn (mem, fnaddr);
423 } 419 }
424 420
425@@ -3648,7 +3698,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) 421@@ -3657,7 +3707,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[])
426 { 422 {
427 comp_reg = cmp_op0; 423 comp_reg = cmp_op0;
428 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); 424 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx);
@@ -431,7 +427,7 @@ index 1ac889041b8..9d3628c6816 100644
431 emit_jump_insn (gen_condjump (condition, label1)); 427 emit_jump_insn (gen_condjump (condition, label1));
432 else 428 else
433 emit_jump_insn (gen_long_condjump (condition, label1)); 429 emit_jump_insn (gen_long_condjump (condition, label1));
434@@ -3767,7 +3817,7 @@ microblaze_expand_conditional_branch_sf (rtx operands[]) 430@@ -3776,7 +3826,7 @@ microblaze_expand_conditional_branch_sf (rtx operands[])
435 rtx comp_reg = gen_reg_rtx (SImode); 431 rtx comp_reg = gen_reg_rtx (SImode);
436 432
437 emit_insn (gen_cstoresf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); 433 emit_insn (gen_cstoresf4 (comp_reg, operands[0], cmp_op0, cmp_op1));
@@ -440,7 +436,7 @@ index 1ac889041b8..9d3628c6816 100644
440 emit_jump_insn (gen_condjump (condition, operands[3])); 436 emit_jump_insn (gen_condjump (condition, operands[3]));
441 } 437 }
442 438
443@@ -3777,10 +3827,10 @@ microblaze_expand_conditional_branch_df (rtx operands[]) 439@@ -3786,10 +3836,10 @@ microblaze_expand_conditional_branch_df (rtx operands[])
444 rtx condition; 440 rtx condition;
445 rtx cmp_op0 = XEXP (operands[0], 0); 441 rtx cmp_op0 = XEXP (operands[0], 0);
446 rtx cmp_op1 = XEXP (operands[0], 1); 442 rtx cmp_op1 = XEXP (operands[0], 1);
@@ -453,7 +449,7 @@ index 1ac889041b8..9d3628c6816 100644
453 emit_jump_insn (gen_long_condjump (condition, operands[3])); 449 emit_jump_insn (gen_long_condjump (condition, operands[3]));
454 } 450 }
455 451
456@@ -3801,8 +3851,8 @@ microblaze_expand_divide (rtx operands[]) 452@@ -3810,8 +3860,8 @@ microblaze_expand_divide (rtx operands[])
457 { 453 {
458 /* Table lookup software divides. Works for all (nr/dr) where (0 <= nr,dr <= 15). */ 454 /* Table lookup software divides. Works for all (nr/dr) where (0 <= nr,dr <= 15). */
459 455
@@ -464,7 +460,7 @@ index 1ac889041b8..9d3628c6816 100644
464 rtx regqi = gen_reg_rtx (QImode); 460 rtx regqi = gen_reg_rtx (QImode);
465 rtx_code_label *div_label = gen_label_rtx (); 461 rtx_code_label *div_label = gen_label_rtx ();
466 rtx_code_label *div_end_label = gen_label_rtx (); 462 rtx_code_label *div_end_label = gen_label_rtx ();
467@@ -3810,17 +3860,31 @@ microblaze_expand_divide (rtx operands[]) 463@@ -3819,17 +3869,31 @@ microblaze_expand_divide (rtx operands[])
468 rtx mem_rtx; 464 rtx mem_rtx;
469 rtx ret; 465 rtx ret;
470 rtx_insn *jump, *cjump, *insn; 466 rtx_insn *jump, *cjump, *insn;
@@ -503,7 +499,7 @@ index 1ac889041b8..9d3628c6816 100644
503 mem_rtx = gen_rtx_MEM (QImode, 499 mem_rtx = gen_rtx_MEM (QImode,
504 gen_rtx_PLUS (QImode, regt1, div_table_rtx)); 500 gen_rtx_PLUS (QImode, regt1, div_table_rtx));
505 501
506@@ -3967,7 +4031,7 @@ insert_wic_for_ilb_runout (rtx_insn *first) 502@@ -3976,7 +4040,7 @@ insert_wic_for_ilb_runout (rtx_insn *first)
507 { 503 {
508 insn = 504 insn =
509 emit_insn_before (gen_iprefetch 505 emit_insn_before (gen_iprefetch
@@ -512,7 +508,7 @@ index 1ac889041b8..9d3628c6816 100644
512 before_4); 508 before_4);
513 recog_memoized (insn); 509 recog_memoized (insn);
514 INSN_LOCATION (insn) = INSN_LOCATION (before_4); 510 INSN_LOCATION (insn) = INSN_LOCATION (before_4);
515@@ -3977,7 +4041,27 @@ insert_wic_for_ilb_runout (rtx_insn *first) 511@@ -3986,7 +4050,27 @@ insert_wic_for_ilb_runout (rtx_insn *first)
516 } 512 }
517 } 513 }
518 } 514 }
@@ -541,7 +537,7 @@ index 1ac889041b8..9d3628c6816 100644
541 /* Insert instruction prefetch instruction at the fall 537 /* Insert instruction prefetch instruction at the fall
542 through path of the function call. */ 538 through path of the function call. */
543 539
544@@ -4130,6 +4214,17 @@ microblaze_starting_frame_offset (void) 540@@ -4139,6 +4223,17 @@ microblaze_starting_frame_offset (void)
545 #undef TARGET_LRA_P 541 #undef TARGET_LRA_P
546 #define TARGET_LRA_P hook_bool_void_false 542 #define TARGET_LRA_P hook_bool_void_false
547 543
@@ -559,7 +555,7 @@ index 1ac889041b8..9d3628c6816 100644
559 #undef TARGET_FRAME_POINTER_REQUIRED 555 #undef TARGET_FRAME_POINTER_REQUIRED
560 #define TARGET_FRAME_POINTER_REQUIRED microblaze_frame_pointer_required 556 #define TARGET_FRAME_POINTER_REQUIRED microblaze_frame_pointer_required
561 557
562@@ -4139,6 +4234,9 @@ microblaze_starting_frame_offset (void) 558@@ -4148,6 +4243,9 @@ microblaze_starting_frame_offset (void)
563 #undef TARGET_TRAMPOLINE_INIT 559 #undef TARGET_TRAMPOLINE_INIT
564 #define TARGET_TRAMPOLINE_INIT microblaze_trampoline_init 560 #define TARGET_TRAMPOLINE_INIT microblaze_trampoline_init
565 561
@@ -570,7 +566,7 @@ index 1ac889041b8..9d3628c6816 100644
570 #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote 566 #define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
571 567
572diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 568diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
573index 885abc6e5a1..5f30b8ac195 100644 569index f35f7075ce3..3aee003de0d 100644
574--- a/gcc/config/microblaze/microblaze.h 570--- a/gcc/config/microblaze/microblaze.h
575+++ b/gcc/config/microblaze/microblaze.h 571+++ b/gcc/config/microblaze/microblaze.h
576@@ -173,7 +173,6 @@ extern enum pipeline_type microblaze_pipe; 572@@ -173,7 +173,6 @@ extern enum pipeline_type microblaze_pipe;
@@ -739,7 +735,7 @@ index 885abc6e5a1..5f30b8ac195 100644
739 /* Default to -G 8 */ 735 /* Default to -G 8 */
740 #ifndef MICROBLAZE_DEFAULT_GVALUE 736 #ifndef MICROBLAZE_DEFAULT_GVALUE
741diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 737diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
742index 40711fe224b..c99150ff0da 100644 738index 3f572fe2351..97da9aad6fd 100644
743--- a/gcc/config/microblaze/microblaze.md 739--- a/gcc/config/microblaze/microblaze.md
744+++ b/gcc/config/microblaze/microblaze.md 740+++ b/gcc/config/microblaze/microblaze.md
745@@ -26,6 +26,7 @@ 741@@ -26,6 +26,7 @@
@@ -1799,7 +1795,7 @@ index 4c25cfe15e7..965132b3513 100644
1799 MULTILIB_EXCEPTIONS += mxl-multiply-high/m64 1795 MULTILIB_EXCEPTIONS += mxl-multiply-high/m64
1800 MULTILIB_EXCEPTIONS += *mxl-multiply-high/mlittle-endian/m64 1796 MULTILIB_EXCEPTIONS += *mxl-multiply-high/mlittle-endian/m64
1801diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S 1797diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S
1802index cbbe32d5f6a..ec797e1bf17 100644 1798index 0f24adb750d..1a89a0a2ffa 100644
1803--- a/libgcc/config/microblaze/crti.S 1799--- a/libgcc/config/microblaze/crti.S
1804+++ b/libgcc/config/microblaze/crti.S 1800+++ b/libgcc/config/microblaze/crti.S
1805@@ -40,7 +40,7 @@ 1801@@ -40,7 +40,7 @@
@@ -1819,7 +1815,7 @@ index cbbe32d5f6a..ec797e1bf17 100644
1819+ addik r1, r1, -16 1815+ addik r1, r1, -16
1820 sw r15, r0, r1 1816 sw r15, r0, r1
1821diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S 1817diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S
1822index cb8d8ef2bfa..977b43b9436 100644 1818index d38d7ab9f98..29a004973ae 100644
1823--- a/libgcc/config/microblaze/crtn.S 1819--- a/libgcc/config/microblaze/crtn.S
1824+++ b/libgcc/config/microblaze/crtn.S 1820+++ b/libgcc/config/microblaze/crtn.S
1825@@ -33,9 +33,9 @@ 1821@@ -33,9 +33,9 @@
@@ -2442,5 +2438,5 @@ index 00000000000..7f5cd23f9a1
2442+ .size __umoddi3, . - __umoddi3 2438+ .size __umoddi3, . - __umoddi3
2443+#endif 2439+#endif
2444-- 2440--
24452.37.1 (Apple Git-137.1) 24412.34.1
2446 2442
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0029-re-arrangement-of-the-compare-branches.patch
index 0a275c0b..448e850f 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0029-re-arrangement-of-the-compare-branches.patch
@@ -1,12 +1,7 @@
1From 10d5e7d6cad5e7349b88b7469eb5ae20d87eb908 Mon Sep 17 00:00:00 2001 1From 870bfd716fcddeb72660f3176fb2a68aaa5ecc0e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 14:45:15 +0530 3Date: Tue, 13 Sep 2022 14:45:15 +0530
4Subject: [PATCH 29/53] [Patch,MicroBlaze] : re-arrangement of the compare 4Subject: [PATCH 29/54] re-arrangement of the compare branches
5 branches
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 5
11--- 6---
12 gcc/config/microblaze/microblaze.cc | 28 ++---- 7 gcc/config/microblaze/microblaze.cc | 28 ++----
@@ -14,10 +9,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14 2 files changed, 73 insertions(+), 96 deletions(-) 9 2 files changed, 73 insertions(+), 96 deletions(-)
15 10
16diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 11diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
17index 9d3628c6816..4792e3ba370 100644 12index 46bbf8a21e7..de3c95a005e 100644
18--- a/gcc/config/microblaze/microblaze.cc 13--- a/gcc/config/microblaze/microblaze.cc
19+++ b/gcc/config/microblaze/microblaze.cc 14+++ b/gcc/config/microblaze/microblaze.cc
20@@ -3698,11 +3698,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) 15@@ -3707,11 +3707,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[])
21 { 16 {
22 comp_reg = cmp_op0; 17 comp_reg = cmp_op0;
23 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); 18 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx);
@@ -30,7 +25,7 @@ index 9d3628c6816..4792e3ba370 100644
30 } 25 }
31 26
32 else if (code == EQ || code == NE) 27 else if (code == EQ || code == NE)
33@@ -3713,10 +3709,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[]) 28@@ -3722,10 +3718,7 @@ microblaze_expand_conditional_branch (machine_mode mode, rtx operands[])
34 else 29 else
35 emit_insn (gen_xordi3 (comp_reg, cmp_op0, cmp_op1)); 30 emit_insn (gen_xordi3 (comp_reg, cmp_op0, cmp_op1));
36 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx); 31 condition = gen_rtx_fmt_ee (signed_condition (code), mode, comp_reg, const0_rtx);
@@ -42,7 +37,7 @@ index 9d3628c6816..4792e3ba370 100644
42 } 37 }
43 else 38 else
44 { 39 {
45@@ -3749,10 +3742,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) 40@@ -3758,10 +3751,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[])
46 comp_reg = cmp_op0; 41 comp_reg = cmp_op0;
47 condition = gen_rtx_fmt_ee (signed_condition (code), 42 condition = gen_rtx_fmt_ee (signed_condition (code),
48 mode, comp_reg, const0_rtx); 43 mode, comp_reg, const0_rtx);
@@ -54,7 +49,7 @@ index 9d3628c6816..4792e3ba370 100644
54 } 49 }
55 else if (code == EQ) 50 else if (code == EQ)
56 { 51 {
57@@ -3767,10 +3757,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) 52@@ -3776,10 +3766,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[])
58 cmp_op1)); 53 cmp_op1));
59 } 54 }
60 condition = gen_rtx_EQ (mode, comp_reg, const0_rtx); 55 condition = gen_rtx_EQ (mode, comp_reg, const0_rtx);
@@ -66,7 +61,7 @@ index 9d3628c6816..4792e3ba370 100644
66 61
67 } 62 }
68 else if (code == NE) 63 else if (code == NE)
69@@ -3786,10 +3773,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[]) 64@@ -3795,10 +3782,7 @@ microblaze_expand_conditional_branch_reg (machine_mode mode, rtx operands[])
70 cmp_op1)); 65 cmp_op1));
71 } 66 }
72 condition = gen_rtx_NE (mode, comp_reg, const0_rtx); 67 condition = gen_rtx_NE (mode, comp_reg, const0_rtx);
@@ -78,7 +73,7 @@ index 9d3628c6816..4792e3ba370 100644
78 } 73 }
79 else 74 else
80 { 75 {
81@@ -3831,7 +3815,7 @@ microblaze_expand_conditional_branch_df (rtx operands[]) 76@@ -3840,7 +3824,7 @@ microblaze_expand_conditional_branch_df (rtx operands[])
82 77
83 emit_insn (gen_cstoredf4 (comp_reg, operands[0], cmp_op0, cmp_op1)); 78 emit_insn (gen_cstoredf4 (comp_reg, operands[0], cmp_op0, cmp_op1));
84 condition = gen_rtx_NE (Pmode, comp_reg, const0_rtx); 79 condition = gen_rtx_NE (Pmode, comp_reg, const0_rtx);
@@ -88,7 +83,7 @@ index 9d3628c6816..4792e3ba370 100644
88 83
89 /* Implement TARGET_FRAME_POINTER_REQUIRED. */ 84 /* Implement TARGET_FRAME_POINTER_REQUIRED. */
90diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 85diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
91index c99150ff0da..566c53ba228 100644 86index 97da9aad6fd..31bf04e4abd 100644
92--- a/gcc/config/microblaze/microblaze.md 87--- a/gcc/config/microblaze/microblaze.md
93+++ b/gcc/config/microblaze/microblaze.md 88+++ b/gcc/config/microblaze/microblaze.md
94@@ -2268,7 +2268,27 @@ else 89@@ -2268,7 +2268,27 @@ else
@@ -269,5 +264,5 @@ index c99150ff0da..566c53ba228 100644
269 ;; Unconditional branches 264 ;; Unconditional branches
270 ;;---------------------------------------------------------------- 265 ;;----------------------------------------------------------------
271-- 266--
2722.37.1 (Apple Git-137.1) 2672.34.1
273 268
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0030-previous-commit-broke-the-handling-of-SI-Branch-comp.patch
index bda4e7da..92951b08 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0030-previous-commit-broke-the-handling-of-SI-Branch-comp.patch
@@ -1,19 +1,15 @@
1From af910dd71faec99838e421dd76fd5231e34bee3e Mon Sep 17 00:00:00 2001 1From e4713a382c1e6729cd3228284def9fa59da70028 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 8 Aug 2018 17:37:26 +0530 3Date: Wed, 8 Aug 2018 17:37:26 +0530
4Subject: [PATCH 30/53] [Patch,Microblaze] : previous commit broke the 4Subject: [PATCH 30/54] previous commit broke the handling of SI Branch compare
5 handling of SI Branch compare for Microblaze 32-bit.. 5 for Microblaze 32-bit..
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 6
11--- 7---
12 gcc/config/microblaze/microblaze.md | 4 ++-- 8 gcc/config/microblaze/microblaze.md | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-) 9 1 file changed, 2 insertions(+), 2 deletions(-)
14 10
15diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 11diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
16index 566c53ba228..e54888550f6 100644 12index 31bf04e4abd..e37a7704195 100644
17--- a/gcc/config/microblaze/microblaze.md 13--- a/gcc/config/microblaze/microblaze.md
18+++ b/gcc/config/microblaze/microblaze.md 14+++ b/gcc/config/microblaze/microblaze.md
19@@ -2224,8 +2224,8 @@ else 15@@ -2224,8 +2224,8 @@ else
@@ -28,5 +24,5 @@ index 566c53ba228..e54888550f6 100644
28 (pc)))] 24 (pc)))]
29 "" 25 ""
30-- 26--
312.37.1 (Apple Git-137.1) 272.34.1
32 28
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0031-Support-of-multilibs-with-m64.patch
index a9a7a03d..40009bf0 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0031-Support-of-multilibs-with-m64.patch
@@ -1,16 +1,12 @@
1From 6921698fc0acf40cb036cf71649762e7a21bf604 Mon Sep 17 00:00:00 2001 1From 0673e986a5c06cba6507e0361ebdb9cf309f6a4c 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:43:48 +0530 3Date: Tue, 11 Sep 2018 13:43:48 +0530
4Subject: [PATCH 31/53] [Patch, Microblaze] : Support of multilibs with m64 ... 4Subject: [PATCH 31/54] Support of multilibs with m64 ...
5 5
6Conflicts: 6Conflicts:
7 gcc/config/microblaze/microblaze-c.c 7 gcc/config/microblaze/microblaze-c.c
8 8
9signed-off-by : Mahesh Bodapati <mbodapat@xilinx.com> 9signed-off-by : Mahesh Bodapati <mbodapat@xilinx.com>
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
14--- 10---
15 gcc/config/microblaze/microblaze-c.cc | 1 + 11 gcc/config/microblaze/microblaze-c.cc | 1 +
16 gcc/config/microblaze/t-microblaze | 15 ++++++--------- 12 gcc/config/microblaze/t-microblaze | 15 ++++++---------
@@ -18,7 +14,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
18 3 files changed, 10 insertions(+), 17 deletions(-) 14 3 files changed, 10 insertions(+), 17 deletions(-)
19 15
20diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc 16diff --git a/gcc/config/microblaze/microblaze-c.cc b/gcc/config/microblaze/microblaze-c.cc
21index ef8d2430565..4e83a84b112 100644 17index af73de0709c..c7cb139d25a 100644
22--- a/gcc/config/microblaze/microblaze-c.cc 18--- a/gcc/config/microblaze/microblaze-c.cc
23+++ b/gcc/config/microblaze/microblaze-c.cc 19+++ b/gcc/config/microblaze/microblaze-c.cc
24@@ -102,6 +102,7 @@ microblaze_cpp_define (cpp_reader *pfile) 20@@ -102,6 +102,7 @@ microblaze_cpp_define (cpp_reader *pfile)
@@ -77,5 +73,5 @@ index 35021b24b7d..8d954a49575 100644
77- $(srcdir)/config/microblaze/divsi3_table.c \ 73- $(srcdir)/config/microblaze/divsi3_table.c \
78+ $(srcdir)/config/microblaze/divsi3_table.c 74+ $(srcdir)/config/microblaze/divsi3_table.c
79-- 75--
802.37.1 (Apple Git-137.1) 762.34.1
81 77
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0032-Fixed-issues-like-1-Interrupt-alignment-issue-2-Sign.patch
index cb62c5a7..df7ef8da 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0032-Fixed-issues-like-1-Interrupt-alignment-issue-2-Sign.patch
@@ -1,12 +1,8 @@
1From 7f827e73dff27c764e5f475613e3e06ae546103f Mon Sep 17 00:00:00 2001 1From 63e3adfb493e225c55536e72cfbf8be70977cdc8 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 15:24:25 +0530 3Date: Tue, 13 Sep 2022 15:24:25 +0530
4Subject: [PATCH 32/53] [Patch,MicroBlaze]: Fixed issues like: 1 Interrupt 4Subject: [PATCH 32/54] Fixed issues like: 1 Interrupt alignment issue 2 Sign
5 alignment issue 2 Sign extension issue 5 extension issue
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 6
11--- 7---
12 gcc/config/microblaze/microblaze.cc | 16 ++++++++++------ 8 gcc/config/microblaze/microblaze.cc | 16 ++++++++++------
@@ -14,10 +10,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14 2 files changed, 11 insertions(+), 7 deletions(-) 10 2 files changed, 11 insertions(+), 7 deletions(-)
15 11
16diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 12diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
17index 4792e3ba370..f1da145232a 100644 13index de3c95a005e..6fbecb43e4a 100644
18--- a/gcc/config/microblaze/microblaze.cc 14--- a/gcc/config/microblaze/microblaze.cc
19+++ b/gcc/config/microblaze/microblaze.cc 15+++ b/gcc/config/microblaze/microblaze.cc
20@@ -2178,9 +2178,14 @@ compute_frame_size (HOST_WIDE_INT size) 16@@ -2183,9 +2183,14 @@ compute_frame_size (HOST_WIDE_INT size)
21 17
22 total_size += gp_reg_size; 18 total_size += gp_reg_size;
23 19
@@ -34,7 +30,7 @@ index 4792e3ba370..f1da145232a 100644
34 30
35 /* No space to be allocated for link register in leaf functions with no other 31 /* No space to be allocated for link register in leaf functions with no other
36 stack requirements. */ 32 stack requirements. */
37@@ -2465,7 +2470,6 @@ print_operand (FILE * file, rtx op, int letter) 33@@ -2470,7 +2475,6 @@ print_operand (FILE * file, rtx op, int letter)
38 else if (letter == 'h' || letter == 'j') 34 else if (letter == 'h' || letter == 'j')
39 { 35 {
40 long val[2]; 36 long val[2];
@@ -42,7 +38,7 @@ index 4792e3ba370..f1da145232a 100644
42 long l[2]; 38 long l[2];
43 if (code == CONST_DOUBLE) 39 if (code == CONST_DOUBLE)
44 { 40 {
45@@ -2480,10 +2484,10 @@ print_operand (FILE * file, rtx op, int letter) 41@@ -2485,10 +2489,10 @@ print_operand (FILE * file, rtx op, int letter)
46 } 42 }
47 else if (code == CONST_INT || code == CONST)// || code == SYMBOL_REF ||code == LABEL_REF) 43 else if (code == CONST_INT || code == CONST)// || code == SYMBOL_REF ||code == LABEL_REF)
48 { 44 {
@@ -57,7 +53,7 @@ index 4792e3ba370..f1da145232a 100644
57 else if (code == CONST_DOUBLE) 53 else if (code == CONST_DOUBLE)
58 { 54 {
59diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 55diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
60index e54888550f6..4e5d21a1f4c 100644 56index e37a7704195..72c2a9a38cd 100644
61--- a/gcc/config/microblaze/microblaze.md 57--- a/gcc/config/microblaze/microblaze.md
62+++ b/gcc/config/microblaze/microblaze.md 58+++ b/gcc/config/microblaze/microblaze.md
63@@ -1096,7 +1096,7 @@ 59@@ -1096,7 +1096,7 @@
@@ -70,5 +66,5 @@ index e54888550f6..4e5d21a1f4c 100644
70 } 66 }
71 } 67 }
72-- 68--
732.37.1 (Apple Git-137.1) 692.34.1
74 70
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0033-fixed-below-issues-Floating-point-print-issues-in-64.patch
index 9760695c..cf1076ea 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0033-fixed-below-issues-Floating-point-print-issues-in-64.patch
@@ -1,16 +1,11 @@
1From 0a86428a345ed359f788a72a0e185053b598e908 Mon Sep 17 00:00:00 2001 1From 58d4d2ca4fdf90d9d21e7813a599b3491f52e34d Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 15:28:58 +0530 3Date: Tue, 13 Sep 2022 15:28:58 +0530
4Subject: [PATCH 33/53] [Patch,MicroBlaze]: fixed below issues: - Floating 4Subject: [PATCH 33/54] fixed below issues: - Floating point print issues in
5 point print issues in 64bit mode - Dejagnu Jump related issues - 5 64bit mode - Dejagnu Jump related issues - Added dbl instruction
6 Added dbl instruction
7 6
8 Conflicts: 7 Conflicts:
9 gcc/config/microblaze/microblaze.md 8 gcc/config/microblaze/microblaze.md
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
14--- 9---
15 gcc/config/microblaze/microblaze.cc | 12 +++- 10 gcc/config/microblaze/microblaze.cc | 12 +++-
16 gcc/config/microblaze/microblaze.h | 7 +++ 11 gcc/config/microblaze/microblaze.h | 7 +++
@@ -20,10 +15,10 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20 5 files changed, 125 insertions(+), 17 deletions(-) 15 5 files changed, 125 insertions(+), 17 deletions(-)
21 16
22diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 17diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
23index f1da145232a..7a08390a027 100644 18index 6fbecb43e4a..965a041ea8c 100644
24--- a/gcc/config/microblaze/microblaze.cc 19--- a/gcc/config/microblaze/microblaze.cc
25+++ b/gcc/config/microblaze/microblaze.cc 20+++ b/gcc/config/microblaze/microblaze.cc
26@@ -2474,7 +2474,12 @@ print_operand (FILE * file, rtx op, int letter) 21@@ -2479,7 +2479,12 @@ print_operand (FILE * file, rtx op, int letter)
27 if (code == CONST_DOUBLE) 22 if (code == CONST_DOUBLE)
28 { 23 {
29 if (GET_MODE (op) == DFmode) 24 if (GET_MODE (op) == DFmode)
@@ -37,7 +32,7 @@ index f1da145232a..7a08390a027 100644
37 else 32 else
38 { 33 {
39 REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), l); 34 REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), l);
40@@ -3877,7 +3882,10 @@ microblaze_expand_divide (rtx operands[]) 35@@ -3886,7 +3891,10 @@ microblaze_expand_divide (rtx operands[])
41 gen_rtx_PLUS (QImode, regt1, div_table_rtx)); 36 gen_rtx_PLUS (QImode, regt1, div_table_rtx));
42 37
43 insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx)); 38 insn = emit_insn (gen_zero_extendqisi2(operands[0],mem_rtx));
@@ -50,7 +45,7 @@ index f1da145232a..7a08390a027 100644
50 LABEL_NUSES (div_end_label) = 1; 45 LABEL_NUSES (div_end_label) = 1;
51 emit_barrier (); 46 emit_barrier ();
52diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 47diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
53index 5f30b8ac195..ac4ea43a706 100644 48index 3aee003de0d..145368db8b8 100644
54--- a/gcc/config/microblaze/microblaze.h 49--- a/gcc/config/microblaze/microblaze.h
55+++ b/gcc/config/microblaze/microblaze.h 50+++ b/gcc/config/microblaze/microblaze.h
56@@ -888,10 +888,17 @@ do { \ 51@@ -888,10 +888,17 @@ do { \
@@ -72,7 +67,7 @@ index 5f30b8ac195..ac4ea43a706 100644
72 /* We need to group -lm as well, since some Newlib math functions 67 /* We need to group -lm as well, since some Newlib math functions
73 reference __errno! */ 68 reference __errno! */
74diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 69diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
75index 4e5d21a1f4c..5a950b49591 100644 70index 72c2a9a38cd..b3d265d9941 100644
76--- a/gcc/config/microblaze/microblaze.md 71--- a/gcc/config/microblaze/microblaze.md
77+++ b/gcc/config/microblaze/microblaze.md 72+++ b/gcc/config/microblaze/microblaze.md
78@@ -527,6 +527,15 @@ 73@@ -527,6 +527,15 @@
@@ -233,7 +228,7 @@ index 4e5d21a1f4c..5a950b49591 100644
233 "" 228 ""
234 "mfs\t%0,rpc\n\taddik\t%0,%0,_GLOBAL_OFFSET_TABLE_+8" 229 "mfs\t%0,rpc\n\taddik\t%0,%0,_GLOBAL_OFFSET_TABLE_+8"
235diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S 230diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S
236index ec797e1bf17..15ebe68c277 100644 231index 1a89a0a2ffa..7cf5664880b 100644
237--- a/libgcc/config/microblaze/crti.S 232--- a/libgcc/config/microblaze/crti.S
238+++ b/libgcc/config/microblaze/crti.S 233+++ b/libgcc/config/microblaze/crti.S
239@@ -33,11 +33,32 @@ 234@@ -33,11 +33,32 @@
@@ -276,7 +271,7 @@ index ec797e1bf17..15ebe68c277 100644
276 sw r15, r0, r1 271 sw r15, r0, r1
277+#endif 272+#endif
278diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S 273diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S
279index 977b43b9436..9de3d4de13c 100644 274index 29a004973ae..9697b247b6c 100644
280--- a/libgcc/config/microblaze/crtn.S 275--- a/libgcc/config/microblaze/crtn.S
281+++ b/libgcc/config/microblaze/crtn.S 276+++ b/libgcc/config/microblaze/crtn.S
282@@ -29,7 +29,19 @@ 277@@ -29,7 +29,19 @@
@@ -305,5 +300,5 @@ index 977b43b9436..9de3d4de13c 100644
305 addik r1, r1, 16 300 addik r1, r1, 16
306+#endif 301+#endif
307-- 302--
3082.37.1 (Apple Git-137.1) 3032.34.1
309 304
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0034-Added-double-arith-instructions-Fixed-prologue-stack.patch
index 3f07dfa1..ab50b599 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0034-Added-double-arith-instructions-Fixed-prologue-stack.patch
@@ -1,20 +1,16 @@
1From 80c16e39bdf8643184c353e34f146dc8601c2c1e Mon Sep 17 00:00:00 2001 1From 924a756b5c9edc5d626f68323f67ced2800c75ff 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:07:08 +0530 3Date: Tue, 9 Oct 2018 10:07:08 +0530
4Subject: [PATCH 34/53] -Added double arith instructions -Fixed prologue stack 4Subject: [PATCH 34/54] -Added double arith instructions -Fixed prologue stack
5 pointer decrement issue 5 pointer decrement issue
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
11--- 7---
12 gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++---- 8 gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++----
13 gcc/config/microblaze/t-microblaze | 7 +++ 9 gcc/config/microblaze/t-microblaze | 7 +++
14 2 files changed, 76 insertions(+), 9 deletions(-) 10 2 files changed, 76 insertions(+), 9 deletions(-)
15 11
16diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 12diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
17index 5a950b49591..5506aee7be5 100644 13index b3d265d9941..0f769f320b2 100644
18--- a/gcc/config/microblaze/microblaze.md 14--- a/gcc/config/microblaze/microblaze.md
19+++ b/gcc/config/microblaze/microblaze.md 15+++ b/gcc/config/microblaze/microblaze.md
20@@ -527,6 +527,66 @@ 16@@ -527,6 +527,66 @@
@@ -135,5 +131,5 @@ index 47b869b9303..3522afd4831 100644
135 MULTILIB_EXCEPTIONS += *mlittle-endian/mxl-multiply-high mxl-multiply-high 131 MULTILIB_EXCEPTIONS += *mlittle-endian/mxl-multiply-high mxl-multiply-high
136 MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mlittle-endian/mxl-multiply-high 132 MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mlittle-endian/mxl-multiply-high
137-- 133--
1382.37.1 (Apple Git-137.1) 1342.34.1
139 135
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch
index 3ff6a2d0..589ca998 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch
@@ -1,19 +1,15 @@
1From 455216291580ca22767433eec11941c5f2471892 Mon Sep 17 00:00:00 2001 1From 3ebc7f9a11d66843982544cd0f88f35cc4defb83 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 12 Oct 2018 16:07:36 +0530 3Date: Fri, 12 Oct 2018 16:07:36 +0530
4Subject: [PATCH 35/53] Fixed the issue in the delay slot with swap 4Subject: [PATCH 35/54] Fixed the issue in the delay slot with swap
5 instructions 5 instructions
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
11--- 7---
12 gcc/config/microblaze/microblaze.md | 6 ++++++ 8 gcc/config/microblaze/microblaze.md | 6 ++++++
13 1 file changed, 6 insertions(+) 9 1 file changed, 6 insertions(+)
14 10
15diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 11diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
16index 5506aee7be5..4a372f8fd3f 100644 12index 0f769f320b2..6ada55ac2bc 100644
17--- a/gcc/config/microblaze/microblaze.md 13--- a/gcc/config/microblaze/microblaze.md
18+++ b/gcc/config/microblaze/microblaze.md 14+++ b/gcc/config/microblaze/microblaze.md
19@@ -443,6 +443,9 @@ 15@@ -443,6 +443,9 @@
@@ -37,5 +33,5 @@ index 5506aee7be5..4a372f8fd3f 100644
37 33
38 ;;---------------------------------------------------------------- 34 ;;----------------------------------------------------------------
39-- 35--
402.37.1 (Apple Git-137.1) 362.34.1
41 37
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch
index 90ddf3eb..8431cb16 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch
@@ -1,13 +1,9 @@
1From b8c468f1bd467213083b59b54af100ee0c6dea9e Mon Sep 17 00:00:00 2001 1From 9ea2aee3599d2f1fc9d67c7a72cd7c826272a2fa Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sat, 13 Oct 2018 21:12:43 +0530 3Date: Sat, 13 Oct 2018 21:12:43 +0530
4Subject: [PATCH 36/53] Fixed the load store issue with the 32bit arith 4Subject: [PATCH 36/54] Fixed the load store issue with the 32bit arith
5 libraries 5 libraries
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
11--- 7---
12 libgcc/config/microblaze/divsi3.S | 25 ++++++++++++++++++++++++- 8 libgcc/config/microblaze/divsi3.S | 25 ++++++++++++++++++++++++-
13 libgcc/config/microblaze/modsi3.S | 26 +++++++++++++++++++++++++- 9 libgcc/config/microblaze/modsi3.S | 26 +++++++++++++++++++++++++-
@@ -17,7 +13,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
17 5 files changed, 98 insertions(+), 4 deletions(-) 13 5 files changed, 98 insertions(+), 4 deletions(-)
18 14
19diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S 15diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S
20index 14829ec6701..b464deed481 100644 16index a449fedd53e..9f04f59104e 100644
21--- a/libgcc/config/microblaze/divsi3.S 17--- a/libgcc/config/microblaze/divsi3.S
22+++ b/libgcc/config/microblaze/divsi3.S 18+++ b/libgcc/config/microblaze/divsi3.S
23@@ -41,6 +41,17 @@ 19@@ -41,6 +41,17 @@
@@ -74,7 +70,7 @@ index 14829ec6701..b464deed481 100644
74 .size __divsi3, . - __divsi3 70 .size __divsi3, . - __divsi3
75 71
76diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S 72diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S
77index b8f2e37809d..e0fbd91e766 100644 73index 282fabfd966..d2f9dc770e4 100644
78--- a/libgcc/config/microblaze/modsi3.S 74--- a/libgcc/config/microblaze/modsi3.S
79+++ b/libgcc/config/microblaze/modsi3.S 75+++ b/libgcc/config/microblaze/modsi3.S
80@@ -41,6 +41,17 @@ 76@@ -41,6 +41,17 @@
@@ -132,7 +128,7 @@ index b8f2e37809d..e0fbd91e766 100644
132 .size __modsi3, . - __modsi3 128 .size __modsi3, . - __modsi3
133 129
134diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S 130diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S
135index f48fcf8270c..657668ef826 100644 131index 3da55416964..437e2bc309e 100644
136--- a/libgcc/config/microblaze/mulsi3.S 132--- a/libgcc/config/microblaze/mulsi3.S
137+++ b/libgcc/config/microblaze/mulsi3.S 133+++ b/libgcc/config/microblaze/mulsi3.S
138@@ -41,6 +41,9 @@ 134@@ -41,6 +41,9 @@
@@ -146,7 +142,7 @@ index f48fcf8270c..657668ef826 100644
146 .frame r1,0,r15 142 .frame r1,0,r15
147 add r3,r0,r0 143 add r3,r0,r0
148diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S 144diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S
149index 2c321f94b09..fc6a4b5a248 100644 145index 7f3fe99eb12..496dd6794bf 100644
150--- a/libgcc/config/microblaze/udivsi3.S 146--- a/libgcc/config/microblaze/udivsi3.S
151+++ b/libgcc/config/microblaze/udivsi3.S 147+++ b/libgcc/config/microblaze/udivsi3.S
152@@ -41,6 +41,16 @@ 148@@ -41,6 +41,16 @@
@@ -201,7 +197,7 @@ index 2c321f94b09..fc6a4b5a248 100644
201 .end __udivsi3 197 .end __udivsi3
202 .size __udivsi3, . - __udivsi3 198 .size __udivsi3, . - __udivsi3
203diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S 199diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S
204index fbe942dc5f2..b68ba7a5ea6 100644 200index 6c7f2b3c917..fffc784b4cb 100644
205--- a/libgcc/config/microblaze/umodsi3.S 201--- a/libgcc/config/microblaze/umodsi3.S
206+++ b/libgcc/config/microblaze/umodsi3.S 202+++ b/libgcc/config/microblaze/umodsi3.S
207@@ -41,6 +41,16 @@ 203@@ -41,6 +41,16 @@
@@ -256,5 +252,5 @@ index fbe942dc5f2..b68ba7a5ea6 100644
256 .end __umodsi3 252 .end __umodsi3
257 .size __umodsi3, . - __umodsi3 253 .size __umodsi3, . - __umodsi3
258-- 254--
2592.37.1 (Apple Git-137.1) 2552.34.1
260 256
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch
index 191c7627..8b0fa208 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch
@@ -1,18 +1,14 @@
1From 2bc476e64f1bacc27874c152340c004c17bfd942 Mon Sep 17 00:00:00 2001 1From d2c971646ce103fa17cc32474cb942268bc59258 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 15 Oct 2018 12:00:10 +0530 3Date: Mon, 15 Oct 2018 12:00:10 +0530
4Subject: [PATCH 37/53] extending the Dwarf support to 64bit Microblaze 4Subject: [PATCH 37/54] extending the Dwarf support to 64bit Microblaze
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 gcc/config/microblaze/microblaze.h | 2 +- 7 gcc/config/microblaze/microblaze.h | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-) 8 1 file changed, 1 insertion(+), 1 deletion(-)
13 9
14diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 10diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
15index ac4ea43a706..56dfc2a3824 100644 11index 145368db8b8..4258dcde0d1 100644
16--- a/gcc/config/microblaze/microblaze.h 12--- a/gcc/config/microblaze/microblaze.h
17+++ b/gcc/config/microblaze/microblaze.h 13+++ b/gcc/config/microblaze/microblaze.h
18@@ -207,7 +207,7 @@ extern enum pipeline_type microblaze_pipe; 14@@ -207,7 +207,7 @@ extern enum pipeline_type microblaze_pipe;
@@ -25,5 +21,5 @@ index ac4ea43a706..56dfc2a3824 100644
25 /* Target machine storage layout */ 21 /* Target machine storage layout */
26 22
27-- 23--
282.37.1 (Apple Git-137.1) 242.34.1
29 25
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0038-fixing-the-typo-errors-in-umodsi3-file.patch
index 8697be58..d7b78895 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0038-fixing-the-typo-errors-in-umodsi3-file.patch
@@ -1,18 +1,14 @@
1From 1e0eaa1330f24d4989af6326ce1af4f613ea0d89 Mon Sep 17 00:00:00 2001 1From 0c0b4fb378d9035f0c5f847321b543a5c2ff70e2 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 16 Oct 2018 07:55:46 +0530 3Date: Tue, 16 Oct 2018 07:55:46 +0530
4Subject: [PATCH 38/53] fixing the typo errors in umodsi3 file 4Subject: [PATCH 38/54] fixing the typo errors in umodsi3 file
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 libgcc/config/microblaze/umodsi3.S | 6 +++--- 7 libgcc/config/microblaze/umodsi3.S | 6 +++---
12 1 file changed, 3 insertions(+), 3 deletions(-) 8 1 file changed, 3 insertions(+), 3 deletions(-)
13 9
14diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S 10diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S
15index b68ba7a5ea6..03be6df1fc6 100644 11index fffc784b4cb..a706017c634 100644
16--- a/libgcc/config/microblaze/umodsi3.S 12--- a/libgcc/config/microblaze/umodsi3.S
17+++ b/libgcc/config/microblaze/umodsi3.S 13+++ b/libgcc/config/microblaze/umodsi3.S
18@@ -47,9 +47,9 @@ __umodsi3: 14@@ -47,9 +47,9 @@ __umodsi3:
@@ -29,5 +25,5 @@ index b68ba7a5ea6..03be6df1fc6 100644
29 __umodsi3: 25 __umodsi3:
30 .frame r1,0,r15 26 .frame r1,0,r15
31-- 27--
322.37.1 (Apple Git-137.1) 282.34.1
33 29
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch
index 032cab4d..27b6efd1 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch
@@ -1,18 +1,14 @@
1From 7dbdc5ba78c9237b0a367ca61f448cf3a0277ea6 Mon Sep 17 00:00:00 2001 1From 8dfc5e76a3b0388bb5c88c5c0072256f3062f3c8 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 17 Oct 2018 16:56:14 +0530 3Date: Wed, 17 Oct 2018 16:56:14 +0530
4Subject: [PATCH 39/53] fixing the 32bit LTO related issue9(1014024) 4Subject: [PATCH 39/54] fixing the 32bit LTO related issue9(1014024)
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 gcc/config/microblaze/microblaze.h | 24 ++++++++++++++---------- 7 gcc/config/microblaze/microblaze.h | 24 ++++++++++++++----------
12 1 file changed, 14 insertions(+), 10 deletions(-) 8 1 file changed, 14 insertions(+), 10 deletions(-)
13 9
14diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 10diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
15index 56dfc2a3824..c48b6de0d58 100644 11index 4258dcde0d1..4d6babfe9c4 100644
16--- a/gcc/config/microblaze/microblaze.h 12--- a/gcc/config/microblaze/microblaze.h
17+++ b/gcc/config/microblaze/microblaze.h 13+++ b/gcc/config/microblaze/microblaze.h
18@@ -265,12 +265,14 @@ extern enum pipeline_type microblaze_pipe; 14@@ -265,12 +265,14 @@ extern enum pipeline_type microblaze_pipe;
@@ -68,5 +64,5 @@ index 56dfc2a3824..c48b6de0d58 100644
68 #define REGNO_OK_FOR_BASE_P(regno) microblaze_regno_ok_for_base_p ((regno), 1) 64 #define REGNO_OK_FOR_BASE_P(regno) microblaze_regno_ok_for_base_p ((regno), 1)
69 65
70-- 66--
712.37.1 (Apple Git-137.1) 672.34.1
72 68
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch
index 1ed53957..35251ff8 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch
@@ -1,19 +1,15 @@
1From a21a41a0c574b807c7e7edaa7051a0f7395d8142 Mon Sep 17 00:00:00 2001 1From 411324e0340a32b4a84094b38e5d74f38cf391bc Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com> 2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 19 Oct 2018 14:26:25 +0530 3Date: Fri, 19 Oct 2018 14:26:25 +0530
4Subject: [PATCH 40/53] Fixed the missing stack adjustment in prologue of 4Subject: [PATCH 40/54] Fixed the missing stack adjustment in prologue of
5 modsi3 function 5 modsi3 function
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
11--- 7---
12 libgcc/config/microblaze/modsi3.S | 1 + 8 libgcc/config/microblaze/modsi3.S | 1 +
13 1 file changed, 1 insertion(+) 9 1 file changed, 1 insertion(+)
14 10
15diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S 11diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S
16index e0fbd91e766..3ec17685e51 100644 12index d2f9dc770e4..f8684db721e 100644
17--- a/libgcc/config/microblaze/modsi3.S 13--- a/libgcc/config/microblaze/modsi3.S
18+++ b/libgcc/config/microblaze/modsi3.S 14+++ b/libgcc/config/microblaze/modsi3.S
19@@ -119,6 +119,7 @@ $LaRETURN_HERE: 15@@ -119,6 +119,7 @@ $LaRETURN_HERE:
@@ -25,5 +21,5 @@ index e0fbd91e766..3ec17685e51 100644
25 .end __modsi3 21 .end __modsi3
26 .size __modsi3, . - __modsi3 22 .size __modsi3, . - __modsi3
27-- 23--
282.37.1 (Apple Git-137.1) 242.34.1
29 25
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0041-corrected-SPN-for-dlong-instruction-mapping.patch
index e6335e8e..bb797a4a 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0041-corrected-SPN-for-dlong-instruction-mapping.patch
@@ -1,19 +1,14 @@
1From 5f799ea01bae0573a44f3fefa825861e99f4e30a Mon Sep 17 00:00:00 2001 1From b03e3a75a37213823c062bb72e4f6f470c516222 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 24 Oct 2018 18:31:04 +0530 3Date: Wed, 24 Oct 2018 18:31:04 +0530
4Subject: [PATCH 41/53] [Patch,Microblaze] : corrected SPN for dlong 4Subject: [PATCH 41/54] corrected SPN for dlong instruction mapping.
5 instruction mapping.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 5
11--- 6---
12 gcc/config/microblaze/microblaze.md | 4 ++-- 7 gcc/config/microblaze/microblaze.md | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-) 8 1 file changed, 2 insertions(+), 2 deletions(-)
14 9
15diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 10diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
16index 4a372f8fd3f..5a964e70d1f 100644 11index 6ada55ac2bc..36b050670b8 100644
17--- a/gcc/config/microblaze/microblaze.md 12--- a/gcc/config/microblaze/microblaze.md
18+++ b/gcc/config/microblaze/microblaze.md 13+++ b/gcc/config/microblaze/microblaze.md
19@@ -602,9 +602,9 @@ 14@@ -602,9 +602,9 @@
@@ -29,5 +24,5 @@ index 4a372f8fd3f..5a964e70d1f 100644
29 "dlong\t%0,%1" 24 "dlong\t%0,%1"
30 [(set_attr "type" "fcvt") 25 [(set_attr "type" "fcvt")
31-- 26--
322.37.1 (Apple Git-137.1) 272.34.1
33 28
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch
index f4013b9e..cbafaafc 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -1,11 +1,7 @@
1From 9c37b9690ec2c6290095209c039725f235537379 Mon Sep 17 00:00:00 2001 1From b926d05a0cdd32d9821a48f62eef49c5b1025f73 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:55:08 +0530 3Date: Thu, 29 Nov 2018 17:55:08 +0530
4Subject: [PATCH 42/53] fixing the long & long long mingw toolchain issue 4Subject: [PATCH 42/54] fixing the long & long long mingw toolchain issue
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 gcc/config/microblaze/constraints.md | 2 +- 7 gcc/config/microblaze/constraints.md | 2 +-
@@ -13,7 +9,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13 2 files changed, 5 insertions(+), 5 deletions(-) 9 2 files changed, 5 insertions(+), 5 deletions(-)
14 10
15diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md 11diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md
16index 0ced155340d..3f9805dfe0a 100644 12index 7bb1e0b4c8d..fa605831bfe 100644
17--- a/gcc/config/microblaze/constraints.md 13--- a/gcc/config/microblaze/constraints.md
18+++ b/gcc/config/microblaze/constraints.md 14+++ b/gcc/config/microblaze/constraints.md
19@@ -55,7 +55,7 @@ 15@@ -55,7 +55,7 @@
@@ -26,7 +22,7 @@ index 0ced155340d..3f9805dfe0a 100644
26 22
27 ;; Define floating point constraints 23 ;; Define floating point constraints
28diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 24diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
29index 5a964e70d1f..f509bd5e665 100644 25index 36b050670b8..e123bf3a7d1 100644
30--- a/gcc/config/microblaze/microblaze.md 26--- a/gcc/config/microblaze/microblaze.md
31+++ b/gcc/config/microblaze/microblaze.md 27+++ b/gcc/config/microblaze/microblaze.md
32@@ -648,8 +648,8 @@ 28@@ -648,8 +648,8 @@
@@ -59,5 +55,5 @@ index 5a964e70d1f..f509bd5e665 100644
59 else 55 else
60 return "addlik\t%0,r0,%1"; 56 return "addlik\t%0,r0,%1";
61-- 57--
622.37.1 (Apple Git-137.1) 582.34.1
63 59
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch
index 7f3c8373..af8c684f 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch
@@ -1,18 +1,14 @@
1From 0ed24f5a2e6e47f5d13896793ab2c6ea89e8c8e6 Mon Sep 17 00:00:00 2001 1From 854371934116e5197d627cebaf274f431205b914 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Thu, 14 Mar 2019 18:11:04 +0530 3Date: Thu, 14 Mar 2019 18:11:04 +0530
4Subject: [PATCH 43/53] Fix the MB-64 bug of handling QI objects 4Subject: [PATCH 43/54] Fix the MB-64 bug of handling QI objects
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 gcc/config/microblaze/microblaze.md | 14 +++++++------- 7 gcc/config/microblaze/microblaze.md | 14 +++++++-------
12 1 file changed, 7 insertions(+), 7 deletions(-) 8 1 file changed, 7 insertions(+), 7 deletions(-)
13 9
14diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 10diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
15index f509bd5e665..27436c0f660 100644 11index e123bf3a7d1..0f81b0ed58c 100644
16--- a/gcc/config/microblaze/microblaze.md 12--- a/gcc/config/microblaze/microblaze.md
17+++ b/gcc/config/microblaze/microblaze.md 13+++ b/gcc/config/microblaze/microblaze.md
18@@ -2345,11 +2345,11 @@ else 14@@ -2345,11 +2345,11 @@ else
@@ -47,5 +43,5 @@ index f509bd5e665..27436c0f660 100644
47 "TARGET_MB_64" 43 "TARGET_MB_64"
48 { 44 {
49-- 45--
502.37.1 (Apple Git-137.1) 462.34.1
51 47
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0044-We-will-check-the-possibility-of-peephole2-optimizat.patch
index 14eb812a..277e5be2 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0044-We-will-check-the-possibility-of-peephole2-optimizat.patch
@@ -1,19 +1,15 @@
1From e8286e00f939486dde52e9475bc9cca0aa025a42 Mon Sep 17 00:00:00 2001 1From 5527cec8136440a1edea87b2bb6dafa8e78d07b0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Fri, 29 Mar 2019 12:08:39 +0530 3Date: Fri, 29 Mar 2019 12:08:39 +0530
4Subject: [PATCH 44/53] [Patch,Microblaze] : We will check the possibility of 4Subject: [PATCH 44/54] We will check the possibility of peephole2
5 peephole2 optimization,if we can then we will fix the compiler issue. 5 optimization,if we can then we will fix the compiler issue.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 6
11--- 7---
12 gcc/config/microblaze/microblaze.md | 63 +++++++++++++++++------------ 8 gcc/config/microblaze/microblaze.md | 63 +++++++++++++++++------------
13 1 file changed, 38 insertions(+), 25 deletions(-) 9 1 file changed, 38 insertions(+), 25 deletions(-)
14 10
15diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 11diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
16index 27436c0f660..4b9acddb1f1 100644 12index 0f81b0ed58c..f661ba1c241 100644
17--- a/gcc/config/microblaze/microblaze.md 13--- a/gcc/config/microblaze/microblaze.md
18+++ b/gcc/config/microblaze/microblaze.md 14+++ b/gcc/config/microblaze/microblaze.md
19@@ -882,31 +882,44 @@ 15@@ -882,31 +882,44 @@
@@ -87,5 +83,5 @@ index 27436c0f660..4b9acddb1f1 100644
87 ;;---------------------------------------------------------------- 83 ;;----------------------------------------------------------------
88 ;; Negation and one's complement 84 ;; Negation and one's complement
89-- 85--
902.37.1 (Apple Git-137.1) 862.34.1
91 87
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0045-fixed-typos-in-mul-div-and-mod-assembly-files.patch
index 54135b0f..4760926f 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0045-fixed-typos-in-mul-div-and-mod-assembly-files.patch
@@ -1,12 +1,7 @@
1From 29c33e35373d7dc52e43162dce38a3ec0e350db3 Mon Sep 17 00:00:00 2001 1From 3c6f051ce41f06eab29932859be52ed864bef52f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Apr 2019 12:36:16 +0530 3Date: Wed, 17 Apr 2019 12:36:16 +0530
4Subject: [PATCH 45/53] [Patch,MicroBlaze]: fixed typos in mul,div and mod 4Subject: [PATCH 45/54] fixed typos in mul,div and mod assembly files.
5 assembly files.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 5
11--- 6---
12 libgcc/config/microblaze/divsi3.S | 47 ++++++++++++++++++++---- 7 libgcc/config/microblaze/divsi3.S | 47 ++++++++++++++++++++----
@@ -17,7 +12,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
17 5 files changed, 212 insertions(+), 20 deletions(-) 12 5 files changed, 212 insertions(+), 20 deletions(-)
18 13
19diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S 14diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S
20index b464deed481..ceeed6be1f4 100644 15index 9f04f59104e..e1dfccbf257 100644
21--- a/libgcc/config/microblaze/divsi3.S 16--- a/libgcc/config/microblaze/divsi3.S
22+++ b/libgcc/config/microblaze/divsi3.S 17+++ b/libgcc/config/microblaze/divsi3.S
23@@ -46,7 +46,7 @@ 18@@ -46,7 +46,7 @@
@@ -111,7 +106,7 @@ index b464deed481..ceeed6be1f4 100644
111 $LaDiv_By_Zero: 106 $LaDiv_By_Zero:
112 $LaResult_Is_Zero: 107 $LaResult_Is_Zero:
113diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S 108diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S
114index 3ec17685e51..637b06c09a3 100644 109index f8684db721e..3bf9b10ec3e 100644
115--- a/libgcc/config/microblaze/modsi3.S 110--- a/libgcc/config/microblaze/modsi3.S
116+++ b/libgcc/config/microblaze/modsi3.S 111+++ b/libgcc/config/microblaze/modsi3.S
117@@ -62,40 +62,72 @@ __modsi3: 112@@ -62,40 +62,72 @@ __modsi3:
@@ -200,7 +195,7 @@ index 3ec17685e51..637b06c09a3 100644
200 nop 195 nop
201 #else 196 #else
202diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S 197diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S
203index 657668ef826..6be75dc95e8 100644 198index 437e2bc309e..bc9ff9cdc89 100644
204--- a/libgcc/config/microblaze/mulsi3.S 199--- a/libgcc/config/microblaze/mulsi3.S
205+++ b/libgcc/config/microblaze/mulsi3.S 200+++ b/libgcc/config/microblaze/mulsi3.S
206@@ -43,7 +43,37 @@ 201@@ -43,7 +43,37 @@
@@ -250,7 +245,7 @@ index 657668ef826..6be75dc95e8 100644
250 .end __mulsi3 245 .end __mulsi3
251 .size __mulsi3, . - __mulsi3 246 .size __mulsi3, . - __mulsi3
252diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S 247diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S
253index fc6a4b5a248..f8ce88bd8b7 100644 248index 496dd6794bf..486bc8f0819 100644
254--- a/libgcc/config/microblaze/udivsi3.S 249--- a/libgcc/config/microblaze/udivsi3.S
255+++ b/libgcc/config/microblaze/udivsi3.S 250+++ b/libgcc/config/microblaze/udivsi3.S
256@@ -59,52 +59,96 @@ __udivsi3: 251@@ -59,52 +59,96 @@ __udivsi3:
@@ -364,7 +359,7 @@ index fc6a4b5a248..f8ce88bd8b7 100644
364 NOP 359 NOP
365 #else 360 #else
366diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S 361diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S
367index 03be6df1fc6..3be3658f7a2 100644 362index a706017c634..1d8e2921745 100644
368--- a/libgcc/config/microblaze/umodsi3.S 363--- a/libgcc/config/microblaze/umodsi3.S
369+++ b/libgcc/config/microblaze/umodsi3.S 364+++ b/libgcc/config/microblaze/umodsi3.S
370@@ -46,7 +46,7 @@ 365@@ -46,7 +46,7 @@
@@ -466,5 +461,5 @@ index 03be6df1fc6..3be3658f7a2 100644
466 $LaRETURN_HERE: 461 $LaRETURN_HERE:
467 # Restore values of CSRs and that of r3 and the divisor and the dividend 462 # Restore values of CSRs and that of r3 and the divisor and the dividend
468-- 463--
4692.37.1 (Apple Git-137.1) 4642.34.1
470 465
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0046-MB-64-removal-of-barrel-shift-instructions-from-defa.patch
index def10321..5f45d03f 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0046-MB-64-removal-of-barrel-shift-instructions-from-defa.patch
@@ -1,27 +1,22 @@
1From 39589348962a2e0453ad49118b6bc3dd8a7b1bb5 Mon Sep 17 00:00:00 2001 1From 0776495e85a15c1ad84fd90736059902bb3ea152 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 15:59:12 +0530 3Date: Tue, 13 Sep 2022 15:59:12 +0530
4Subject: [PATCH 46/53] [Patch, microblaze]: MB-64 removal of barrel-shift 4Subject: [PATCH 46/54] MB-64 removal of barrel-shift instructions from default
5 instructions from default By default MB-64 is generatting 5 By default MB-64 is generatting barrel-shift instructions. It has been
6 barrel-shift instructions. It has been removed from default. 6 removed from default. Barrel-shift instructions will be generated only if
7 Barrel-shift instructions will be generated only if barrel-shifter is 7 barrel-shifter is enabled. Similarly to double instructions as well.
8 enabled. Similarly to double instructions as well.
9 8
10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 9 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11Upstream-Status: Pending
12
13Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14
15--- 10---
16 gcc/config/microblaze/microblaze.cc | 2 +- 11 gcc/config/microblaze/microblaze.cc | 2 +-
17 gcc/config/microblaze/microblaze.md | 269 ++++++++++++++++++++++++++-- 12 gcc/config/microblaze/microblaze.md | 269 ++++++++++++++++++++++++++--
18 2 files changed, 252 insertions(+), 19 deletions(-) 13 2 files changed, 252 insertions(+), 19 deletions(-)
19 14
20diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 15diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
21index 7a08390a027..3ee3996a38d 100644 16index 965a041ea8c..f949a8863d3 100644
22--- a/gcc/config/microblaze/microblaze.cc 17--- a/gcc/config/microblaze/microblaze.cc
23+++ b/gcc/config/microblaze/microblaze.cc 18+++ b/gcc/config/microblaze/microblaze.cc
24@@ -3871,7 +3871,7 @@ microblaze_expand_divide (rtx operands[]) 19@@ -3880,7 +3880,7 @@ microblaze_expand_divide (rtx operands[])
25 emit_insn (gen_rtx_CLOBBER (Pmode, reg18)); 20 emit_insn (gen_rtx_CLOBBER (Pmode, reg18));
26 21
27 if (TARGET_MB_64) { 22 if (TARGET_MB_64) {
@@ -31,7 +26,7 @@ index 7a08390a027..3ee3996a38d 100644
31 } 26 }
32 else { 27 else {
33diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 28diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
34index 4b9acddb1f1..3695e9e101d 100644 29index f661ba1c241..9bc9512db8e 100644
35--- a/gcc/config/microblaze/microblaze.md 30--- a/gcc/config/microblaze/microblaze.md
36+++ b/gcc/config/microblaze/microblaze.md 31+++ b/gcc/config/microblaze/microblaze.md
37@@ -547,7 +547,7 @@ 32@@ -547,7 +547,7 @@
@@ -477,5 +472,5 @@ index 4b9acddb1f1..3695e9e101d 100644
477 [(set_attr "type" "arith") 472 [(set_attr "type" "arith")
478 (set_attr "mode" "DI") 473 (set_attr "mode" "DI")
479-- 474--
4802.37.1 (Apple Git-137.1) 4752.34.1
481 476
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch
index 318abe7b..0272fd3c 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch
@@ -1,18 +1,14 @@
1From e32334b0f8a4c9532975001ffab33e86469ea4e1 Mon Sep 17 00:00:00 2001 1From 003f60fa4eedddd15de6e9f633bffec1a887fe45 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:16:53 +0530 3Date: Fri, 23 Aug 2019 16:16:53 +0530
4Subject: [PATCH 47/53] Added new MB-64 single register arithmetic instructions 4Subject: [PATCH 47/54] Added new MB-64 single register arithmetic instructions
5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9 5
10--- 6---
11 gcc/config/microblaze/microblaze.md | 56 +++++++++++++++++++++++++++++ 7 gcc/config/microblaze/microblaze.md | 56 +++++++++++++++++++++++++++++
12 1 file changed, 56 insertions(+) 8 1 file changed, 56 insertions(+)
13 9
14diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 10diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
15index 3695e9e101d..85c1ab45994 100644 11index 9bc9512db8e..9172f1bc209 100644
16--- a/gcc/config/microblaze/microblaze.md 12--- a/gcc/config/microblaze/microblaze.md
17+++ b/gcc/config/microblaze/microblaze.md 13+++ b/gcc/config/microblaze/microblaze.md
18@@ -654,6 +654,18 @@ 14@@ -654,6 +654,18 @@
@@ -107,5 +103,5 @@ index 3695e9e101d..85c1ab45994 100644
107 [(set (match_operand:DI 0 "register_operand" "=d,d") 103 [(set (match_operand:DI 0 "register_operand" "=d,d")
108 (xor:DI (match_operand:DI 1 "arith_operand" "%d,d") 104 (xor:DI (match_operand:DI 1 "arith_operand" "%d,d")
109-- 105--
1102.37.1 (Apple Git-137.1) 1062.34.1
111 107
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0048-Added-support-for-64-bit-Immediate-values.patch
index 09514a7d..0be495a8 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0048-Added-support-for-64-bit-Immediate-values.patch
@@ -1,12 +1,7 @@
1From f5f262b196de197b7e9ece8cc08c8715f953857f Mon Sep 17 00:00:00 2001 1From 8d20c82d95e22a42551b446c087d9e06958a3580 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:55:22 +0530 3Date: Mon, 26 Aug 2019 15:55:22 +0530
4Subject: [PATCH 48/53] [Patch,MicroBlaze] : Added support for 64 bit Immediate 4Subject: [PATCH 48/54] Added support for 64 bit Immediate values.
5 values.
6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10 5
11--- 6---
12 gcc/config/microblaze/constraints.md | 4 ++-- 7 gcc/config/microblaze/constraints.md | 4 ++--
@@ -14,7 +9,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14 2 files changed, 3 insertions(+), 4 deletions(-) 9 2 files changed, 3 insertions(+), 4 deletions(-)
15 10
16diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md 11diff --git a/gcc/config/microblaze/constraints.md b/gcc/config/microblaze/constraints.md
17index 3f9805dfe0a..91653f36f52 100644 12index fa605831bfe..40cd88a870c 100644
18--- a/gcc/config/microblaze/constraints.md 13--- a/gcc/config/microblaze/constraints.md
19+++ b/gcc/config/microblaze/constraints.md 14+++ b/gcc/config/microblaze/constraints.md
20@@ -53,9 +53,9 @@ 15@@ -53,9 +53,9 @@
@@ -30,7 +25,7 @@ index 3f9805dfe0a..91653f36f52 100644
30 25
31 ;; Define floating point constraints 26 ;; Define floating point constraints
32diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 27diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
33index 85c1ab45994..0ac6e1480e6 100644 28index 9172f1bc209..f41474feca6 100644
34--- a/gcc/config/microblaze/microblaze.md 29--- a/gcc/config/microblaze/microblaze.md
35+++ b/gcc/config/microblaze/microblaze.md 30+++ b/gcc/config/microblaze/microblaze.md
36@@ -1332,8 +1332,7 @@ 31@@ -1332,8 +1332,7 @@
@@ -44,5 +39,5 @@ index 85c1ab45994..0ac6e1480e6 100644
44 addlk\t%0,r0,r0\t 39 addlk\t%0,r0,r0\t
45 addlik\t%0,r0,%1\t #N1 %X1 40 addlik\t%0,r0,%1\t #N1 %X1
46-- 41--
472.37.1 (Apple Git-137.1) 422.34.1
48 43
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0049-Fix-Compiler-crash-with-freg-struct-return-This-patc.patch
index 6258e799..ca813796 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0049-Fix-Compiler-crash-with-freg-struct-return-This-patc.patch
@@ -1,26 +1,22 @@
1From d45405d05a1f9079f7db86ba60dcd30d358613d4 Mon Sep 17 00:00:00 2001 1From 8107e0be46e5bdbfc353648ce5129afde5275ea9 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 16:06:10 +0530 3Date: Tue, 13 Sep 2022 16:06:10 +0530
4Subject: [PATCH 49/53] [Patch, microblaze]: Fix Compiler crash with 4Subject: [PATCH 49/54] Fix Compiler crash with -freg-struct-return This patch
5 -freg-struct-return This patch fixes a bug in MB GCC regarding the 5 fixes a bug in MB GCC regarding the passing struct values in registers.
6 passing struct values in registers. Currently we are only handling SImode 6 Currently we are only handling SImode With this patch all other modes are
7 With this patch all other modes are handled properly 7 handled properly
8 8
9 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 9 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
14--- 10---
15 gcc/config/microblaze/microblaze.cc | 11 ++++++++++- 11 gcc/config/microblaze/microblaze.cc | 11 ++++++++++-
16 gcc/config/microblaze/microblaze.h | 19 ------------------- 12 gcc/config/microblaze/microblaze.h | 19 -------------------
17 2 files changed, 10 insertions(+), 20 deletions(-) 13 2 files changed, 10 insertions(+), 20 deletions(-)
18 14
19diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 15diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
20index 3ee3996a38d..4668a81d060 100644 16index f949a8863d3..4748c8c1f0d 100644
21--- a/gcc/config/microblaze/microblaze.cc 17--- a/gcc/config/microblaze/microblaze.cc
22+++ b/gcc/config/microblaze/microblaze.cc 18+++ b/gcc/config/microblaze/microblaze.cc
23@@ -3909,7 +3909,16 @@ microblaze_function_value (const_tree valtype, 19@@ -3918,7 +3918,16 @@ microblaze_function_value (const_tree valtype,
24 const_tree func ATTRIBUTE_UNUSED, 20 const_tree func ATTRIBUTE_UNUSED,
25 bool outgoing ATTRIBUTE_UNUSED) 21 bool outgoing ATTRIBUTE_UNUSED)
26 { 22 {
@@ -39,7 +35,7 @@ index 3ee3996a38d..4668a81d060 100644
39 35
40 /* Implement TARGET_SCHED_ADJUST_COST. */ 36 /* Implement TARGET_SCHED_ADJUST_COST. */
41diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 37diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
42index c48b6de0d58..730ad87b13b 100644 38index 4d6babfe9c4..eea360fda47 100644
43--- a/gcc/config/microblaze/microblaze.h 39--- a/gcc/config/microblaze/microblaze.h
44+++ b/gcc/config/microblaze/microblaze.h 40+++ b/gcc/config/microblaze/microblaze.h
45@@ -266,13 +266,6 @@ extern enum pipeline_type microblaze_pipe; 41@@ -266,13 +266,6 @@ extern enum pipeline_type microblaze_pipe;
@@ -76,5 +72,5 @@ index c48b6de0d58..730ad87b13b 100644
76 On the MicroBlaze, R2 R3 are the only register thus used. 72 On the MicroBlaze, R2 R3 are the only register thus used.
77 Currently, R2 are only implemented here (C has no complex type) */ 73 Currently, R2 are only implemented here (C has no complex type) */
78-- 74--
792.37.1 (Apple Git-137.1) 752.34.1
80 76
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0050-Add-TARGET_OPTION_OPTIMIZATION-and-disable-fivopts-b.patch
index 8d99c93d..3b8fad81 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0050-Add-TARGET_OPTION_OPTIMIZATION-and-disable-fivopts-b.patch
@@ -1,16 +1,14 @@
1From a64afc59e82703f40d04d4d7126038811a195467 Mon Sep 17 00:00:00 2001 1From b7fb925d6277d11e4014aa1731fc58813e30761f Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com> 2From: Nagaraju <nmekala@xilinx.com>
3Date: Wed, 8 May 2019 14:12:03 +0530 3Date: Wed, 8 May 2019 14:12:03 +0530
4Subject: [PATCH 50/53] [Patch, microblaze]: Add TARGET_OPTION_OPTIMIZATION and 4Subject: [PATCH 50/54] Add TARGET_OPTION_OPTIMIZATION and disable fivopts by
5 disable fivopts by default 5 default
6 6
7Added TARGET_OPTION_OPTIMIZATIONS and Turn off ivopts by default. 7Added TARGET_OPTION_OPTIMIZATIONS and Turn off ivopts by default.
8 8
9 * gcc/common/config/microblaze/microblaze-common.c 9 * gcc/common/config/microblaze/microblaze-common.c
10 (microblaze_option_optimization_table): Disable fivopts by default. 10 (microblaze_option_optimization_table): Disable fivopts by default.
11 11
12Upstream-Status: Pending
13
14Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> 12Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com>
15 Mahesh Bodapati <mbodapat@xilinx.com> 13 Mahesh Bodapati <mbodapat@xilinx.com>
16Conflicts: 14Conflicts:
@@ -23,7 +21,7 @@ Conflicts:
23 1 file changed, 13 insertions(+) 21 1 file changed, 13 insertions(+)
24 22
25diff --git a/gcc/common/config/microblaze/microblaze-common.cc b/gcc/common/config/microblaze/microblaze-common.cc 23diff --git a/gcc/common/config/microblaze/microblaze-common.cc b/gcc/common/config/microblaze/microblaze-common.cc
26index 21b35f55b92..137332ded25 100644 24index 8750b022447..8a924e8a997 100644
27--- a/gcc/common/config/microblaze/microblaze-common.cc 25--- a/gcc/common/config/microblaze/microblaze-common.cc
28+++ b/gcc/common/config/microblaze/microblaze-common.cc 26+++ b/gcc/common/config/microblaze/microblaze-common.cc
29@@ -24,7 +24,20 @@ 27@@ -24,7 +24,20 @@
@@ -48,5 +46,5 @@ index 21b35f55b92..137332ded25 100644
48+ 46+
49 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; 47 struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
50-- 48--
512.37.1 (Apple Git-137.1) 492.34.1
52 50
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0051-Reducing-Stack-space-for-arguments.patch
index 64069e3c..648da43a 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0051-Reducing-Stack-space-for-arguments.patch
@@ -1,7 +1,7 @@
1From 09e10c513f8970f4d2402244b7ac69ecd33b4c04 Mon Sep 17 00:00:00 2001 1From a464c0e6070cac9b40b7fe760e25cbd484a615a7 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 16:35:00 +0530 3Date: Tue, 13 Sep 2022 16:35:00 +0530
4Subject: [PATCH 51/53] [Patch, microblaze]: Reducing Stack space for arguments 4Subject: [PATCH 51/54] Reducing Stack space for arguments
5 5
6 Currently in Microblaze target stack space for arguments in register is being 6 Currently in Microblaze target stack space for arguments in register is being
7 allocated even if there are no arguments in the function. 7 allocated even if there are no arguments in the function.
@@ -9,10 +9,6 @@ Subject: [PATCH 51/53] [Patch, microblaze]: Reducing Stack space for arguments
9 9
10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11 :Ajit Agarwal <ajitkum@xilinx.com> 11 :Ajit Agarwal <ajitkum@xilinx.com>
12Upstream-Status: Pending
13
14Signed-off-by: Mark Hatle <mark.hatle@amd.com>
15
16--- 12---
17 gcc/config/microblaze/microblaze-protos.h | 1 + 13 gcc/config/microblaze/microblaze-protos.h | 1 +
18 gcc/config/microblaze/microblaze.cc | 130 ++++++++++++++++++++++ 14 gcc/config/microblaze/microblaze.cc | 130 ++++++++++++++++++++++
@@ -20,7 +16,7 @@ Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20 3 files changed, 133 insertions(+), 2 deletions(-) 16 3 files changed, 133 insertions(+), 2 deletions(-)
21 17
22diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h 18diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
23index 7f575c2adec..bd594699940 100644 19index 0e9f783c4a4..091d8d9a51b 100644
24--- a/gcc/config/microblaze/microblaze-protos.h 20--- a/gcc/config/microblaze/microblaze-protos.h
25+++ b/gcc/config/microblaze/microblaze-protos.h 21+++ b/gcc/config/microblaze/microblaze-protos.h
26@@ -60,6 +60,7 @@ extern int symbol_mentioned_p (rtx); 22@@ -60,6 +60,7 @@ extern int symbol_mentioned_p (rtx);
@@ -32,10 +28,10 @@ index 7f575c2adec..bd594699940 100644
32 28
33 /* Declare functions in microblaze-c.cc. */ 29 /* Declare functions in microblaze-c.cc. */
34diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 30diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
35index 4668a81d060..24ac215b6d5 100644 31index 4748c8c1f0d..e6d3f35370c 100644
36--- a/gcc/config/microblaze/microblaze.cc 32--- a/gcc/config/microblaze/microblaze.cc
37+++ b/gcc/config/microblaze/microblaze.cc 33+++ b/gcc/config/microblaze/microblaze.cc
38@@ -2081,6 +2081,136 @@ microblaze_must_save_register (int regno) 34@@ -2086,6 +2086,136 @@ microblaze_must_save_register (int regno)
39 return 0; 35 return 0;
40 } 36 }
41 37
@@ -173,7 +169,7 @@ index 4668a81d060..24ac215b6d5 100644
173 stack pointer. 169 stack pointer.
174 170
175diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h 171diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
176index 730ad87b13b..dfacd080b6d 100644 172index eea360fda47..f23805b1c03 100644
177--- a/gcc/config/microblaze/microblaze.h 173--- a/gcc/config/microblaze/microblaze.h
178+++ b/gcc/config/microblaze/microblaze.h 174+++ b/gcc/config/microblaze/microblaze.h
179@@ -447,9 +447,9 @@ extern struct microblaze_frame_info current_frame_info; 175@@ -447,9 +447,9 @@ extern struct microblaze_frame_info current_frame_info;
@@ -189,5 +185,5 @@ index 730ad87b13b..dfacd080b6d 100644
189 #define STACK_BOUNDARY (TARGET_MB_64 ? 64 : 32) 185 #define STACK_BOUNDARY (TARGET_MB_64 ? 64 : 32)
190 186
191-- 187--
1922.37.1 (Apple Git-137.1) 1882.34.1
193 189
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0052-If-we-use-break_handler-attribute-then-interrupt-vec.patch
index 63feff79..d0474dd9 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0052-If-we-use-break_handler-attribute-then-interrupt-vec.patch
@@ -1,26 +1,21 @@
1From fe2781d189493dc82a3714b48bbc12c6bd5cdfd0 Mon Sep 17 00:00:00 2001 1From b792943436857172e7a39e26a00602c7e6620860 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 16:38:43 +0530 3Date: Tue, 13 Sep 2022 16:38:43 +0530
4Subject: [PATCH 52/53] [Patch,MicroBlaze] : If we use break_handler 4Subject: [PATCH 52/54] If we use break_handler attribute then interrupt vector
5 attribute then interrupt vector call happened to break_handler instead of 5 call happened to break_handler instead of interrupt_handler. this fix will
6 interrupt_handler. this fix will resolve the issue CR-1081780. This 6 resolve the issue CR-1081780. This fix will not change the behavior of
7 fix will not change the behavior of compiler unless there is a usage of 7 compiler unless there is a usage of break_handler attribute. signed-off-by :
8 break_handler attribute. signed-off-by : Mahesh Bodapati 8 Mahesh Bodapati <mbodapat@xilinx.com>
9 <mbodapat@xilinx.com>
10
11Upstream-Status: Pending
12
13Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14 9
15--- 10---
16 gcc/config/microblaze/microblaze.cc | 13 +++++-------- 11 gcc/config/microblaze/microblaze.cc | 13 +++++--------
17 1 file changed, 5 insertions(+), 8 deletions(-) 12 1 file changed, 5 insertions(+), 8 deletions(-)
18 13
19diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc 14diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
20index 24ac215b6d5..66d62f6f909 100644 15index e6d3f35370c..58d091fbed2 100644
21--- a/gcc/config/microblaze/microblaze.cc 16--- a/gcc/config/microblaze/microblaze.cc
22+++ b/gcc/config/microblaze/microblaze.cc 17+++ b/gcc/config/microblaze/microblaze.cc
23@@ -2020,7 +2020,7 @@ microblaze_save_volatiles (tree func) 18@@ -2025,7 +2025,7 @@ microblaze_save_volatiles (tree func)
24 int 19 int
25 microblaze_is_interrupt_variant (void) 20 microblaze_is_interrupt_variant (void)
26 { 21 {
@@ -29,7 +24,7 @@ index 24ac215b6d5..66d62f6f909 100644
29 } 24 }
30 int 25 int
31 microblaze_is_break_handler (void) 26 microblaze_is_break_handler (void)
32@@ -2059,7 +2059,7 @@ microblaze_must_save_register (int regno) 27@@ -2064,7 +2064,7 @@ microblaze_must_save_register (int regno)
33 { 28 {
34 if (df_regs_ever_live_p (regno) 29 if (df_regs_ever_live_p (regno)
35 || regno == MB_ABI_MSR_SAVE_REG 30 || regno == MB_ABI_MSR_SAVE_REG
@@ -38,7 +33,7 @@ index 24ac215b6d5..66d62f6f909 100644
38 && (regno == MB_ABI_ASM_TEMP_REGNUM 33 && (regno == MB_ABI_ASM_TEMP_REGNUM
39 || regno == MB_ABI_EXCEPTION_RETURN_ADDR_REGNUM))) 34 || regno == MB_ABI_EXCEPTION_RETURN_ADDR_REGNUM)))
40 return 1; 35 return 1;
41@@ -2275,9 +2275,6 @@ compute_frame_size (HOST_WIDE_INT size) 36@@ -2280,9 +2280,6 @@ compute_frame_size (HOST_WIDE_INT size)
42 fast_interrupt = 37 fast_interrupt =
43 microblaze_fast_interrupt_function_p (current_function_decl); 38 microblaze_fast_interrupt_function_p (current_function_decl);
44 save_volatiles = microblaze_save_volatiles (current_function_decl); 39 save_volatiles = microblaze_save_volatiles (current_function_decl);
@@ -48,7 +43,7 @@ index 24ac215b6d5..66d62f6f909 100644
48 gp_reg_size = 0; 43 gp_reg_size = 0;
49 mask = 0; 44 mask = 0;
50 var_size = size; 45 var_size = size;
51@@ -3237,7 +3234,7 @@ microblaze_expand_prologue (void) 46@@ -3242,7 +3239,7 @@ microblaze_expand_prologue (void)
52 gen_rtx_PLUS (Pmode, stack_pointer_rtx, 47 gen_rtx_PLUS (Pmode, stack_pointer_rtx,
53 const0_rtx)); 48 const0_rtx));
54 49
@@ -57,7 +52,7 @@ index 24ac215b6d5..66d62f6f909 100644
57 /* Do not optimize in flow analysis. */ 52 /* Do not optimize in flow analysis. */
58 MEM_VOLATILE_P (mem_rtx) = 1; 53 MEM_VOLATILE_P (mem_rtx) = 1;
59 54
60@@ -3348,12 +3345,12 @@ microblaze_expand_epilogue (void) 55@@ -3353,12 +3350,12 @@ microblaze_expand_epilogue (void)
61 a load-use stall cycle :) This is also important to handle alloca. 56 a load-use stall cycle :) This is also important to handle alloca.
62 (See comments for if (frame_pointer_needed) below. */ 57 (See comments for if (frame_pointer_needed) below. */
63 58
@@ -73,5 +68,5 @@ index 24ac215b6d5..66d62f6f909 100644
73 MEM_VOLATILE_P (mem_rtx) = 1; 68 MEM_VOLATILE_P (mem_rtx) = 1;
74 reg_rtx = gen_rtx_REG (Pmode, MB_ABI_SUB_RETURN_ADDR_REGNUM); 69 reg_rtx = gen_rtx_REG (Pmode, MB_ABI_SUB_RETURN_ADDR_REGNUM);
75-- 70--
762.37.1 (Apple Git-137.1) 712.34.1
77 72
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0053-Add-Zero_extended-instructions.patch
index 1552a5e9..52017a9d 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0053-Add-Zero_extended-instructions.patch
@@ -1,7 +1,7 @@
1From 6c2e67237a12cecfd8c0575fd17314d3024943fc Mon Sep 17 00:00:00 2001 1From fbf853f0b9571529dcc72fc53adf4a35abd3e050 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com> 2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 13 Sep 2022 16:45:41 +0530 3Date: Tue, 13 Sep 2022 16:45:41 +0530
4Subject: [PATCH 53/53] [patch, microblaze64]: Add Zero_extended instructions 4Subject: [PATCH 53/54] Add Zero_extended instructions
5 5
6 Due to latest changes in GCC-10.2 MB64 perforamance has reduced 6 Due to latest changes in GCC-10.2 MB64 perforamance has reduced
7 We have added zero_extended instructions to get rid of left shift 7 We have added zero_extended instructions to get rid of left shift
@@ -9,8 +9,6 @@ Subject: [PATCH 53/53] [patch, microblaze64]: Add Zero_extended instructions
9 9
10 [CR/TSR]: TSR-974519 10 [CR/TSR]: TSR-974519
11 11
12Upstream-Status: Pending
13
14 Signed-off-by: Nagaraju Mekala<nmekala@xilinx.com> 12 Signed-off-by: Nagaraju Mekala<nmekala@xilinx.com>
15 Mahesh Bodapati<mbodapat@xilinx.com> 13 Mahesh Bodapati<mbodapat@xilinx.com>
16--- 14---
@@ -18,7 +16,7 @@ Upstream-Status: Pending
18 1 file changed, 27 insertions(+) 16 1 file changed, 27 insertions(+)
19 17
20diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md 18diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
21index 0ac6e1480e6..7a7c70d607b 100644 19index f41474feca6..aff98604db7 100644
22--- a/gcc/config/microblaze/microblaze.md 20--- a/gcc/config/microblaze/microblaze.md
23+++ b/gcc/config/microblaze/microblaze.md 21+++ b/gcc/config/microblaze/microblaze.md
24@@ -1191,6 +1191,33 @@ 22@@ -1191,6 +1191,33 @@
@@ -56,5 +54,5 @@ index 0ac6e1480e6..7a7c70d607b 100644
56 ;; Sign extension 54 ;; Sign extension
57 ;;---------------------------------------------------------------- 55 ;;----------------------------------------------------------------
58-- 56--
592.37.1 (Apple Git-137.1) 572.34.1
60 58
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-13/0054-Fix-failure-with-gcc.c-torture-execute-ashrdi-1.c-Os.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0054-Fix-failure-with-gcc.c-torture-execute-ashrdi-1.c-Os.patch
new file mode 100644
index 00000000..ec8bc0cf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0054-Fix-failure-with-gcc.c-torture-execute-ashrdi-1.c-Os.patch
@@ -0,0 +1,42 @@
1From 79d007fea870a3b8d72faa90238cee2cdfaf5c85 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Fri, 28 Jun 2024 12:18:38 +0530
4Subject: [PATCH 54/54] Fix failure with gcc.c-torture/execute/ashrdi-1.c -Os
5 execution test
6
7The following tests fail with -Os option because a shift instruction
8in a branch delay slot gets replaced with multiple instructions when
9the processor has no barrel shifter. This fix addresses the problem
10by marking the responsible instruction pattern as type multi preventing
11it from being placed in a delay slot.
12
13> gcc.c-torture/execute/ashrdi-1.c -Os execution test
14> gcc.c-torture/execute/pr40057.c -Os execution test
15> gcc.c-torture/execute/pr79121.c -Os execution test
16> gcc.c-torture/execute/pr82524.c -Os execution test
17> c-c++-common/torture/vector-compare-1.c -Os execution test
18> gcc.dg/torture/vec-cvt-1.c -Os execution test
19
20These tests pass with this fix.
21
22Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
23---
24 gcc/config/microblaze/microblaze.md | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
28index aff98604db7..0e3981390c8 100644
29--- a/gcc/config/microblaze/microblaze.md
30+++ b/gcc/config/microblaze/microblaze.md
31@@ -2286,7 +2286,7 @@ else
32 output_asm_insn ("bneid\t%3,.-4", operands);
33 return "sra\t%0,%0";
34 }
35- [(set_attr "type" "arith")
36+ [(set_attr "type" "multi")
37 (set_attr "mode" "SI")
38 (set_attr "length" "20")]
39 )
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/microblaze-mulitlib-hack.patch
index 56d8c223..56d8c223 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/microblaze-mulitlib-hack.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/microblaze-mulitlib-hack.patch
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
index e4cdb73f..dba25eb7 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
@@ -40,7 +40,6 @@ EXTRA_OECONF = "\
40 ${@get_gcc_mips_plt_setting(bb, d)} \ 40 ${@get_gcc_mips_plt_setting(bb, d)} \
41 ${@get_gcc_ppc_plt_settings(bb, d)} \ 41 ${@get_gcc_ppc_plt_settings(bb, d)} \
42 ${@get_gcc_multiarch_setting(bb, d)} \ 42 ${@get_gcc_multiarch_setting(bb, d)} \
43 --enable-standard-branch-protection \
44" 43"
45 44
46# glibc version is a minimum controlling whether features are enabled. 45# glibc version is a minimum controlling whether features are enabled.
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.3.bb
index bf53c5cd..bf53c5cd 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.3.bb
index b43cca0c..b43cca0c 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
index bd65b1fe..7eaad231 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -10,3 +10,5 @@ GCCMULTILIB = "--disable-multilib"
10 10
11DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}" 11DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
12PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" 12PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
13
14gcc_multilib_setup[vardepsexclude] = "MULTILIB_VARIANTS"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.3.bb
index 40a6c4fe..40a6c4fe 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
index 8bb58631..89b0bebc 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
@@ -85,12 +85,14 @@ do_install () {
85 cd ${B}/${TARGET_SYS}/$d/ 85 cd ${B}/${TARGET_SYS}/$d/
86 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install 86 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
87 done 87 done
88 install -d ${D}${datadir}/gdb/auto-load/${libdir}
89 mv ${D}${libdir}/libstdc++*-gdb.py ${D}${datadir}/gdb/auto-load/${libdir}
88 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then 90 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
89 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include 91 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
90 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include 92 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
91 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include 93 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
92 fi 94 fi
93 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir 95 rm -rf ${D}${infodir}/libgomp.info* ${D}${infodir}/dir
94 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir 96 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
95 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir 97 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
96 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then 98 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
@@ -99,6 +101,9 @@ do_install () {
99 if [ -d ${D}${infodir} ]; then 101 if [ -d ${D}${infodir} ]; then
100 rmdir --ignore-fail-on-non-empty -p ${D}${infodir} 102 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
101 fi 103 fi
104 if [ -d ${D}${libdir} ]; then
105 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}
106 fi
102} 107}
103 108
104do_install:append:class-target () { 109do_install:append:class-target () {
@@ -132,7 +137,7 @@ do_install:append:class-target () {
132 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext 137 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
133 fi 138 fi
134 139
135 if [ "${TARGET_ARCH}" == "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then 140 if [ "${TARGET_ARCH}" = "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then
136 ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32 141 ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32
137 fi 142 fi
138 143
@@ -151,7 +156,7 @@ INHIBIT_DEFAULT_DEPS = "1"
151DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc" 156DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
152PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs" 157PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
153 158
154#BBCLASSEXTEND = "nativesdk" 159BBCLASSEXTEND = "nativesdk"
155 160
156PACKAGES = "\ 161PACKAGES = "\
157 ${PN}-dbg \ 162 ${PN}-dbg \
@@ -182,9 +187,14 @@ RRECOMMENDS:${PN}-dbg = ""
182 187
183# include python debugging scripts 188# include python debugging scripts
184FILES:${PN}-dbg += "\ 189FILES:${PN}-dbg += "\
185 ${libdir}/libstdc++.*-gdb.py \
186 ${datadir}/gcc-${BINV}/python/libstdcxx \ 190 ${datadir}/gcc-${BINV}/python/libstdcxx \
191 ${datadir}/gdb/auto-load \
187" 192"
193# Needed by libstdcxx pretty printer, however it is disabled intentionally
194# as it adds build time dependency on bash and some cases e.g. no GPL3 cases
195# bash is not availbale and builds fails
196# So it needs to be added manually to images sadly.
197# RDEPENDS:${PN}-dbg += "python3-datetime"
188 198
189FILES:libg2c = "${target_libdir}/libg2c.so.*" 199FILES:libg2c = "${target_libdir}/libg2c.so.*"
190SUMMARY:libg2c = "Companion runtime library for g77" 200SUMMARY:libg2c = "Companion runtime library for g77"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.3.bb
index dd430b57..dd430b57 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
index f6aa9c99..524ebd4b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -53,7 +53,7 @@ DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
53# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized] 53# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
54DEBUG_OPTIMIZATION:append = " -Wno-error" 54DEBUG_OPTIMIZATION:append = " -Wno-error"
55 55
56#BBCLASSEXTEND = "nativesdk" 56BBCLASSEXTEND = "nativesdk"
57 57
58PACKAGES = "${PN} ${PN}-dbg" 58PACKAGES = "${PN} ${PN}-dbg"
59PACKAGES += "libasan libubsan liblsan libtsan" 59PACKAGES += "libasan libubsan liblsan libtsan"
@@ -78,14 +78,15 @@ do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlib
78do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 78do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
79do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" 79do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
80 80
81# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported 81# Only x86, powerpc, sparc, s390, arm, aarch64 and loongarch64 are supported
82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' 82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64|loongarch64).*-linux'
83# musl is currently broken entirely 83# musl is currently broken entirely
84COMPATIBLE_HOST:libc-musl = 'null' 84COMPATIBLE_HOST:libc-musl = 'null'
85 85
86FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" 86FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
87FILES:libasan-dev += "\ 87FILES:libasan-dev += "\
88 ${libdir}/libasan_preinit.o \ 88 ${libdir}/libasan_preinit.o \
89 ${libdir}/libhwasan_preinit.o \
89 ${libdir}/libasan.so \ 90 ${libdir}/libasan.so \
90 ${libdir}/libhwasan.so \ 91 ${libdir}/libhwasan.so \
91 ${libdir}/libasan.la \ 92 ${libdir}/libasan.la \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.3.bb
index 8bda2cca..8bda2cca 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend
deleted file mode 100644
index 42bcd174..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.%.bbappend
+++ /dev/null
@@ -1,59 +0,0 @@
1# Add MicroBlaze Patches (only when using MicroBlaze)
2FILESEXTRAPATHS:append := ":${THISDIR}/gcc-12"
3
4SRC_URI += " \
5 file://0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch \
6 file://0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch \
7 file://0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch \
8 file://0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch \
9 file://0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch \
10 file://0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch \
11 file://0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch \
12 file://0008-Patch-microblaze-Fix-atomic-side-effects.patch \
13 file://0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch \
14 file://0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch \
15 file://0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch \
16 file://0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch \
17 file://0013-Patch-microblaze-Removed-moddi3-routinue.patch \
18 file://0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch \
19 file://0015-Patch-microblaze-Add-optimized-lshrsi3.patch \
20 file://0016-Patch-microblaze-Add-cbranchsi4_reg.patch \
21 file://0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch \
22 file://0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch \
23 file://0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch \
24 file://0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch \
25 file://0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch \
26 file://0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch \
27 file://0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch \
28 file://0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch \
29 file://0025-Fixing-the-issue-with-the-builtin_alloc.patch \
30 file://0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch \
31 file://0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch \
32 file://0028-Intial-commit-for-64bit-MB-sources.patch \
33 file://0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch \
34 file://0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch \
35 file://0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch \
36 file://0032-Patch-MicroBlaze-Fixed-issues-like.patch \
37 file://0033-Patch-MicroBlaze.patch \
38 file://0034-Added-double-arith-instructions.patch \
39 file://0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch \
40 file://0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch \
41 file://0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch \
42 file://0038-fixing-the-typo-errors-in-umodsi3-file.patch \
43 file://0039-fixing-the-32bit-LTO-related-issue9-1014024.patch \
44 file://0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch \
45 file://0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch \
46 file://0042-fixing-the-long-long-long-mingw-toolchain-issue.patch \
47 file://0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch \
48 file://0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch \
49 file://0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch \
50 file://0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch \
51 file://0047-Added-new-MB-64-single-register-arithmetic-instructi.patch \
52 file://0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch \
53 file://0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch \
54 file://0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch \
55 file://0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch \
56 file://0052-Patch-MicroBlaze.patch \
57 file://0053-patch-microblaze64-Add-Zero_extended-instructions.patch \
58 file://microblaze-mulitlib-hack.patch \
59"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-source_13.%.bbappend
new file mode 100644
index 00000000..51b08f36
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_13.%.bbappend
@@ -0,0 +1,63 @@
1# Add MicroBlaze Patches (only when using MicroBlaze)
2FILESEXTRAPATHS:append := ":${THISDIR}/gcc-13"
3
4# Our changes are all local, no real patch-status
5ERROR_QA:remove = "patch-status"
6
7SRC_URI += " \
8 file://0001-LOCAL-Testsuite-builtins-tests-require-fpic-Signed-o.patch \
9 file://0002-Quick-fail-g-.dg-opt-memcpy1.C-This-particular-testc.patch \
10 file://0003-For-dejagnu-static-testing-on-qemu-suppress-warnings.patch \
11 file://0004-Add-MicroBlaze-to-target-supports-for-atomic-buil.-..patch \
12 file://0005-Update-MicroBlaze-strings-test-for-new-scan-assembly.patch \
13 file://0006-Allow-MicroBlaze-.weakext-pattern-in-regex-match-Ext.patch \
14 file://0007-Add-MicroBlaze-to-check_profiling_available-Testsuit.patch \
15 file://0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch \
16 file://0009-Fix-atomic-boolean-return-value.-In-atomic_compare_a.patch \
17 file://0010-Fix-the-Microblaze-crash-with-msmall-divides-flag-Co.patch \
18 file://0011-Added-ashrsi3_with_size_opt-Added-ashrsi3_with_size_.patch \
19 file://0012-Use-bralid-for-profiler-calls-Signed-off-by-Edgar-E..patch \
20 file://0013-Removed-moddi3-routinue-Using-the-default-moddi3-fun.patch \
21 file://0014-Add-INIT_PRIORITY-support-Added-TARGET_ASM_CONSTRUCT.patch \
22 file://0015-Add-optimized-lshrsi3-When-barrel-shifter-is-not-pre.patch \
23 file://0016-Add-cbranchsi4_reg-This-patch-optimizes-the-generati.patch \
24 file://0017-Inline-Expansion-of-fsqrt-builtin.-The-changes-are-m.patch \
25 file://0018-microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch \
26 file://0019-Update-ashlsi3-movsf-patterns-This-patch-removes-the.patch \
27 file://0020-8-stage-pipeline-for-microblaze-This-patch-adds-the-.patch \
28 file://0021-Correct-the-const-high-double-immediate-value-with-t.patch \
29 file://0022-Fix-internal-compiler-error-with-msmall-divides-This.patch \
30 file://0023-Fix-the-calculation-of-high-word-in-a-long-long-64-b.patch \
31 file://0024-this-patch-has-1.Fixed-the-bug-in-version-calculatio.patch \
32 file://0025-Fixing-the-issue-with-the-builtin_alloc.-register-r1.patch \
33 file://0026-Removed-fsqrt-generation-for-double-values.patch \
34 file://0027-Intial-commit-of-64-bit-Microblaze.patch \
35 file://0028-Intial-commit-for-64bit-MB-sources.-Need-to-cleanup-.patch \
36 file://0029-re-arrangement-of-the-compare-branches.patch \
37 file://0030-previous-commit-broke-the-handling-of-SI-Branch-comp.patch \
38 file://0031-Support-of-multilibs-with-m64.patch \
39 file://0032-Fixed-issues-like-1-Interrupt-alignment-issue-2-Sign.patch \
40 file://0033-fixed-below-issues-Floating-point-print-issues-in-64.patch \
41 file://0034-Added-double-arith-instructions-Fixed-prologue-stack.patch \
42 file://0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch \
43 file://0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch \
44 file://0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch \
45 file://0038-fixing-the-typo-errors-in-umodsi3-file.patch \
46 file://0039-fixing-the-32bit-LTO-related-issue9-1014024.patch \
47 file://0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch \
48 file://0041-corrected-SPN-for-dlong-instruction-mapping.patch \
49 file://0042-fixing-the-long-long-long-mingw-toolchain-issue.patch \
50 file://0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch \
51 file://0044-We-will-check-the-possibility-of-peephole2-optimizat.patch \
52 file://0045-fixed-typos-in-mul-div-and-mod-assembly-files.patch \
53 file://0046-MB-64-removal-of-barrel-shift-instructions-from-defa.patch \
54 file://0047-Added-new-MB-64-single-register-arithmetic-instructi.patch \
55 file://0048-Added-support-for-64-bit-Immediate-values.patch \
56 file://0049-Fix-Compiler-crash-with-freg-struct-return-This-patc.patch \
57 file://0050-Add-TARGET_OPTION_OPTIMIZATION-and-disable-fivopts-b.patch \
58 file://0051-Reducing-Stack-space-for-arguments.patch \
59 file://0052-If-we-use-break_handler-attribute-then-interrupt-vec.patch \
60 file://0053-Add-Zero_extended-instructions.patch \
61 file://0054-Fix-failure-with-gcc.c-torture-execute-ashrdi-1.c-Os.patch \
62 file://microblaze-mulitlib-hack.patch \
63"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-source_13.3.bb
index b890fa33..b890fa33 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
index f68fec58..f16d4714 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
@@ -51,9 +51,14 @@ python check_prepare() {
51 # enable all valid instructions, since the test suite itself does not 51 # enable all valid instructions, since the test suite itself does not
52 # limit itself to the target cpu options. 52 # limit itself to the target cpu options.
53 # - valid for x86*, powerpc, arm, arm64 53 # - valid for x86*, powerpc, arm, arm64
54 if qemu_binary.lstrip("qemu-") in ["x86_64", "i386", "ppc", "arm", "aarch64"]: 54 if qemu_binary.endswith(("x86_64", "i386", "arm", "aarch64")):
55 args += ["-cpu", "max"] 55 args += ["-cpu", "max"]
56 56 elif qemu_binary.endswith(("ppc", "mips", "mips64")):
57 extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH'))
58 if extra:
59 args += extra.split()
60 # For mips64 we could set a maximal CPU (e.g. Loongson-3A4000) however they either have MSA
61 # or Loongson-MMI vector extensions, not both and qemu lacks complete support for MMI
57 sysroot = d.getVar("RECIPE_SYSROOT") 62 sysroot = d.getVar("RECIPE_SYSROOT")
58 args += ["-L", sysroot] 63 args += ["-L", sysroot]
59 # lib paths are static here instead of using $libdir since this is used by a -cross recipe 64 # lib paths are static here instead of using $libdir since this is used by a -cross recipe
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
index 66e582ca..5c75698e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -1,4 +1,4 @@
1From 31f94ef5b43a984a98f0eebd2dcf1b53aa1d7bce Mon Sep 17 00:00:00 2001 1From 553564bdcabdcc5d4cc4de73c7eb94c505ef51f5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400 3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET 4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
@@ -12,10 +12,10 @@ Upstream-Status: Inappropriate [embedded specific]
12 2 files changed, 2 insertions(+), 2 deletions(-) 12 2 files changed, 2 insertions(+), 2 deletions(-)
13 13
14diff --git a/configure b/configure 14diff --git a/configure b/configure
15index 5dcaab14ae9..f76310a36bb 100755 15index 117a7ef23f2..535265253fd 100755
16--- a/configure 16--- a/configure
17+++ b/configure 17+++ b/configure
18@@ -10165,7 +10165,7 @@ fi 18@@ -10195,7 +10195,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently. 19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}" 20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21 21
@@ -25,10 +25,10 @@ index 5dcaab14ae9..f76310a36bb 100755
25 *" newlib "*) 25 *" newlib "*)
26 case " $target_configargs " in 26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac 27diff --git a/configure.ac b/configure.ac
28index 85977482aee..8b9097c7a45 100644 28index b3e9bbd2aa5..5ac8d6490f6 100644
29--- a/configure.ac 29--- a/configure.ac
30+++ b/configure.ac 30+++ b/configure.ac
31@@ -3346,7 +3346,7 @@ fi 31@@ -3351,7 +3351,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently. 32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}" 33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34 34
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
index 5aa635b3..49230004 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
@@ -1,4 +1,4 @@
1From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001 1From 52676b5934ba127c3af39fc484c8236c8fa60b96 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 8 Mar 2021 16:04:20 -0800 3Date: Mon, 8 Mar 2021 16:04:20 -0800
4Subject: [PATCH] gcc: poison-system-directories 4Subject: [PATCH] gcc: poison-system-directories
@@ -11,7 +11,7 @@ aborted.
11Instead, we add the two missing items to the current scan. If the user 11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories". 12wants this to be a failure, they can add "-Werror=poison-system-directories".
13 13
14Upstream-Status: Pending 14Upstream-Status: Inappropriate [OE configuration]
15Signed-off-by: Mark Hatle <mark.hatle@windriver.com> 15Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com> 16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17--- 17---
@@ -20,15 +20,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 gcc/configure | 19 +++++++++++++++++++ 20 gcc/configure | 19 +++++++++++++++++++
21 gcc/configure.ac | 16 ++++++++++++++++ 21 gcc/configure.ac | 16 ++++++++++++++++
22 gcc/doc/invoke.texi | 9 +++++++++ 22 gcc/doc/invoke.texi | 9 +++++++++
23 gcc/gcc.cc | 15 ++++++++++++--- 23 gcc/gcc.cc | 9 +++++++--
24 gcc/incpath.cc | 21 +++++++++++++++++++++ 24 gcc/incpath.cc | 21 +++++++++++++++++++++
25 7 files changed, 91 insertions(+), 3 deletions(-) 25 7 files changed, 86 insertions(+), 2 deletions(-)
26 26
27diff --git a/gcc/common.opt b/gcc/common.opt 27diff --git a/gcc/common.opt b/gcc/common.opt
28index 8a0dafc52..0357868e2 100644 28index 862c474d3c8..64c4277c991 100644
29--- a/gcc/common.opt 29--- a/gcc/common.opt
30+++ b/gcc/common.opt 30+++ b/gcc/common.opt
31@@ -710,6 +710,10 @@ Wreturn-local-addr 31@@ -711,6 +711,10 @@ Wreturn-local-addr
32 Common Var(warn_return_local_addr) Init(1) Warning 32 Common Var(warn_return_local_addr) Init(1) Warning
33 Warn about returning a pointer/reference to a local or temporary variable. 33 Warn about returning a pointer/reference to a local or temporary variable.
34 34
@@ -40,10 +40,10 @@ index 8a0dafc52..0357868e2 100644
40 Common Var(warn_shadow) Warning 40 Common Var(warn_shadow) Warning
41 Warn when one variable shadows another. Same as -Wshadow=global. 41 Warn when one variable shadows another. Same as -Wshadow=global.
42diff --git a/gcc/config.in b/gcc/config.in 42diff --git a/gcc/config.in b/gcc/config.in
43index 64c27c9cf..a693cb8a8 100644 43index 4cad077bfbe..80e832fdb84 100644
44--- a/gcc/config.in 44--- a/gcc/config.in
45+++ b/gcc/config.in 45+++ b/gcc/config.in
46@@ -230,6 +230,16 @@ 46@@ -236,6 +236,16 @@
47 #endif 47 #endif
48 48
49 49
@@ -61,10 +61,10 @@ index 64c27c9cf..a693cb8a8 100644
61 optimizer and back end) to be checked for dynamic type safety at runtime. 61 optimizer and back end) to be checked for dynamic type safety at runtime.
62 This is quite expensive. */ 62 This is quite expensive. */
63diff --git a/gcc/configure b/gcc/configure 63diff --git a/gcc/configure b/gcc/configure
64index 2b83acfb0..8bb97578c 100755 64index c7b26d1927d..3508be7b439 100755
65--- a/gcc/configure 65--- a/gcc/configure
66+++ b/gcc/configure 66+++ b/gcc/configure
67@@ -1023,6 +1023,7 @@ enable_maintainer_mode 67@@ -1026,6 +1026,7 @@ enable_maintainer_mode
68 enable_link_mutex 68 enable_link_mutex
69 enable_link_serialization 69 enable_link_serialization
70 enable_version_specific_runtime_libs 70 enable_version_specific_runtime_libs
@@ -72,7 +72,7 @@ index 2b83acfb0..8bb97578c 100755
72 enable_plugin 72 enable_plugin
73 enable_host_shared 73 enable_host_shared
74 enable_libquadmath_support 74 enable_libquadmath_support
75@@ -1785,6 +1786,8 @@ Optional Features: 75@@ -1788,6 +1789,8 @@ Optional Features:
76 --enable-version-specific-runtime-libs 76 --enable-version-specific-runtime-libs
77 specify that runtime libraries should be installed 77 specify that runtime libraries should be installed
78 in a compiler-specific directory 78 in a compiler-specific directory
@@ -81,7 +81,7 @@ index 2b83acfb0..8bb97578c 100755
81 --enable-plugin enable plugin support 81 --enable-plugin enable plugin support
82 --enable-host-shared build host code as shared libraries 82 --enable-host-shared build host code as shared libraries
83 --disable-libquadmath-support 83 --disable-libquadmath-support
84@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : 84@@ -31753,6 +31756,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
85 fi 85 fi
86 86
87 87
@@ -105,10 +105,10 @@ index 2b83acfb0..8bb97578c 100755
105 105
106 106
107diff --git a/gcc/configure.ac b/gcc/configure.ac 107diff --git a/gcc/configure.ac b/gcc/configure.ac
108index daf2a708c..6155b83a7 100644 108index 09082e8ccae..6cd01a8966b 100644
109--- a/gcc/configure.ac 109--- a/gcc/configure.ac
110+++ b/gcc/configure.ac 110+++ b/gcc/configure.ac
111@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs, 111@@ -7292,6 +7292,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
112 [specify that runtime libraries should be 112 [specify that runtime libraries should be
113 installed in a compiler-specific directory])]) 113 installed in a compiler-specific directory])])
114 114
@@ -132,37 +132,37 @@ index daf2a708c..6155b83a7 100644
132 AC_SUBST(subdirs) 132 AC_SUBST(subdirs)
133 AC_SUBST(srcdir) 133 AC_SUBST(srcdir)
134diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 134diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
135index ff6c338be..a8ebfa59a 100644 135index de40f62e219..d6f203c8b71 100644
136--- a/gcc/doc/invoke.texi 136--- a/gcc/doc/invoke.texi
137+++ b/gcc/doc/invoke.texi 137+++ b/gcc/doc/invoke.texi
138@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}. 138@@ -384,6 +384,7 @@ Objective-C and Objective-C++ Dialects}.
139 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol 139 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
140 -Wparentheses -Wno-pedantic-ms-format @gol 140 -Wparentheses -Wno-pedantic-ms-format
141 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol 141 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
142+-Wno-poison-system-directories @gol 142+-Wno-poison-system-directories
143 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol 143 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
144 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol 144 -Wrestrict -Wno-return-local-addr -Wreturn-type
145 -Wno-scalar-storage-order -Wsequence-point @gol 145 -Wno-scalar-storage-order -Wsequence-point
146@@ -8029,6 +8030,14 @@ made up of data only and thus requires no special treatment. But, for 146@@ -8426,6 +8427,14 @@ made up of data only and thus requires no special treatment. But, for
147 most targets, it is made up of code and thus requires the stack to be 147 most targets, it is made up of code and thus requires the stack to be
148 made executable in order for the program to work properly. 148 made executable in order for the program to work properly.
149 149
150+@item -Wno-poison-system-directories
151+@opindex Wno-poison-system-directories 150+@opindex Wno-poison-system-directories
151+@item -Wno-poison-system-directories
152+Do not warn for @option{-I} or @option{-L} options using system 152+Do not warn for @option{-I} or @option{-L} options using system
153+directories such as @file{/usr/include} when cross compiling. This 153+directories such as @file{/usr/include} when cross compiling. This
154+option is intended for use in chroot environments when such 154+option is intended for use in chroot environments when such
155+directories contain the correct headers and libraries for the target 155+directories contain the correct headers and libraries for the target
156+system rather than the host. 156+system rather than the host.
157+ 157+
158 @item -Wfloat-equal
159 @opindex Wfloat-equal 158 @opindex Wfloat-equal
160 @opindex Wno-float-equal 159 @opindex Wno-float-equal
160 @item -Wfloat-equal
161diff --git a/gcc/gcc.cc b/gcc/gcc.cc 161diff --git a/gcc/gcc.cc b/gcc/gcc.cc
162index beefde7f6..4e6557b3c 100644 162index 16bb07f2cdc..5feae021545 100644
163--- a/gcc/gcc.cc 163--- a/gcc/gcc.cc
164+++ b/gcc/gcc.cc 164+++ b/gcc/gcc.cc
165@@ -1162,6 +1162,8 @@ proper position among the other output files. */ 165@@ -1146,6 +1146,8 @@ proper position among the other output files. */
166 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ 166 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
167 "%X %{o*} %{e*} %{N} %{n} %{r}\ 167 "%X %{o*} %{e*} %{N} %{n} %{r}\
168 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ 168 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@@ -171,7 +171,7 @@ index beefde7f6..4e6557b3c 100644
171 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ 171 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
172 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ 172 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
173 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ 173 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
174@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options = 174@@ -1241,8 +1243,11 @@ static const char *cpp_unique_options =
175 static const char *cpp_options = 175 static const char *cpp_options =
176 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ 176 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
177 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ 177 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
@@ -179,27 +179,14 @@ index beefde7f6..4e6557b3c 100644
179- %{undef} %{save-temps*:-fpch-preprocess}"; 179- %{undef} %{save-temps*:-fpch-preprocess}";
180+ %{!fno-working-directory:-fworking-directory}}} %{O*}" 180+ %{!fno-working-directory:-fworking-directory}}} %{O*}"
181+#ifdef POISON_BY_DEFAULT 181+#ifdef POISON_BY_DEFAULT
182+ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}" 182+ " -Werror=poison-system-directories"
183+#endif 183+#endif
184+ " %{undef} %{save-temps*:-fpch-preprocess}"; 184+ " %{undef} %{save-temps*:-fpch-preprocess}";
185 185
186 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. 186 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
187 187
188@@ -1287,7 +1292,11 @@ static const char *cc1_options =
189 %{coverage:-fprofile-arcs -ftest-coverage}\
190 %{fprofile-arcs|fprofile-generate*|coverage:\
191 %{!fprofile-update=single:\
192- %{pthread:-fprofile-update=prefer-atomic}}}";
193+ %{pthread:-fprofile-update=prefer-atomic}}}"
194+#ifdef POISON_BY_DEFAULT
195+ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
196+#endif
197+ ;
198
199 static const char *asm_options =
200 "%{-target-help:%:print-asm-header()} "
201diff --git a/gcc/incpath.cc b/gcc/incpath.cc 188diff --git a/gcc/incpath.cc b/gcc/incpath.cc
202index 622204a38..5ac03c086 100644 189index 4d44321183f..46c0d543205 100644
203--- a/gcc/incpath.cc 190--- a/gcc/incpath.cc
204+++ b/gcc/incpath.cc 191+++ b/gcc/incpath.cc
205@@ -26,6 +26,7 @@ 192@@ -26,6 +26,7 @@
@@ -221,17 +208,17 @@ index 622204a38..5ac03c086 100644
221+ struct cpp_dir *p; 208+ struct cpp_dir *p;
222+ 209+
223+ for (p = heads[INC_QUOTE]; p; p = p->next) 210+ for (p = heads[INC_QUOTE]; p; p = p->next)
224+ { 211+ {
225+ if ((!strncmp (p->name, "/usr/include", 12)) 212+ if ((!strncmp (p->name, "/usr/include", 12))
226+ || (!strncmp (p->name, "/usr/local/include", 18)) 213+ || (!strncmp (p->name, "/usr/local/include", 18))
227+ || (!strncmp (p->name, "/usr/X11R6/include", 18)) 214+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
228+ || (!strncmp (p->name, "/sw/include", 11)) 215+ || (!strncmp (p->name, "/sw/include", 11))
229+ || (!strncmp (p->name, "/opt/include", 12))) 216+ || (!strncmp (p->name, "/opt/include", 12)))
230+ warning (OPT_Wpoison_system_directories, 217+ warning (OPT_Wpoison_system_directories,
231+ "include location \"%s\" is unsafe for " 218+ "include location \"%s\" is unsafe for "
232+ "cross-compilation", 219+ "cross-compilation",
233+ p->name); 220+ p->name);
234+ } 221+ }
235+ } 222+ }
236+#endif 223+#endif
237 } 224 }
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
index e83f05b8..69e7fa0b 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
@@ -1,7 +1,7 @@
1From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001 1From febfac59d0e8a864370d0b4018b4e497ceec156d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400 3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH] 64-bit multilib hack. 4Subject: [PATCH] 64-bit multilib hack
5 5
6GCC has internal multilib handling code but it assumes a very specific rigid directory 6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows 7layout. The build system implementation of multilib layout is very generic and allows
@@ -28,18 +28,19 @@ Upstream-Status: Inappropriate [OE-Specific]
28Signed-off-by: Khem Raj <raj.khem@gmail.com> 28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com> 29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
30Signed-off-by: Mark Hatle <mark.hatle@windriver.com> 30Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
31Signed-off-by: Khem Raj <raj.khem@gmail.com> 31Signed-off-by: Zang Ruochen <zangruochen@loongson.cn>
32--- 32---
33 gcc/config/aarch64/t-aarch64-linux | 8 ++++---- 33 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
34 gcc/config/arc/t-multilib-linux | 4 ++-- 34 gcc/config/arc/t-multilib-linux | 4 ++--
35 gcc/config/i386/t-linux64 | 6 ++---- 35 gcc/config/i386/t-linux64 | 6 ++----
36 gcc/config/mips/t-linux64 | 10 +++------- 36 gcc/config/mips/t-linux64 | 28 ++--------------------------
37 gcc/config/riscv/t-linux | 6 ++++-- 37 gcc/config/riscv/t-linux | 4 ++--
38 gcc/config/rs6000/t-linux64 | 5 ++--- 38 gcc/config/rs6000/t-linux64 | 5 ++---
39 6 files changed, 17 insertions(+), 22 deletions(-) 39 gcc/config/loongarch/t-linux | 34 ++++++++++++++++++----------------
40 7 files changed, 32 insertions(+), 57 deletions(-)
40 41
41diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux 42diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
42index d0cd546002a..f4056d68372 100644 43index 57bf4100fcd..aaef5da8059 100644
43--- a/gcc/config/aarch64/t-aarch64-linux 44--- a/gcc/config/aarch64/t-aarch64-linux
44+++ b/gcc/config/aarch64/t-aarch64-linux 45+++ b/gcc/config/aarch64/t-aarch64-linux
45@@ -21,8 +21,8 @@ 46@@ -21,8 +21,8 @@
@@ -56,7 +57,7 @@ index d0cd546002a..f4056d68372 100644
56-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) 57-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
57+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) 58+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
58diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux 59diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
59index ecb9ae6859f..12a164028d4 100644 60index a839e4ea67c..f92664573a9 100644
60--- a/gcc/config/arc/t-multilib-linux 61--- a/gcc/config/arc/t-multilib-linux
61+++ b/gcc/config/arc/t-multilib-linux 62+++ b/gcc/config/arc/t-multilib-linux
62@@ -16,9 +16,9 @@ 63@@ -16,9 +16,9 @@
@@ -72,7 +73,7 @@ index ecb9ae6859f..12a164028d4 100644
72 # Aliases: 73 # Aliases:
73 MULTILIB_MATCHES += mcpu?arc700=mA7 74 MULTILIB_MATCHES += mcpu?arc700=mA7
74diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 75diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
75index 5526ad0e6cc..fa51c88912b 100644 76index 138956b0962..d6e0cdc4342 100644
76--- a/gcc/config/i386/t-linux64 77--- a/gcc/config/i386/t-linux64
77+++ b/gcc/config/i386/t-linux64 78+++ b/gcc/config/i386/t-linux64
78@@ -32,7 +32,5 @@ 79@@ -32,7 +32,5 @@
@@ -86,37 +87,53 @@ index 5526ad0e6cc..fa51c88912b 100644
86+MULTILIB_DIRNAMES = . . 87+MULTILIB_DIRNAMES = . .
87+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) 88+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
88diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 89diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
89index 2fdd8e00407..04f2099250f 100644 90index 176091cabb6..8258ef40559 100644
90--- a/gcc/config/mips/t-linux64 91--- a/gcc/config/mips/t-linux64
91+++ b/gcc/config/mips/t-linux64 92+++ b/gcc/config/mips/t-linux64
92@@ -17,10 +17,6 @@ 93@@ -17,29 +17,5 @@
93 # <http://www.gnu.org/licenses/>. 94 # <http://www.gnu.org/licenses/>.
94 95
95 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64 96 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
96-MULTILIB_DIRNAMES = n32 32 64 97-MULTILIB_DIRNAMES = n32 32 64
97-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el) 98-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
98-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft) 99-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
99-MULTILIB_OSDIRNAMES = \ 100-ifeq (yes,$(enable_multiarch))
101- ifneq (,$(findstring gnuabi64,$(target)))
102- MULTILIB_OSDIRNAMES = \
103- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
104- ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
105- ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
106- else ifneq (,$(findstring gnuabin32,$(target)))
107- MULTILIB_OSDIRNAMES = \
108- ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
109- ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
110- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
111- else
112- MULTILIB_OSDIRNAMES = \
100- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ 113- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
101- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ 114- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
102- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) 115- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
116- endif
117-else
118- MULTILIB_OSDIRNAMES = \
119- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
120- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
121- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
122-endif
103+MULTILIB_DIRNAMES = . . . 123+MULTILIB_DIRNAMES = . . .
104+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) 124+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
105+
106diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux 125diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
107index 216d2776a18..e4d817621fc 100644 126index 216d2776a18..e3c520f4bf6 100644
108--- a/gcc/config/riscv/t-linux 127--- a/gcc/config/riscv/t-linux
109+++ b/gcc/config/riscv/t-linux 128+++ b/gcc/config/riscv/t-linux
110@@ -1,3 +1,5 @@ 129@@ -1,3 +1,3 @@
111 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ 130 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
112-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) 131-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
113-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) 132-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
114+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) 133+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
115+MULTILIB_DIRNAMES := . .
116+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) 134+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
117+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
118diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 135diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
119index 47e0efd5764..05f5a3f188e 100644 136index 01a94242308..1429eceaebf 100644
120--- a/gcc/config/rs6000/t-linux64 137--- a/gcc/config/rs6000/t-linux64
121+++ b/gcc/config/rs6000/t-linux64 138+++ b/gcc/config/rs6000/t-linux64
122@@ -26,10 +26,9 @@ 139@@ -26,10 +26,9 @@
@@ -132,3 +149,53 @@ index 47e0efd5764..05f5a3f188e 100644
132 149
133 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc 150 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
134 $(COMPILE) $< 151 $(COMPILE) $<
152diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux
153index e40da1792..0c7ec9f8a 100644
154--- a/gcc/config/loongarch/t-linux
155+++ b/gcc/config/loongarch/t-linux
156@@ -18,7 +18,9 @@
157
158 # Multilib
159 MULTILIB_OPTIONS = mabi=lp64d/mabi=lp64f/mabi=lp64s
160-MULTILIB_DIRNAMES = base/lp64d base/lp64f base/lp64s
161+#MULTILIB_DIRNAMES = base/lp64d base/lp64f base/lp64s
162+MULTILIB_DIRNAMES = . . .
163+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
164
165 # The GCC driver always gets all abi-related options on the command line.
166 # (see loongarch-driver.c:driver_get_normalized_m_opts)
167@@ -36,18 +38,18 @@ else
168 endif
169
170 # Don't define MULTILIB_OSDIRNAMES if multilib is disabled.
171-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
172-
173- MULTILIB_OSDIRNAMES = \
174- mabi.lp64d=../lib64$\
175- $(call if_multiarch,:loongarch64-linux-gnu)
176-
177- MULTILIB_OSDIRNAMES += \
178- mabi.lp64f=../lib64/f32$\
179- $(call if_multiarch,:loongarch64-linux-gnuf32)
180-
181- MULTILIB_OSDIRNAMES += \
182- mabi.lp64s=../lib64/sf$\
183- $(call if_multiarch,:loongarch64-linux-gnusf)
184-
185-endif
186+#ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
187+#
188+# MULTILIB_OSDIRNAMES = \
189+# mabi.lp64d=../lib64$\
190+# $(call if_multiarch,:loongarch64-linux-gnu)
191+#
192+# MULTILIB_OSDIRNAMES += \
193+# mabi.lp64f=../lib64/f32$\
194+# $(call if_multiarch,:loongarch64-linux-gnuf32)
195+#
196+# MULTILIB_OSDIRNAMES += \
197+# mabi.lp64s=../lib64/sf$\
198+# $(call if_multiarch,:loongarch64-linux-gnusf)
199+#
200+#endif
201
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
index e8f21634..7e33bf17 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
@@ -1,4 +1,4 @@
1From 7f40f8321fb999e9b34d948724517d3fb0d26820 Mon Sep 17 00:00:00 2001 1From 6fbf920ccde6efc2d0caafde996d9e5738a1ba37 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 28 Oct 2021 11:33:40 +0100 3Date: Thu, 28 Oct 2021 11:33:40 +0100
4Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these 4Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these
@@ -13,7 +13,7 @@ ChangeLog:
13 * Makefile.in: Regenerate. 13 * Makefile.in: Regenerate.
14 * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides 14 * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
15 15
16Upstream-Status: Pending [should be submittable] 16Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612560.html]
17 17
18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
19Signed-off-by: Khem Raj <raj.khem@gmail.com> 19Signed-off-by: Khem Raj <raj.khem@gmail.com>
@@ -23,10 +23,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
23 2 files changed, 4 insertions(+) 23 2 files changed, 4 insertions(+)
24 24
25diff --git a/Makefile.in b/Makefile.in 25diff --git a/Makefile.in b/Makefile.in
26index 593495e1650..1d9c83cc566 100644 26index 06a9398e172..4b0069b257c 100644
27--- a/Makefile.in 27--- a/Makefile.in
28+++ b/Makefile.in 28+++ b/Makefile.in
29@@ -176,6 +176,7 @@ BUILD_EXPORTS = \ 29@@ -178,6 +178,7 @@ BUILD_EXPORTS = \
30 # built for the build system to override those in BASE_FLAGS_TO_PASS. 30 # built for the build system to override those in BASE_FLAGS_TO_PASS.
31 EXTRA_BUILD_FLAGS = \ 31 EXTRA_BUILD_FLAGS = \
32 CFLAGS="$(CFLAGS_FOR_BUILD)" \ 32 CFLAGS="$(CFLAGS_FOR_BUILD)" \
@@ -34,7 +34,7 @@ index 593495e1650..1d9c83cc566 100644
34 LDFLAGS="$(LDFLAGS_FOR_BUILD)" 34 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
35 35
36 # This is the list of directories to built for the host system. 36 # This is the list of directories to built for the host system.
37@@ -207,6 +208,7 @@ HOST_EXPORTS = \ 37@@ -210,6 +211,7 @@ HOST_EXPORTS = \
38 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ 38 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
39 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ 39 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
40 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ 40 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
@@ -43,10 +43,10 @@ index 593495e1650..1d9c83cc566 100644
43 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ 43 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
44 LD="$(LD)"; export LD; \ 44 LD="$(LD)"; export LD; \
45diff --git a/Makefile.tpl b/Makefile.tpl 45diff --git a/Makefile.tpl b/Makefile.tpl
46index ef58fac2b9a..bab04f335c2 100644 46index dfbd74b68f8..419b332953b 100644
47--- a/Makefile.tpl 47--- a/Makefile.tpl
48+++ b/Makefile.tpl 48+++ b/Makefile.tpl
49@@ -179,6 +179,7 @@ BUILD_EXPORTS = \ 49@@ -181,6 +181,7 @@ BUILD_EXPORTS = \
50 # built for the build system to override those in BASE_FLAGS_TO_PASS. 50 # built for the build system to override those in BASE_FLAGS_TO_PASS.
51 EXTRA_BUILD_FLAGS = \ 51 EXTRA_BUILD_FLAGS = \
52 CFLAGS="$(CFLAGS_FOR_BUILD)" \ 52 CFLAGS="$(CFLAGS_FOR_BUILD)" \
@@ -54,7 +54,7 @@ index ef58fac2b9a..bab04f335c2 100644
54 LDFLAGS="$(LDFLAGS_FOR_BUILD)" 54 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
55 55
56 # This is the list of directories to built for the host system. 56 # This is the list of directories to built for the host system.
57@@ -210,6 +211,7 @@ HOST_EXPORTS = \ 57@@ -213,6 +214,7 @@ HOST_EXPORTS = \
58 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ 58 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
59 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ 59 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
60 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ 60 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
index e34eb2cf..db2fea3d 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -1,4 +1,4 @@
1From 5455fc1de74897a27c1199dc5611ec02243e24af Mon Sep 17 00:00:00 2001 1From 2cedf13819c0cc929660072d8a972f5e422f9701 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400 3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B} 4Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
@@ -7,16 +7,16 @@ Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
7the source can be shared between gcc-cross-initial, 7the source can be shared between gcc-cross-initial,
8gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build. 8gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
9 9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Pending
13
14While compiling gcc-crosssdk-initial-x86_64 on some host, there is 10While compiling gcc-crosssdk-initial-x86_64 on some host, there is
15occasionally failure that test the existance of default.h doesn't 11occasionally failure that test the existance of default.h doesn't
16work, the reason is tm_include_list='** defaults.h' rather than 12work, the reason is tm_include_list='** defaults.h' rather than
17tm_include_list='** ./defaults.h' 13tm_include_list='** ./defaults.h'
18 14
19So we add the test condition for this situation. 15So we add the test condition for this situation.
16
17Upstream-Status: Inappropriate [embedded specific]
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21--- 21---
22 gcc/Makefile.in | 2 +- 22 gcc/Makefile.in | 2 +-
@@ -26,10 +26,10 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
26 4 files changed, 7 insertions(+), 7 deletions(-) 26 4 files changed, 7 insertions(+), 7 deletions(-)
27 27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in 28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 31ff95500c9..a8277254696 100644 29index 775aaa1b3c4..04f28984b34 100644
30--- a/gcc/Makefile.in 30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in 31+++ b/gcc/Makefile.in
32@@ -553,7 +553,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ 32@@ -561,7 +561,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
33 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ 33 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
34 34
35 xmake_file=@xmake_file@ 35 xmake_file=@xmake_file@
@@ -39,10 +39,10 @@ index 31ff95500c9..a8277254696 100644
39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ 39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ 40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
41diff --git a/gcc/configure b/gcc/configure 41diff --git a/gcc/configure b/gcc/configure
42index dc2d59701ad..3fc0e2f5813 100755 42index 3508be7b439..cf773a8b854 100755
43--- a/gcc/configure 43--- a/gcc/configure
44+++ b/gcc/configure 44+++ b/gcc/configure
45@@ -13381,8 +13381,8 @@ for f in $tm_file; do 45@@ -13507,8 +13507,8 @@ for f in $tm_file; do
46 tm_include_list="${tm_include_list} $f" 46 tm_include_list="${tm_include_list} $f"
47 ;; 47 ;;
48 defaults.h ) 48 defaults.h )
@@ -54,10 +54,10 @@ index dc2d59701ad..3fc0e2f5813 100755
54 * ) 54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f" 55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56diff --git a/gcc/configure.ac b/gcc/configure.ac 56diff --git a/gcc/configure.ac b/gcc/configure.ac
57index 36ce78924de..46de496b256 100644 57index 6cd01a8966b..22591478b72 100644
58--- a/gcc/configure.ac 58--- a/gcc/configure.ac
59+++ b/gcc/configure.ac 59+++ b/gcc/configure.ac
60@@ -2332,8 +2332,8 @@ for f in $tm_file; do 60@@ -2357,8 +2357,8 @@ for f in $tm_file; do
61 tm_include_list="${tm_include_list} $f" 61 tm_include_list="${tm_include_list} $f"
62 ;; 62 ;;
63 defaults.h ) 63 defaults.h )
@@ -69,7 +69,7 @@ index 36ce78924de..46de496b256 100644
69 * ) 69 * )
70 tm_file_list="${tm_file_list} \$(srcdir)/config/$f" 70 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
71diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh 71diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
72index 91cc43f69ff..8de33713cd8 100644 72index 054ede89647..3b2c2b9df37 100644
73--- a/gcc/mkconfig.sh 73--- a/gcc/mkconfig.sh
74+++ b/gcc/mkconfig.sh 74+++ b/gcc/mkconfig.sh
75@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then 75@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
index b08aecc7..704c44cb 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
@@ -1,4 +1,4 @@
1From abc3b82ab24169277f2090e9df1ceac3573142be Mon Sep 17 00:00:00 2001 1From f0b4d02a3a3dca1d67fd7add15ed63c2cd572bb9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400 3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH] cpp: honor sysroot. 4Subject: [PATCH] cpp: honor sysroot.
@@ -17,16 +17,16 @@ The fix below adds %I to the cpp-output spec macro so the default substitutions
17 17
18RP 2012/04/13 18RP 2012/04/13
19 19
20Signed-off-by: Khem Raj <raj.khem@gmail.com> 20Upstream-Status: Inappropriate [embedded specific]
21 21
22Upstream-Status: Pending 22Signed-off-by: Khem Raj <raj.khem@gmail.com>
23--- 23---
24 gcc/cp/lang-specs.h | 2 +- 24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.cc | 2 +- 25 gcc/gcc.cc | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-) 26 2 files changed, 2 insertions(+), 2 deletions(-)
27 27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h 28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index f35c9fab76b..19ddc98ce7f 100644 29index c591d155cc1..61927869fe1 100644
30--- a/gcc/cp/lang-specs.h 30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h 31+++ b/gcc/cp/lang-specs.h
32@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see 32@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see
@@ -39,11 +39,11 @@ index f35c9fab76b..19ddc98ce7f 100644
39 " %{fmodule-only:%{!S:-o %g.s%V}}" 39 " %{fmodule-only:%{!S:-o %g.s%V}}"
40 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" 40 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
41diff --git a/gcc/gcc.cc b/gcc/gcc.cc 41diff --git a/gcc/gcc.cc b/gcc/gcc.cc
42index ce161d3c853..aa4cf92fb78 100644 42index 5feae021545..8af0c814c33 100644
43--- a/gcc/gcc.cc 43--- a/gcc/gcc.cc
44+++ b/gcc/gcc.cc 44+++ b/gcc/gcc.cc
45@@ -1476,7 +1476,7 @@ static const struct compiler default_compilers[] = 45@@ -1468,7 +1468,7 @@ static const struct compiler default_compilers[] =
46 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, 46 %W{o*:--output-pch %*}}%V}}}}}}}", 0, 0, 0},
47 {".i", "@cpp-output", 0, 0, 0}, 47 {".i", "@cpp-output", 0, 0, 0},
48 {"@cpp-output", 48 {"@cpp-output",
49- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, 49- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
index b59eed57..9de883c2 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -1,4 +1,4 @@
1From 4de00af67b57b5440bdf61ab364ad959ad0aeee7 Mon Sep 17 00:00:00 2001 1From 4067ae345f0ff1fbf37c0348f2af09257513b817 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400 3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER 4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
@@ -12,8 +12,6 @@ SH, sparc, alpha for possible future support (if any)
12 12
13Removes the do_headerfix task in metadata 13Removes the do_headerfix task in metadata
14 14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration] 15Upstream-Status: Inappropriate [OE configuration]
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 16Signed-off-by: Khem Raj <raj.khem@gmail.com>
19--- 17---
@@ -38,7 +36,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
38 18 files changed, 53 insertions(+), 58 deletions(-) 36 18 files changed, 53 insertions(+), 58 deletions(-)
39 37
40diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h 38diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
41index 5e4553d79f5..877e8841eb2 100644 39index 4277f03da2a..e4c92c03291 100644
42--- a/gcc/config/aarch64/aarch64-linux.h 40--- a/gcc/config/aarch64/aarch64-linux.h
43+++ b/gcc/config/aarch64/aarch64-linux.h 41+++ b/gcc/config/aarch64/aarch64-linux.h
44@@ -21,10 +21,10 @@ 42@@ -21,10 +21,10 @@
@@ -55,7 +53,7 @@ index 5e4553d79f5..877e8841eb2 100644
55 #undef ASAN_CC1_SPEC 53 #undef ASAN_CC1_SPEC
56 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" 54 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
57diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h 55diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
58index 17f16a55910..0a7be38fa63 100644 56index 03f783f2ad1..4fa02668aa7 100644
59--- a/gcc/config/alpha/linux-elf.h 57--- a/gcc/config/alpha/linux-elf.h
60+++ b/gcc/config/alpha/linux-elf.h 58+++ b/gcc/config/alpha/linux-elf.h
61@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see 59@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
@@ -70,10 +68,10 @@ index 17f16a55910..0a7be38fa63 100644
70 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" 68 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
71 #elif DEFAULT_LIBC == LIBC_GLIBC 69 #elif DEFAULT_LIBC == LIBC_GLIBC
72diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h 70diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
73index 50cc0bc6d08..17c18b27145 100644 71index a119875599d..dce7f59eeea 100644
74--- a/gcc/config/arm/linux-eabi.h 72--- a/gcc/config/arm/linux-eabi.h
75+++ b/gcc/config/arm/linux-eabi.h 73+++ b/gcc/config/arm/linux-eabi.h
76@@ -65,8 +65,8 @@ 74@@ -62,8 +62,8 @@
77 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */ 75 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
78 76
79 #undef GLIBC_DYNAMIC_LINKER 77 #undef GLIBC_DYNAMIC_LINKER
@@ -84,7 +82,7 @@ index 50cc0bc6d08..17c18b27145 100644
84 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT 82 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
85 83
86 #define GLIBC_DYNAMIC_LINKER \ 84 #define GLIBC_DYNAMIC_LINKER \
87@@ -89,7 +89,7 @@ 85@@ -86,7 +86,7 @@
88 #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" 86 #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
89 #endif 87 #endif
90 #define MUSL_DYNAMIC_LINKER \ 88 #define MUSL_DYNAMIC_LINKER \
@@ -94,7 +92,7 @@ index 50cc0bc6d08..17c18b27145 100644
94 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to 92 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
95 use the GNU/Linux version, not the generic BPABI version. */ 93 use the GNU/Linux version, not the generic BPABI version. */
96diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h 94diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
97index df3da67c4f0..37456e9d5a4 100644 95index 7b7b7cbbe14..98ef2267117 100644
98--- a/gcc/config/arm/linux-elf.h 96--- a/gcc/config/arm/linux-elf.h
99+++ b/gcc/config/arm/linux-elf.h 97+++ b/gcc/config/arm/linux-elf.h
100@@ -60,7 +60,7 @@ 98@@ -60,7 +60,7 @@
@@ -107,7 +105,7 @@ index df3da67c4f0..37456e9d5a4 100644
107 #define LINUX_TARGET_LINK_SPEC "%{h*} \ 105 #define LINUX_TARGET_LINK_SPEC "%{h*} \
108 %{static:-Bstatic} \ 106 %{static:-Bstatic} \
109diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h 107diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
110index 5d99ee56d5b..a76022c9ccc 100644 108index bbb7cc7115e..7d9272040ee 100644
111--- a/gcc/config/i386/linux.h 109--- a/gcc/config/i386/linux.h
112+++ b/gcc/config/i386/linux.h 110+++ b/gcc/config/i386/linux.h
113@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see 111@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
@@ -121,7 +119,7 @@ index 5d99ee56d5b..a76022c9ccc 100644
121-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" 119-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
122+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1" 120+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
123diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h 121diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
124index 8681e36f10d..ddce49b6b60 100644 122index 2bd9f48e271..dbbe7ca5440 100644
125--- a/gcc/config/i386/linux64.h 123--- a/gcc/config/i386/linux64.h
126+++ b/gcc/config/i386/linux64.h 124+++ b/gcc/config/i386/linux64.h
127@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 125@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@@ -145,10 +143,10 @@ index 8681e36f10d..ddce49b6b60 100644
145-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" 143-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
146+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1" 144+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
147diff --git a/gcc/config/linux.h b/gcc/config/linux.h 145diff --git a/gcc/config/linux.h b/gcc/config/linux.h
148index 74f70793d90..4ce173384ef 100644 146index e3aca79cccc..6491c6b84f5 100644
149--- a/gcc/config/linux.h 147--- a/gcc/config/linux.h
150+++ b/gcc/config/linux.h 148+++ b/gcc/config/linux.h
151@@ -99,10 +99,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 149@@ -86,10 +86,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
152 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or 150 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
153 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets 151 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
154 supporting both 32-bit and 64-bit compilation. */ 152 supporting both 32-bit and 64-bit compilation. */
@@ -164,25 +162,30 @@ index 74f70793d90..4ce173384ef 100644
164 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" 162 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
165 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" 163 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
166diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h 164diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
167index 664dc9206ad..082bd7cfc6f 100644 165index aecaa02a199..62f88f7f9a2 100644
168--- a/gcc/config/loongarch/gnu-user.h 166--- a/gcc/config/loongarch/gnu-user.h
169+++ b/gcc/config/loongarch/gnu-user.h 167+++ b/gcc/config/loongarch/gnu-user.h
170@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see 168@@ -31,16 +31,16 @@ along with GCC; see the file COPYING3. If not see
171 169
172 #undef GLIBC_DYNAMIC_LINKER 170 #undef GLIBC_DYNAMIC_LINKER
173 #define GLIBC_DYNAMIC_LINKER \ 171 #define GLIBC_DYNAMIC_LINKER \
174- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1" 172- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
175+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1" 173+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1"
174
175 #define MUSL_ABI_SPEC \
176 "%{mabi=lp64d:}" \
177 "%{mabi=lp64f:-sp}" \
178 "%{mabi=lp64s:-sf}"
176 179
177 #undef MUSL_DYNAMIC_LINKER 180 #undef MUSL_DYNAMIC_LINKER
178 #define MUSL_DYNAMIC_LINKER \ 181 #define MUSL_DYNAMIC_LINKER \
179- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1" 182- "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1"
180+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1" 183+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1"
181 184
182 #undef GNU_USER_TARGET_LINK_SPEC 185 #undef GNU_USER_TARGET_LINK_SPEC
183 #define GNU_USER_TARGET_LINK_SPEC \ 186 #define GNU_USER_TARGET_LINK_SPEC \
184diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h 187diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h
185index 5b1a365eda4..2e63df1ae9c 100644 188index 5ed8ee518be..299d1a62c81 100644
186--- a/gcc/config/microblaze/linux.h 189--- a/gcc/config/microblaze/linux.h
187+++ b/gcc/config/microblaze/linux.h 190+++ b/gcc/config/microblaze/linux.h
188@@ -28,7 +28,7 @@ 191@@ -28,7 +28,7 @@
@@ -190,7 +193,7 @@ index 5b1a365eda4..2e63df1ae9c 100644
190 #define TLS_NEEDS_GOT 1 193 #define TLS_NEEDS_GOT 1
191 194
192-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" 195-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
193+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "/ld.so.1" 196+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
194 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" 197 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
195 198
196 #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */ 199 #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
@@ -204,7 +207,7 @@ index 5b1a365eda4..2e63df1ae9c 100644
204 #undef SUBTARGET_EXTRA_SPECS 207 #undef SUBTARGET_EXTRA_SPECS
205 #define SUBTARGET_EXTRA_SPECS \ 208 #define SUBTARGET_EXTRA_SPECS \
206diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h 209diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
207index 230b7789bb8..d96d134bfcf 100644 210index 5add34ea134..34692b433b8 100644
208--- a/gcc/config/mips/linux.h 211--- a/gcc/config/mips/linux.h
209+++ b/gcc/config/mips/linux.h 212+++ b/gcc/config/mips/linux.h
210@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see 213@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see
@@ -247,22 +250,24 @@ index 230b7789bb8..d96d134bfcf 100644
247 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" 250 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
248 #define GNU_USER_DYNAMIC_LINKERN32 \ 251 #define GNU_USER_DYNAMIC_LINKERN32 \
249diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h 252diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
250index f5dd813acad..7a13e1c9799 100644 253index 2ce097ebbce..1d45d7b4962 100644
251--- a/gcc/config/nios2/linux.h 254--- a/gcc/config/nios2/linux.h
252+++ b/gcc/config/nios2/linux.h 255+++ b/gcc/config/nios2/linux.h
253@@ -29,8 +29,8 @@ 256@@ -29,10 +29,10 @@
254 #undef CPP_SPEC 257 #undef CPP_SPEC
255 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 258 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
256 259
257-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1" 260-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
258-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
259+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-nios2.so.1" 261+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-nios2.so.1"
262
263 #undef MUSL_DYNAMIC_LINKER
264-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
260+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1" 265+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1"
261 266
262 #undef LINK_SPEC 267 #undef LINK_SPEC
263 #define LINK_SPEC LINK_SPEC_ENDIAN \ 268 #define LINK_SPEC LINK_SPEC_ENDIAN \
264diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h 269diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
265index 38803723ba9..d5ef8a96a19 100644 270index 3e625e0f867..dc3afc97e27 100644
266--- a/gcc/config/riscv/linux.h 271--- a/gcc/config/riscv/linux.h
267+++ b/gcc/config/riscv/linux.h 272+++ b/gcc/config/riscv/linux.h
268@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see 273@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
@@ -281,10 +286,10 @@ index 38803723ba9..d5ef8a96a19 100644
281-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" 286-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
282+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1" 287+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
283 288
284 /* Because RISC-V only has word-sized atomics, it requries libatomic where 289 #define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
285 others do not. So link libatomic by default, as needed. */ 290
286diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h 291diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
287index b2a7afabc73..364c1a5b155 100644 292index 9e457033d11..2ddab7c99c1 100644
288--- a/gcc/config/rs6000/linux64.h 293--- a/gcc/config/rs6000/linux64.h
289+++ b/gcc/config/rs6000/linux64.h 294+++ b/gcc/config/rs6000/linux64.h
290@@ -339,24 +339,19 @@ extern int dot_symbols; 295@@ -339,24 +339,19 @@ extern int dot_symbols;
@@ -318,10 +323,10 @@ index b2a7afabc73..364c1a5b155 100644
318 #undef DEFAULT_ASM_ENDIAN 323 #undef DEFAULT_ASM_ENDIAN
319 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) 324 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
320diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h 325diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
321index 7e2519de5d4..a73954d9de5 100644 326index ae932fc22f0..26db003cb3a 100644
322--- a/gcc/config/rs6000/sysv4.h 327--- a/gcc/config/rs6000/sysv4.h
323+++ b/gcc/config/rs6000/sysv4.h 328+++ b/gcc/config/rs6000/sysv4.h
324@@ -779,10 +779,10 @@ GNU_USER_TARGET_CC1_SPEC 329@@ -771,10 +771,10 @@ GNU_USER_TARGET_CC1_SPEC
325 330
326 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","") 331 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
327 332
@@ -335,7 +340,7 @@ index 7e2519de5d4..a73954d9de5 100644
335 #ifndef GNU_USER_DYNAMIC_LINKER 340 #ifndef GNU_USER_DYNAMIC_LINKER
336 #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER 341 #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
337diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h 342diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
338index d7b7e7a7b02..0139b4d06ca 100644 343index 02aa1edaff8..fab268d61f4 100644
339--- a/gcc/config/s390/linux.h 344--- a/gcc/config/s390/linux.h
340+++ b/gcc/config/s390/linux.h 345+++ b/gcc/config/s390/linux.h
341@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see 346@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see
@@ -357,7 +362,7 @@ index d7b7e7a7b02..0139b4d06ca 100644
357 #undef LINK_SPEC 362 #undef LINK_SPEC
358 #define LINK_SPEC \ 363 #define LINK_SPEC \
359diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h 364diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
360index d96d077c99e..7d27f9893ee 100644 365index 29f5902b98b..83d1e53e6e2 100644
361--- a/gcc/config/sh/linux.h 366--- a/gcc/config/sh/linux.h
362+++ b/gcc/config/sh/linux.h 367+++ b/gcc/config/sh/linux.h
363@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see 368@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see
@@ -374,7 +379,7 @@ index d96d077c99e..7d27f9893ee 100644
374 #undef SUBTARGET_LINK_EMUL_SUFFIX 379 #undef SUBTARGET_LINK_EMUL_SUFFIX
375 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" 380 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
376diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h 381diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
377index 6a809e9092d..60603765ad6 100644 382index 0e33b3cac2c..84f29adbb35 100644
378--- a/gcc/config/sparc/linux.h 383--- a/gcc/config/sparc/linux.h
379+++ b/gcc/config/sparc/linux.h 384+++ b/gcc/config/sparc/linux.h
380@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); 385@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
@@ -387,7 +392,7 @@ index 6a809e9092d..60603765ad6 100644
387 #undef LINK_SPEC 392 #undef LINK_SPEC
388 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ 393 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
389diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h 394diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
390index d08a2ef96fe..e6955da0a5b 100644 395index f1cc0a19e49..94bc2032803 100644
391--- a/gcc/config/sparc/linux64.h 396--- a/gcc/config/sparc/linux64.h
392+++ b/gcc/config/sparc/linux64.h 397+++ b/gcc/config/sparc/linux64.h
393@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see 398@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
index c9bc38cc..5b44dc80 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
@@ -1,4 +1,4 @@
1From 5117519c1897a49b09fe7fff213b9c2ea15d37f5 Mon Sep 17 00:00:00 2001 1From 7608e93ab97e8c33e3b14323d0cabc651926e403 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400 3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH] libtool 4Subject: [PATCH] libtool
@@ -15,9 +15,8 @@ to filter the zero case.
15 15
16RP 2012/8/24 16RP 2012/8/24
17 17
18Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2023-04/msg00000.html]
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 19Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21--- 20---
22 ltmain.sh | 4 ++++ 21 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+) 22 1 file changed, 4 insertions(+)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
index dd67b115..86542bd1 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -1,4 +1,4 @@
1From 32129f9682d0d27fc67af10f077ad2768935cbe6 Mon Sep 17 00:00:00 2001 1From 4b0efc18e0d91967a3db11d9ef0595a5a76ad67a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400 3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI. 4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
@@ -11,18 +11,17 @@ for eabi defaulting toolchains.
11 11
12We might want to send it upstream. 12We might want to send it upstream.
13 13
14Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615319.html]
14Signed-off-by: Khem Raj <raj.khem@gmail.com> 15Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17--- 16---
18 gcc/config/arm/linux-eabi.h | 6 +++++- 17 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-) 18 1 file changed, 5 insertions(+), 1 deletion(-)
20 19
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h 20diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index 17c18b27145..8eacb099317 100644 21index dce7f59eeea..27402c629c6 100644
23--- a/gcc/config/arm/linux-eabi.h 22--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h 23+++ b/gcc/config/arm/linux-eabi.h
25@@ -91,10 +91,14 @@ 24@@ -88,10 +88,14 @@
26 #define MUSL_DYNAMIC_LINKER \ 25 #define MUSL_DYNAMIC_LINKER \
27 SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1" 26 SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
28 27
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
index 45edc62e..bc394308 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -1,4 +1,4 @@
1From bf85b8bbcb4b77725d4c22c1bb25a29f6ff21038 Mon Sep 17 00:00:00 2001 1From b015460586e2ea8a35a11d1a607728707bdf6509 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400 3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH] Use the multilib config files from ${B} instead of using the 4Subject: [PATCH] Use the multilib config files from ${B} instead of using the
@@ -18,10 +18,10 @@ Upstream-Status: Inappropriate [configuration]
18 2 files changed, 36 insertions(+), 8 deletions(-) 18 2 files changed, 36 insertions(+), 8 deletions(-)
19 19
20diff --git a/gcc/configure b/gcc/configure 20diff --git a/gcc/configure b/gcc/configure
21index 3fc0e2f5813..2f0f0e057a9 100755 21index cf773a8b854..448a1ec093e 100755
22--- a/gcc/configure 22--- a/gcc/configure
23+++ b/gcc/configure 23+++ b/gcc/configure
24@@ -13361,10 +13361,20 @@ done 24@@ -13487,10 +13487,20 @@ done
25 tmake_file_= 25 tmake_file_=
26 for f in ${tmake_file} 26 for f in ${tmake_file}
27 do 27 do
@@ -46,7 +46,7 @@ index 3fc0e2f5813..2f0f0e057a9 100755
46 done 46 done
47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}" 47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
48 48
49@@ -13375,6 +13385,10 @@ tm_file_list="options.h" 49@@ -13501,6 +13511,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h" 50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do 51 for f in $tm_file; do
52 case $f in 52 case $f in
@@ -58,10 +58,10 @@ index 3fc0e2f5813..2f0f0e057a9 100755
58 f=`echo $f | sed 's/^..//'` 58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f" 59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac 60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 46de496b256..6155b83a732 100644 61index 22591478b72..b6e7f5149a7 100644
62--- a/gcc/configure.ac 62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac 63+++ b/gcc/configure.ac
64@@ -2312,10 +2312,20 @@ done 64@@ -2337,10 +2337,20 @@ done
65 tmake_file_= 65 tmake_file_=
66 for f in ${tmake_file} 66 for f in ${tmake_file}
67 do 67 do
@@ -86,7 +86,7 @@ index 46de496b256..6155b83a732 100644
86 done 86 done
87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}" 87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
88 88
89@@ -2326,6 +2336,10 @@ tm_file_list="options.h" 89@@ -2351,6 +2361,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h" 90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do 91 for f in $tm_file; do
92 case $f in 92 case $f in
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
deleted file mode 100644
index 352c6eec..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From e5463727ff028cee5e452da38f5b4c44d52e412e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH] Avoid using libdir from .la which usually points to a host
5 path
6
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Jonathan Liu <net147@gmail.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 ltmain.sh | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/ltmain.sh b/ltmain.sh
16index ee938056bef..9ebc7e3d1e0 100644
17--- a/ltmain.sh
18+++ b/ltmain.sh
19@@ -5628,6 +5628,9 @@ func_mode_link ()
20 absdir="$abs_ladir"
21 libdir="$abs_ladir"
22 else
23+ # Instead of using libdir from .la which usually points to a host path,
24+ # use the path the .la is contained in.
25+ libdir="$abs_ladir"
26 dir="$libdir"
27 absdir="$libdir"
28 fi
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
index f52e21ed..974aca5e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
@@ -1,4 +1,4 @@
1From 710d1325474e708e6b34eebe09f3f130420af293 Mon Sep 17 00:00:00 2001 1From b7ce05b2d969b311c6061bda32c3117c76bf7e0c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 31 Jan 2023 22:03:38 -0800 3Date: Tue, 31 Jan 2023 22:03:38 -0800
4Subject: [PATCH] aarch64: Fix include paths when S != B 4Subject: [PATCH] aarch64: Fix include paths when S != B
@@ -28,7 +28,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
28 1 file changed, 4 insertions(+), 4 deletions(-) 28 1 file changed, 4 insertions(+), 4 deletions(-)
29 29
30diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h 30diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
31index 155cace6afe..07d68958908 100644 31index 73b09e20508..10ea3672f20 100644
32--- a/gcc/config/aarch64/aarch64.h 32--- a/gcc/config/aarch64/aarch64.h
33+++ b/gcc/config/aarch64/aarch64.h 33+++ b/gcc/config/aarch64/aarch64.h
34@@ -161,8 +161,8 @@ 34@@ -161,8 +161,8 @@
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
index b05be59c..cf5efcd3 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -1,4 +1,4 @@
1From e8e8a0ab572cfceb9758f99599c0db4c962e49c0 Mon Sep 17 00:00:00 2001 1From 39ab6fe76f2788b2c989d29c9016f1fe53cb736e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000 3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH] Avoid using libdir from .la which usually points to a host 4Subject: [PATCH] Avoid using libdir from .la which usually points to a host
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
index 61e61ecc..e2343a3c 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
@@ -1,4 +1,4 @@
1From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001 1From 531b9df680c4380797e8e7705a8e7f8ed17ebe68 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000 3Date: Fri, 20 Feb 2015 10:25:11 +0000
4Subject: [PATCH] Ensure target gcc headers can be included 4Subject: [PATCH] Ensure target gcc headers can be included
@@ -13,7 +13,7 @@ command line in order to resolve this.
13 13
14Extend target gcc headers search to musl too 14Extend target gcc headers search to musl too
15 15
16Upstream-Status: Pending 16Upstream-Status: Inappropriate [embedded specific]
17 17
18Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> 18Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com> 19Signed-off-by: Khem Raj <raj.khem@gmail.com>
@@ -25,10 +25,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
25 4 files changed, 22 insertions(+) 25 4 files changed, 22 insertions(+)
26 26
27diff --git a/gcc/Makefile.in b/gcc/Makefile.in 27diff --git a/gcc/Makefile.in b/gcc/Makefile.in
28index a8277254696..07fa63b6640 100644 28index 04f28984b34..8ef996c0f4d 100644
29--- a/gcc/Makefile.in 29--- a/gcc/Makefile.in
30+++ b/gcc/Makefile.in 30+++ b/gcc/Makefile.in
31@@ -632,6 +632,7 @@ libexecdir = @libexecdir@ 31@@ -640,6 +640,7 @@ libexecdir = @libexecdir@
32 32
33 # Directory in which the compiler finds libraries etc. 33 # Directory in which the compiler finds libraries etc.
34 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) 34 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
@@ -36,7 +36,7 @@ index a8277254696..07fa63b6640 100644
36 # Directory in which the compiler finds executables 36 # Directory in which the compiler finds executables
37 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix) 37 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
38 # Directory in which all plugin resources are installed 38 # Directory in which all plugin resources are installed
39@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\" 39@@ -3059,6 +3060,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
40 40
41 PREPROCESSOR_DEFINES = \ 41 PREPROCESSOR_DEFINES = \
42 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ 42 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
@@ -45,10 +45,10 @@ index a8277254696..07fa63b6640 100644
45 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ 45 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
46 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \ 46 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
47diff --git a/gcc/config/linux.h b/gcc/config/linux.h 47diff --git a/gcc/config/linux.h b/gcc/config/linux.h
48index 4ce173384ef..8a3cd4f2d34 100644 48index 6491c6b84f5..57496ff1f2f 100644
49--- a/gcc/config/linux.h 49--- a/gcc/config/linux.h
50+++ b/gcc/config/linux.h 50+++ b/gcc/config/linux.h
51@@ -170,6 +170,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 51@@ -157,6 +157,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
52 #define INCLUDE_DEFAULTS_MUSL_TOOL 52 #define INCLUDE_DEFAULTS_MUSL_TOOL
53 #endif 53 #endif
54 54
@@ -62,7 +62,7 @@ index 4ce173384ef..8a3cd4f2d34 100644
62 #ifdef NATIVE_SYSTEM_HEADER_DIR 62 #ifdef NATIVE_SYSTEM_HEADER_DIR
63 #define INCLUDE_DEFAULTS_MUSL_NATIVE \ 63 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
64 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ 64 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
65@@ -196,6 +203,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 65@@ -183,6 +190,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
66 INCLUDE_DEFAULTS_MUSL_PREFIX \ 66 INCLUDE_DEFAULTS_MUSL_PREFIX \
67 INCLUDE_DEFAULTS_MUSL_CROSS \ 67 INCLUDE_DEFAULTS_MUSL_CROSS \
68 INCLUDE_DEFAULTS_MUSL_TOOL \ 68 INCLUDE_DEFAULTS_MUSL_TOOL \
@@ -71,10 +71,10 @@ index 4ce173384ef..8a3cd4f2d34 100644
71 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ 71 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
72 { 0, 0, 0, 0, 0, 0 } \ 72 { 0, 0, 0, 0, 0, 0 } \
73diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h 73diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
74index a73954d9de5..e5dd6538358 100644 74index 26db003cb3a..3a443abcf6b 100644
75--- a/gcc/config/rs6000/sysv4.h 75--- a/gcc/config/rs6000/sysv4.h
76+++ b/gcc/config/rs6000/sysv4.h 76+++ b/gcc/config/rs6000/sysv4.h
77@@ -994,6 +994,13 @@ ncrtn.o%s" 77@@ -986,6 +986,13 @@ ncrtn.o%s"
78 #define INCLUDE_DEFAULTS_MUSL_TOOL 78 #define INCLUDE_DEFAULTS_MUSL_TOOL
79 #endif 79 #endif
80 80
@@ -88,7 +88,7 @@ index a73954d9de5..e5dd6538358 100644
88 #ifdef NATIVE_SYSTEM_HEADER_DIR 88 #ifdef NATIVE_SYSTEM_HEADER_DIR
89 #define INCLUDE_DEFAULTS_MUSL_NATIVE \ 89 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
90 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ 90 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
91@@ -1020,6 +1027,7 @@ ncrtn.o%s" 91@@ -1012,6 +1019,7 @@ ncrtn.o%s"
92 INCLUDE_DEFAULTS_MUSL_PREFIX \ 92 INCLUDE_DEFAULTS_MUSL_PREFIX \
93 INCLUDE_DEFAULTS_MUSL_CROSS \ 93 INCLUDE_DEFAULTS_MUSL_CROSS \
94 INCLUDE_DEFAULTS_MUSL_TOOL \ 94 INCLUDE_DEFAULTS_MUSL_TOOL \
@@ -97,7 +97,7 @@ index a73954d9de5..e5dd6538358 100644
97 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ 97 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
98 { 0, 0, 0, 0, 0, 0 } \ 98 { 0, 0, 0, 0, 0, 0 } \
99diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc 99diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
100index 7888300f277..52cf14e92f8 100644 100index 141bb4d25f6..734590a7059 100644
101--- a/gcc/cppdefault.cc 101--- a/gcc/cppdefault.cc
102+++ b/gcc/cppdefault.cc 102+++ b/gcc/cppdefault.cc
103@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[] 103@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
index 94308b2a..30224d74 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -1,4 +1,4 @@
1From 9ae49e7b88c208ab79ec9c2fc4a2fa8a3f1e85bb Mon Sep 17 00:00:00 2001 1From 793201cebfeb129f6f263e64310b30a0ffa48895 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Mar 2015 08:21:19 +0000 3Date: Tue, 3 Mar 2015 08:21:19 +0000
4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix 4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
index ce9635ce..33c601ac 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -1,4 +1,4 @@
1From bf918db7117f41d3c04162095641165ca241707d Mon Sep 17 00:00:00 2001 1From 5de63874335c1c673dd132f6aca00dc13f1eac51 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com> 2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 5 Jul 2015 20:25:18 -0700 3Date: Sun, 5 Jul 2015 20:25:18 -0700
4Subject: [PATCH] libcc1: fix libcc1's install path and rpath 4Subject: [PATCH] libcc1: fix libcc1's install path and rpath
@@ -20,7 +20,7 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
20 2 files changed, 4 insertions(+), 4 deletions(-) 20 2 files changed, 4 insertions(+), 4 deletions(-)
21 21
22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am 22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
23index 6e3a34ff7e2..3f3f6391aba 100644 23index 921a33fe236..938e6f964cd 100644
24--- a/libcc1/Makefile.am 24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am 25+++ b/libcc1/Makefile.am
26@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \ 26@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
index 3b547195..bdffcae7 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -1,4 +1,4 @@
1From 4fbbd40d7db89cdbeaf93df1e1da692b1f80a5bc Mon Sep 17 00:00:00 2001 1From bbc75b93bff66891fa7ffb3af5c6ad53df1fff68 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:39:54 +0000 3Date: Mon, 7 Dec 2015 23:39:54 +0000
4Subject: [PATCH] handle sysroot support for nativesdk-gcc 4Subject: [PATCH] handle sysroot support for nativesdk-gcc
@@ -38,15 +38,15 @@ Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
38 gcc/c-family/c-opts.cc | 4 +-- 38 gcc/c-family/c-opts.cc | 4 +--
39 gcc/config/linux.h | 24 +++++++-------- 39 gcc/config/linux.h | 24 +++++++--------
40 gcc/config/rs6000/sysv4.h | 24 +++++++-------- 40 gcc/config/rs6000/sysv4.h | 24 +++++++--------
41 gcc/cppdefault.cc | 63 ++++++++++++++++++++++++--------------- 41 gcc/cppdefault.cc | 65 ++++++++++++++++++++++++---------------
42 gcc/cppdefault.h | 13 ++++---- 42 gcc/cppdefault.h | 13 +++-----
43 gcc/gcc.cc | 20 +++++++++---- 43 gcc/gcc.cc | 20 ++++++++----
44 gcc/incpath.cc | 12 ++++---- 44 gcc/incpath.cc | 12 ++++----
45 gcc/prefix.cc | 6 ++-- 45 gcc/prefix.cc | 6 ++--
46 8 files changed, 94 insertions(+), 72 deletions(-) 46 8 files changed, 95 insertions(+), 73 deletions(-)
47 47
48diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc 48diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
49index a341a061758..83b0bef4dbb 100644 49index c68a2a27469..77e9b5eceaa 100644
50--- a/gcc/c-family/c-opts.cc 50--- a/gcc/c-family/c-opts.cc
51+++ b/gcc/c-family/c-opts.cc 51+++ b/gcc/c-family/c-opts.cc
52@@ -1458,8 +1458,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain) 52@@ -1458,8 +1458,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
@@ -61,10 +61,10 @@ index a341a061758..83b0bef4dbb 100644
61 path = (char *) xmalloc (prefix_len + suffix_len + 1); 61 path = (char *) xmalloc (prefix_len + suffix_len + 1);
62 memcpy (path, prefix, prefix_len); 62 memcpy (path, prefix, prefix_len);
63diff --git a/gcc/config/linux.h b/gcc/config/linux.h 63diff --git a/gcc/config/linux.h b/gcc/config/linux.h
64index 8a3cd4f2d34..58143dff731 100644 64index 57496ff1f2f..c921cf6ef63 100644
65--- a/gcc/config/linux.h 65--- a/gcc/config/linux.h
66+++ b/gcc/config/linux.h 66+++ b/gcc/config/linux.h
67@@ -134,53 +134,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 67@@ -121,53 +121,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
68 * Unfortunately, this is mostly duplicated from cppdefault.cc */ 68 * Unfortunately, this is mostly duplicated from cppdefault.cc */
69 #if DEFAULT_LIBC == LIBC_MUSL 69 #if DEFAULT_LIBC == LIBC_MUSL
70 #define INCLUDE_DEFAULTS_MUSL_GPP \ 70 #define INCLUDE_DEFAULTS_MUSL_GPP \
@@ -129,7 +129,7 @@ index 8a3cd4f2d34..58143dff731 100644
129 #else 129 #else
130 #define INCLUDE_DEFAULTS_MUSL_NATIVE 130 #define INCLUDE_DEFAULTS_MUSL_NATIVE
131 #endif 131 #endif
132@@ -205,7 +205,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 132@@ -192,7 +192,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
133 INCLUDE_DEFAULTS_MUSL_TOOL \ 133 INCLUDE_DEFAULTS_MUSL_TOOL \
134 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ 134 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
135 INCLUDE_DEFAULTS_MUSL_NATIVE \ 135 INCLUDE_DEFAULTS_MUSL_NATIVE \
@@ -139,10 +139,10 @@ index 8a3cd4f2d34..58143dff731 100644
139 } 139 }
140 #endif 140 #endif
141diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h 141diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
142index e5dd6538358..b496849b792 100644 142index 3a443abcf6b..ef83a5a432e 100644
143--- a/gcc/config/rs6000/sysv4.h 143--- a/gcc/config/rs6000/sysv4.h
144+++ b/gcc/config/rs6000/sysv4.h 144+++ b/gcc/config/rs6000/sysv4.h
145@@ -958,53 +958,53 @@ ncrtn.o%s" 145@@ -950,53 +950,53 @@ ncrtn.o%s"
146 /* Include order changes for musl, same as in generic linux.h. */ 146 /* Include order changes for musl, same as in generic linux.h. */
147 #if DEFAULT_LIBC == LIBC_MUSL 147 #if DEFAULT_LIBC == LIBC_MUSL
148 #define INCLUDE_DEFAULTS_MUSL_GPP \ 148 #define INCLUDE_DEFAULTS_MUSL_GPP \
@@ -207,7 +207,7 @@ index e5dd6538358..b496849b792 100644
207 #else 207 #else
208 #define INCLUDE_DEFAULTS_MUSL_NATIVE 208 #define INCLUDE_DEFAULTS_MUSL_NATIVE
209 #endif 209 #endif
210@@ -1029,7 +1029,7 @@ ncrtn.o%s" 210@@ -1021,7 +1021,7 @@ ncrtn.o%s"
211 INCLUDE_DEFAULTS_MUSL_TOOL \ 211 INCLUDE_DEFAULTS_MUSL_TOOL \
212 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \ 212 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
213 INCLUDE_DEFAULTS_MUSL_NATIVE \ 213 INCLUDE_DEFAULTS_MUSL_NATIVE \
@@ -217,7 +217,7 @@ index e5dd6538358..b496849b792 100644
217 } 217 }
218 #endif 218 #endif
219diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc 219diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
220index 52cf14e92f8..d8977afc05e 100644 220index 734590a7059..b4a8fc29e4a 100644
221--- a/gcc/cppdefault.cc 221--- a/gcc/cppdefault.cc
222+++ b/gcc/cppdefault.cc 222+++ b/gcc/cppdefault.cc
223@@ -35,6 +35,30 @@ 223@@ -35,6 +35,30 @@
@@ -272,7 +272,7 @@ index 52cf14e92f8..d8977afc05e 100644
272 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, 272 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
273 #endif 273 #endif
274 #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR 274 #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR
275@@ -62,23 +86,23 @@ const struct default_include cpp_include_defaults[] 275@@ -62,26 +86,26 @@ const struct default_include cpp_include_defaults[]
276 #endif 276 #endif
277 #ifdef GCC_INCLUDE_DIR 277 #ifdef GCC_INCLUDE_DIR
278 /* This is the dir for gcc's private headers. */ 278 /* This is the dir for gcc's private headers. */
@@ -297,12 +297,16 @@ index 52cf14e92f8..d8977afc05e 100644
297 #endif 297 #endif
298 #ifdef FIXED_INCLUDE_DIR 298 #ifdef FIXED_INCLUDE_DIR
299 /* This is the dir for fixincludes. */ 299 /* This is the dir for fixincludes. */
300 #ifndef SYSROOT_HEADERS_SUFFIX_SPEC
301- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 2 },
302+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 2 },
303 #endif
300- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 304- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
301+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 305+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
302 /* A multilib suffix needs adding if different multilibs use 306 /* A multilib suffix needs adding if different multilibs use
303 different headers. */ 307 different headers. */
304 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC 308 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
305@@ -90,33 +114,24 @@ const struct default_include cpp_include_defaults[] 309@@ -93,33 +117,24 @@ const struct default_include cpp_include_defaults[]
306 #endif 310 #endif
307 #ifdef CROSS_INCLUDE_DIR 311 #ifdef CROSS_INCLUDE_DIR
308 /* One place the target system's headers might be. */ 312 /* One place the target system's headers might be. */
@@ -343,7 +347,7 @@ index 52cf14e92f8..d8977afc05e 100644
343 /* This value is set by cpp_relocated at runtime */ 347 /* This value is set by cpp_relocated at runtime */
344 const char *gcc_exec_prefix; 348 const char *gcc_exec_prefix;
345diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h 349diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
346index fb97c0b5814..6267150facc 100644 350index e26b424e99c..c9abb090dcd 100644
347--- a/gcc/cppdefault.h 351--- a/gcc/cppdefault.h
348+++ b/gcc/cppdefault.h 352+++ b/gcc/cppdefault.h
349@@ -33,7 +33,8 @@ 353@@ -33,7 +33,8 @@
@@ -378,10 +382,10 @@ index fb97c0b5814..6267150facc 100644
378 subdirectory of the actual installation. */ 382 subdirectory of the actual installation. */
379 extern const char *gcc_exec_prefix; 383 extern const char *gcc_exec_prefix;
380diff --git a/gcc/gcc.cc b/gcc/gcc.cc 384diff --git a/gcc/gcc.cc b/gcc/gcc.cc
381index aa4cf92fb78..5569a39a14a 100644 385index 8af0c814c33..605fe3b8c0d 100644
382--- a/gcc/gcc.cc 386--- a/gcc/gcc.cc
383+++ b/gcc/gcc.cc 387+++ b/gcc/gcc.cc
384@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL; 388@@ -255,6 +255,8 @@ FILE *report_times_to_file = NULL;
385 #endif 389 #endif
386 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT; 390 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
387 391
@@ -390,7 +394,7 @@ index aa4cf92fb78..5569a39a14a 100644
390 /* Nonzero means pass the updated target_system_root to the compiler. */ 394 /* Nonzero means pass the updated target_system_root to the compiler. */
391 395
392 static int target_system_root_changed; 396 static int target_system_root_changed;
393@@ -575,6 +577,7 @@ or with constant text in a single argument. 397@@ -578,6 +580,7 @@ or with constant text in a single argument.
394 %G process LIBGCC_SPEC as a spec. 398 %G process LIBGCC_SPEC as a spec.
395 %R Output the concatenation of target_system_root and 399 %R Output the concatenation of target_system_root and
396 target_sysroot_suffix. 400 target_sysroot_suffix.
@@ -398,7 +402,7 @@ index aa4cf92fb78..5569a39a14a 100644
398 %S process STARTFILE_SPEC as a spec. A capital S is actually used here. 402 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
399 %E process ENDFILE_SPEC as a spec. A capital E is actually used here. 403 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
400 %C process CPP_SPEC as a spec. 404 %C process CPP_SPEC as a spec.
401@@ -1627,10 +1630,10 @@ static const char *gcc_libexec_prefix; 405@@ -1619,10 +1622,10 @@ static const char *gcc_libexec_prefix;
402 gcc_exec_prefix is set because, in that case, we know where the 406 gcc_exec_prefix is set because, in that case, we know where the
403 compiler has been installed, and use paths relative to that 407 compiler has been installed, and use paths relative to that
404 location instead. */ 408 location instead. */
@@ -413,7 +417,7 @@ index aa4cf92fb78..5569a39a14a 100644
413 417
414 /* For native compilers, these are well-known paths containing 418 /* For native compilers, these are well-known paths containing
415 components that may be provided by the system. For cross 419 components that may be provided by the system. For cross
416@@ -1638,9 +1641,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; 420@@ -1630,9 +1633,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
417 static const char *md_exec_prefix = MD_EXEC_PREFIX; 421 static const char *md_exec_prefix = MD_EXEC_PREFIX;
418 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; 422 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
419 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; 423 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
@@ -425,7 +429,7 @@ index aa4cf92fb78..5569a39a14a 100644
425 = STANDARD_STARTFILE_PREFIX_2; 429 = STANDARD_STARTFILE_PREFIX_2;
426 430
427 /* A relative path to be used in finding the location of tools 431 /* A relative path to be used in finding the location of tools
428@@ -6676,6 +6679,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) 432@@ -6652,6 +6655,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
429 } 433 }
430 break; 434 break;
431 435
@@ -438,7 +442,7 @@ index aa4cf92fb78..5569a39a14a 100644
438 value = do_spec_1 (startfile_spec, 0, NULL); 442 value = do_spec_1 (startfile_spec, 0, NULL);
439 if (value != 0) 443 if (value != 0)
440diff --git a/gcc/incpath.cc b/gcc/incpath.cc 444diff --git a/gcc/incpath.cc b/gcc/incpath.cc
441index c80f100f476..5ac03c08693 100644 445index 46c0d543205..d088dae7b04 100644
442--- a/gcc/incpath.cc 446--- a/gcc/incpath.cc
443+++ b/gcc/incpath.cc 447+++ b/gcc/incpath.cc
444@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix, 448@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
@@ -485,10 +489,10 @@ index c80f100f476..5ac03c08693 100644
485 str = update_path (ostr, p->component); 489 str = update_path (ostr, p->component);
486 free (ostr); 490 free (ostr);
487diff --git a/gcc/prefix.cc b/gcc/prefix.cc 491diff --git a/gcc/prefix.cc b/gcc/prefix.cc
488index 096ed5afa3d..2526f0ecc39 100644 492index c2a37bde5ea..33944701ced 100644
489--- a/gcc/prefix.cc 493--- a/gcc/prefix.cc
490+++ b/gcc/prefix.cc 494+++ b/gcc/prefix.cc
491@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see 495@@ -73,7 +73,9 @@ License along with GCC; see the file COPYING3. If not see
492 #include "prefix.h" 496 #include "prefix.h"
493 #include "common/common-target.h" 497 #include "common/common-target.h"
494 498
@@ -499,7 +503,7 @@ index 096ed5afa3d..2526f0ecc39 100644
499 503
500 static const char *get_key_value (char *); 504 static const char *get_key_value (char *);
501 static char *translate_name (char *); 505 static char *translate_name (char *);
502@@ -212,7 +214,7 @@ translate_name (char *name) 506@@ -213,7 +215,7 @@ translate_name (char *name)
503 prefix = getenv (key); 507 prefix = getenv (key);
504 508
505 if (prefix == 0) 509 if (prefix == 0)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
index 9b05da64..8a11049c 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -1,4 +1,4 @@
1From 33a1f07a4417247dc24819d4e583ca09f56d5a7b Mon Sep 17 00:00:00 2001 1From 7e095089452b6e895ec40981752e9f902f0ad889 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:41:45 +0000 3Date: Mon, 7 Dec 2015 23:41:45 +0000
4Subject: [PATCH] Search target sysroot gcc version specific dirs with 4Subject: [PATCH] Search target sysroot gcc version specific dirs with
@@ -42,19 +42,20 @@ binaries can be found first. With this change the search path becomes:
42<sysroot>/lib32/ 42<sysroot>/lib32/
43<sysroot>/usr/lib32/ 43<sysroot>/usr/lib32/
44 44
45Upstream-Status: Pending
46RP 2015/7/31 45RP 2015/7/31
47 46
47Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615320.html]
48
48Signed-off-by: Khem Raj <raj.khem@gmail.com> 49Signed-off-by: Khem Raj <raj.khem@gmail.com>
49--- 50---
50 gcc/gcc.cc | 29 ++++++++++++++++++++++++++++- 51 gcc/gcc.cc | 29 ++++++++++++++++++++++++++++-
51 1 file changed, 28 insertions(+), 1 deletion(-) 52 1 file changed, 28 insertions(+), 1 deletion(-)
52 53
53diff --git a/gcc/gcc.cc b/gcc/gcc.cc 54diff --git a/gcc/gcc.cc b/gcc/gcc.cc
54index 5569a39a14a..4598f6cd7c9 100644 55index 605fe3b8c0d..c3a1dab38c4 100644
55--- a/gcc/gcc.cc 56--- a/gcc/gcc.cc
56+++ b/gcc/gcc.cc 57+++ b/gcc/gcc.cc
57@@ -2817,7 +2817,7 @@ for_each_path (const struct path_prefix *paths, 58@@ -2809,7 +2809,7 @@ for_each_path (const struct path_prefix *paths,
58 if (path == NULL) 59 if (path == NULL)
59 { 60 {
60 len = paths->max_len + extra_space + 1; 61 len = paths->max_len + extra_space + 1;
@@ -63,7 +64,7 @@ index 5569a39a14a..4598f6cd7c9 100644
63 path = XNEWVEC (char, len); 64 path = XNEWVEC (char, len);
64 } 65 }
65 66
66@@ -2829,6 +2829,33 @@ for_each_path (const struct path_prefix *paths, 67@@ -2821,6 +2821,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */ 68 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir) 69 if (!skip_multi_dir)
69 { 70 {
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
index 56793e03..9bc77b48 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -1,4 +1,4 @@
1From d7dc2861840e88a4592817a398a054a886c3f3ee Mon Sep 17 00:00:00 2001 1From bf92b290556b7050df0a001cc7ae43cf79990456 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700 3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets 4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
@@ -13,7 +13,7 @@ are already present in libc_nonshared library therefore
13we do not need any library helper on glibc based systems 13we do not need any library helper on glibc based systems
14but musl needs the libssp_noshared from gcc 14but musl needs the libssp_noshared from gcc
15 15
16Upstream-Status: Pending 16Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615317.html]
17 17
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19--- 19---
@@ -23,10 +23,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
23 3 files changed, 27 insertions(+) 23 3 files changed, 27 insertions(+)
24 24
25diff --git a/gcc/config/linux.h b/gcc/config/linux.h 25diff --git a/gcc/config/linux.h b/gcc/config/linux.h
26index 58143dff731..d2409ccac26 100644 26index c921cf6ef63..32e1bc1ae2d 100644
27--- a/gcc/config/linux.h 27--- a/gcc/config/linux.h
28+++ b/gcc/config/linux.h 28+++ b/gcc/config/linux.h
29@@ -208,6 +208,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 29@@ -195,6 +195,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
30 { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \ 30 { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
31 { 0, 0, 0, 0, 0, 0 } \ 31 { 0, 0, 0, 0, 0, 0 } \
32 } 32 }
@@ -41,7 +41,7 @@ index 58143dff731..d2409ccac26 100644
41 41
42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ 42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h 43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 8c9039ac1e5..259cd485973 100644 44index 5d21befe8e4..1248a68e4ca 100644
45--- a/gcc/config/rs6000/linux.h 45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h 46+++ b/gcc/config/rs6000/linux.h
47@@ -99,6 +99,16 @@ 47@@ -99,6 +99,16 @@
@@ -62,7 +62,7 @@ index 8c9039ac1e5..259cd485973 100644
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \ 62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{!static-pie: \ 63 %{!static-pie: \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h 64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 364c1a5b155..e33d9ae98e0 100644 65index 2ddab7c99c1..9641580fc83 100644
66--- a/gcc/config/rs6000/linux64.h 66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h 67+++ b/gcc/config/rs6000/linux64.h
68@@ -372,6 +372,16 @@ extern int dot_symbols; 68@@ -372,6 +372,16 @@ extern int dot_symbols;
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
index bb1699be..f7856886 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
@@ -1,4 +1,4 @@
1From bf0d7c463e1fab62804556099b56319fe94be1eb Mon Sep 17 00:00:00 2001 1From 587ac4a59ea56da18a9989c31a75124e974cb37c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 6 Jun 2018 12:10:22 -0700 3Date: Wed, 6 Jun 2018 12:10:22 -0700
4Subject: [PATCH] Re-introduce spe commandline options 4Subject: [PATCH] Re-introduce spe commandline options
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 13 insertions(+) 14 1 file changed, 13 insertions(+)
15 15
16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt 16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
17index 4931d781c4e..3fb87b6f7d5 100644 17index bde6d3ff664..5af9640825c 100644
18--- a/gcc/config/rs6000/rs6000.opt 18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt 19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -348,6 +348,19 @@ mdebug= 20@@ -344,6 +344,19 @@ mdebug=
21 Target RejectNegative Joined 21 Target RejectNegative Joined
22 -mdebug= Enable debug output. 22 -mdebug= Enable debug output.
23 23
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
index f3709208..b86edab5 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -1,4 +1,4 @@
1From a32c75b37209d6836eaaa943dc6b1207acba5d27 Mon Sep 17 00:00:00 2001 1From 8c4c59521720f8c1b1e38e38896b47fcb1bf00ac Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net> 2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000 3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of 4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
@@ -29,7 +29,7 @@ gcc/Changelog:
29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init 29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init. 30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31 31
32Upstream-Status: Pending 32Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612559.html]
33 33
34Signed-off-by: Khem Raj <raj.khem@gmail.com> 34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35--- 35---
@@ -39,10 +39,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
39 3 files changed, 6 insertions(+), 6 deletions(-) 39 3 files changed, 6 insertions(+), 6 deletions(-)
40 40
41diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc 41diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
42index 68978ef8dc2..0c71f36b572 100644 42index 0d817fc3f3b..8d34d19d3f9 100644
43--- a/gcc/config/i386/i386-expand.cc 43--- a/gcc/config/i386/i386-expand.cc
44+++ b/gcc/config/i386/i386-expand.cc 44+++ b/gcc/config/i386/i386-expand.cc
45@@ -12321,10 +12321,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, 45@@ -12691,10 +12691,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
46 { 46 {
47 case IX86_BUILTIN_CPU_INIT: 47 case IX86_BUILTIN_CPU_INIT:
48 { 48 {
@@ -56,7 +56,7 @@ index 68978ef8dc2..0c71f36b572 100644
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL); 56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 } 57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c 58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index dab1d98060f..cf824b4114a 100644 59index 50b6d8248a2..724ced402a1 100644
60--- a/libgcc/config/i386/cpuinfo.c 60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c 61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -63,7 +63,7 @@ __cpu_indicator_init (void) 62@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
index f5f04ae3..b6707592 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -1,4 +1,4 @@
1From 4efc42b99c96b026f560b0918de7e237ac3dc8d1 Mon Sep 17 00:00:00 2001 1From f15b19d8e058c983c49c4566c1879fdaf5b1ab54 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 10 Mar 2020 08:26:53 -0700 3Date: Tue, 10 Mar 2020 08:26:53 -0700
4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining 4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
@@ -17,10 +17,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 2 files changed, 19 insertions(+), 19 deletions(-) 17 2 files changed, 19 insertions(+), 19 deletions(-)
18 18
19diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc 19diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
20index 386ae1b0506..9762e914296 100644 20index 7763f40e9ab..4f0c1eb1508 100644
21--- a/gcc/gengtype.cc 21--- a/gcc/gengtype.cc
22+++ b/gcc/gengtype.cc 22+++ b/gcc/gengtype.cc
23@@ -1006,7 +1006,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt, 23@@ -1005,7 +1005,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
24 /* Create a fake field with the given type and name. NEXT is the next 24 /* Create a fake field with the given type and name. NEXT is the next
25 field in the chain. */ 25 field in the chain. */
26 #define create_field(next,type,name) \ 26 #define create_field(next,type,name) \
@@ -29,7 +29,7 @@ index 386ae1b0506..9762e914296 100644
29 29
30 /* Like create_field, but the field is only valid when condition COND 30 /* Like create_field, but the field is only valid when condition COND
31 is true. */ 31 is true. */
32@@ -1039,7 +1039,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name, 32@@ -1038,7 +1038,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
33 } 33 }
34 34
35 #define create_optional_field(next,type,name,cond) \ 35 #define create_optional_field(next,type,name,cond) \
@@ -38,7 +38,7 @@ index 386ae1b0506..9762e914296 100644
38 38
39 /* Reverse a linked list of 'struct pair's in place. */ 39 /* Reverse a linked list of 'struct pair's in place. */
40 pair_p 40 pair_p
41@@ -5238,7 +5238,7 @@ main (int argc, char **argv) 41@@ -5223,7 +5223,7 @@ main (int argc, char **argv)
42 /* These types are set up with #define or else outside of where 42 /* These types are set up with #define or else outside of where
43 we can see them. We should initialize them before calling 43 we can see them. We should initialize them before calling
44 read_input_list. */ 44 read_input_list. */
@@ -48,10 +48,10 @@ index 386ae1b0506..9762e914296 100644
48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos)); 48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos)); 49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
50diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc 50diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
51index 59850bb070a..e187f8542a1 100644 51index 715787b8f48..302adff28d5 100644
52--- a/gcc/genmodes.cc 52--- a/gcc/genmodes.cc
53+++ b/gcc/genmodes.cc 53+++ b/gcc/genmodes.cc
54@@ -440,7 +440,7 @@ complete_all_modes (void) 54@@ -441,7 +441,7 @@ complete_all_modes (void)
55 } 55 }
56 56
57 /* For each mode in class CLASS, construct a corresponding complex mode. */ 57 /* For each mode in class CLASS, construct a corresponding complex mode. */
@@ -60,7 +60,7 @@ index 59850bb070a..e187f8542a1 100644
60 static void 60 static void
61 make_complex_modes (enum mode_class cl, 61 make_complex_modes (enum mode_class cl,
62 const char *file, unsigned int line) 62 const char *file, unsigned int line)
63@@ -499,7 +499,7 @@ make_complex_modes (enum mode_class cl, 63@@ -500,7 +500,7 @@ make_complex_modes (enum mode_class cl,
64 having as many components as necessary. ORDER is the sorting order 64 having as many components as necessary. ORDER is the sorting order
65 of the mode, with smaller numbers indicating a higher priority. */ 65 of the mode, with smaller numbers indicating a higher priority. */
66 #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \ 66 #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
@@ -69,7 +69,7 @@ index 59850bb070a..e187f8542a1 100644
69 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0) 69 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
70 static void ATTRIBUTE_UNUSED 70 static void ATTRIBUTE_UNUSED
71 make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, 71 make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
72@@ -552,7 +552,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, 72@@ -553,7 +553,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
73 BYTESIZE bytes in total. */ 73 BYTESIZE bytes in total. */
74 #define VECTOR_BOOL_MODE(NAME, COUNT, COMPONENT, BYTESIZE) \ 74 #define VECTOR_BOOL_MODE(NAME, COUNT, COMPONENT, BYTESIZE) \
75 make_vector_bool_mode (#NAME, COUNT, #COMPONENT, BYTESIZE, \ 75 make_vector_bool_mode (#NAME, COUNT, #COMPONENT, BYTESIZE, \
@@ -78,7 +78,7 @@ index 59850bb070a..e187f8542a1 100644
78 static void ATTRIBUTE_UNUSED 78 static void ATTRIBUTE_UNUSED
79 make_vector_bool_mode (const char *name, unsigned int count, 79 make_vector_bool_mode (const char *name, unsigned int count,
80 const char *component, unsigned int bytesize, 80 const char *component, unsigned int bytesize,
81@@ -574,7 +574,7 @@ make_vector_bool_mode (const char *name, unsigned int count, 81@@ -575,7 +575,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
82 /* Input. */ 82 /* Input. */
83 83
84 #define _SPECIAL_MODE(C, N) \ 84 #define _SPECIAL_MODE(C, N) \
@@ -87,7 +87,7 @@ index 59850bb070a..e187f8542a1 100644
87 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N) 87 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
88 #define CC_MODE(N) _SPECIAL_MODE (CC, N) 88 #define CC_MODE(N) _SPECIAL_MODE (CC, N)
89 89
90@@ -587,7 +587,7 @@ make_special_mode (enum mode_class cl, const char *name, 90@@ -588,7 +588,7 @@ make_special_mode (enum mode_class cl, const char *name,
91 91
92 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y) 92 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
93 #define FRACTIONAL_INT_MODE(N, B, Y) \ 93 #define FRACTIONAL_INT_MODE(N, B, Y) \
@@ -96,7 +96,7 @@ index 59850bb070a..e187f8542a1 100644
96 96
97 static void 97 static void
98 make_int_mode (const char *name, 98 make_int_mode (const char *name,
99@@ -628,16 +628,16 @@ make_opaque_mode (const char *name, 99@@ -629,16 +629,16 @@ make_opaque_mode (const char *name,
100 } 100 }
101 101
102 #define FRACT_MODE(N, Y, F) \ 102 #define FRACT_MODE(N, Y, F) \
@@ -117,7 +117,7 @@ index 59850bb070a..e187f8542a1 100644
117 117
118 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT, 118 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
119 FILE, and LINE. */ 119 FILE, and LINE. */
120@@ -658,7 +658,7 @@ make_fixed_point_mode (enum mode_class cl, 120@@ -659,7 +659,7 @@ make_fixed_point_mode (enum mode_class cl,
121 121
122 #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F) 122 #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
123 #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \ 123 #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
@@ -126,7 +126,7 @@ index 59850bb070a..e187f8542a1 100644
126 126
127 static void 127 static void
128 make_float_mode (const char *name, 128 make_float_mode (const char *name,
129@@ -675,7 +675,7 @@ make_float_mode (const char *name, 129@@ -676,7 +676,7 @@ make_float_mode (const char *name,
130 #define DECIMAL_FLOAT_MODE(N, Y, F) \ 130 #define DECIMAL_FLOAT_MODE(N, Y, F) \
131 FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F) 131 FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
132 #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \ 132 #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \
@@ -135,7 +135,7 @@ index 59850bb070a..e187f8542a1 100644
135 135
136 static void 136 static void
137 make_decimal_float_mode (const char *name, 137 make_decimal_float_mode (const char *name,
138@@ -690,7 +690,7 @@ make_decimal_float_mode (const char *name, 138@@ -691,7 +691,7 @@ make_decimal_float_mode (const char *name,
139 } 139 }
140 140
141 #define RESET_FLOAT_FORMAT(N, F) \ 141 #define RESET_FLOAT_FORMAT(N, F) \
@@ -144,7 +144,7 @@ index 59850bb070a..e187f8542a1 100644
144 static void ATTRIBUTE_UNUSED 144 static void ATTRIBUTE_UNUSED
145 reset_float_format (const char *name, const char *format, 145 reset_float_format (const char *name, const char *format,
146 const char *file, unsigned int line) 146 const char *file, unsigned int line)
147@@ -711,7 +711,7 @@ reset_float_format (const char *name, const char *format, 147@@ -712,7 +712,7 @@ reset_float_format (const char *name, const char *format,
148 148
149 /* __intN support. */ 149 /* __intN support. */
150 #define INT_N(M,PREC) \ 150 #define INT_N(M,PREC) \
@@ -153,7 +153,7 @@ index 59850bb070a..e187f8542a1 100644
153 static void ATTRIBUTE_UNUSED 153 static void ATTRIBUTE_UNUSED
154 make_int_n (const char *m, int bitsize, 154 make_int_n (const char *m, int bitsize,
155 const char *file, unsigned int line) 155 const char *file, unsigned int line)
156@@ -740,7 +740,7 @@ make_int_n (const char *m, int bitsize, 156@@ -741,7 +741,7 @@ make_int_n (const char *m, int bitsize,
157 /* Partial integer modes are specified by relation to a full integer 157 /* Partial integer modes are specified by relation to a full integer
158 mode. */ 158 mode. */
159 #define PARTIAL_INT_MODE(M,PREC,NAME) \ 159 #define PARTIAL_INT_MODE(M,PREC,NAME) \
@@ -162,7 +162,7 @@ index 59850bb070a..e187f8542a1 100644
162 static void ATTRIBUTE_UNUSED 162 static void ATTRIBUTE_UNUSED
163 make_partial_integer_mode (const char *base, const char *name, 163 make_partial_integer_mode (const char *base, const char *name,
164 unsigned int precision, 164 unsigned int precision,
165@@ -767,7 +767,7 @@ make_partial_integer_mode (const char *base, const char *name, 165@@ -768,7 +768,7 @@ make_partial_integer_mode (const char *base, const char *name,
166 /* A single vector mode can be specified by naming its component 166 /* A single vector mode can be specified by naming its component
167 mode and the number of components. */ 167 mode and the number of components. */
168 #define VECTOR_MODE_WITH_PREFIX(PREFIX, C, M, N, ORDER) \ 168 #define VECTOR_MODE_WITH_PREFIX(PREFIX, C, M, N, ORDER) \
@@ -171,7 +171,7 @@ index 59850bb070a..e187f8542a1 100644
171 #define VECTOR_MODE(C, M, N) VECTOR_MODE_WITH_PREFIX(V, C, M, N, 0); 171 #define VECTOR_MODE(C, M, N) VECTOR_MODE_WITH_PREFIX(V, C, M, N, 0);
172 static void ATTRIBUTE_UNUSED 172 static void ATTRIBUTE_UNUSED
173 make_vector_mode (enum mode_class bclass, 173 make_vector_mode (enum mode_class bclass,
174@@ -814,7 +814,7 @@ make_vector_mode (enum mode_class bclass, 174@@ -815,7 +815,7 @@ make_vector_mode (enum mode_class bclass,
175 175
176 /* Adjustability. */ 176 /* Adjustability. */
177 #define _ADD_ADJUST(A, M, X, C1, C2) \ 177 #define _ADD_ADJUST(A, M, X, C1, C2) \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
index cb8969b1..0ea8aac5 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -1,4 +1,4 @@
1From c3870d073eb9e5d82f9d3067d0fa15038b69713a Mon Sep 17 00:00:00 2001 1From 939a899b862f7a25e52b74d1587fc75fc65779c0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 May 2020 15:10:38 -0700 3Date: Wed, 13 May 2020 15:10:38 -0700
4Subject: [PATCH] libatomic: Do not enforce march on aarch64 4Subject: [PATCH] libatomic: Do not enforce march on aarch64
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
index 11f42c59..cd962d82 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
@@ -1,4 +1,4 @@
1From 7bd6e631e4a5273f5ecc41a5a48830a1342e5926 Mon Sep 17 00:00:00 2001 1From 696d696381dd99ec2bddb1170f96f98da36eb418 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei.gherzan@huawei.com> 2From: Andrei Gherzan <andrei.gherzan@huawei.com>
3Date: Wed, 22 Dec 2021 12:49:25 +0100 3Date: Wed, 22 Dec 2021 12:49:25 +0100
4Subject: [PATCH] Fix install path of linux64.h 4Subject: [PATCH] Fix install path of linux64.h
@@ -17,10 +17,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 2 insertions(+) 17 1 file changed, 2 insertions(+)
18 18
19diff --git a/gcc/Makefile.in b/gcc/Makefile.in 19diff --git a/gcc/Makefile.in b/gcc/Makefile.in
20index 065ce7e9a5b..d4c723968aa 100644 20index 8ef996c0f4d..21daf380e34 100644
21--- a/gcc/Makefile.in 21--- a/gcc/Makefile.in
22+++ b/gcc/Makefile.in 22+++ b/gcc/Makefile.in
23@@ -3738,6 +3738,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype 23@@ -3731,6 +3731,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
24 "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \ 24 "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
25 | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \ 25 | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
26 base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \ 26 base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch
deleted file mode 100644
index 2f016598..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 52931ec7a708b58d68e69ce9eb99001ae9f099dd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 May 2020 15:10:38 -0700
4Subject: [PATCH] libatomic: Do not enforce march on aarch64
5
6OE passes the right options via gcc compiler cmdline via TUNE_CCARGS
7this can conflict between -mcpu settings and -march setting here, since
8-mcpu will translate into an appropriate -march, lets depend on that
9instead of setting it explicitly
10
11Upstream-Status: Inappropriate [OE-Specific]
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 libatomic/Makefile.am | 1 -
16 libatomic/Makefile.in | 1 -
17 2 files changed, 2 deletions(-)
18
19diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
20index d88515e4a03..e0e2f8b442a 100644
21--- a/libatomic/Makefile.am
22+++ b/libatomic/Makefile.am
23@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
24 ## On a target-specific basis, include alternates to be selected by IFUNC.
25 if HAVE_IFUNC
26 if ARCH_AARCH64_LINUX
27-IFUNC_OPTIONS = -march=armv8-a+lse
28 libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
29 endif
30 if ARCH_ARM_LINUX
31diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
32index 80d25653dc7..7377689ab34 100644
33--- a/libatomic/Makefile.in
34+++ b/libatomic/Makefile.in
35@@ -434,7 +434,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
36 libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
37 _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
38 $(am__append_3) $(am__append_4)
39-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
40 @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
41 @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
42 @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
index ad826901..04d940ae 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
@@ -1,4 +1,4 @@
1From 4623d87d779853a2862ee92a15a41fded81eddb8 Mon Sep 17 00:00:00 2001 1From 9487b1d6136ea09cce4792d59d0170c712575550 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Sat, 20 Aug 2022 09:04:14 -0700 3Date: Sat, 20 Aug 2022 09:04:14 -0700
4Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc 4Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch
deleted file mode 100644
index 555be623..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 3e67c9c77e46132c252911bf1e5e4222dfd3aa34 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei.gherzan@huawei.com>
3Date: Wed, 22 Dec 2021 12:49:25 +0100
4Subject: [PATCH] Fix install path of linux64.h
5
6We add linux64.h to tm includes[1] as a relative path to B. This patch
7adapts the install path of linux64.h to match the include in tm.h.
8
9[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
10
11Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
12
13Upstream-Status: Inappropriate [configuration]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 gcc/Makefile.in | 2 ++
17 1 file changed, 2 insertions(+)
18
19diff --git a/gcc/Makefile.in b/gcc/Makefile.in
20index 07fa63b6640..0def7394454 100644
21--- a/gcc/Makefile.in
22+++ b/gcc/Makefile.in
23@@ -3706,6 +3706,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
24 "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
25 | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
26 base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
27+ */linux64.h ) \
28+ base=`dirname $$path`;;\
29 *) base=`basename $$path` ;; \
30 esac; \
31 dest=$(plugin_includedir)/$$base; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch
new file mode 100644
index 00000000..e4d57c27
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch
@@ -0,0 +1,233 @@
1From f12acc6a383546d48da3bdfb2f25ca2adb7976d7 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Sun, 13 Aug 2023 10:24:05 +0100
4Subject: [PATCH] gcc testsuite tweaks for mips/OE
5
6Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some
7of the instruction decoding is there.
8
9Also disable MSA mips runtime extensions. For some reason qemu appears to accept the test
10code when it shouldn't. Our selected MIPS cpu for QEMU doesn't support them.
11
12MIPS is unusual in the gcc testsuite as it uses EFFECTIVE_TARGETS and loops
13multiple times through the vector testsuite. In the case of the two above, we can
14compile/link them but not run them. Even with the runtime disabled, if the code
15marks it as a runtime test, it will elevate itself to that. Setting the default
16target to compile therefore isn't enough.
17
18Therefore add code to downgrade runtime tests to link tests if the hardware
19support isn't there to run them. This avoids thousands of test failures. To do
20this we have to hook downgrade code into the main test runner.
21
22Enable that downgrading for other cases where hardware to run vector extensions is
23unavailable to remove test failures on other architectures too.
24
25Also, for gcc.target tests, add checks on wheter loongson or msa code can
26be run before trying that, allowing downgrading of tests there to work too.
27
28Upstream-Status: Pending
29[Parts of the patch may be able to be split off and acceptable to upstream with
30discussion. Need to investigate why qemu-user passes the 'bad' instructions']
31
32Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
33---
34 gcc/testsuite/gcc.target/mips/mips.exp | 16 +++++++++
35 gcc/testsuite/lib/gcc-dg.exp | 11 +++++++
36 gcc/testsuite/lib/target-supports.exp | 45 ++++++++------------------
37 3 files changed, 41 insertions(+), 31 deletions(-)
38
39diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
40index 15d574202d3..2cef9709774 100644
41--- a/gcc/testsuite/gcc.target/mips/mips.exp
42+++ b/gcc/testsuite/gcc.target/mips/mips.exp
43@@ -709,7 +709,23 @@ proc mips_first_unsupported_option { upstatus } {
44 global mips_option_tests
45 upvar $upstatus status
46
47+ if { [mips_have_test_option_p status "-mmsa"] } {
48+ verbose -log "Found -mmsa"
49+ if { ![check_mips_msa_hw_available] } {
50+ verbose -log "No MSA avail"
51+ return "-mmsa"
52+ }
53+ }
54+ if { [mips_have_test_option_p status "-mloongson-mmi"] } {
55+ verbose -log "Found -mloonson-mmi"
56+ if { ![check_mips_loongson_mmi_hw_available] } {
57+ verbose -log "No MMI avail"
58+ return "-mloonson-mmi"
59+ }
60+ }
61+
62 foreach { option code } [array get mips_option_tests] {
63+
64 if { [mips_have_test_option_p status $option] } {
65 regsub -all "\n" $code "\\n\\\n" asm
66 # Use check_runtime from target-supports.exp, which caches
67diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
68index 9d79b9402e9..e0e5cbb1af8 100644
69--- a/gcc/testsuite/lib/gcc-dg.exp
70+++ b/gcc/testsuite/lib/gcc-dg.exp
71@@ -240,9 +240,20 @@ proc schedule-cleanups { opts } {
72
73 proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
74 # Set up the compiler flags, based on what we're going to do.
75+ global do-what-limit
76
77 set options [list]
78
79+ if [info exists do-what-limit] then {
80+ # Demote run tests to $do-what-limit if set
81+ switch $do_what {
82+ run {
83+ set do_what ${do-what-limit}
84+ set dg-do-what ${do-what-limit}
85+ }
86+ }
87+ }
88+
89 switch $do_what {
90 "preprocess" {
91 set compile_type "preprocess"
92diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
93index 40f71e9ed8b..10e267fa16d 100644
94--- a/gcc/testsuite/lib/target-supports.exp
95+++ b/gcc/testsuite/lib/target-supports.exp
96@@ -2155,14 +2155,7 @@ proc check_mips_loongson_mmi_hw_available { } {
97 if { !([istarget mips*-*-*]) } {
98 expr 0
99 } else {
100- check_runtime_nocache mips_loongson_mmi_hw_available {
101- #include <loongson-mmiintrin.h>
102- int main()
103- {
104- asm volatile ("paddw $f2,$f4,$f6");
105- return 0;
106- }
107- } "-mloongson-mmi"
108+ expr 0
109 }
110 }]
111 }
112@@ -2176,29 +2169,7 @@ proc check_mips_msa_hw_available { } {
113 if { !([istarget mips*-*-*]) } {
114 expr 0
115 } else {
116- check_runtime_nocache mips_msa_hw_available {
117- #if !defined(__mips_msa)
118- #error "MSA NOT AVAIL"
119- #else
120- #if !(((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2))
121- #error "MSA NOT AVAIL FOR ISA REV < 2"
122- #endif
123- #if !defined(__mips_hard_float)
124- #error "MSA HARD_FLOAT REQUIRED"
125- #endif
126- #if __mips_fpr != 64
127- #error "MSA 64-bit FPR REQUIRED"
128- #endif
129- #include <msa.h>
130-
131- int main()
132- {
133- v8i16 v = __builtin_msa_ldi_h (0);
134- v[0] = 0;
135- return v[0];
136- }
137- #endif
138- } "-mmsa"
139+ expr 0
140 }
141 }]
142 }
143@@ -9187,6 +9158,7 @@ proc is-effective-target-keyword { arg } {
144
145 proc et-dg-runtest { runtest testcases flags default-extra-flags } {
146 global dg-do-what-default
147+ global do-what-limit
148 global EFFECTIVE_TARGETS
149 global et_index
150
151@@ -9194,6 +9166,7 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } {
152 foreach target $EFFECTIVE_TARGETS {
153 set target_flags $flags
154 set dg-do-what-default compile
155+ set do-what-limit link
156 set et_index [lsearch -exact $EFFECTIVE_TARGETS $target]
157 if { [info procs add_options_for_${target}] != [list] } {
158 set target_flags [add_options_for_${target} "$flags"]
159@@ -9201,8 +9174,10 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } {
160 if { [info procs check_effective_target_${target}_runtime]
161 != [list] && [check_effective_target_${target}_runtime] } {
162 set dg-do-what-default run
163+ set do-what-limit run
164 }
165 $runtest $testcases $target_flags ${default-extra-flags}
166+ unset do-what-limit
167 }
168 } else {
169 set et_index 0
170@@ -10789,6 +10764,7 @@ proc check_effective_target_sigsetjmp {} {
171 proc check_vect_support_and_set_flags { } {
172 global DEFAULT_VECTCFLAGS
173 global dg-do-what-default
174+ global do-what-limit
175 global EFFECTIVE_TARGETS
176
177 if [istarget powerpc-*paired*] {
178@@ -10797,6 +10773,7 @@ proc check_vect_support_and_set_flags { } {
179 set dg-do-what-default run
180 } else {
181 set dg-do-what-default compile
182+ set do-what-limit link
183 }
184 } elseif [istarget powerpc*-*-*] {
185 # Skip targets not supporting -maltivec.
186@@ -10821,6 +10798,7 @@ proc check_vect_support_and_set_flags { } {
187 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
188 }
189 set dg-do-what-default compile
190+ set do-what-limit link
191 }
192 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
193 lappend DEFAULT_VECTCFLAGS "-msse2"
194@@ -10828,6 +10806,7 @@ proc check_vect_support_and_set_flags { } {
195 set dg-do-what-default run
196 } else {
197 set dg-do-what-default compile
198+ set do-what-limit link
199 }
200 } elseif { [istarget mips*-*-*]
201 && [check_effective_target_nomips16] } {
202@@ -10847,6 +10826,7 @@ proc check_vect_support_and_set_flags { } {
203 set dg-do-what-default run
204 } else {
205 set dg-do-what-default compile
206+ set do-what-limit link
207 }
208 } elseif [istarget alpha*-*-*] {
209 # Alpha's vectorization capabilities are extremely limited.
210@@ -10860,6 +10840,7 @@ proc check_vect_support_and_set_flags { } {
211 set dg-do-what-default run
212 } else {
213 set dg-do-what-default compile
214+ set do-what-limit link
215 }
216 } elseif [istarget ia64-*-*] {
217 set dg-do-what-default run
218@@ -10873,6 +10854,7 @@ proc check_vect_support_and_set_flags { } {
219 set dg-do-what-default run
220 } else {
221 set dg-do-what-default compile
222+ set do-what-limit link
223 }
224 } elseif [istarget aarch64*-*-*] {
225 set dg-do-what-default run
226@@ -10897,6 +10879,7 @@ proc check_vect_support_and_set_flags { } {
227 } else {
228 lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
229 set dg-do-what-default compile
230+ set do-what-limit link
231 }
232 } elseif [istarget amdgcn-*-*] {
233 set dg-do-what-default run
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
deleted file mode 100644
index bbe2f18f..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
+++ /dev/null
@@ -1,92 +0,0 @@
1From 9234cdca6ee88badfc00297e72f13dac4e540c79 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Fri, 1 Jul 2022 15:58:52 +0100
4Subject: [PATCH] Add a recursion limit to the demangle_const function in the
5 Rust demangler.
6
7libiberty/
8 PR demangler/105039
9 * rust-demangle.c (demangle_const): Add recursion limit.
10
11Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9234cdca6ee88badfc00297e72f13dac4e540c79]
12---
13 libiberty/rust-demangle.c | 29 ++++++++++++++++++++---------
14 1 file changed, 20 insertions(+), 9 deletions(-)
15
16diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
17index bb58d900e27..36afcfae278 100644
18--- a/libiberty/rust-demangle.c
19+++ b/libiberty/rust-demangle.c
20@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm)
21 return 0;
22
23 x = 0;
24- while (!eat (rdm, '_'))
25+ while (!eat (rdm, '_') && !rdm->errored)
26 {
27 c = next (rdm);
28 x *= 62;
29@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm)
30 if (rdm->errored)
31 return;
32
33+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
34+ {
35+ ++ rdm->recursion;
36+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
37+ /* FIXME: There ought to be a way to report
38+ that the recursion limit has been reached. */
39+ goto fail_return;
40+ }
41+
42 if (eat (rdm, 'B'))
43 {
44 backref = parse_integer_62 (rdm);
45@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm)
46 demangle_const (rdm);
47 rdm->next = old_next;
48 }
49- return;
50+ goto pass_return;
51 }
52
53 ty_tag = next (rdm);
54@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm)
55 /* Placeholder. */
56 case 'p':
57 PRINT ("_");
58- return;
59+ goto pass_return;
60
61 /* Unsigned integer types. */
62 case 'h':
63@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm)
64 break;
65
66 default:
67- rdm->errored = 1;
68- return;
69+ goto fail_return;
70 }
71
72- if (rdm->errored)
73- return;
74-
75- if (rdm->verbose)
76+ if (!rdm->errored && rdm->verbose)
77 {
78 PRINT (": ");
79 PRINT (basic_type (ty_tag));
80 }
81+
82+ fail_return:
83+ rdm->errored = 1;
84+ pass_return:
85+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
86+ -- rdm->recursion;
87 }
88
89 static void
90--
912.31.1
92
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0027-Fix-gcc-vect-module-testcases.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0027-Fix-gcc-vect-module-testcases.patch
new file mode 100644
index 00000000..4b890368
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0027-Fix-gcc-vect-module-testcases.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=948dbc5ee45f9ffd5f41fd6782704081cc7c8c27]
2
3Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
4
5diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
6index ed63ff59cc0..009c849b7e7 100644
7--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
8+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
9@@ -1,3 +1,5 @@
10+/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */
11+/* { dg-do run } */
12 /* { dg-require-effective-target vect_simd_clones } */
13 /* { dg-additional-options "-fopenmp-simd" } */
14 /* { dg-additional-options "-mavx" { target avx_runtime } } */
15diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
16index c44471e35bc..4699a3f3c80 100644
17--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
18+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
19@@ -1,3 +1,5 @@
20+/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */
21+/* { dg-do run } */
22 /* { dg-require-effective-target vect_simd_clones } */
23 /* { dg-additional-options "-fopenmp-simd" } */
24 /* { dg-additional-options "-mavx" { target avx_runtime } } */
25--
262.43.0
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
deleted file mode 100644
index f3485858..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
+++ /dev/null
@@ -1,19 +0,0 @@
1Avoid encoding build paths into sources used for floating point on powerpc.
2(MACHINE=qemuppc bitbake libgcc).
3
4Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html]
5Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
6
7Index: gcc-12.1.0/libgcc/config/rs6000/t-float128
8===================================================================
9--- gcc-12.1.0.orig/libgcc/config/rs6000/t-float128
10+++ gcc-12.1.0/libgcc/config/rs6000/t-float128
11@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS +=
12 $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
13 @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
14 echo "Create $@"; \
15- (echo "/* file created from $$src */"; \
16+ (echo "/* file created from `basename $$src` */"; \
17 echo; \
18 sed -f $(fp128_sed) < $$src) > $@
19
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch
deleted file mode 100644
index 7f1a2dee..00000000
--- a/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1Relative paths don't work with -fdebug-prefix-map and friends. This
2can lead to paths which the user wanted to be remapped being missed.
3Setting -fdebug-prefix-map to work with a relative path isn't practical
4either.
5
6Instead, call gcc's realpath function on the incomming path name before
7comparing it with the remapping. This means other issues like symlinks
8are also accounted for and leads to a more consistent remapping experience.
9
10Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599885.html]
11[Also https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599884.html]
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14
15Index: gcc-12.1.0/gcc/file-prefix-map.cc
16===================================================================
17--- gcc-12.1.0.orig/gcc/file-prefix-map.cc
18+++ gcc-12.1.0/gcc/file-prefix-map.cc
19@@ -70,19 +70,28 @@ remap_filename (file_prefix_map *maps, c
20 file_prefix_map *map;
21 char *s;
22 const char *name;
23+ char *realname;
24 size_t name_len;
25
26+ if (lbasename (filename) == filename)
27+ return filename;
28+
29+ realname = lrealpath (filename);
30+
31 for (map = maps; map; map = map->next)
32- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
33+ if (filename_ncmp (realname, map->old_prefix, map->old_len) == 0)
34 break;
35- if (!map)
36+ if (!map) {
37+ free (realname);
38 return filename;
39- name = filename + map->old_len;
40+ }
41+ name = realname + map->old_len;
42 name_len = strlen (name) + 1;
43
44 s = (char *) ggc_alloc_atomic (name_len + map->new_len);
45 memcpy (s, map->new_prefix, map->new_len);
46 memcpy (s + map->new_len, name, name_len);
47+ free (realname);
48 return s;
49 }
50
51Index: gcc-12.1.0/libcpp/macro.cc
52===================================================================
53--- gcc-12.1.0.orig/libcpp/macro.cc
54+++ gcc-12.1.0/libcpp/macro.cc
55@@ -563,7 +563,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
56 if (!name)
57 abort ();
58 }
59- if (pfile->cb.remap_filename)
60+ if (pfile->cb.remap_filename && !pfile->state.in_directive)
61 name = pfile->cb.remap_filename (name);
62 len = strlen (name);
63 buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc_13.3.bb
index c1996ab1..255fe552 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/gcc_13.3.bb
@@ -11,4 +11,4 @@ ARMFPARCHEXT:armv6 = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
11ARMFPARCHEXT:armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}" 11ARMFPARCHEXT:armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
12ARMFPARCHEXT:armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}" 12ARMFPARCHEXT:armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
13 13
14#BBCLASSEXTEND = "nativesdk" 14BBCLASSEXTEND = "nativesdk"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
index ac0a5a7b..d9084af5 100644
--- a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
@@ -58,7 +58,7 @@ do_install:append:libc-newlib () {
58DEV_PKG_DEPENDENCY:libc-baremetal = "" 58DEV_PKG_DEPENDENCY:libc-baremetal = ""
59DEV_PKG_DEPENDENCY:libc-newlib = "" 59DEV_PKG_DEPENDENCY:libc-newlib = ""
60 60
61#BBCLASSEXTEND = "nativesdk" 61BBCLASSEXTEND = "nativesdk"
62 62
63addtask multilib_install after do_install before do_package do_populate_sysroot 63addtask multilib_install after do_install before do_package do_populate_sysroot
64# this makes multilib gcc files findable for target gcc 64# this makes multilib gcc files findable for target gcc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.3.bb
index a259082b..a259082b 100644
--- a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc_13.3.bb
index f88963b0..fdcd6cc0 100644
--- a/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc_13.3.bb
@@ -1,5 +1,7 @@
1require recipes-devtools/gcc/gcc-${PV}.inc 1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc 2require libgcc.inc
3 3
4LDFLAGS += "-fuse-ld=bfd"
5
4# Building with thumb enabled on armv6t fails 6# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET:armv6 = "arm" 7ARM_INSTRUCTION_SET:armv6 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran.inc b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
index 99fdd89c..c68645e3 100644
--- a/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
@@ -47,10 +47,11 @@ do_install () {
47 chown -R root:root ${D} 47 chown -R root:root ${D}
48} 48}
49 49
50# avoid virtual/libc
50INHIBIT_DEFAULT_DEPS = "1" 51INHIBIT_DEFAULT_DEPS = "1"
51DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}" 52DEPENDS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs"
52 53
53#BBCLASSEXTEND = "nativesdk" 54BBCLASSEXTEND = "nativesdk"
54 55
55PACKAGES = "\ 56PACKAGES = "\
56 ${PN}-dbg \ 57 ${PN}-dbg \
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.3.bb
index 71dd8b4b..71dd8b4b 100644
--- a/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.3.bb
diff --git a/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
deleted file mode 100644
index 67c40845..00000000
--- a/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
+++ /dev/null
@@ -1 +0,0 @@
1COMPATIBLE_HOST:microblaze = "^$"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
deleted file mode 100644
index aef0d2a1..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
+++ /dev/null
@@ -1,66 +0,0 @@
1SUMMARY = "GNU debugger"
2HOMEPAGE = "http://www.gnu.org/software/gdb/"
3DESCRIPTION = "GDB, the GNU Project debugger, allows you to see what is going on inside another program while it executes -- or what another program was doing at the moment it crashed."
4SECTION = "devel"
5DEPENDS = "expat gmp zlib ncurses virtual/libiconv ${LTTNGUST} bison-native"
6
7LTTNGUST = "lttng-ust"
8LTTNGUST:arc = ""
9LTTNGUST:aarch64 = ""
10LTTNGUST:mipsarch = ""
11LTTNGUST:sh4 = ""
12
13inherit autotools texinfo
14
15UPSTREAM_CHECK_GITTAGREGEX = "gdb\-(?P<pver>.+)\-release"
16
17B = "${UNPACKDIR}/build-${TARGET_SYS}"
18
19EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}"
20
21EXTRA_OECONF = "--disable-gdbtk --disable-x --disable-werror \
22 --with-curses --disable-multilib --disable-sim \
23 --without-guile \
24 ${GDBPROPREFIX} ${EXPAT} \
25 ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \
26 --disable-rpath \
27 --disable-gas --disable-binutils \
28 --disable-ld --disable-gold \
29 --disable-gprof \
30 --with-libgmp-prefix=${STAGING_EXECPREFIXDIR} \
31"
32
33PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
34# Use --without-system-readline to compile with readline 5.
35PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline"
36PACKAGECONFIG[python] = "--with-python=${UNPACKDIR}/python,--without-python,python3,python3 python3-codecs"
37PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace"
38# ncurses is already a hard DEPENDS, but would be added here if it weren't
39PACKAGECONFIG[tui] = "--enable-tui,--disable-tui"
40PACKAGECONFIG[xz] = "--with-lzma --with-liblzma-prefix=${STAGING_DIR_HOST},--without-lzma,xz"
41PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils"
42
43GDBPROPREFIX = "--program-prefix=''"
44
45DISABLE_STATIC = ""
46
47do_configure () {
48 # override this function to avoid the autoconf/automake/aclocal/autoheader
49 # calls for now
50 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
51 oe_runconf
52}
53
54# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
55# right bits installed by binutils. Same for bfd.info -- also from binutils.
56do_install:append() {
57 rm -rf ${D}${libdir}
58 rm -rf ${D}${includedir}
59 rm -rf ${D}${datadir}/locale
60 rm -f ${D}${infodir}/bfd.info
61}
62
63RRECOMMENDS:gdb:append:linux = " glibc-thread-db "
64RRECOMMENDS:gdb:append:linux-gnueabi = " glibc-thread-db "
65RRECOMMENDS:gdbserver:append:linux = " glibc-thread-db "
66RRECOMMENDS:gdbserver:append:linux-gnueabi = " glibc-thread-db "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc
deleted file mode 100644
index a6857cf7..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc
+++ /dev/null
@@ -1,44 +0,0 @@
1inherit cross-canadian
2inherit python3-dir
3inherit pkgconfig
4
5SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)"
6PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
7BPN = "gdb"
8
9DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-gmp \
10 virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc"
11
12GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
13
14# Overrides PACKAGECONFIG variables in gdb-common.inc
15PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
16PACKAGECONFIG[python] = "--with-python=${UNPACKDIR}/python,--without-python,nativesdk-python3, \
17 nativesdk-python3-core \
18 nativesdk-python3-codecs nativesdk-python3-netclient \
19 "
20PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline"
21PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, nativesdk-elfutils"
22
23SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_DATADIR}/gdb"
24
25do_configure:prepend() {
26cat > ${UNPACKDIR}/python << EOF
27#! /bin/sh
28case "\$2" in
29 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;;
30 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;;
31 --exec-prefix) echo "${exec_prefix}" ;;
32 *) exit 1 ;;
33esac
34exit 0
35EOF
36 chmod +x ${UNPACKDIR}/python
37}
38
39# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
40# right bits installed by binutils.
41do_install:append() {
42 rm -rf ${D}${exec_prefix}/lib
43 cross_canadian_bindirlinks
44}
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb
deleted file mode 100644
index 4ab2b715..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require gdb-common.inc
2require gdb-cross-canadian.inc
3require gdb.inc
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc
deleted file mode 100644
index b418f3a3..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc
+++ /dev/null
@@ -1,31 +0,0 @@
1require gdb-common.inc
2
3DEPENDS = "expat-native gmp-native ncurses-native flex-native bison-native"
4
5inherit python3native pkgconfig
6
7# Overrides PACKAGECONFIG variables in gdb-common.inc
8PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
9PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3-native"
10PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline-native"
11PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils-native"
12
13do_compile:prepend() {
14 export STAGING_LIBDIR="${STAGING_LIBDIR_NATIVE}"
15 export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}"
16}
17
18#EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'"
19
20GDBPROPREFIX = ""
21
22PN = "gdb-cross-${TARGET_ARCH}"
23BPN = "gdb"
24
25# Ignore how TARGET_ARCH is computed.
26TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
27
28inherit cross
29inherit gettext
30
31datadir .= "/gdb-${TARGET_SYS}${TARGET_VENDOR}-${TARGET_OS}"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb
deleted file mode 100644
index 3b654a2f..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require gdb-cross.inc
2require gdb.inc
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
index d3618229..4e8993c4 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc
@@ -4,14 +4,54 @@ LTTNGUST:microblaze = ""
4# Add MicroBlaze patches 4# Add MicroBlaze patches
5FILESEXTRAPATHS:append := ":${THISDIR}/gdb" 5FILESEXTRAPATHS:append := ":${THISDIR}/gdb"
6 6
7# Our changes are all local, no real patch-status
8ERROR_QA:remove = "patch-status"
9
10LDFLAGS:append:class-target:microblaze = " -latomic"
11
7SRC_URI:append:microblaze = " \ 12SRC_URI:append:microblaze = " \
8 file://0001-Add-initial-port-of-linux-gdbserver.patch \ 13 file://0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
9 file://0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch \ 14 file://0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \
10 file://0003-Fix-debug-message-when-register-is-unavailable.patch \ 15 file://0003-Initial-port-of-core-reading-support-Added-support-f.patch \
11 file://0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch \ 16 file://0004-Fix-debug-message-when-register-is-unavailable.patch \
12 file://0005-Patch-microblaze-Adding-64-bit-MB-support.patch \ 17 file://0005-MicroBlaze-native-gdb-port.patch \
13 file://0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch \ 18 file://0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch \
14 file://0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch \ 19 file://0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch \
15 file://0008-Patch-MicroBlaze.patch \ 20 file://0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch \
16 file://0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch \ 21 file://0009-Depth-Total-number-of-inline-functions-refer-inline-.patch \
22 file://0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch \
23 file://0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch \
24 file://0013-Disable-the-warning-message-for-eh_frame_hdr.patch \
25 file://0015-upstream-change-to-garbage-collection-sweep-causes-m.patch \
26 file://0016-Add-new-bit-field-instructions.patch \
27 file://0019-initial-support-for-MicroBlaze-64-bit-m64.patch \
28 file://0020-initial-support-for-MicroBlaze-64-bit-m64.patch \
29 file://0021-Added-relocations-for-MB-X.patch \
30 file://0022-initial-support-for-MicroBlaze-64-bit-m64.patch \
31 file://0023-Added-relocations-for-MB-X.patch \
32 file://0025-Fixed-address-computation-issues-with-64bit-address-.patch \
33 file://0028-fixing-the-long-long-long-mingw-toolchain-issue.patch \
34 file://0029-Added-support-to-new-arithmetic-single-register-inst.patch \
35 file://0030-double-imml-generation-for-64-bit-values.patch \
36 file://0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
37 file://0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch \
38 file://0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch \
39 file://0038-MB-binutils-Upstream-port-issues.patch \
40 file://0039-Initial-port-of-core-reading-support-Added-support-f.patch \
41 file://0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch \
42 file://0041-disable-truncated-register-warning-gdb-remote.c.patch \
43 file://0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch \
44 file://0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch \
45 file://0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch \
46 file://0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch \
47 file://0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch \
48 file://0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch \
49 file://0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch \
50 file://0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch \
51 file://0050-When-unwinding-pc-value-adjust-return-pc-value.patch \
52 file://0051-info-reg-pc-does-not-print-symbolic-value.patch \
53 file://0052-Wrong-target-description-accepted-by-microblaze-arch.patch \
54 file://0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch \
55 file://0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch \
56 file://0055-fix-microblaze-linux-nat.patch \
17 " 57 "
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb.inc b/meta-microblaze/recipes-devtools/gdb/gdb.inc
deleted file mode 100644
index a5dc5545..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb.inc
+++ /dev/null
@@ -1,20 +0,0 @@
1LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.0-only & LGPL-3.0-only"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
8 file://0001-make-man-install-relative-to-DESTDIR.patch \
9 file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \
10 file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \
11 file://0004-Dont-disable-libreadline.a-when-using-disable-static.patch \
12 file://0005-use-asm-sgidefs.h.patch \
13 file://0006-Change-order-of-CFLAGS.patch \
14 file://0007-resolve-restrict-keyword-conflict.patch \
15 file://0008-Fix-invalid-sigprocmask-call.patch \
16 file://0009-gdbserver-ctrl-c-handling.patch \
17 file://readline-8.2.patch \
18 file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
19 "
20SRC_URI[sha256sum] = "0e1793bf8f2b54d53f46dea84ccfd446f48f81b297b28c4f7fc017b818d69fed"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
new file mode 100644
index 00000000..bf7b3363
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -0,0 +1,42 @@
1From fc4e376f932514d9e5e3c04a18952d5900334c09 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 01/54] 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>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdbserver/Makefile.in | 1 +
26 1 file changed, 1 insertion(+)
27
28diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
29index b597515d428..faf32cd9d42 100644
30--- a/gdbserver/Makefile.in
31+++ b/gdbserver/Makefile.in
32@@ -180,6 +180,7 @@ SFILES = \
33 $(srcdir)/linux-loongarch-low.cc \
34 $(srcdir)/linux-low.cc \
35 $(srcdir)/linux-m68k-low.cc \
36+ $(srcdir)/linux-microblaze-low.cc \
37 $(srcdir)/linux-mips-low.cc \
38 $(srcdir)/linux-nios2-low.cc \
39 $(srcdir)/linux-or1k-low.cc \
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
deleted file mode 100644
index 16d6cf19..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 8eca28eddcda4ce8a345ca031f43ff1ed6f37089 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 02:27:55 +0000
4Subject: [PATCH 1/9] make man install relative to DESTDIR
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 sim/common/Make-common.in | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
14index 74e5dad3049..9e95c224ba4 100644
15--- a/sim/common/Make-common.in
16+++ b/sim/common/Make-common.in
17@@ -70,7 +70,7 @@ tooldir = $(libdir)/$(target_alias)
18 datadir = @datadir@
19 datarootdir = @datarootdir@
20 mandir = @mandir@
21-man1dir = $(mandir)/man1
22+man1dir = $(DESTDIR)$(mandir)/man1
23 infodir = @infodir@
24 includedir = @includedir@
25
26--
272.36.1
28
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
new file mode 100644
index 00000000..02b42cbd
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
@@ -0,0 +1,639 @@
1From fa91dbd8c23e519760213f32de572cbf98ad6bc3 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 15:07:22 +0530
4Subject: [PATCH 02/54] 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>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdb/configure.host | 2 +
26 gdb/features/Makefile | 1 +
27 gdb/features/microblaze-linux.xml | 13 ++
28 gdb/microblaze-linux-tdep.c | 29 ++-
29 gdb/microblaze-tdep.c | 35 +++-
30 gdb/microblaze-tdep.h | 4 +-
31 gdb/regformats/microblaze-linux.dat | 64 +++++++
32 gdb/regformats/reg-microblaze.dat | 41 +++++
33 gdbserver/configure.srv | 10 ++
34 gdbserver/linux-microblaze-low.cc | 269 ++++++++++++++++++++++++++++
35 10 files changed, 465 insertions(+), 3 deletions(-)
36 create mode 100644 gdb/features/microblaze-linux.xml
37 create mode 100644 gdb/regformats/microblaze-linux.dat
38 create mode 100644 gdb/regformats/reg-microblaze.dat
39 create mode 100644 gdbserver/linux-microblaze-low.cc
40
41diff --git a/gdb/configure.host b/gdb/configure.host
42index da71675b201..877537d06ef 100644
43--- a/gdb/configure.host
44+++ b/gdb/configure.host
45@@ -61,6 +61,7 @@ i[34567]86*) gdb_host_cpu=i386 ;;
46 loongarch*) gdb_host_cpu=loongarch ;;
47 m68*) gdb_host_cpu=m68k ;;
48 mips*) gdb_host_cpu=mips ;;
49+microblaze*) gdb_host_cpu=microblaze ;;
50 powerpc* | rs6000) gdb_host_cpu=powerpc ;;
51 sparcv9 | sparc64) gdb_host_cpu=sparc ;;
52 s390*) gdb_host_cpu=s390 ;;
53@@ -127,6 +128,7 @@ m68*-*-openbsd*) gdb_host=obsd ;;
54
55 m88*-*-openbsd*) gdb_host=obsd ;;
56
57+microblaze*-*linux*) gdb_host=linux ;;
58 mips*-*-linux*) gdb_host=linux ;;
59 mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu)
60 gdb_host=nbsd ;;
61diff --git a/gdb/features/Makefile b/gdb/features/Makefile
62index 32341f71815..0af9d67c2f7 100644
63--- a/gdb/features/Makefile
64+++ b/gdb/features/Makefile
65@@ -46,6 +46,7 @@
66 # List of .dat files to create in ../regformats/
67 WHICH = mips-linux mips-dsp-linux \
68 mips64-linux mips64-dsp-linux \
69+ microblaze-linux \
70 nios2-linux \
71 or1k-linux \
72 rs6000/powerpc-32 \
73diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
74new file mode 100644
75index 00000000000..688a3f83d1e
76--- /dev/null
77+++ b/gdb/features/microblaze-linux.xml
78@@ -0,0 +1,13 @@
79+<?xml version="1.0"?>
80+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
81+
82+ Copying and distribution of this file, with or without modification,
83+ are permitted in any medium without royalty provided the copyright
84+ notice and this notice are preserved. -->
85+
86+<!DOCTYPE target SYSTEM "gdb-target.dtd">
87+<target>
88+ <architecture>microblaze</architecture>
89+ <osabi>GNU/Linux</osabi>
90+ <xi:include href="microblaze-core.xml"/>
91+</target>
92diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
93index ae33cb5c014..9160b4ad464 100644
94--- a/gdb/microblaze-linux-tdep.c
95+++ b/gdb/microblaze-linux-tdep.c
96@@ -37,6 +37,22 @@
97 #include "tramp-frame.h"
98 #include "linux-tdep.h"
99
100+static int microblaze_debug_flag = 0;
101+
102+static void
103+microblaze_debug (const char *fmt, ...)
104+{
105+ if (microblaze_debug_flag)
106+ {
107+ va_list args;
108+
109+ va_start (args, fmt);
110+ printf_unfiltered ("MICROBLAZE LINUX: ");
111+ vprintf_unfiltered (fmt, args);
112+ va_end (args);
113+ }
114+}
115+
116 static int
117 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
118 struct bp_target_info *bp_tgt)
119@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
120 /* Determine appropriate breakpoint contents and size for this address. */
121 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
122
123+ /* Make sure we see the memory breakpoints. */
124+ scoped_restore restore_memory
125+ = make_scoped_restore_show_memory_breakpoints (1);
126+
127 val = target_read_memory (addr, old_contents, bplen);
128
129 /* If our breakpoint is no longer at the address, this means that the
130 program modified the code on us, so it is wrong to put back the
131 old value. */
132 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
133- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
134+ {
135+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
136+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
137+ }
138
139 return val;
140 }
141@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
142 /* Trampolines. */
143 tramp_frame_prepend_unwinder (gdbarch,
144 &microblaze_linux_sighandler_tramp_frame);
145+
146+ /* Enable TLS support. */
147+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
148+ svr4_fetch_objfile_link_map);
149 }
150
151 void _initialize_microblaze_linux_tdep ();
152diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
153index f254a54305c..28a647e940b 100644
154--- a/gdb/microblaze-tdep.c
155+++ b/gdb/microblaze-tdep.c
156@@ -128,7 +128,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
157 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
158
159 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
160-
161+static int
162+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
163+ struct bp_target_info *bp_tgt)
164+{
165+ CORE_ADDR addr = bp_tgt->placed_address;
166+ const unsigned char *bp;
167+ int val;
168+ int bplen;
169+ gdb_byte old_contents[BREAKPOINT_MAX];
170+
171+ /* Determine appropriate breakpoint contents and size for this address. */
172+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
173+ if (bp == NULL)
174+ error (_("Software breakpoints not implemented for this target."));
175+
176+ /* Make sure we see the memory breakpoints. */
177+ scoped_restore restore_memory
178+ = make_scoped_restore_show_memory_breakpoints (1);
179+
180+ val = target_read_memory (addr, old_contents, bplen);
181+
182+ /* If our breakpoint is no longer at the address, this means that the
183+ program modified the code on us, so it is wrong to put back the
184+ old value. */
185+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
186+ {
187+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
188+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
189+ }
190+
191+ return val;
192+}
193
194 /* Allocate and initialize a frame cache. */
195
196@@ -714,6 +745,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
197 microblaze_breakpoint::kind_from_pc);
198 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
199 microblaze_breakpoint::bp_from_kind);
200+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
201
202 set_gdbarch_frame_args_skip (gdbarch, 8);
203
204@@ -754,4 +786,5 @@ When non-zero, microblaze specific debugging is enabled."),
205 NULL,
206 &setdebuglist, &showdebuglist);
207
208+
209 }
210diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
211index 892e5b3b849..e9f57e97c26 100644
212--- a/gdb/microblaze-tdep.h
213+++ b/gdb/microblaze-tdep.h
214@@ -118,6 +118,8 @@ struct microblaze_frame_cache
215
216 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
217 Only used for native debugging. */
218-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
219+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
220+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
221+
222
223 #endif /* microblaze-tdep.h */
224diff --git a/gdb/regformats/microblaze-linux.dat b/gdb/regformats/microblaze-linux.dat
225new file mode 100644
226index 00000000000..b5b49f485cd
227--- /dev/null
228+++ b/gdb/regformats/microblaze-linux.dat
229@@ -0,0 +1,64 @@
230+# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro:
231+# Generated from: microblaze-linux.xml
232+name:microblaze_linux
233+xmltarget:microblaze-linux.xml
234+expedite:r1,rpc
235+32:r0
236+32:r1
237+32:r2
238+32:r3
239+32:r4
240+32:r5
241+32:r6
242+32:r7
243+32:r8
244+32:r9
245+32:r10
246+32:r11
247+32:r12
248+32:r13
249+32:r14
250+32:r15
251+32:r16
252+32:r17
253+32:r18
254+32:r19
255+32:r20
256+32:r21
257+32:r22
258+32:r23
259+32:r24
260+32:r25
261+32:r26
262+32:r27
263+32:r28
264+32:r29
265+32:r30
266+32:r31
267+32:rpc
268+32:rmsr
269+32:rear
270+32:resr
271+32:rfsr
272+32:rbtr
273+32:rpvr0
274+32:rpvr1
275+32:rpvr2
276+32:rpvr3
277+32:rpvr4
278+32:rpvr5
279+32:rpvr6
280+32:rpvr7
281+32:rpvr8
282+32:rpvr9
283+32:rpvr10
284+32:rpvr11
285+32:redr
286+32:rpid
287+32:rzpr
288+32:rtlbx
289+32:rtlbsx
290+32:rtlblo
291+32:rtlbhi
292+32:slr
293+32:shr
294diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
295new file mode 100644
296index 00000000000..bd8a4384424
297--- /dev/null
298+++ b/gdb/regformats/reg-microblaze.dat
299@@ -0,0 +1,41 @@
300+name:microblaze
301+expedite:r1,pc
302+32:r0
303+32:r1
304+32:r2
305+32:r3
306+32:r4
307+32:r5
308+32:r6
309+32:r7
310+32:r8
311+32:r9
312+32:r10
313+32:r11
314+32:r12
315+32:r13
316+32:r14
317+32:r15
318+32:r16
319+32:r17
320+32:r18
321+32:r19
322+32:r20
323+32:r21
324+32:r22
325+32:r23
326+32:r24
327+32:r25
328+32:r26
329+32:r27
330+32:r28
331+32:r29
332+32:r30
333+32:r31
334+32:pc
335+32:msr
336+32:ear
337+32:esr
338+32:fsr
339+32:slr
340+32:shr
341diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
342index 9e861a75088..11ce617e72f 100644
343--- a/gdbserver/configure.srv
344+++ b/gdbserver/configure.srv
345@@ -159,6 +159,16 @@ case "${gdbserver_host}" in
346 srv_linux_regsets=yes
347 srv_linux_thread_db=yes
348 ;;
349+
350+microblaze*-*-linux*) srv_regobj="microblaze-linux.o"
351+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o"
352+ srv_xmlfiles="microblaze-linux.xml"
353+ srv_xmlfiles="${srv_xmlfiles} microblaze-core.xml"
354+ srv_linux_usrregs=yes
355+ srv_linux_regsets=yes
356+ srv_linux_thread_db=yes
357+ ;;
358+
359 mips*-*-linux*) srv_regobj="mips-linux.o"
360 srv_regobj="${srv_regobj} mips-dsp-linux.o"
361 srv_regobj="${srv_regobj} mips64-linux.o"
362diff --git a/gdbserver/linux-microblaze-low.cc b/gdbserver/linux-microblaze-low.cc
363new file mode 100644
364index 00000000000..bf9eecc41ab
365--- /dev/null
366+++ b/gdbserver/linux-microblaze-low.cc
367@@ -0,0 +1,269 @@
368+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
369+ GDB.
370+ Copyright (C) 1995-2013 Free Software Foundation, Inc.
371+
372+ This file is part of GDB.
373+
374+ This program is free software; you can redistribute it and/or modify
375+ it under the terms of the GNU General Public License as published by
376+ the Free Software Foundation; either version 3 of the License, or
377+ (at your option) any later version.
378+
379+ This program is distributed in the hope that it will be useful,
380+ but WITHOUT ANY WARRANTY; without even the implied warranty of
381+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
382+ GNU General Public License for more details.
383+
384+ You should have received a copy of the GNU General Public License
385+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
386+
387+#include "server.h"
388+#include "linux-low.h"
389+
390+#include "elf/common.h"
391+#include "nat/gdb_ptrace.h"
392+#include <endian.h>
393+
394+#include <asm/ptrace.h>
395+#include <sys/procfs.h>
396+#include <sys/ptrace.h>
397+
398+#include "gdb_proc_service.h"
399+
400+
401+static int microblaze_regmap[] =
402+ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3),
403+ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7),
404+ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11),
405+ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15),
406+ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19),
407+ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23),
408+ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27),
409+ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31),
410+ PT_PC, PT_MSR, PT_EAR, PT_ESR,
411+ PT_FSR
412+ };
413+
414+
415+
416+class microblaze_target : public linux_process_target
417+{
418+public:
419+
420+ const regs_info *get_regs_info () override;
421+
422+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
423+ // CORE_ADDR microblaze_reinsert_addr (regcache *regcache);
424+
425+protected:
426+
427+ void low_arch_setup () override;
428+
429+ bool low_cannot_fetch_register (int regno) override;
430+
431+ bool low_cannot_store_register (int regno) override;
432+
433+ // bool low_supports_breakpoints () override;
434+
435+ CORE_ADDR low_get_pc (regcache *regcache) override;
436+
437+ void low_set_pc (regcache *regcache, CORE_ADDR newpc) override;
438+
439+ bool low_breakpoint_at (CORE_ADDR pc) override;
440+};
441+
442+/* The singleton target ops object. */
443+
444+static microblaze_target the_microblaze_target;
445+
446+#define microblaze_num_regs (sizeof (microblaze_regmap) / sizeof (microblaze_regmap[0]))
447+
448+/* Defined in auto-generated file microblaze-linux.c. */
449+void init_registers_microblaze_linux (void);
450+extern const struct target_desc *tdesc_microblaze_linux;
451+
452+bool
453+microblaze_target::low_cannot_store_register (int regno)
454+{
455+ if (microblaze_regmap[regno] == -1 || regno == 0)
456+ return 1;
457+
458+ return 0;
459+}
460+
461+bool
462+microblaze_target::low_cannot_fetch_register (int regno)
463+{
464+ return 0;
465+}
466+
467+CORE_ADDR
468+microblaze_target::low_get_pc (struct regcache *regcache)
469+{
470+ unsigned long pc;
471+
472+ collect_register_by_name (regcache, "pc", &pc);
473+ return (CORE_ADDR) pc;
474+}
475+
476+void
477+microblaze_target::low_set_pc (struct regcache *regcache, CORE_ADDR pc)
478+{
479+ unsigned long newpc = pc;
480+
481+ supply_register_by_name (regcache, "pc", &newpc);
482+}
483+
484+/* dbtrap insn */
485+/* brki r16, 0x18; */
486+static const unsigned long microblaze_breakpoint = 0xba0c0018;
487+#define microblaze_breakpoint_len 4
488+
489+/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
490+
491+const gdb_byte *
492+microblaze_target::sw_breakpoint_from_kind (int kind, int *size)
493+{
494+ *size = microblaze_breakpoint_len;
495+ return (const gdb_byte *) &microblaze_breakpoint;
496+}
497+
498+bool
499+microblaze_target::low_breakpoint_at (CORE_ADDR where)
500+{
501+ unsigned long insn;
502+
503+ read_memory (where, (unsigned char *) &insn, 4);
504+ if (insn == microblaze_breakpoint)
505+ return 1;
506+ /* If necessary, recognize more trap instructions here. GDB only uses the
507+ one. */
508+ return 0;
509+}
510+#if 0
511+CORE_ADDR
512+microblaze_target::microblaze_reinsert_addr (struct regcache *regcache)
513+{
514+ unsigned long pc;
515+ collect_register_by_name (regcache, "r15", &pc);
516+ return pc;
517+}
518+#endif
519+#if 0
520+#ifdef HAVE_PTRACE_GETREGS
521+
522+static void
523+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
524+{
525+ int size = register_size (regcache->tdesc, regno);
526+
527+ memset (buf, 0, sizeof (long));
528+
529+ if (size < sizeof (long))
530+ collect_register (regcache, regno, buf + sizeof (long) - size);
531+ else
532+ collect_register (regcache, regno, buf);
533+}
534+
535+static void
536+microblaze_supply_ptrace_register (struct regcache *regcache,
537+ int regno, const char *buf)
538+{
539+ int size = register_size (regcache->tdesc, regno);
540+
541+ if (regno == 0) {
542+ unsigned long regbuf_0 = 0;
543+ /* clobbering r0 so that it is always 0 as enforced by hardware */
544+ supply_register (regcache, regno, (const char*)&regbuf_0);
545+ } else {
546+ if (size < sizeof (long))
547+ supply_register (regcache, regno, buf + sizeof (long) - size);
548+ else
549+ supply_register (regcache, regno, buf);
550+ }
551+}
552+
553+/* Provide only a fill function for the general register set. ps_lgetregs
554+ will use this for NPTL support. */
555+
556+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
557+{
558+ int i;
559+
560+ for (i = 0; i < 32; i++)
561+ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
562+}
563+
564+static void
565+microblaze_store_gregset (struct regcache *regcache, const void *buf)
566+{
567+ int i;
568+
569+ for (i = 0; i < 32; i++)
570+ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
571+}
572+
573+#endif /* HAVE_PTRACE_GETREGS */
574+#endif
575+
576+static struct regset_info microblaze_regsets[] = {
577+#if 0
578+#ifdef HAVE_PTRACE_GETREGS
579+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
580+ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
581+#endif /* HAVE_PTRACE_GETREGS */
582+#endif
583+ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
584+ NULL_REGSET
585+};
586+
587+static struct usrregs_info microblaze_usrregs_info =
588+ {
589+ microblaze_num_regs,
590+ microblaze_regmap,
591+ };
592+
593+static struct regsets_info microblaze_regsets_info =
594+ {
595+ microblaze_regsets, /* regsets */
596+ 0, /* num_regsets */
597+ NULL, /* disabled_regsets */
598+ };
599+
600+static struct regs_info microblaze_regs_info =
601+ {
602+ NULL, /* regset_bitmap */
603+ &microblaze_usrregs_info,
604+ &microblaze_regsets_info
605+ };
606+
607+const regs_info *
608+microblaze_target::get_regs_info (void)
609+{
610+ return &microblaze_regs_info;
611+}
612+
613+/* Support for hardware single step. */
614+
615+static int
616+microblaze_supports_hardware_single_step (void)
617+{
618+ return 1;
619+}
620+
621+
622+void
623+microblaze_target::low_arch_setup (void)
624+{
625+ current_process ()->tdesc = tdesc_microblaze_linux;
626+}
627+
628+linux_process_target *the_linux_target = &the_microblaze_target;
629+
630+void
631+initialize_low_arch (void)
632+{
633+ init_registers_microblaze_linux ();
634+ initialize_regsets_info (&microblaze_regsets_info);
635+}
636+
637--
6382.34.1
639
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
deleted file mode 100644
index 8d263de8..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 37d3afd2eaa95c89ad7cb5d0079b017752e4d0ea Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 23 Mar 2016 06:30:09 +0000
4Subject: [PATCH 2/9] mips-linux-nat: Define _ABIO32 if not defined
5
6This helps building gdb on mips64 on musl, since
7musl does not provide sgidefs.h this define is
8only defined when GCC is using o32 ABI, in that
9case gcc emits it as built-in define and hence
10it works ok for mips32
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 gdb/mips-linux-nat.c | 4 ++++
16 1 file changed, 4 insertions(+)
17
18diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
19index 20e12b6889e..6adc61235aa 100644
20--- a/gdb/mips-linux-nat.c
21+++ b/gdb/mips-linux-nat.c
22@@ -41,6 +41,10 @@
23 #ifndef PTRACE_GET_THREAD_AREA
24 #define PTRACE_GET_THREAD_AREA 25
25 #endif
26+/* musl does not define and relies on compiler built-in macros for it */
27+#ifndef _ABIO32
28+#define _ABIO32 1
29+#endif
30
31 class mips_linux_nat_target final : public linux_nat_trad_target
32 {
33--
342.36.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
deleted file mode 100644
index d8ba6fca..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Fix-debug-message-when-register-is-unavailable.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 6ecb1de66a6a5f55e69c9b108a3d5a85b0ebf315 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 3/8] Fix debug message when register is unavailable
5
6Upstream-Status: Pending
7
8Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
9
10Conflicts:
11 gdb/frame.c
12---
13 gdb/frame.c | 21 ++++++++++++++-------
14 1 file changed, 14 insertions(+), 7 deletions(-)
15
16diff --git a/gdb/frame.c b/gdb/frame.c
17index ce95cf8343b..c49ab9feab2 100644
18--- a/gdb/frame.c
19+++ b/gdb/frame.c
20@@ -1261,13 +1261,20 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
21 else
22 {
23 int i;
24- gdb::array_view<const gdb_byte> buf = value_contents (value);
25-
26- fprintf_unfiltered (&debug_file, " bytes=");
27- fprintf_unfiltered (&debug_file, "[");
28- for (i = 0; i < register_size (gdbarch, regnum); i++)
29- fprintf_unfiltered (&debug_file, "%02x", buf[i]);
30- fprintf_unfiltered (&debug_file, "]");
31+ const gdb_byte *buf = NULL;
32+ if (value_entirely_available(value)) {
33+ gdb::array_view<const gdb_byte> buf = value_contents (value);
34+ }
35+
36+ fprintf_unfiltered (gdb_stdlog, " bytes=");
37+ fprintf_unfiltered (gdb_stdlog, "[");
38+ if (buf != NULL) {
39+ for (i = 0; i < register_size (gdbarch, regnum); i++)
40+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
41+ } else {
42+ fprintf_unfiltered (gdb_stdlog, "unavailable");
43+ }
44+ fprintf_unfiltered (gdb_stdlog, "]");
45 }
46 }
47
48--
492.37.1 (Apple Git-137.1)
50
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch
new file mode 100644
index 00000000..6e86a773
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -0,0 +1,301 @@
1From 118ce6c252a56ca592a7fdd40919522be00d5fb4 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 03/54] Initial port of core reading support Added support for
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.
7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/elf32-microblaze.c | 84 +++++++++++++++++++++++++++++++++++++
14 gdb/configure.tgt | 2 +-
15 gdb/microblaze-linux-tdep.c | 17 +++++++-
16 gdb/microblaze-tdep.c | 48 +++++++++++++++++++++
17 gdb/microblaze-tdep.h | 28 +++++++++++++
18 5 files changed, 177 insertions(+), 2 deletions(-)
19
20diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
21index a7e81c70fc8..487ddeafc5a 100644
22--- a/bfd/elf32-microblaze.c
23+++ b/bfd/elf32-microblaze.c
24@@ -754,6 +754,87 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
25 return _bfd_elf_is_local_label_name (abfd, name);
26 }
27
28+/* Support for core dump NOTE sections. */
29+static bool
30+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
31+{
32+ int offset;
33+ unsigned int size;
34+
35+ switch (note->descsz)
36+ {
37+ default:
38+ return false;
39+
40+ case 228: /* Linux/MicroBlaze */
41+ /* pr_cursig */
42+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
43+
44+ /* pr_pid */
45+ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
46+
47+ /* pr_reg */
48+ offset = 72;
49+ size = 50 * 4;
50+
51+ break;
52+ }
53+
54+ /* Make a ".reg/999" section. */
55+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
56+ size, note->descpos + offset);
57+}
58+
59+static bool
60+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
61+{
62+ switch (note->descsz)
63+ {
64+ default:
65+ return false;
66+
67+ case 128: /* Linux/MicroBlaze elf_prpsinfo */
68+ elf_tdata (abfd)->core->program
69+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
70+ elf_tdata (abfd)->core->command
71+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
72+ }
73+
74+ /* Note that for some reason, a spurious space is tacked
75+ onto the end of the args in some (at least one anyway)
76+ implementations, so strip it off if it exists. */
77+
78+ {
79+ char *command = elf_tdata (abfd)->core->command;
80+ int n = strlen (command);
81+
82+ if (0 < n && command[n - 1] == ' ')
83+ command[n - 1] = '\0';
84+ }
85+
86+ return true;
87+}
88+
89+/* The microblaze linker (like many others) needs to keep track of
90+ the number of relocs that it decides to copy as dynamic relocs in
91+ check_relocs for each symbol. This is so that it can later discard
92+ them if they are found to be unnecessary. We store the information
93+ in a field extending the regular ELF linker hash table. */
94+
95+struct elf32_mb_dyn_relocs
96+{
97+ struct elf32_mb_dyn_relocs *next;
98+
99+ /* The input section of the reloc. */
100+ asection *sec;
101+
102+ /* Total number of relocs copied for the input section. */
103+ bfd_size_type count;
104+
105+ /* Number of pc-relative relocs copied for the input section. */
106+ bfd_size_type pc_count;
107+};
108+
109 /* ELF linker hash entry. */
110
111 struct elf32_mb_link_hash_entry
112@@ -3480,4 +3561,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
113 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
114 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
115
116+#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
117+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
118+
119 #include "elf32-target.h"
120diff --git a/gdb/configure.tgt b/gdb/configure.tgt
121index 47a674201f9..d0673abd2b8 100644
122--- a/gdb/configure.tgt
123+++ b/gdb/configure.tgt
124@@ -415,7 +415,7 @@ mep-*-*)
125
126 microblaze*-linux-*|microblaze*-*-linux*)
127 # Target: Xilinx MicroBlaze running Linux
128- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o \
129+ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o glibc-tdep.o \
130 symfile-mem.o linux-tdep.o"
131 ;;
132 microblaze*-*-*)
133diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
134index 9160b4ad464..17bcb50fd4f 100644
135--- a/gdb/microblaze-linux-tdep.c
136+++ b/gdb/microblaze-linux-tdep.c
137@@ -36,6 +36,7 @@
138 #include "frame-unwind.h"
139 #include "tramp-frame.h"
140 #include "linux-tdep.h"
141+#include "glibc-tdep.h"
142
143 static int microblaze_debug_flag = 0;
144
145@@ -135,11 +136,14 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
146 microblaze_linux_sighandler_cache_init
147 };
148
149-
150 static void
151 microblaze_linux_init_abi (struct gdbarch_info info,
152 struct gdbarch *gdbarch)
153 {
154+ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
155+
156+ tdep->sizeof_gregset = 200;
157+
158 linux_init_abi (info, gdbarch, 0);
159
160 set_gdbarch_memory_remove_breakpoint (gdbarch,
161@@ -153,6 +157,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
162 tramp_frame_prepend_unwinder (gdbarch,
163 &microblaze_linux_sighandler_tramp_frame);
164
165+ /* BFD target for core files. */
166+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
167+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
168+ else
169+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
170+
171+
172+ /* Shared library handling. */
173+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
174+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
175+
176 /* Enable TLS support. */
177 set_gdbarch_fetch_tls_load_module_address (gdbarch,
178 svr4_fetch_objfile_link_map);
179diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
180index 28a647e940b..6ab36bd746b 100644
181--- a/gdb/microblaze-tdep.c
182+++ b/gdb/microblaze-tdep.c
183@@ -665,6 +665,43 @@ microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
184 tdesc_microblaze_with_stack_protect);
185 }
186
187+void
188+microblaze_supply_gregset (const struct regset *regset,
189+ struct regcache *regcache,
190+ int regnum, const void *gregs)
191+{
192+ const unsigned int *regs = (const unsigned int *)gregs;
193+ if (regnum >= 0)
194+ regcache->raw_supply (regnum, regs + regnum);
195+
196+ if (regnum == -1) {
197+ int i;
198+
199+ for (i = 0; i < 50; i++) {
200+ regcache->raw_supply (i, regs + i);
201+ }
202+ }
203+}
204+
205+
206+/* Return the appropriate register set for the core section identified
207+ by SECT_NAME and SECT_SIZE. */
208+
209+static void
210+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
211+ iterate_over_regset_sections_cb *cb,
212+ void *cb_data,
213+ const struct regcache *regcache)
214+{
215+ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
216+
217+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
218+
219+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
220+}
221+
222+
223+
224 static struct gdbarch *
225 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
226 {
227@@ -716,6 +753,10 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
228 gdbarch *gdbarch
229 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
230
231+ tdep->gregset = NULL;
232+ tdep->sizeof_gregset = 0;
233+ tdep->fpregset = NULL;
234+ tdep->sizeof_fpregset = 0;
235 set_gdbarch_long_double_bit (gdbarch, 128);
236
237 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
238@@ -764,6 +805,13 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
239 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
240 if (tdesc_data != NULL)
241 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
242+ //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
243+
244+ /* If we have register sets, enable the generic core file support. */
245+ if (tdep->gregset) {
246+ set_gdbarch_iterate_over_regset_sections (gdbarch,
247+ microblaze_iterate_over_regset_sections);
248+ }
249
250 return gdbarch;
251 }
252diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
253index e9f57e97c26..738da4f0531 100644
254--- a/gdb/microblaze-tdep.h
255+++ b/gdb/microblaze-tdep.h
256@@ -23,8 +23,23 @@
257 #include "gdbarch.h"
258
259 /* Microblaze architecture-specific information. */
260+struct microblaze_gregset
261+{
262+ microblaze_gregset() {}
263+ unsigned int gregs[32];
264+ unsigned int fpregs[32];
265+ unsigned int pregs[16];
266+};
267+
268 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
269 {
270+ int dummy; // declare something.
271+
272+ /* Register sets. */
273+ struct regset *gregset;
274+ size_t sizeof_gregset;
275+ struct regset *fpregset;
276+ size_t sizeof_fpregset;
277 };
278
279 /* Register numbers. */
280@@ -121,5 +136,18 @@ struct microblaze_frame_cache
281 #define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
282 #define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
283
284+extern void microblaze_supply_gregset (const struct regset *regset,
285+ struct regcache *regcache,
286+ int regnum, const void *gregs);
287+extern void microblaze_collect_gregset (const struct regset *regset,
288+ const struct regcache *regcache,
289+ int regnum, void *gregs);
290+extern void microblaze_supply_fpregset (struct regcache *regcache,
291+ int regnum, const void *fpregs);
292+extern void microblaze_collect_fpregset (const struct regcache *regcache,
293+ int regnum, void *fpregs);
294+
295+extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch,
296+ const char *sect_name, size_t sect_size);
297
298 #endif /* microblaze-tdep.h */
299--
3002.34.1
301
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
deleted file mode 100644
index 7e09404b..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From e689eec672ee8c53b3adb2ade2b5deb9b7cd99d4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 18:32:14 -0700
4Subject: [PATCH 3/9] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 gdb/nat/ppc-linux.h | 6 ++++++
11 gdbserver/linux-ppc-low.cc | 6 ++++++
12 2 files changed, 12 insertions(+)
13
14diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
15index 1094f6b0be3..d8588a646c2 100644
16--- a/gdb/nat/ppc-linux.h
17+++ b/gdb/nat/ppc-linux.h
18@@ -18,7 +18,13 @@
19 #ifndef NAT_PPC_LINUX_H
20 #define NAT_PPC_LINUX_H
21
22+#if !defined(__GLIBC__)
23+# define pt_regs uapi_pt_regs
24+#endif
25 #include <asm/ptrace.h>
26+#if !defined(__GLIBC__)
27+# undef pt_regs
28+#endif
29 #include <asm/cputable.h>
30
31 /* This sometimes isn't defined. */
32diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
33index 08824887003..69afbae5359 100644
34--- a/gdbserver/linux-ppc-low.cc
35+++ b/gdbserver/linux-ppc-low.cc
36@@ -23,7 +23,13 @@
37 #include "elf/common.h"
38 #include <sys/uio.h>
39 #include <elf.h>
40+#if !defined(__GLIBC__)
41+# define pt_regs uapi_pt_regs
42+#endif
43 #include <asm/ptrace.h>
44+#if !defined(__GLIBC__)
45+# undef pt_regs
46+#endif
47
48 #include "arch/ppc-linux-common.h"
49 #include "arch/ppc-linux-tdesc.h"
50--
512.36.1
52
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch
deleted file mode 100644
index a1e85e91..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 15ee6a626242efb8f367be49c13e00d0b72317f0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 15:25:03 -0700
4Subject: [PATCH 4/9] Dont disable libreadline.a when using --disable-static
5
6If gdb is configured with --disable-static then this is dutifully passed to
7readline which then disables libreadline.a, which causes a problem when gdb
8tries to link against that.
9
10To ensure that readline always builds static libraries, pass --enable-static to
11the sub-configure.
12
13Upstream-Status: Pending
14Signed-off-by: Ross Burton <ross.burton@intel.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 Makefile.def | 3 ++-
18 Makefile.in | 2 +-
19 2 files changed, 3 insertions(+), 2 deletions(-)
20
21diff --git a/Makefile.def b/Makefile.def
22index acdcd625ed6..78fc31e1199 100644
23--- a/Makefile.def
24+++ b/Makefile.def
25@@ -120,7 +120,8 @@ host_modules= { module= libiconv;
26 missing= install-html;
27 missing= install-info; };
28 host_modules= { module= m4; };
29-host_modules= { module= readline; };
30+host_modules= { module= readline;
31+ extra_configure_flags='--enable-static';};
32 host_modules= { module= sid; };
33 host_modules= { module= sim; };
34 host_modules= { module= texinfo; no_install= true; };
35diff --git a/Makefile.in b/Makefile.in
36index 3aacd2daac9..aa58adada4a 100644
37--- a/Makefile.in
38+++ b/Makefile.in
39@@ -32791,7 +32791,7 @@ configure-readline:
40 $$s/$$module_srcdir/configure \
41 --srcdir=$${topdir}/$$module_srcdir \
42 $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
43- --target=${target_alias} \
44+ --target=${target_alias} --enable-static \
45 || exit 1
46 @endif readline
47
48--
492.36.1
50
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch
new file mode 100644
index 00000000..1e6aff76
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Fix-debug-message-when-register-is-unavailable.patch
@@ -0,0 +1,45 @@
1From a027a1ce861f93bd00d814d6aef28414069330a1 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 04/54] Fix debug message when register is unavailable
5
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7
8Conflicts:
9 gdb/frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gdb/frame.c | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15diff --git a/gdb/frame.c b/gdb/frame.c
16index 87fb3d7a2d5..c4d967e01d5 100644
17--- a/gdb/frame.c
18+++ b/gdb/frame.c
19@@ -1313,12 +1313,20 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
20 else
21 {
22 int i;
23- gdb::array_view<const gdb_byte> buf = value->contents ();
24+
25+ const gdb_byte *buf = NULL;
26+ if (value_entirely_available(value)) {
27+ gdb::array_view<const gdb_byte> buf = value->contents ();
28+ }
29
30 gdb_printf (&debug_file, " bytes=");
31 gdb_printf (&debug_file, "[");
32- for (i = 0; i < register_size (gdbarch, regnum); i++)
33- gdb_printf (&debug_file, "%02x", buf[i]);
34+ if (buf != NULL) {
35+ for (i = 0; i < register_size (gdbarch, regnum); i++)
36+ gdb_printf (&debug_file, "%02x", buf[i]);
37+ } else {
38+ gdb_printf (&debug_file, "unavailable");
39+ }
40 gdb_printf (&debug_file, "]");
41 }
42 }
43--
442.34.1
45
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch
new file mode 100644
index 00000000..a9c6aee4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-MicroBlaze-native-gdb-port.patch
@@ -0,0 +1,834 @@
1From 2e84106b932f40eeaa4ae40b441b9eb7b713b2fa Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 18:53:46 +0530
4Subject: [PATCH 05/54] MicroBlaze native gdb port.
5
6signed-off-by : Mahesh Bodapati <mbodapat@amd.com>
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 gdb/Makefile.in | 2 +
11 gdb/configure.nat | 4 +
12 gdb/features/microblaze-linux.c | 79 +++++++
13 gdb/microblaze-linux-nat.c | 366 ++++++++++++++++++++++++++++++++
14 gdb/microblaze-linux-tdep.c | 2 +
15 gdb/microblaze-linux-tdep.h | 24 +++
16 gdb/microblaze-tdep.c | 151 ++++++++++++-
17 gdb/microblaze-tdep.h | 15 +-
18 8 files changed, 629 insertions(+), 14 deletions(-)
19 create mode 100755 gdb/features/microblaze-linux.c
20 create mode 100755 gdb/microblaze-linux-nat.c
21 create mode 100644 gdb/microblaze-linux-tdep.h
22
23diff --git a/gdb/Makefile.in b/gdb/Makefile.in
24index 9c0a0bff2cd..1ad975b50ae 100644
25--- a/gdb/Makefile.in
26+++ b/gdb/Makefile.in
27@@ -1406,6 +1406,7 @@ HFILES_NO_SRCDIR = \
28 memory-map.h \
29 memrange.h \
30 microblaze-tdep.h \
31+ microblaze-linux-tdep.h \
32 mips-linux-tdep.h \
33 mips-netbsd-tdep.h \
34 mips-tdep.h \
35@@ -1754,6 +1755,7 @@ ALLDEPFILES = \
36 m68k-linux-nat.c \
37 m68k-linux-tdep.c \
38 m68k-tdep.c \
39+ microblaze-linux-nat.c \
40 microblaze-linux-tdep.c \
41 microblaze-tdep.c \
42 mingw-hdep.c \
43diff --git a/gdb/configure.nat b/gdb/configure.nat
44index 1dc4206b69c..05003e57020 100644
45--- a/gdb/configure.nat
46+++ b/gdb/configure.nat
47@@ -274,6 +274,10 @@ case ${gdb_host} in
48 # Host: Motorola m68k running GNU/Linux.
49 NATDEPFILES="${NATDEPFILES} m68k-linux-nat.o"
50 ;;
51+ microblaze)
52+ # Host: Microblaze running GNU/Linux.
53+ NATDEPFILES="${NATDEPFILES} microblaze-linux-nat.o"
54+ ;;
55 mips)
56 # Host: Linux/MIPS
57 NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
58diff --git a/gdb/features/microblaze-linux.c b/gdb/features/microblaze-linux.c
59new file mode 100755
60index 00000000000..267e12f6d59
61--- /dev/null
62+++ b/gdb/features/microblaze-linux.c
63@@ -0,0 +1,79 @@
64+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
65+ Original: microblaze.xml */
66+
67+#include "defs.h"
68+#include "osabi.h"
69+#include "target-descriptions.h"
70+
71+struct target_desc *tdesc_microblaze_linux;
72+static void
73+initialize_tdesc_microblaze_linux (void)
74+{
75+ target_desc_up result = allocate_target_description ();
76+ struct tdesc_feature *feature;
77+ set_tdesc_architecture (result.get(), bfd_scan_arch ("microblaze"));
78+ set_tdesc_osabi (result.get(), osabi_from_tdesc_string ("GNU/Linux"));
79+
80+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze.core");
81+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
82+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
83+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
84+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
85+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
86+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int");
87+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int");
88+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int");
89+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int");
90+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int");
91+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int");
92+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int");
93+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int");
94+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "int");
95+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "int");
96+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "int");
97+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "int");
98+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "int");
99+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "int");
100+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "int");
101+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "int");
102+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "int");
103+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "int");
104+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "int");
105+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "int");
106+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "int");
107+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "int");
108+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "int");
109+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "int");
110+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
111+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
112+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
113+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
114+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
115+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
116+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
117+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
118+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 32, "int");
119+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
120+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
121+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
122+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
123+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
124+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
125+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
126+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
127+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 32, "int");
128+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 32, "int");
129+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
130+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
131+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
132+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
133+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
134+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
135+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
136+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
137+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
138+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
139+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
140+
141+ tdesc_microblaze_linux = result.release();
142+}
143diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
144new file mode 100755
145index 00000000000..a348001a3e2
146--- /dev/null
147+++ b/gdb/microblaze-linux-nat.c
148@@ -0,0 +1,366 @@
149+/* Native-dependent code for GNU/Linux MicroBlaze.
150+ Copyright (C) 2021 Free Software Foundation, Inc.
151+
152+ This file is part of GDB.
153+
154+ This program is free software; you can redistribute it and/or modify
155+ it under the terms of the GNU General Public License as published by
156+ the Free Software Foundation; either version 3 of the License, or
157+ (at your option) any later version.
158+
159+ This program is distributed in the hope that it will be useful,
160+ but WITHOUT ANY WARRANTY; without even the implied warranty of
161+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162+ GNU General Public License for more details.
163+
164+ You should have received a copy of the GNU General Public License
165+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
166+
167+#include "defs.h"
168+#include "arch-utils.h"
169+#include "dis-asm.h"
170+#include "frame.h"
171+#include "trad-frame.h"
172+#include "symtab.h"
173+#include "value.h"
174+#include "gdbcmd.h"
175+#include "breakpoint.h"
176+#include "inferior.h"
177+#include "gdbthread.h"
178+#include "gdbcore.h"
179+#include "regcache.h"
180+#include "regset.h"
181+#include "target.h"
182+#include "frame.h"
183+#include "frame-base.h"
184+#include "frame-unwind.h"
185+#include "osabi.h"
186+#include "gdbsupport/gdb_assert.h"
187+#include <string.h>
188+#include "target-descriptions.h"
189+#include "opcodes/microblaze-opcm.h"
190+#include "opcodes/microblaze-dis.h"
191+#include "gregset.h"
192+
193+#include "linux-nat.h"
194+#include "linux-tdep.h"
195+#include "target-descriptions.h"
196+
197+#include <sys/user.h>
198+#include <sys/ioctl.h>
199+#include <sys/uio.h>
200+#include "gdbsupport/gdb_wait.h"
201+#include <fcntl.h>
202+#include <sys/procfs.h>
203+#include "nat/gdb_ptrace.h"
204+#include "nat/linux-ptrace.h"
205+#include "inf-ptrace.h"
206+#include <algorithm>
207+#include <unordered_map>
208+#include <list>
209+#include <sys/ptrace.h>
210+
211+/* Prototypes for supply_gregset etc. */
212+#include "gregset.h"
213+
214+#include "microblaze-tdep.h"
215+#include "microblaze-linux-tdep.h"
216+#include "inferior.h"
217+
218+#include "elf/common.h"
219+
220+#include "auxv.h"
221+#include "linux-tdep.h"
222+
223+#include <sys/ptrace.h>
224+
225+
226+//int have_ptrace_getsetregs=1;
227+
228+/* MicroBlaze Linux native additions to the default linux support. */
229+
230+class microblaze_linux_nat_target final : public linux_nat_target
231+{
232+public:
233+ /* Add our register access methods. */
234+ void fetch_registers (struct regcache *regcache, int regnum) override;
235+ void store_registers (struct regcache *regcache, int regnum) override;
236+
237+ /* Read suitable target description. */
238+ const struct target_desc *read_description () override;
239+};
240+
241+static microblaze_linux_nat_target the_microblaze_linux_nat_target;
242+
243+static int
244+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
245+{
246+ int u_addr = -1;
247+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
248+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
249+ * interface, and not the wordsize of the program's ABI. */
250+ int wordsize = sizeof (long);
251+
252+ /* General purpose registers occupy 1 slot each in the buffer. */
253+ if (regno >= MICROBLAZE_R0_REGNUM
254+ && regno <= MICROBLAZE_FSR_REGNUM)
255+ u_addr = ((regno - MICROBLAZE_R0_REGNUM)* wordsize);
256+
257+ return u_addr;
258+}
259+
260+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
261+ from regset GREGS into REGCACHE. */
262+
263+static void
264+supply_gregset_regnum (struct regcache *regcache, const prgregset_t *gregs,
265+ int regnum)
266+{
267+ int i;
268+ const elf_greg_t *regp = *gregs;
269+ /* Access all registers */
270+ if (regnum == -1)
271+ {
272+ /* We fill the general purpose registers. */
273+ for (i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
274+ regcache->raw_supply (i, regp + i);
275+
276+ /* Supply MICROBLAZE_PC_REGNUM from index 32. */
277+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
278+
279+ /* Fill the inaccessible zero register with zero. */
280+ regcache->raw_supply_zeroed (0);
281+ }
282+ else if (regnum == MICROBLAZE_R0_REGNUM)
283+ regcache->raw_supply_zeroed (0);
284+ else if (regnum == MICROBLAZE_PC_REGNUM)
285+ regcache->raw_supply (MICROBLAZE_PC_REGNUM, regp + 32);
286+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
287+ regcache->raw_supply (regnum, regp + regnum);
288+}
289+
290+/* Copy all general purpose registers from regset GREGS into REGCACHE. */
291+
292+void
293+supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
294+{
295+ supply_gregset_regnum (regcache, gregs, -1);
296+}
297+
298+/* Copy general purpose register REGNUM (or all gp regs if REGNUM == -1)
299+ from REGCACHE into regset GREGS. */
300+
301+void
302+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
303+{
304+ elf_greg_t *regp = *gregs;
305+ if (regnum == -1)
306+ {
307+ /* We fill the general purpose registers. */
308+ for (int i = MICROBLAZE_R0_REGNUM + 1; i < MICROBLAZE_FSR_REGNUM; i++)
309+ regcache->raw_collect (i, regp + i);
310+
311+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
312+ }
313+ else if (regnum == MICROBLAZE_R0_REGNUM)
314+ /* Nothing to do here. */
315+ ;
316+ else if (regnum > MICROBLAZE_R0_REGNUM && regnum < MICROBLAZE_FSR_REGNUM)
317+ regcache->raw_collect (regnum, regp + regnum);
318+ else if (regnum == MICROBLAZE_PC_REGNUM)
319+ regcache->raw_collect (MICROBLAZE_PC_REGNUM, regp + 32);
320+}
321+
322+/* Transfering floating-point registers between GDB, inferiors and cores.
323+ Since MicroBlaze floating-point registers are the same as GPRs these do
324+ nothing. */
325+
326+void
327+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
328+{
329+}
330+
331+void
332+fill_fpregset (const struct regcache *regcache,
333+ gdb_fpregset_t *fpregs, int regno)
334+{
335+}
336+
337+
338+static void
339+fetch_register (struct regcache *regcache, int tid, int regno)
340+{
341+ struct gdbarch *gdbarch = regcache->arch ();
342+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
343+ /* This isn't really an address. But ptrace thinks of it as one. */
344+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
345+ int bytes_transferred;
346+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
347+
348+ if (regaddr == -1)
349+ {
350+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
351+ regcache->raw_supply (regno, buf);
352+ return;
353+ }
354+
355+ /* Read the raw register using sizeof(long) sized chunks. On a
356+ * 32-bit platform, 64-bit floating-point registers will require two
357+ * transfers. */
358+ for (bytes_transferred = 0;
359+ bytes_transferred < register_size (gdbarch, regno);
360+ bytes_transferred += sizeof (long))
361+ {
362+ long l;
363+
364+ errno = 0;
365+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
366+ if (errno == EIO)
367+ {
368+ printf("ptrace io error\n");
369+ }
370+ regaddr += sizeof (long);
371+ if (errno != 0)
372+ {
373+ char message[128];
374+ sprintf (message, "reading register %s (#%d)",
375+ gdbarch_register_name (gdbarch, regno), regno);
376+ perror_with_name (message);
377+ }
378+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
379+ }
380+
381+ /* Now supply the register. Keep in mind that the regcache's idea
382+ * of the register's size may not be a multiple of sizeof
383+ * (long). */
384+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
385+ {
386+ /* Little-endian values are always found at the left end of the
387+ * bytes transferred. */
388+ regcache->raw_supply (regno, buf);
389+ }
390+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
391+ {
392+ /* Big-endian values are found at the right end of the bytes
393+ * transferred. */
394+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
395+ regcache->raw_supply (regno, buf + padding);
396+ }
397+ else
398+ internal_error (__FILE__, __LINE__,
399+ _("fetch_register: unexpected byte order: %d"),
400+ gdbarch_byte_order (gdbarch));
401+}
402+
403+
404+/* This is a wrapper for the fetch_all_gp_regs function. It is
405+ * responsible for verifying if this target has the ptrace request
406+ * that can be used to fetch all general-purpose registers at one
407+ * shot. If it doesn't, then we should fetch them using the
408+ * old-fashioned way, which is to iterate over the registers and
409+ * request them one by one. */
410+static void
411+fetch_gp_regs (struct regcache *regcache, int tid)
412+{
413+ int i;
414+/* If we've hit this point, it doesn't really matter which
415+ architecture we are using. We just need to read the
416+ registers in the "old-fashioned way". */
417+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
418+ fetch_register (regcache, tid, i);
419+}
420+
421+/* Return a target description for the current target. */
422+
423+const struct target_desc *
424+microblaze_linux_nat_target::read_description ()
425+{
426+ return tdesc_microblaze_linux;
427+}
428+
429+/* Fetch REGNUM (or all registers if REGNUM == -1) from the target
430+ into REGCACHE using PTRACE_GETREGSET. */
431+
432+void
433+microblaze_linux_nat_target::fetch_registers (struct regcache * regcache,
434+ int regno)
435+{
436+ /* Get the thread id for the ptrace call. */
437+ int tid = regcache->ptid ().lwp ();
438+//int tid = get_ptrace_pid (regcache->ptid());
439+#if 1
440+ if (regno == -1)
441+#endif
442+ fetch_gp_regs (regcache, tid);
443+#if 1
444+ else
445+ fetch_register (regcache, tid, regno);
446+#endif
447+}
448+
449+
450+/* Store REGNUM (or all registers if REGNUM == -1) to the target
451+ from REGCACHE using PTRACE_SETREGSET. */
452+
453+void
454+microblaze_linux_nat_target::store_registers (struct regcache *regcache, int regno)
455+{
456+ int tid;
457+
458+ tid = get_ptrace_pid (regcache->ptid ());
459+
460+ struct gdbarch *gdbarch = regcache->arch ();
461+ /* This isn't really an address. But ptrace thinks of it as one. */
462+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
463+ int i;
464+ size_t bytes_to_transfer;
465+ char buf[MICROBLAZE_MAX_REGISTER_SIZE];
466+
467+ if (regaddr == -1)
468+ return;
469+
470+ /* First collect the register. Keep in mind that the regcache's
471+ * idea of the register's size may not be a multiple of sizeof
472+ * (long). */
473+ memset (buf, 0, sizeof buf);
474+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
475+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
476+ {
477+ /* Little-endian values always sit at the left end of the buffer. */
478+ regcache->raw_collect (regno, buf);
479+ }
480+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
481+ {
482+ /* Big-endian values sit at the right end of the buffer. */
483+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
484+ regcache->raw_collect (regno, buf + padding);
485+ }
486+
487+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
488+ {
489+ long l;
490+
491+ memcpy (&l, &buf[i], sizeof (l));
492+ errno = 0;
493+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
494+ regaddr += sizeof (long);
495+
496+ if (errno != 0)
497+ {
498+ char message[128];
499+ sprintf (message, "writing register %s (#%d)",
500+ gdbarch_register_name (gdbarch, regno), regno);
501+ perror_with_name (message);
502+ }
503+ }
504+}
505+
506+void _initialize_microblaze_linux_nat (void);
507+
508+void
509+_initialize_microblaze_linux_nat (void)
510+{
511+ /* Register the target. */
512+ linux_target = &the_microblaze_linux_nat_target;
513+ add_inf_child_target (linux_target);
514+}
515diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
516index 17bcb50fd4f..5b57bb4d3ba 100644
517--- a/gdb/microblaze-linux-tdep.c
518+++ b/gdb/microblaze-linux-tdep.c
519@@ -37,6 +37,7 @@
520 #include "tramp-frame.h"
521 #include "linux-tdep.h"
522 #include "glibc-tdep.h"
523+#include "features/microblaze-linux.c"
524
525 static int microblaze_debug_flag = 0;
526
527@@ -179,4 +180,5 @@ _initialize_microblaze_linux_tdep ()
528 {
529 gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
530 microblaze_linux_init_abi);
531+ initialize_tdesc_microblaze_linux ();
532 }
533diff --git a/gdb/microblaze-linux-tdep.h b/gdb/microblaze-linux-tdep.h
534new file mode 100644
535index 00000000000..a2c744e2961
536--- /dev/null
537+++ b/gdb/microblaze-linux-tdep.h
538@@ -0,0 +1,24 @@
539+/* Target-dependent code for GNU/Linux on OpenRISC.
540+
541+ Copyright (C) 2021 Free Software Foundation, Inc.
542+
543+ This file is part of GDB.
544+
545+ This program is free software; you can redistribute it and/or modify
546+ it under the terms of the GNU General Public License as published by
547+ the Free Software Foundation; either version 3 of the License, or
548+ (at your option) any later version.
549+
550+ This program is distributed in the hope that it will be useful,
551+ but WITHOUT ANY WARRANTY; without even the implied warranty of
552+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
553+ GNU General Public License for more details.
554+
555+ You should have received a copy of the GNU General Public License
556+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
557+#ifndef MICROBLAZE_LINUX_TDEP_H
558+#define MICROBLAZE_LINUX_TDEP_H
559+ /* Target descriptions. */
560+ extern struct target_desc *tdesc_microblaze_linux;
561+
562+#endif /* MICROBLAZE_LINUX_TDEP_H */
563diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
564index 6ab36bd746b..066602b385a 100644
565--- a/gdb/microblaze-tdep.c
566+++ b/gdb/microblaze-tdep.c
567@@ -285,6 +285,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
568 cache->frameless_p = 0; /* Frame found. */
569 save_hidden_pointer_found = 0;
570 non_stack_instruction_found = 0;
571+ cache->register_offsets[rd] = -imm;
572 continue;
573 }
574 else if (IS_SPILL_SP(op, rd, ra))
575@@ -431,15 +432,17 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
576 if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
577 {
578 sal = find_pc_line (func_start, 0);
579-
580- if (sal.end < func_end
581- && start_pc <= sal.end)
582+
583+ if (sal.line !=0 && sal.end <= func_end && start_pc <= sal.end) {
584 start_pc = sal.end;
585+ microblaze_debug("start_pc is %d\t sal.end is %d\t func_end is %d\t",start_pc,sal.end,func_end);
586+ }
587 }
588
589 ostart_pc = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL,
590 &cache);
591
592+
593 if (ostart_pc > start_pc)
594 return ostart_pc;
595 return start_pc;
596@@ -453,6 +456,7 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
597 struct microblaze_frame_cache *cache;
598 struct gdbarch *gdbarch = get_frame_arch (next_frame);
599 int rn;
600+ CORE_ADDR current_pc;
601
602 if (*this_cache)
603 return (struct microblaze_frame_cache *) *this_cache;
604@@ -466,10 +470,17 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
605 cache->register_offsets[rn] = -1;
606
607 /* Call for side effects. */
608- get_frame_func (next_frame);
609-
610- cache->pc = get_frame_address_in_block (next_frame);
611-
612+ cache->pc = get_frame_func (next_frame);
613+
614+// cache->pc = get_frame_address_in_block (next_frame);
615+ current_pc = get_frame_pc (next_frame);
616+ if (cache->pc)
617+ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc, cache);
618+
619+ cache->saved_sp = cache->base + cache->framesize;
620+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base;
621+ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp;
622+
623 return cache;
624 }
625
626@@ -494,6 +505,25 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
627 struct microblaze_frame_cache *cache =
628 microblaze_frame_cache (this_frame, this_cache);
629
630+if ((regnum == MICROBLAZE_SP_REGNUM &&
631+ cache->register_offsets[MICROBLAZE_SP_REGNUM])
632+ || (regnum == MICROBLAZE_FP_REGNUM &&
633+ cache->register_offsets[MICROBLAZE_SP_REGNUM]))
634+
635+ return frame_unwind_got_constant (this_frame, regnum,
636+ cache->register_offsets[MICROBLAZE_SP_REGNUM]);
637+
638+if (regnum == MICROBLAZE_PC_REGNUM)
639+{
640+ regnum = 15;
641+ return frame_unwind_got_memory (this_frame, regnum,
642+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
643+
644+}
645+if (regnum == MICROBLAZE_SP_REGNUM)
646+ regnum = 1;
647+#if 0
648+
649 if (cache->frameless_p)
650 {
651 if (regnum == MICROBLAZE_PC_REGNUM)
652@@ -506,7 +536,9 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
653 else
654 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
655 regnum);
656-
657+#endif
658+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
659+ regnum);
660 }
661
662 static const struct frame_unwind microblaze_frame_unwind =
663@@ -621,7 +653,106 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
664 return (type->length () == 16);
665 }
666
667-
668+#if 1
669+static std::vector<CORE_ADDR>
670+microblaze_software_single_step (struct regcache *regcache)
671+{
672+ struct gdbarch *arch = regcache->arch ();
673+ //struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
674+ static int le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
675+ static int be_breakp[] = MICROBLAZE_BREAKPOINT;
676+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
677+ int *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
678+// std::vector<CORE_ADDR> ret = NULL;
679+
680+ /* Save the address and the values of the next_pc and the target */
681+ static struct sstep_breaks
682+ {
683+ CORE_ADDR address;
684+ bfd_boolean valid;
685+ /* Shadow contents. */
686+ char data[INST_WORD_SIZE];
687+ } stepbreaks[2];
688+ int ii;
689+
690+ CORE_ADDR pc;
691+ std::vector<CORE_ADDR> next_pcs;
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+ next_pcs.push_back (stepbreaks[ii].address);
762+ }
763+ }
764+ return next_pcs;
765+}
766+#endif
767+
768 static int dwarf2_to_reg_map[78] =
769 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
770 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
771@@ -788,6 +919,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
772 microblaze_breakpoint::bp_from_kind);
773 set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
774
775+ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
776+
777 set_gdbarch_frame_args_skip (gdbarch, 8);
778
779 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
780diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
781index 738da4f0531..21f206777f0 100644
782--- a/gdb/microblaze-tdep.h
783+++ b/gdb/microblaze-tdep.h
784@@ -60,11 +60,11 @@ enum microblaze_regnum
785 MICROBLAZE_R12_REGNUM,
786 MICROBLAZE_R13_REGNUM,
787 MICROBLAZE_R14_REGNUM,
788- MICROBLAZE_R15_REGNUM,
789+ MICROBLAZE_R15_REGNUM,MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM,
790 MICROBLAZE_R16_REGNUM,
791 MICROBLAZE_R17_REGNUM,
792 MICROBLAZE_R18_REGNUM,
793- MICROBLAZE_R19_REGNUM,
794+ MICROBLAZE_R19_REGNUM,MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM,
795 MICROBLAZE_R20_REGNUM,
796 MICROBLAZE_R21_REGNUM,
797 MICROBLAZE_R22_REGNUM,
798@@ -77,7 +77,8 @@ enum microblaze_regnum
799 MICROBLAZE_R29_REGNUM,
800 MICROBLAZE_R30_REGNUM,
801 MICROBLAZE_R31_REGNUM,
802- MICROBLAZE_PC_REGNUM,
803+ MICROBLAZE_MAX_GPR_REGS,
804+ MICROBLAZE_PC_REGNUM=32,
805 MICROBLAZE_MSR_REGNUM,
806 MICROBLAZE_EAR_REGNUM,
807 MICROBLAZE_ESR_REGNUM,
808@@ -102,17 +103,21 @@ enum microblaze_regnum
809 MICROBLAZE_RTLBSX_REGNUM,
810 MICROBLAZE_RTLBLO_REGNUM,
811 MICROBLAZE_RTLBHI_REGNUM,
812- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
813+ MICROBLAZE_SLR_REGNUM,
814 MICROBLAZE_SHR_REGNUM,
815- MICROBLAZE_NUM_REGS
816+ MICROBLAZE_NUM_REGS, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_NUM_REGS
817 };
818
819+/* Big enough to hold the size of the largest register in bytes. */
820+#define MICROBLAZE_MAX_REGISTER_SIZE 64
821+
822 struct microblaze_frame_cache
823 {
824 /* Base address. */
825 CORE_ADDR base;
826 CORE_ADDR pc;
827
828+ CORE_ADDR saved_sp;
829 /* Do we have a frame? */
830 int frameless_p;
831
832--
8332.34.1
834
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch
deleted file mode 100644
index 242099b9..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 25a75aaf29791f4302f0e4452f7ebaf735d4f083 Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <amccurdy@gmail.com>
3Date: Sat, 30 Apr 2016 15:29:06 -0700
4Subject: [PATCH 5/9] use <asm/sgidefs.h>
5
6Build fix for MIPS with musl libc
7
8The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
9but not by musl. Regardless of the libc, the kernel headers provide
10<asm/sgidefs.h> which provides the same definitions, so use that
11instead.
12
13Upstream-Status: Pending
14
15Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 gdb/mips-linux-nat.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
22index 6adc61235aa..afb40066744 100644
23--- a/gdb/mips-linux-nat.c
24+++ b/gdb/mips-linux-nat.c
25@@ -31,7 +31,7 @@
26 #include "gdb_proc_service.h"
27 #include "gregset.h"
28
29-#include <sgidefs.h>
30+#include <asm/sgidefs.h>
31 #include "nat/gdb_ptrace.h"
32 #include <asm/ptrace.h>
33 #include "inf-ptrace.h"
34--
352.36.1
36
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
new file mode 100644
index 00000000..3a069fdf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Adding-64-bit-MB-support-Added-new-architecture-to-M.patch
@@ -0,0 +1,1891 @@
1From 510b596b8cd25ccb3563555190d5396c7b378522 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 31 Jan 2019 14:36:00 +0530
4Subject: [PATCH 06/54] 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> Signed-off-by :Mahesh Bodapati <mbodapat@xilinx.com>
7
8Conflicts:
9 gdb/Makefile.in
10
11Conflicts:
12 bfd/cpu-microblaze.c
13 gdb/microblaze-tdep.c
14 ld/Makefile.am
15 ld/Makefile.in
16 opcodes/microblaze-dis.c
17
18Conflicts:
19 bfd/configure
20 gas/config/tc-microblaze.c
21 ld/Makefile.in
22 opcodes/microblaze-opcm.h
23
24Conflicts:
25 gdb/microblaze-tdep.c
26
27Conflicts:
28 bfd/elf32-microblaze.c
29 gas/config/tc-microblaze.c
30 gdb/features/Makefile
31 gdb/features/microblaze-with-stack-protect.c
32 gdb/microblaze-tdep.c
33 gdb/regformats/microblaze-with-stack-protect.dat
34 gdbserver/linux-microblaze-low.c
35 include/elf/common.h
36
37Signed-off-by: Aayush Misra <aayushm@amd.com>
38---
39 bfd/Makefile.am | 2 +
40 bfd/Makefile.in | 3 +
41 bfd/archures.c | 2 +
42 bfd/bfd-in2.h | 31 +++-
43 bfd/config.bfd | 4 +
44 bfd/configure | 2 +
45 bfd/cpu-microblaze.c | 55 +++++-
46 bfd/elf32-microblaze.c | 155 ++++++++++++++--
47 bfd/libbfd.h | 3 +
48 bfd/reloc.c | 20 +++
49 bfd/targets.c | 6 +
50 gdb/features/Makefile | 2 +
51 gdb/features/microblaze-core.xml | 6 +-
52 gdb/features/microblaze-stack-protect.xml | 4 +-
53 gdb/features/microblaze-with-stack-protect.c | 8 +-
54 gdb/features/microblaze.c | 6 +-
55 gdb/features/microblaze64-core.xml | 69 ++++++++
56 gdb/features/microblaze64-stack-protect.xml | 12 ++
57 .../microblaze64-with-stack-protect.c | 79 +++++++++
58 .../microblaze64-with-stack-protect.xml | 12 ++
59 gdb/features/microblaze64.c | 77 ++++++++
60 gdb/features/microblaze64.xml | 11 ++
61 gdb/microblaze-linux-tdep.c | 36 +++-
62 gdb/microblaze-tdep.c | 125 +++++++++----
63 gdb/microblaze-tdep.h | 4 +-
64 include/elf/common.h | 1 +
65 include/elf/microblaze.h | 4 +
66 opcodes/microblaze-dis.c | 51 +++++-
67 opcodes/microblaze-opc.h | 165 +++++++++++++++++-
68 opcodes/microblaze-opcm.h | 28 ++-
69 30 files changed, 896 insertions(+), 87 deletions(-)
70 create mode 100644 gdb/features/microblaze64-core.xml
71 create mode 100644 gdb/features/microblaze64-stack-protect.xml
72 create mode 100644 gdb/features/microblaze64-with-stack-protect.c
73 create mode 100644 gdb/features/microblaze64-with-stack-protect.xml
74 create mode 100644 gdb/features/microblaze64.c
75 create mode 100644 gdb/features/microblaze64.xml
76
77diff --git a/bfd/Makefile.am b/bfd/Makefile.am
78index 378c13198d6..089d86b6191 100644
79--- a/bfd/Makefile.am
80+++ b/bfd/Makefile.am
81@@ -568,6 +568,7 @@ BFD64_BACKENDS = \
82 elf64-ppc.lo \
83 elf64-riscv.lo \
84 elf64-s390.lo \
85+ elf64-microblaze.lo \
86 elf64-sparc.lo \
87 elf64-tilegx.lo \
88 elf64-x86-64.lo \
89@@ -615,6 +616,7 @@ BFD64_BACKENDS_CFILES = \
90 elf64-nfp.c \
91 elf64-ppc.c \
92 elf64-s390.c \
93+ elf64-microblaze.c \
94 elf64-sparc.c \
95 elf64-tilegx.c \
96 elf64-x86-64.c \
97diff --git a/bfd/Makefile.in b/bfd/Makefile.in
98index 8d09f6fa4af..d9fe20f502b 100644
99--- a/bfd/Makefile.in
100+++ b/bfd/Makefile.in
101@@ -1025,6 +1025,7 @@ BFD64_BACKENDS = \
102 elf64-ppc.lo \
103 elf64-riscv.lo \
104 elf64-s390.lo \
105+ elf64-microblaze.lo \
106 elf64-sparc.lo \
107 elf64-tilegx.lo \
108 elf64-x86-64.lo \
109@@ -1072,6 +1073,7 @@ BFD64_BACKENDS_CFILES = \
110 elf64-nfp.c \
111 elf64-ppc.c \
112 elf64-s390.c \
113+ elf64-microblaze.c \
114 elf64-sparc.c \
115 elf64-tilegx.c \
116 elf64-x86-64.c \
117@@ -1646,6 +1648,7 @@ distclean-compile:
118 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
119 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
120 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
121+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
122 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
123 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
124 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
125diff --git a/bfd/archures.c b/bfd/archures.c
126index b59979e60ac..2994a09bc37 100644
127--- a/bfd/archures.c
128+++ b/bfd/archures.c
129@@ -515,6 +515,8 @@ DESCRIPTION
130 . bfd_arch_lm32, {* Lattice Mico32. *}
131 .#define bfd_mach_lm32 1
132 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
133+.#define bfd_mach_microblaze 1
134+.#define bfd_mach_microblaze64 2
135 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
136 .#define bfd_mach_kv3_unknown 0
137 .#define bfd_mach_kv3_1 1
138diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
139index eddb9902f5e..9db63f254a3 100644
140--- a/bfd/bfd-in2.h
141+++ b/bfd/bfd-in2.h
142@@ -1771,6 +1771,8 @@ enum bfd_architecture
143 bfd_arch_lm32, /* Lattice Mico32. */
144 #define bfd_mach_lm32 1
145 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
146+#define bfd_mach_microblaze 1
147+#define bfd_mach_microblaze64 2
148 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
149 #define bfd_mach_kv3_unknown 0
150 #define bfd_mach_kv3_1 1
151@@ -6461,16 +6463,41 @@ value relative to the read-write small data area anchor */
152 expressions of the form "Symbol Op Symbol" */
153 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
154
155-/* This is a 64 bit reloc that stores the 32 bit pc relative
156+/* This is a 32 bit reloc that stores the 32 bit pc relative
157 value in two words (with an imm instruction). No relocation is
158 done here - only used for relaxing */
159- BFD_RELOC_MICROBLAZE_64_NONE,
160+ BFD_RELOC_MICROBLAZE_32_NONE,
161+
162+/* This is a 64 bit reloc that stores the 32 bit pc relative
163+ * +value in two words (with an imml instruction). No relocation is
164+ * +done here - only used for relaxing */
165+ BFD_RELOC_MICROBLAZE_64_PCREL,
166+
167+/* This is a 64 bit reloc that stores the 32 bit relative
168+ * +value in two words (with an imml instruction). No relocation is
169+ * +done here - only used for relaxing */
170+ BFD_RELOC_MICROBLAZE_64,
171+
172+/* This is a 64 bit reloc that stores the 32 bit relative
173+ * +value in two words (with an imml instruction). No relocation is
174+ * +done here - only used for relaxing */
175+ BFD_RELOC_MICROBLAZE_EA64,
176+
177+/* This is a 64 bit reloc that stores the 32 bit pc relative
178+ * +value in two words (with an imm instruction). No relocation is
179+ * +done here - only used for relaxing */
180+ BFD_RELOC_MICROBLAZE_64_NONE,
181
182 /* This is a 64 bit reloc that stores the 32 bit pc relative
183 value in two words (with an imm instruction). The relocation is
184 PC-relative GOT offset */
185 BFD_RELOC_MICROBLAZE_64_GOTPC,
186
187+/* This is a 64 bit reloc that stores the 32 bit pc relative
188+value in two words (with an imml instruction). The relocation is
189+PC-relative GOT offset */
190+ BFD_RELOC_MICROBLAZE_64_GPC,
191+
192 /* This is a 64 bit reloc that stores the 32 bit pc relative
193 value in two words (with an imm instruction). The relocation is
194 GOT offset */
195diff --git a/bfd/config.bfd b/bfd/config.bfd
196index 08129e6a8cb..3a7d427778c 100644
197--- a/bfd/config.bfd
198+++ b/bfd/config.bfd
199@@ -884,11 +884,15 @@ case "${targ}" in
200 microblazeel*-*)
201 targ_defvec=microblaze_elf32_le_vec
202 targ_selvecs=microblaze_elf32_vec
203+ targ64_selvecs=microblaze_elf64_vec
204+ targ64_selvecs=microblaze_elf64_le_vec
205 ;;
206
207 microblaze*-*)
208 targ_defvec=microblaze_elf32_vec
209 targ_selvecs=microblaze_elf32_le_vec
210+ targ64_selvecs=microblaze_elf64_vec
211+ targ64_selvecs=microblaze_elf64_le_vec
212 ;;
213
214 #ifdef BFD64
215diff --git a/bfd/configure b/bfd/configure
216index f0a07ff675f..b2afdcf9bec 100755
217--- a/bfd/configure
218+++ b/bfd/configure
219@@ -14062,6 +14062,8 @@ do
220 rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
221 s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
222 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
223+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
224+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
225 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
226 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
227 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
228diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
229index c14b170f94b..7557b3de7b3 100644
230--- a/bfd/cpu-microblaze.c
231+++ b/bfd/cpu-microblaze.c
232@@ -23,13 +23,30 @@
233 #include "bfd.h"
234 #include "libbfd.h"
235
236-const bfd_arch_info_type bfd_microblaze_arch =
237+const bfd_arch_info_type bfd_microblaze_arch[] =
238+{
239+#if BFD_DEFAULT_TARGET_SIZE == 64
240+{
241+ 64, /* 32 bits in a word. */
242+ 64, /* 32 bits in an address. */
243+ 8, /* 8 bits in a byte. */
244+ bfd_arch_microblaze, /* Architecture. */
245+ bfd_mach_microblaze64, /* 64 bit Machine */
246+ "microblaze", /* Architecture name. */
247+ "MicroBlaze", /* Printable name. */
248+ 3, /* Section align power. */
249+ false, /* Is this the default architecture ? */
250+ bfd_default_compatible, /* Architecture comparison function. */
251+ bfd_default_scan, /* String to architecture conversion. */
252+ bfd_arch_default_fill, /* Default fill. */
253+ &bfd_microblaze_arch[1] /* Next in list. */
254+},
255 {
256 32, /* Bits in a word. */
257 32, /* Bits in an address. */
258 8, /* Bits in a byte. */
259 bfd_arch_microblaze, /* Architecture number. */
260- 0, /* Machine number - 0 for now. */
261+ bfd_mach_microblaze, /* Machine number - 0 for now. */
262 "microblaze", /* Architecture name. */
263 "MicroBlaze", /* Printable name. */
264 3, /* Section align power. */
265@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
266 bfd_arch_default_fill, /* Default fill. */
267 NULL, /* Next in list. */
268 0 /* Maximum offset of a reloc from the start of an insn. */
269+}
270+#else
271+{
272+ 32, /* 32 bits in a word. */
273+ 32, /* 32 bits in an address. */
274+ 8, /* 8 bits in a byte. */
275+ bfd_arch_microblaze, /* Architecture. */
276+ bfd_mach_microblaze, /* 32 bit Machine */
277+ "microblaze", /* Architecture name. */
278+ "MicroBlaze", /* Printable name. */
279+ 3, /* Section align power. */
280+ true, /* Is this the default architecture ? */
281+ bfd_default_compatible, /* Architecture comparison function. */
282+ bfd_default_scan, /* String to architecture conversion. */
283+ bfd_arch_default_fill, /* Default fill. */
284+ &bfd_microblaze_arch[1] /* Next in list. */
285+},
286+{
287+ 64, /* 32 bits in a word. */
288+ 64, /* 32 bits in an address. */
289+ 8, /* 8 bits in a byte. */
290+ bfd_arch_microblaze, /* Architecture. */
291+ bfd_mach_microblaze64, /* 64 bit Machine */
292+ "microblaze", /* Architecture name. */
293+ "MicroBlaze", /* Printable name. */
294+ 3, /* Section align power. */
295+ false, /* Is this the default architecture ? */
296+ bfd_default_compatible, /* Architecture comparison function. */
297+ bfd_default_scan, /* String to architecture conversion. */
298+ bfd_arch_default_fill, /* Default fill. */
299+ NULL, /* Next in list. */
300+ 0
301+}
302+#endif
303 };
304diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
305index 487ddeafc5a..6ba28e757be 100644
306--- a/bfd/elf32-microblaze.c
307+++ b/bfd/elf32-microblaze.c
308@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
309 0x0000ffff, /* Dest Mask. */
310 true), /* PC relative offset? */
311
312+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
313+ 0, /* Rightshift. */
314+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
315+ 16, /* Bitsize. */
316+ true, /* PC_relative. */
317+ 0, /* Bitpos. */
318+ complain_overflow_dont, /* Complain on overflow. */
319+ bfd_elf_generic_reloc,/* Special Function. */
320+ "R_MICROBLAZE_IMML_64", /* Name. */
321+ false, /* Partial Inplace. */
322+ 0, /* Source Mask. */
323+ 0x0000ffff, /* Dest Mask. */
324+ false), /* PC relative offset? */
325+
326 /* A 64 bit relocation. Table entry not really used. */
327 HOWTO (R_MICROBLAZE_64, /* Type. */
328 0, /* Rightshift. */
329@@ -174,7 +188,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
330 0x0000ffff, /* Dest Mask. */
331 false), /* PC relative offset? */
332
333- /* This reloc does nothing. Used for relaxation. */
334+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
335+ 0, /* Rightshift. */
336+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
337+ 32, /* Bitsize. */
338+ true, /* PC_relative. */
339+ 0, /* Bitpos. */
340+ complain_overflow_bitfield, /* Complain on overflow. */
341+ NULL, /* Special Function. */
342+ "R_MICROBLAZE_32_NONE",/* Name. */
343+ false, /* Partial Inplace. */
344+ 0, /* Source Mask. */
345+ 0, /* Dest Mask. */
346+ false), /* PC relative offset? */
347+
348+ /* This reloc does nothing. Used for relaxation. */
349 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
350 0, /* Rightshift. */
351 0, /* Size. */
352@@ -264,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
353 0x0000ffff, /* Dest Mask. */
354 true), /* PC relative offset? */
355
356+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
357+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
358+ 0, /* Rightshift. */
359+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
360+ 16, /* Bitsize. */
361+ true, /* PC_relative. */
362+ 0, /* Bitpos. */
363+ complain_overflow_dont, /* Complain on overflow. */
364+ bfd_elf_generic_reloc, /* Special Function. */
365+ "R_MICROBLAZE_GPC_64", /* Name. */
366+ false, /* Partial Inplace. */
367+ 0, /* Source Mask. */
368+ 0x0000ffff, /* Dest Mask. */
369+ true), /* PC relative offset? */
370+
371 /* A 64 bit GOT relocation. Table-entry not really used. */
372 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
373 0, /* Rightshift. */
374@@ -560,6 +603,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
375 case BFD_RELOC_NONE:
376 microblaze_reloc = R_MICROBLAZE_NONE;
377 break;
378+ case BFD_RELOC_MICROBLAZE_32_NONE:
379+ microblaze_reloc = R_MICROBLAZE_32_NONE;
380+ break;
381 case BFD_RELOC_MICROBLAZE_64_NONE:
382 microblaze_reloc = R_MICROBLAZE_64_NONE;
383 break;
384@@ -600,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
385 case BFD_RELOC_VTABLE_ENTRY:
386 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
387 break;
388+ case BFD_RELOC_MICROBLAZE_64:
389+ microblaze_reloc = R_MICROBLAZE_IMML_64;
390+ break;
391 case BFD_RELOC_MICROBLAZE_64_GOTPC:
392 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
393 break;
394+ case BFD_RELOC_MICROBLAZE_64_GPC:
395+ microblaze_reloc = R_MICROBLAZE_GPC_64;
396+ break;
397 case BFD_RELOC_MICROBLAZE_64_GOT:
398 microblaze_reloc = R_MICROBLAZE_GOT_64;
399 break;
400@@ -1564,7 +1616,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
401 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
402 {
403 relocation += addend;
404- if (r_type == R_MICROBLAZE_32)
405+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
406 bfd_put_32 (input_bfd, relocation, contents + offset);
407 else
408 {
409@@ -1969,8 +2021,7 @@ microblaze_elf_relax_section (bfd *abfd,
410 else
411 symval += irel->r_addend;
412
413- if ((symval & 0xffff8000) == 0
414- || (symval & 0xffff8000) == 0xffff8000)
415+ if ((symval & 0xffff8000) == 0)
416 {
417 /* We can delete this instruction. */
418 sdata->relax[sdata->relax_count].addr = irel->r_offset;
419@@ -2034,15 +2085,44 @@ microblaze_elf_relax_section (bfd *abfd,
420 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
421 }
422 break;
423- case R_MICROBLAZE_NONE:
424+ case R_MICROBLAZE_IMML_64:
425+ {
426+ /* This was a PC-relative instruction that was
427+ completely resolved. */
428+ int sfix, efix;
429+ unsigned int val;
430+ bfd_vma target_address;
431+ target_address = irel->r_addend + irel->r_offset;
432+ sfix = calc_fixup (irel->r_offset, 0, sec);
433+ efix = calc_fixup (target_address, 0, sec);
434+
435+ /* Validate the in-band val. */
436+ val = bfd_get_32 (abfd, contents + irel->r_offset);
437+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
438+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
439+ }
440+ irel->r_addend -= (efix - sfix);
441+ /* Should use HOWTO. */
442+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
443+ irel->r_addend);
444+ }
445+ break;
446+ case R_MICROBLAZE_32_NONE:
447 {
448 /* This was a PC-relative instruction that was
449 completely resolved. */
450 size_t sfix, efix;
451+ unsigned int val;
452 bfd_vma target_address;
453 target_address = irel->r_addend + irel->r_offset;
454 sfix = calc_fixup (irel->r_offset, 0, sec);
455 efix = calc_fixup (target_address, 0, sec);
456+
457+ /* Validate the in-band val. */
458+ val = bfd_get_32 (abfd, contents + irel->r_offset);
459+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
460+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
461+ }
462 irel->r_addend -= (efix - sfix);
463 /* Should use HOWTO. */
464 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
465@@ -2059,8 +2139,8 @@ microblaze_elf_relax_section (bfd *abfd,
466 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
467 efix = calc_fixup (target_address, 0, sec);
468 irel->r_addend -= (efix - sfix);
469- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
470- + INST_WORD_SIZE, irel->r_addend);
471+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
472+ irel->r_addend);
473 }
474 break;
475 }
476@@ -2090,9 +2170,50 @@ microblaze_elf_relax_section (bfd *abfd,
477 irelscanend = irelocs + o->reloc_count;
478 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
479 {
480- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
481- {
482- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
483+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
484+ {
485+ unsigned int val;
486+
487+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
488+
489+ /* hax: We only do the following fixup for debug location lists. */
490+ if (strcmp(".debug_loc", o->name))
491+ continue;
492+
493+ /* This was a PC-relative instruction that was completely resolved. */
494+ if (ocontents == NULL)
495+ {
496+ if (elf_section_data (o)->this_hdr.contents != NULL)
497+ ocontents = elf_section_data (o)->this_hdr.contents;
498+ else
499+ {
500+ /* We always cache the section contents.
501+ Perhaps, if info->keep_memory is FALSE, we
502+ should free them, if we are permitted to. */
503+
504+ if (o->rawsize == 0)
505+ o->rawsize = o->size;
506+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
507+ if (ocontents == NULL)
508+ goto error_return;
509+ if (!bfd_get_section_contents (abfd, o, ocontents,
510+ (file_ptr) 0,
511+ o->rawsize))
512+ goto error_return;
513+ elf_section_data (o)->this_hdr.contents = ocontents;
514+ }
515+ }
516+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
517+ if (val != irelscan->r_addend) {
518+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
519+ }
520+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
521+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
522+ irelscan->r_addend);
523+ }
524+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
525+ {
526+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
527
528 /* Look at the reloc only if the value has been resolved. */
529 if (isym->st_shndx == shndx
530@@ -2149,7 +2270,7 @@ microblaze_elf_relax_section (bfd *abfd,
531 elf_section_data (o)->this_hdr.contents = ocontents;
532 }
533 }
534- irelscan->r_addend -= calc_fixup (irel->r_addend
535+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
536 + isym->st_value,
537 0,
538 sec);
539@@ -3490,6 +3611,14 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
540 return true;
541 }
542
543+
544+static bool
545+elf_microblaze_object_p (bfd *abfd)
546+{
547+ /* Set the right machine number for an s390 elf32 file. */
548+ return bfd_default_set_arch_mach (abfd, bfd_arch_microblaze, bfd_mach_microblaze);
549+}
550+
551 /* Hook called by the linker routine which adds symbols from an object
552 file. We use it to put .comm items in .sbss, and not .bss. */
553
554@@ -3560,8 +3689,6 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
555 #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
556 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
557 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
558-
559-#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
560-#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
561+#define elf_backend_object_p elf_microblaze_object_p
562
563 #include "elf32-target.h"
564diff --git a/bfd/libbfd.h b/bfd/libbfd.h
565index d5f42f22c08..b0e898bf815 100644
566--- a/bfd/libbfd.h
567+++ b/bfd/libbfd.h
568@@ -3010,6 +3010,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
569 "BFD_RELOC_MICROBLAZE_32_ROSDA",
570 "BFD_RELOC_MICROBLAZE_32_RWSDA",
571 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
572+ "BFD_RELOC_MICROBLAZE_32_NONE",
573 "BFD_RELOC_MICROBLAZE_64_NONE",
574 "BFD_RELOC_MICROBLAZE_64_GOTPC",
575 "BFD_RELOC_MICROBLAZE_64_GOT",
576@@ -3017,6 +3018,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
577 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
578 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
579 "BFD_RELOC_MICROBLAZE_COPY",
580+ "BFD_RELOC_MICROBLAZE_64",
581+ "BFD_RELOC_MICROBLAZE_64_PCREL",
582 "BFD_RELOC_MICROBLAZE_64_TLS",
583 "BFD_RELOC_MICROBLAZE_64_TLSGD",
584 "BFD_RELOC_MICROBLAZE_64_TLSLD",
585diff --git a/bfd/reloc.c b/bfd/reloc.c
586index 2ac883d0eac..278876e765e 100644
587--- a/bfd/reloc.c
588+++ b/bfd/reloc.c
589@@ -6694,6 +6694,12 @@ ENUM
590 ENUMDOC
591 This is a 32 bit reloc for the microblaze to handle
592 expressions of the form "Symbol Op Symbol"
593+ENUM
594+ BFD_RELOC_MICROBLAZE_32_NONE
595+ENUMDOC
596+ This is a 32 bit reloc that stores the 32 bit pc relative
597+ value in two words (with an imm instruction). No relocation is
598+ done here - only used for relaxing
599 ENUM
600 BFD_RELOC_MICROBLAZE_64_NONE
601 ENUMDOC
602@@ -7933,6 +7939,20 @@ ENUMX
603 ENUMDOC
604 Tilera TILE-Gx Relocations.
605
606+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
607+ to two words (uses imml instruction).
608+ENUM
609+BFD_RELOC_MICROBLAZE_64,
610+ENUMDOC
611+ This is a 64 bit reloc that stores the 64 bit pc relative
612+ value in two words (with an imml instruction). No relocation is
613+ done here - only used for relaxing
614+ENUM
615+BFD_RELOC_MICROBLAZE_64_PCREL,
616+ENUMDOC
617+ This is a 32 bit reloc that stores the 32 bit pc relative
618+ value in two words (with an imml instruction). No relocation is
619+ done here - only used for relaxing
620 ENUM
621 BFD_RELOC_BPF_64
622 ENUMX
623diff --git a/bfd/targets.c b/bfd/targets.c
624index 63b3abbd287..c48c0929157 100644
625--- a/bfd/targets.c
626+++ b/bfd/targets.c
627@@ -799,6 +799,8 @@ extern const bfd_target mep_elf32_le_vec;
628 extern const bfd_target metag_elf32_vec;
629 extern const bfd_target microblaze_elf32_vec;
630 extern const bfd_target microblaze_elf32_le_vec;
631+extern const bfd_target microblaze_elf64_vec;
632+extern const bfd_target microblaze_elf64_le_vec;
633 extern const bfd_target mips_ecoff_be_vec;
634 extern const bfd_target mips_ecoff_le_vec;
635 extern const bfd_target mips_ecoff_bele_vec;
636@@ -1166,6 +1168,10 @@ static const bfd_target * const _bfd_target_vector[] =
637
638 &metag_elf32_vec,
639
640+#ifdef BFD64
641+ &microblaze_elf64_vec,
642+ &microblaze_elf64_le_vec,
643+#endif
644 &microblaze_elf32_vec,
645
646 &mips_ecoff_be_vec,
647diff --git a/gdb/features/Makefile b/gdb/features/Makefile
648index 0af9d67c2f7..ee053b7557c 100644
649--- a/gdb/features/Makefile
650+++ b/gdb/features/Makefile
651@@ -102,7 +102,9 @@ OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
652 # to make on the command line.
653 XMLTOC = \
654 microblaze-with-stack-protect.xml \
655+ microblaze64-with-stack-protect.xml \
656 microblaze.xml \
657+ microblaze64.xml \
658 mips-dsp-linux.xml \
659 mips-linux.xml \
660 mips64-dsp-linux.xml \
661diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
662index d49aa075bae..ac052365773 100644
663--- a/gdb/features/microblaze-core.xml
664+++ b/gdb/features/microblaze-core.xml
665@@ -8,7 +8,7 @@
666 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
667 <feature name="org.gnu.gdb.microblaze.core">
668 <reg name="r0" bitsize="32" regnum="0"/>
669- <reg name="r1" bitsize="32" type="data_ptr"/>
670+ <reg name="r1" bitsize="32"/>
671 <reg name="r2" bitsize="32"/>
672 <reg name="r3" bitsize="32"/>
673 <reg name="r4" bitsize="32"/>
674@@ -39,7 +39,7 @@
675 <reg name="r29" bitsize="32"/>
676 <reg name="r30" bitsize="32"/>
677 <reg name="r31" bitsize="32"/>
678- <reg name="rpc" bitsize="32" type="code_ptr"/>
679+ <reg name="rpc" bitsize="32"/>
680 <reg name="rmsr" bitsize="32"/>
681 <reg name="rear" bitsize="32"/>
682 <reg name="resr" bitsize="32"/>
683@@ -64,4 +64,6 @@
684 <reg name="rtlbsx" bitsize="32"/>
685 <reg name="rtlblo" bitsize="32"/>
686 <reg name="rtlbhi" bitsize="32"/>
687+ <reg name="slr" bitsize="32"/>
688+ <reg name="shr" bitsize="32"/>
689 </feature>
690diff --git a/gdb/features/microblaze-stack-protect.xml b/gdb/features/microblaze-stack-protect.xml
691index a5ffe2e50b1..b15369e03a4 100644
692--- a/gdb/features/microblaze-stack-protect.xml
693+++ b/gdb/features/microblaze-stack-protect.xml
694@@ -7,6 +7,6 @@
695
696 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
697 <feature name="org.gnu.gdb.microblaze.stack-protect">
698- <reg name="rslr" bitsize="32"/>
699- <reg name="rshr" bitsize="32"/>
700+ <reg name="slr" bitsize="32"/>
701+ <reg name="shr" bitsize="32"/>
702 </feature>
703diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
704index 574dc02db67..8ab9565a047 100644
705--- a/gdb/features/microblaze-with-stack-protect.c
706+++ b/gdb/features/microblaze-with-stack-protect.c
707@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
708
709 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
710 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
711- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
712+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
713 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
714 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
715 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
716@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
717 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
718 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
719 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
720- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
721+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
722 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
723 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
724 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
725@@ -72,8 +72,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
726 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
727
728 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
729- tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
730- tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
731+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
732+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
733
734 tdesc_microblaze_with_stack_protect = result.release ();
735 }
736diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
737index 8f1fb0a142f..ed12e5bcfd2 100644
738--- a/gdb/features/microblaze.c
739+++ b/gdb/features/microblaze.c
740@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
741
742 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
743 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
744- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
745+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
746 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
747 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
748 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
749@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
750 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
751 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
752 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
753- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
754+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
755 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
756 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
757 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
758@@ -70,6 +70,8 @@ initialize_tdesc_microblaze (void)
759 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
760 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
761 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
762+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
763+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
764
765 tdesc_microblaze = result.release ();
766 }
767diff --git a/gdb/features/microblaze64-core.xml b/gdb/features/microblaze64-core.xml
768new file mode 100644
769index 00000000000..96e99e2fb24
770--- /dev/null
771+++ b/gdb/features/microblaze64-core.xml
772@@ -0,0 +1,69 @@
773+<?xml version="1.0"?>
774+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
775+
776+ Copying and distribution of this file, with or without modification,
777+ are permitted in any medium without royalty provided the copyright
778+ notice and this notice are preserved. -->
779+
780+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
781+<feature name="org.gnu.gdb.microblaze64.core">
782+ <reg name="r0" bitsize="64" regnum="0"/>
783+ <reg name="r1" bitsize="64"/>
784+ <reg name="r2" bitsize="64"/>
785+ <reg name="r3" bitsize="64"/>
786+ <reg name="r4" bitsize="64"/>
787+ <reg name="r5" bitsize="64"/>
788+ <reg name="r6" bitsize="64"/>
789+ <reg name="r7" bitsize="64"/>
790+ <reg name="r8" bitsize="64"/>
791+ <reg name="r9" bitsize="64"/>
792+ <reg name="r10" bitsize="64"/>
793+ <reg name="r11" bitsize="64"/>
794+ <reg name="r12" bitsize="64"/>
795+ <reg name="r13" bitsize="64"/>
796+ <reg name="r14" bitsize="64"/>
797+ <reg name="r15" bitsize="64"/>
798+ <reg name="r16" bitsize="64"/>
799+ <reg name="r17" bitsize="64"/>
800+ <reg name="r18" bitsize="64"/>
801+ <reg name="r19" bitsize="64"/>
802+ <reg name="r20" bitsize="64"/>
803+ <reg name="r21" bitsize="64"/>
804+ <reg name="r22" bitsize="64"/>
805+ <reg name="r23" bitsize="64"/>
806+ <reg name="r24" bitsize="64"/>
807+ <reg name="r25" bitsize="64"/>
808+ <reg name="r26" bitsize="64"/>
809+ <reg name="r27" bitsize="64"/>
810+ <reg name="r28" bitsize="64"/>
811+ <reg name="r29" bitsize="64"/>
812+ <reg name="r30" bitsize="64"/>
813+ <reg name="r31" bitsize="64"/>
814+ <reg name="rpc" bitsize="64"/>
815+ <reg name="rmsr" bitsize="32"/>
816+ <reg name="rear" bitsize="64"/>
817+ <reg name="resr" bitsize="32"/>
818+ <reg name="rfsr" bitsize="32"/>
819+ <reg name="rbtr" bitsize="64"/>
820+ <reg name="rpvr0" bitsize="32"/>
821+ <reg name="rpvr1" bitsize="32"/>
822+ <reg name="rpvr2" bitsize="32"/>
823+ <reg name="rpvr3" bitsize="32"/>
824+ <reg name="rpvr4" bitsize="32"/>
825+ <reg name="rpvr5" bitsize="32"/>
826+ <reg name="rpvr6" bitsize="32"/>
827+ <reg name="rpvr7" bitsize="32"/>
828+ <reg name="rpvr8" bitsize="64"/>
829+ <reg name="rpvr9" bitsize="64"/>
830+ <reg name="rpvr10" bitsize="32"/>
831+ <reg name="rpvr11" bitsize="32"/>
832+ <reg name="redr" bitsize="32"/>
833+ <reg name="rpid" bitsize="32"/>
834+ <reg name="rzpr" bitsize="32"/>
835+ <reg name="rtlbx" bitsize="32"/>
836+ <reg name="rtlbsx" bitsize="32"/>
837+ <reg name="rtlblo" bitsize="32"/>
838+ <reg name="rtlbhi" bitsize="32"/>
839+ <reg name="slr" bitsize="64"/>
840+ <reg name="shr" bitsize="64"/>
841+</feature>
842diff --git a/gdb/features/microblaze64-stack-protect.xml b/gdb/features/microblaze64-stack-protect.xml
843new file mode 100644
844index 00000000000..1bbf5fc3cea
845--- /dev/null
846+++ b/gdb/features/microblaze64-stack-protect.xml
847@@ -0,0 +1,12 @@
848+<?xml version="1.0"?>
849+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
850+
851+ Copying and distribution of this file, with or without modification,
852+ are permitted in any medium without royalty provided the copyright
853+ notice and this notice are preserved. -->
854+
855+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
856+<feature name="org.gnu.gdb.microblaze64.stack-protect">
857+ <reg name="slr" bitsize="64"/>
858+ <reg name="shr" bitsize="64"/>
859+</feature>
860diff --git a/gdb/features/microblaze64-with-stack-protect.c b/gdb/features/microblaze64-with-stack-protect.c
861new file mode 100644
862index 00000000000..a4de4666c76
863--- /dev/null
864+++ b/gdb/features/microblaze64-with-stack-protect.c
865@@ -0,0 +1,79 @@
866+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
867+ Original: microblaze-with-stack-protect.xml */
868+
869+#include "defs.h"
870+#include "osabi.h"
871+#include "target-descriptions.h"
872+
873+struct target_desc *tdesc_microblaze64_with_stack_protect;
874+static void
875+initialize_tdesc_microblaze64_with_stack_protect (void)
876+{
877+ target_desc_up result = allocate_target_description ();
878+ struct tdesc_feature *feature;
879+
880+ feature = tdesc_create_feature (result.get() , "org.gnu.gdb.microblaze64.core");
881+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
882+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
883+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
884+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
885+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
886+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
887+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
888+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
889+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
890+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
891+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
892+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
893+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
894+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
895+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
896+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
897+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
898+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
899+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
900+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
901+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
902+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
903+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
904+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
905+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
906+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
907+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
908+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
909+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
910+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
911+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
912+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
913+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
914+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
915+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "int");
916+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
917+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
918+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
919+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
920+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
921+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
922+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
923+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
924+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
925+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
926+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
927+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
928+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
929+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
930+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
931+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
932+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
933+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
934+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
935+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
936+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
937+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
938+
939+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.stack-protect");
940+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
941+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
942+
943+ tdesc_microblaze64_with_stack_protect = result.release();
944+}
945diff --git a/gdb/features/microblaze64-with-stack-protect.xml b/gdb/features/microblaze64-with-stack-protect.xml
946new file mode 100644
947index 00000000000..0e9f01611f3
948--- /dev/null
949+++ b/gdb/features/microblaze64-with-stack-protect.xml
950@@ -0,0 +1,12 @@
951+<?xml version="1.0"?>
952+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
953+
954+ Copying and distribution of this file, with or without modification,
955+ are permitted in any medium without royalty provided the copyright
956+ notice and this notice are preserved. -->
957+
958+<!DOCTYPE target SYSTEM "gdb-target.dtd">
959+<target>
960+ <xi:include href="microblaze64-core.xml"/>
961+ <xi:include href="microblaze64-stack-protect.xml"/>
962+</target>
963diff --git a/gdb/features/microblaze64.c b/gdb/features/microblaze64.c
964new file mode 100644
965index 00000000000..8ab7a90dd95
966--- /dev/null
967+++ b/gdb/features/microblaze64.c
968@@ -0,0 +1,77 @@
969+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
970+ Original: microblaze.xml */
971+
972+#include "defs.h"
973+#include "osabi.h"
974+#include "target-descriptions.h"
975+
976+struct target_desc *tdesc_microblaze64;
977+static void
978+initialize_tdesc_microblaze64 (void)
979+{
980+ target_desc_up result = allocate_target_description ();
981+ struct tdesc_feature *feature;
982+
983+ feature = tdesc_create_feature (result.get(), "org.gnu.gdb.microblaze64.core");
984+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 64, "uint64");
985+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 64, "uint64");
986+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 64, "uint64");
987+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 64, "uint64");
988+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 64, "uint64");
989+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 64, "uint64");
990+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 64, "uint64");
991+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 64, "uint64");
992+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "uint64");
993+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "uint64");
994+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "uint64");
995+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "uint64");
996+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "uint64");
997+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "uint64");
998+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "uint64");
999+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "uint64");
1000+ tdesc_create_reg (feature, "r16", 16, 1, NULL, 64, "uint64");
1001+ tdesc_create_reg (feature, "r17", 17, 1, NULL, 64, "uint64");
1002+ tdesc_create_reg (feature, "r18", 18, 1, NULL, 64, "uint64");
1003+ tdesc_create_reg (feature, "r19", 19, 1, NULL, 64, "uint64");
1004+ tdesc_create_reg (feature, "r20", 20, 1, NULL, 64, "uint64");
1005+ tdesc_create_reg (feature, "r21", 21, 1, NULL, 64, "uint64");
1006+ tdesc_create_reg (feature, "r22", 22, 1, NULL, 64, "uint64");
1007+ tdesc_create_reg (feature, "r23", 23, 1, NULL, 64, "uint64");
1008+ tdesc_create_reg (feature, "r24", 24, 1, NULL, 64, "uint64");
1009+ tdesc_create_reg (feature, "r25", 25, 1, NULL, 64, "uint64");
1010+ tdesc_create_reg (feature, "r26", 26, 1, NULL, 64, "uint64");
1011+ tdesc_create_reg (feature, "r27", 27, 1, NULL, 64, "uint64");
1012+ tdesc_create_reg (feature, "r28", 28, 1, NULL, 64, "uint64");
1013+ tdesc_create_reg (feature, "r29", 29, 1, NULL, 64, "uint64");
1014+ tdesc_create_reg (feature, "r30", 30, 1, NULL, 64, "uint64");
1015+ tdesc_create_reg (feature, "r31", 31, 1, NULL, 64, "uint64");
1016+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 64, "uint64");
1017+ tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
1018+ tdesc_create_reg (feature, "rear", 34, 1, NULL, 64, "uint64");
1019+ tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
1020+ tdesc_create_reg (feature, "rfsr", 36, 1, NULL, 32, "int");
1021+ tdesc_create_reg (feature, "rbtr", 37, 1, NULL, 64, "uint64");
1022+ tdesc_create_reg (feature, "rpvr0", 38, 1, NULL, 32, "int");
1023+ tdesc_create_reg (feature, "rpvr1", 39, 1, NULL, 32, "int");
1024+ tdesc_create_reg (feature, "rpvr2", 40, 1, NULL, 32, "int");
1025+ tdesc_create_reg (feature, "rpvr3", 41, 1, NULL, 32, "int");
1026+ tdesc_create_reg (feature, "rpvr4", 42, 1, NULL, 32, "int");
1027+ tdesc_create_reg (feature, "rpvr5", 43, 1, NULL, 32, "int");
1028+ tdesc_create_reg (feature, "rpvr6", 44, 1, NULL, 32, "int");
1029+ tdesc_create_reg (feature, "rpvr7", 45, 1, NULL, 32, "int");
1030+ tdesc_create_reg (feature, "rpvr8", 46, 1, NULL, 64, "uint64");
1031+ tdesc_create_reg (feature, "rpvr9", 47, 1, NULL, 64, "uint64");
1032+ tdesc_create_reg (feature, "rpvr10", 48, 1, NULL, 32, "int");
1033+ tdesc_create_reg (feature, "rpvr11", 49, 1, NULL, 32, "int");
1034+ tdesc_create_reg (feature, "redr", 50, 1, NULL, 32, "int");
1035+ tdesc_create_reg (feature, "rpid", 51, 1, NULL, 32, "int");
1036+ tdesc_create_reg (feature, "rzpr", 52, 1, NULL, 32, "int");
1037+ tdesc_create_reg (feature, "rtlbx", 53, 1, NULL, 32, "int");
1038+ tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
1039+ tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
1040+ tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
1041+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
1042+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
1043+
1044+ tdesc_microblaze64 = result.release();
1045+}
1046diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
1047new file mode 100644
1048index 00000000000..515d18e65cf
1049--- /dev/null
1050+++ b/gdb/features/microblaze64.xml
1051@@ -0,0 +1,11 @@
1052+<?xml version="1.0"?>
1053+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
1054+
1055+ Copying and distribution of this file, with or without modification,
1056+ are permitted in any medium without royalty provided the copyright
1057+ notice and this notice are preserved. -->
1058+
1059+<!DOCTYPE target SYSTEM "gdb-target.dtd">
1060+<target>
1061+ <xi:include href="microblaze64-core.xml"/>
1062+</target>
1063diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
1064index 5b57bb4d3ba..39592a43f7c 100644
1065--- a/gdb/microblaze-linux-tdep.c
1066+++ b/gdb/microblaze-linux-tdep.c
1067@@ -40,6 +40,7 @@
1068 #include "features/microblaze-linux.c"
1069
1070 static int microblaze_debug_flag = 0;
1071+int MICROBLAZE_REGISTER_SIZE=4;
1072
1073 static void
1074 microblaze_debug (const char *fmt, ...)
1075@@ -55,6 +56,7 @@ microblaze_debug (const char *fmt, ...)
1076 }
1077 }
1078
1079+#if 0
1080 static int
1081 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1082 struct bp_target_info *bp_tgt)
1083@@ -86,6 +88,8 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1084 return val;
1085 }
1086
1087+#endif
1088+
1089 static void
1090 microblaze_linux_sigtramp_cache (frame_info_ptr next_frame,
1091 struct trad_frame_cache *this_cache,
1092@@ -147,8 +151,8 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1093
1094 linux_init_abi (info, gdbarch, 0);
1095
1096- set_gdbarch_memory_remove_breakpoint (gdbarch,
1097- microblaze_linux_memory_remove_breakpoint);
1098+ // set_gdbarch_memory_remove_breakpoint (gdbarch,
1099+ // microblaze_linux_memory_remove_breakpoint);
1100
1101 /* Shared library handling. */
1102 set_solib_svr4_fetch_link_map_offsets (gdbarch,
1103@@ -160,10 +164,30 @@ microblaze_linux_init_abi (struct gdbarch_info info,
1104
1105 /* BFD target for core files. */
1106 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
1107- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1108+ {
1109+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1110+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblaze");
1111+ MICROBLAZE_REGISTER_SIZE=8;
1112+ }
1113+ else
1114+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
1115+ }
1116 else
1117- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1118+ {
1119+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64) {
1120+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-microblazeel");
1121+ MICROBLAZE_REGISTER_SIZE=8;
1122+ }
1123+ else
1124+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
1125+ }
1126
1127+ switch (info.bfd_arch_info->mach)
1128+ {
1129+ case bfd_mach_microblaze64:
1130+ set_gdbarch_ptr_bit (gdbarch, 64);
1131+ break;
1132+ }
1133
1134 /* Shared library handling. */
1135 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
1136@@ -178,7 +202,9 @@ void _initialize_microblaze_linux_tdep ();
1137 void
1138 _initialize_microblaze_linux_tdep ()
1139 {
1140- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
1141+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze, GDB_OSABI_LINUX,
1142+ microblaze_linux_init_abi);
1143+ gdbarch_register_osabi (bfd_arch_microblaze, bfd_mach_microblaze64, GDB_OSABI_LINUX,
1144 microblaze_linux_init_abi);
1145 initialize_tdesc_microblaze_linux ();
1146 }
1147diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
1148index 066602b385a..9450882e850 100644
1149--- a/gdb/microblaze-tdep.c
1150+++ b/gdb/microblaze-tdep.c
1151@@ -40,7 +40,9 @@
1152 #include "remote.h"
1153
1154 #include "features/microblaze-with-stack-protect.c"
1155+#include "features/microblaze64-with-stack-protect.c"
1156 #include "features/microblaze.c"
1157+#include "features/microblaze64.c"
1158
1159 /* Instruction macros used for analyzing the prologue. */
1160 /* This set of instruction macros need to be changed whenever the
1161@@ -75,12 +77,13 @@ static const char * const microblaze_register_names[] =
1162 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
1163 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
1164 "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
1165- "rslr", "rshr"
1166+ "slr", "shr"
1167 };
1168
1169 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
1170
1171 static unsigned int microblaze_debug_flag = 0;
1172+int reg_size = 4;
1173
1174 #define microblaze_debug(fmt, ...) \
1175 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
1176@@ -128,6 +131,15 @@ microblaze_fetch_instruction (CORE_ADDR pc)
1177 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
1178
1179 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
1180+static CORE_ADDR
1181+microblaze_store_arguments (struct regcache *regcache, int nargs,
1182+ struct value **args, CORE_ADDR sp,
1183+ int struct_return, CORE_ADDR struct_addr)
1184+{
1185+ error (_("store_arguments not implemented"));
1186+ return sp;
1187+}
1188+#if 0
1189 static int
1190 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1191 struct bp_target_info *bp_tgt)
1192@@ -146,7 +158,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1193 /* Make sure we see the memory breakpoints. */
1194 scoped_restore restore_memory
1195 = make_scoped_restore_show_memory_breakpoints (1);
1196-
1197 val = target_read_memory (addr, old_contents, bplen);
1198
1199 /* If our breakpoint is no longer at the address, this means that the
1200@@ -161,6 +172,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
1201 return val;
1202 }
1203
1204+#endif
1205 /* Allocate and initialize a frame cache. */
1206
1207 static struct microblaze_frame_cache *
1208@@ -583,11 +595,11 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
1209 {
1210 case 1: /* return last byte in the register. */
1211 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1212- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
1213+ memcpy(valbuf, buf + reg_size - 1, 1);
1214 return;
1215 case 2: /* return last 2 bytes in register. */
1216 regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
1217- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
1218+ memcpy(valbuf, buf + reg_size - 2, 2);
1219 return;
1220 case 4: /* for sizes 4 or 8, copy the required length. */
1221 case 8:
1222@@ -753,6 +765,12 @@ microblaze_software_single_step (struct regcache *regcache)
1223 }
1224 #endif
1225
1226+static void
1227+microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
1228+{
1229+ regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc);
1230+}
1231+
1232 static int dwarf2_to_reg_map[78] =
1233 { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
1234 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
1235@@ -787,13 +805,14 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
1236 static void
1237 microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
1238 {
1239+
1240 register_remote_g_packet_guess (gdbarch,
1241 4 * MICROBLAZE_NUM_CORE_REGS,
1242- tdesc_microblaze);
1243+ tdesc_microblaze64);
1244
1245 register_remote_g_packet_guess (gdbarch,
1246 4 * MICROBLAZE_NUM_REGS,
1247- tdesc_microblaze_with_stack_protect);
1248+ tdesc_microblaze64_with_stack_protect);
1249 }
1250
1251 void
1252@@ -801,7 +820,7 @@ microblaze_supply_gregset (const struct regset *regset,
1253 struct regcache *regcache,
1254 int regnum, const void *gregs)
1255 {
1256- const unsigned int *regs = (const unsigned int *)gregs;
1257+ const gdb_byte *regs = (const gdb_byte *) gregs;
1258 if (regnum >= 0)
1259 regcache->raw_supply (regnum, regs + regnum);
1260
1261@@ -809,7 +828,7 @@ microblaze_supply_gregset (const struct regset *regset,
1262 int i;
1263
1264 for (i = 0; i < 50; i++) {
1265- regcache->raw_supply (i, regs + i);
1266+ regcache->raw_supply (regnum, regs + i);
1267 }
1268 }
1269 }
1270@@ -832,6 +851,17 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
1271 }
1272
1273
1274+static void
1275+make_regs (struct gdbarch *arch)
1276+{
1277+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
1278+ int mach = gdbarch_bfd_arch_info (arch)->mach;
1279+
1280+ if (mach == bfd_mach_microblaze64)
1281+ {
1282+ set_gdbarch_ptr_bit (arch, 64);
1283+ }
1284+}
1285
1286 static struct gdbarch *
1287 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1288@@ -844,8 +874,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1289 if (arches != NULL)
1290 return arches->gdbarch;
1291 if (tdesc == NULL)
1292- tdesc = tdesc_microblaze;
1293-
1294+ {
1295+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1296+ {
1297+ tdesc = tdesc_microblaze64;
1298+ reg_size = 8;
1299+ }
1300+ else
1301+ tdesc = tdesc_microblaze;
1302+ }
1303 /* Check any target description for validity. */
1304 if (tdesc_has_registers (tdesc))
1305 {
1306@@ -853,31 +890,42 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1307 int valid_p;
1308 int i;
1309
1310- feature = tdesc_find_feature (tdesc,
1311- "org.gnu.gdb.microblaze.core");
1312+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1313+ feature = tdesc_find_feature (tdesc,
1314+ "org.gnu.gdb.microblaze64.core");
1315+ else
1316+ feature = tdesc_find_feature (tdesc,
1317+ "org.gnu.gdb.microblaze.core");
1318 if (feature == NULL)
1319 return NULL;
1320 tdesc_data = tdesc_data_alloc ();
1321
1322 valid_p = 1;
1323- for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
1324- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
1325- microblaze_register_names[i]);
1326- feature = tdesc_find_feature (tdesc,
1327- "org.gnu.gdb.microblaze.stack-protect");
1328+ for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
1329+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
1330+ microblaze_register_names[i]);
1331+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
1332+ feature = tdesc_find_feature (tdesc,
1333+ "org.gnu.gdb.microblaze64.stack-protect");
1334+ else
1335+ feature = tdesc_find_feature (tdesc,
1336+ "org.gnu.gdb.microblaze.stack-protect");
1337 if (feature != NULL)
1338- {
1339- valid_p = 1;
1340- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1341- MICROBLAZE_SLR_REGNUM,
1342- "rslr");
1343- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
1344- MICROBLAZE_SHR_REGNUM,
1345- "rshr");
1346- }
1347+ {
1348+ valid_p = 1;
1349+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1350+ MICROBLAZE_SLR_REGNUM,
1351+ "slr");
1352+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get(),
1353+ MICROBLAZE_SHR_REGNUM,
1354+ "shr");
1355+ }
1356
1357 if (!valid_p)
1358- return NULL;
1359+ {
1360+ // tdesc_data_cleanup (tdesc_data.get ());
1361+ return NULL;
1362+ }
1363 }
1364
1365 /* Allocate space for the new architecture. */
1366@@ -897,7 +945,17 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1367 /* Register numbers of various important registers. */
1368 set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
1369 set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
1370+
1371+ /* Register set.
1372+ make_regs (gdbarch); */
1373+ switch (info.bfd_arch_info->mach)
1374+ {
1375+ case bfd_mach_microblaze64:
1376+ set_gdbarch_ptr_bit (gdbarch, 64);
1377+ break;
1378+ }
1379
1380+
1381 /* Map Dwarf2 registers to GDB registers. */
1382 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
1383
1384@@ -917,7 +975,9 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1385 microblaze_breakpoint::kind_from_pc);
1386 set_gdbarch_sw_breakpoint_from_kind (gdbarch,
1387 microblaze_breakpoint::bp_from_kind);
1388- set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1389+// set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
1390+
1391+// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1392
1393 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
1394
1395@@ -925,7 +985,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1396
1397 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
1398
1399- microblaze_register_g_packet_guesses (gdbarch);
1400+ //microblaze_register_g_packet_guesses (gdbarch);
1401
1402 frame_base_set_default (gdbarch, &microblaze_frame_base);
1403
1404@@ -940,12 +1000,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1405 tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
1406 //frame_base_append_sniffer (gdbarch, microblaze_frame_sniffer);
1407
1408- /* If we have register sets, enable the generic core file support. */
1409+ /* If we have register sets, enable the generic core file support.
1410 if (tdep->gregset) {
1411 set_gdbarch_iterate_over_regset_sections (gdbarch,
1412 microblaze_iterate_over_regset_sections);
1413- }
1414-
1415+ }*/
1416 return gdbarch;
1417 }
1418
1419@@ -957,6 +1016,8 @@ _initialize_microblaze_tdep ()
1420
1421 initialize_tdesc_microblaze_with_stack_protect ();
1422 initialize_tdesc_microblaze ();
1423+ initialize_tdesc_microblaze64_with_stack_protect ();
1424+ initialize_tdesc_microblaze64 ();
1425 /* Debug this files internals. */
1426 add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
1427 &microblaze_debug_flag, _("\
1428diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
1429index 21f206777f0..542cdd82070 100644
1430--- a/gdb/microblaze-tdep.h
1431+++ b/gdb/microblaze-tdep.h
1432@@ -28,7 +28,7 @@ struct microblaze_gregset
1433 microblaze_gregset() {}
1434 unsigned int gregs[32];
1435 unsigned int fpregs[32];
1436- unsigned int pregs[16];
1437+ unsigned int pregs[18];
1438 };
1439
1440 struct microblaze_gdbarch_tdep : gdbarch_tdep_base
1441@@ -134,7 +134,7 @@ struct microblaze_frame_cache
1442 struct trad_frame_saved_reg *saved_regs;
1443 };
1444 /* All registers are 32 bits. */
1445-#define MICROBLAZE_REGISTER_SIZE 4
1446+//#define MICROBLAZE_REGISTER_SIZE 8
1447
1448 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
1449 Only used for native debugging. */
1450diff --git a/include/elf/common.h b/include/elf/common.h
1451index 244b13361e5..6395f69426f 100644
1452--- a/include/elf/common.h
1453+++ b/include/elf/common.h
1454@@ -360,6 +360,7 @@
1455 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
1456 #define EM_TACHYUM 261 /* Tachyum */
1457 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
1458+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
1459
1460 /* If it is necessary to assign new unofficial EM_* values, please pick large
1461 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
1462diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
1463index fecdd7e4831..3306e3c3ad6 100644
1464--- a/include/elf/microblaze.h
1465+++ b/include/elf/microblaze.h
1466@@ -61,6 +61,10 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
1467 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
1468 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
1469 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
1470+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
1471+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
1472+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
1473+
1474 END_RELOC_NUMBERS (R_MICROBLAZE_max)
1475
1476 /* Global base address names. */
1477diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
1478index 12981abfea1..c910f2ff210 100644
1479--- a/opcodes/microblaze-dis.c
1480+++ b/opcodes/microblaze-dis.c
1481@@ -33,6 +33,7 @@
1482 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
1483 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
1484 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
1485+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
1486 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
1487
1488 #define NUM_STRBUFS 3
1489@@ -73,11 +74,20 @@ get_field_imm (struct string_buf *buf, long instr)
1490 }
1491
1492 static char *
1493-get_field_imm5 (struct string_buf *buf, long instr)
1494+get_field_imml (struct string_buf *buf, long instr)
1495 {
1496 char *p = strbuf (buf);
1497
1498- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
1499+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
1500+ return p;
1501+}
1502+
1503+static char *
1504+get_field_imms (struct string_buf *buf, long instr)
1505+{
1506+ char *p = strbuf (buf);
1507+
1508+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
1509 return p;
1510 }
1511
1512@@ -90,6 +100,18 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
1513 return p;
1514 }
1515
1516+static char *
1517+get_field_immw (struct string_buf *buf, long instr)
1518+{
1519+ char *p = strbuf (buf);
1520+
1521+ if (instr & 0x00004000)
1522+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
1523+ else
1524+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
1525+ return p;
1526+}
1527+
1528 static char *
1529 get_field_rfsl (struct string_buf *buf, long instr)
1530 {
1531@@ -296,9 +318,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1532 }
1533 }
1534 break;
1535- case INST_TYPE_RD_R1_IMM5:
1536+ case INST_TYPE_RD_R1_IMML:
1537+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1538+ get_field_r1(&buf, inst), get_field_imm (&buf, inst));
1539+ /* TODO: Also print symbol */
1540+ break;
1541+ case INST_TYPE_RD_R1_IMMS:
1542 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
1543- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
1544+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
1545 break;
1546 case INST_TYPE_RD_RFSL:
1547 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1548@@ -402,9 +429,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1549 }
1550 }
1551 break;
1552- case INST_TYPE_RD_R2:
1553- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
1554- get_field_r2 (&buf, inst));
1555+ case INST_TYPE_IMML:
1556+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
1557+ /* TODO: Also print symbol */
1558+ break;
1559+ case INST_TYPE_RD_R2:
1560+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_r2 (&buf, inst));
1561 break;
1562 case INST_TYPE_R2:
1563 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
1564@@ -427,7 +457,12 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
1565 /* For mbar 16 or sleep insn. */
1566 case INST_TYPE_NONE:
1567 break;
1568- /* For tuqula instruction */
1569+ /* For bit field insns. */
1570+ case INST_TYPE_RD_R1_IMMW_IMMS:
1571+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
1572+ get_field_immw (&buf, inst), get_field_imms (&buf, inst));
1573+ break;
1574+ /* For tuqula instruction */
1575 case INST_TYPE_RD:
1576 print_func (stream, "\t%s", get_field_rd (&buf, inst));
1577 break;
1578diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
1579index 7398e9e246a..dc78712d67b 100644
1580--- a/opcodes/microblaze-opc.h
1581+++ b/opcodes/microblaze-opc.h
1582@@ -40,7 +40,7 @@
1583 #define INST_TYPE_RD_SPECIAL 11
1584 #define INST_TYPE_R1 12
1585 /* New instn type for barrel shift imms. */
1586-#define INST_TYPE_RD_R1_IMM5 13
1587+#define INST_TYPE_RD_R1_IMMS 13
1588 #define INST_TYPE_RD_RFSL 14
1589 #define INST_TYPE_R1_RFSL 15
1590
1591@@ -59,6 +59,15 @@
1592 /* For mbar. */
1593 #define INST_TYPE_IMM5 20
1594
1595+/* For bsefi and bsifi */
1596+#define INST_TYPE_RD_R1_IMMW_IMMS 21
1597+
1598+/* For 64-bit instructions */
1599+#define INST_TYPE_IMML 22
1600+#define INST_TYPE_RD_R1_IMML 23
1601+#define INST_TYPE_R1_IMML 24
1602+#define INST_TYPE_RD_R1_IMMW_IMMS 21
1603+
1604 #define INST_TYPE_NONE 25
1605
1606
1607@@ -88,11 +97,14 @@
1608 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
1609 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
1610 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
1611-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
1612+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
1613+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
1614 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
1615+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
1616 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
1617 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
1618 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
1619+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
1620
1621 /* New Mask for msrset, msrclr insns. */
1622 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
1623@@ -102,7 +114,7 @@
1624 #define DELAY_SLOT 1
1625 #define NO_DELAY_SLOT 0
1626
1627-#define MAX_OPCODES 300
1628+#define MAX_OPCODES 412
1629
1630 const struct op_code_struct
1631 {
1632@@ -120,6 +132,7 @@ const struct op_code_struct
1633 /* More info about output format here. */
1634 } microblaze_opcodes[MAX_OPCODES] =
1635 {
1636+ /* 32-bit instructions */
1637 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
1638 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
1639 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
1640@@ -156,9 +169,11 @@ const struct op_code_struct
1641 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
1642 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
1643 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
1644- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
1645- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
1646- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
1647+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
1648+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
1649+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
1650+ {"bsefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
1651+ {"bsifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
1652 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
1653 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
1654 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
1655@@ -260,9 +275,7 @@ const struct op_code_struct
1656 {"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. */
1657 {"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. */
1658 {"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. */
1659- {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1660 {"rtb", INST_TYPE_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB6000004, OPCODE_MASK_H1, invalid_inst, return_inst }, /* rtb translates to rts rd, 4. */
1661- {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1662 {"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 },
1663 {"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 },
1664 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
1665@@ -418,6 +431,130 @@ const struct op_code_struct
1666 {"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. */
1667 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
1668 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
1669+ /* 64-bit instructions */
1670+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
1671+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
1672+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
1673+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
1674+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
1675+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
1676+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
1677+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
1678+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
1679+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
1680+ {"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 */
1681+ {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1682+ {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1683+ {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1684+ {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1685+ {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1686+ {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1687+ {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
1688+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
1689+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
1690+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
1691+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
1692+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
1693+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
1694+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
1695+ {"bslefi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64006000, OPCODE_MASK_H32B, bslefi, barrel_shift_inst },
1696+ {"bslifi", INST_TYPE_RD_R1_IMMW_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6400a000, OPCODE_MASK_H32B, bslifi, barrel_shift_inst },
1697+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
1698+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
1699+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
1700+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
1701+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
1702+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
1703+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
1704+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
1705+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
1706+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
1707+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
1708+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
1709+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
1710+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
1711+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
1712+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
1713+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
1714+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
1715+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
1716+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
1717+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
1718+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
1719+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
1720+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
1721+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
1722+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
1723+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
1724+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
1725+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
1726+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
1727+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
1728+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
1729+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
1730+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
1731+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
1732+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
1733+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
1734+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
1735+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
1736+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
1737+ {"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 */
1738+ {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1739+ {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1740+ {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
1741+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
1742+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
1743+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
1744+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
1745+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
1746+ {"bealeqi", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqi */
1747+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
1748+ {"bealeqid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaeqid */
1749+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
1750+ {"bealnei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beanei */
1751+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
1752+ {"bealneid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beaneid */
1753+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
1754+ {"beallti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealti */
1755+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
1756+ {"bealltid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealtid */
1757+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
1758+ {"beallei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealei */
1759+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
1760+ {"bealleid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to bealeid */
1761+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
1762+ {"bealgti", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagti */
1763+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
1764+ {"bealgtid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagtid */
1765+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
1766+ {"bealgei", INST_TYPE_R1_IMML, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beagei */
1767+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
1768+ {"bealgeid",INST_TYPE_R1_IMML, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, invalid_inst, branch_inst }, /* Identical to beageid */
1769+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
1770+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
1771+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
1772+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
1773+ {"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 */
1774+ {"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 */
1775+ {"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 */
1776+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
1777+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
1778+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
1779+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
1780+ {"dcmp.lt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000610, OPCODE_MASK_H4, dcmp_lt, arithmetic_inst },
1781+ {"dcmp.eq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000620, OPCODE_MASK_H4, dcmp_eq, arithmetic_inst },
1782+ {"dcmp.le", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000630, OPCODE_MASK_H4, dcmp_le, arithmetic_inst },
1783+ {"dcmp.gt", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000640, OPCODE_MASK_H4, dcmp_gt, arithmetic_inst },
1784+ {"dcmp.ne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000650, OPCODE_MASK_H4, dcmp_ne, arithmetic_inst },
1785+ {"dcmp.ge", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000660, OPCODE_MASK_H4, dcmp_ge, arithmetic_inst },
1786+ {"dcmp.un", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000600, OPCODE_MASK_H4, dcmp_un, arithmetic_inst },
1787+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
1788+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
1789+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
1790+ {"neg", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* neg translates to rsub rd, ra, r0. */
1791+ {"sub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* sub translates to rsub rd, rb, ra. */
1792+
1793 {"", 0, 0, 0, 0, 0, 0, 0, 0},
1794 };
1795
1796@@ -438,5 +575,17 @@ char pvr_register_prefix[] = "rpvr";
1797 #define MIN_IMM5 ((int) 0x00000000)
1798 #define MAX_IMM5 ((int) 0x0000001f)
1799
1800+#define MIN_IMM6 ((int) 0x00000000)
1801+#define MAX_IMM6 ((int) 0x0000003f)
1802+
1803+#define MIN_IMM_WIDTH ((int) 0x00000001)
1804+#define MAX_IMM_WIDTH ((int) 0x00000020)
1805+
1806+#define MIN_IMM6_WIDTH ((int) 0x00000001)
1807+#define MAX_IMM6_WIDTH ((int) 0x00000040)
1808+
1809+#define MIN_IMML ((long) 0xffffff8000000000L)
1810+#define MAX_IMML ((long) 0x0000007fffffffffL)
1811+
1812 #endif /* MICROBLAZE_OPC */
1813
1814diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
1815index c91b002d951..3923f6258d8 100644
1816--- a/opcodes/microblaze-opcm.h
1817+++ b/opcodes/microblaze-opcm.h
1818@@ -25,11 +25,12 @@
1819
1820 enum microblaze_instr
1821 {
1822+ /* 32-bit instructions */
1823 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
1824 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
1825 mulh, mulhu, mulhsu, swapb, swaph,
1826 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
1827- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
1828+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
1829 /* 'or/and/xor' are C++ keywords. */
1830 microblaze_or, microblaze_and, microblaze_xor,
1831 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
1832@@ -39,8 +40,8 @@ enum microblaze_instr
1833 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
1834 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
1835 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
1836- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
1837- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1838+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
1839+ sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
1840 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
1841 /* 'fsqrt' is a glibc:math.h symbol. */
1842 fint, microblaze_fsqrt,
1843@@ -59,6 +60,18 @@ enum microblaze_instr
1844 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
1845 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
1846 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
1847+
1848+ /* 64-bit instructions */
1849+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
1850+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
1851+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
1852+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
1853+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
1854+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
1855+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
1856+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
1857+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
1858+ dcmp_un, dbl, dlong, dsqrt,
1859 invalid_inst
1860 };
1861
1862@@ -130,18 +143,25 @@ enum microblaze_instr_type
1863 #define RB_LOW 11 /* Low bit for RB. */
1864 #define IMM_LOW 0 /* Low bit for immediate. */
1865 #define IMM_MBAR 21 /* low bit for mbar instruction. */
1866+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
1867
1868 #define RD_MASK 0x03E00000
1869 #define RA_MASK 0x001F0000
1870 #define RB_MASK 0x0000F800
1871 #define IMM_MASK 0x0000FFFF
1872+#define IMML_MASK 0x00FFFFFF
1873
1874-/* Imm mask for barrel shifts. */
1875+/* Imm masks for barrel shifts. */
1876 #define IMM5_MASK 0x0000001F
1877+#define IMM6_MASK 0x0000003F
1878
1879 /* Imm mask for mbar. */
1880 #define IMM5_MBAR_MASK 0x03E00000
1881
1882+/* Imm masks for extract/insert width. */
1883+#define IMM5_WIDTH_MASK 0x000007C0
1884+#define IMM6_WIDTH_MASK 0x00000FC0
1885+
1886 /* FSL imm mask for get, put instructions. */
1887 #define RFSL_MASK 0x000000F
1888
1889--
18902.34.1
1891
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch
deleted file mode 100644
index 58c9b1d0..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From c0e7c34134aa1f9644075c596a2338a50d3d923e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 30 Apr 2016 15:35:39 -0700
4Subject: [PATCH 6/9] Change order of CFLAGS
5
6Lets us override Werror if need be
7
8Upstream-Status: Inappropriate
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 gdbserver/Makefile.in | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
16index 47648b8d962..5599779de57 100644
17--- a/gdbserver/Makefile.in
18+++ b/gdbserver/Makefile.in
19@@ -156,7 +156,7 @@ WIN32APILIBS = @WIN32APILIBS@
20 INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
21 ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
22 INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
23-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
24+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${COMPILER_CFLAGS} -DGDBSERVER
25
26 # LDFLAGS is specifically reserved for setting from the command line
27 # when running make.
28--
292.36.1
30
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
deleted file mode 100644
index ec11e7be..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch
+++ /dev/null
@@ -1,300 +0,0 @@
1From d2f145ec8e4e149e055adc74e92016447af91806 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 7/8] [Patch,MicroBlaze] : Added m64 abi for 64 bit target
5 descriptions. set m64 abi for 64 bit elf.
6
7Conflicts:
8 gdb/microblaze-tdep.c
9 gdb/microblaze-tdep.h
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
14---
15 gdb/features/microblaze64.xml | 1 +
16 gdb/microblaze-tdep.c | 159 ++++++++++++++++++++++++++++++++--
17 gdb/microblaze-tdep.h | 13 ++-
18 3 files changed, 165 insertions(+), 8 deletions(-)
19
20diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
21index 515d18e65cf..9c1b7d22003 100644
22--- a/gdb/features/microblaze64.xml
23+++ b/gdb/features/microblaze64.xml
24@@ -7,5 +7,6 @@
25
26 <!DOCTYPE target SYSTEM "gdb-target.dtd">
27 <target>
28+ <architecture>microblaze64</architecture>
29 <xi:include href="microblaze64-core.xml"/>
30 </target>
31diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
32index c347bb9516b..d83072cdaef 100644
33--- a/gdb/microblaze-tdep.c
34+++ b/gdb/microblaze-tdep.c
35@@ -65,8 +65,95 @@
36 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
37 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
38
39+static const char *microblaze_abi_string;
40+
41+static const char *const microblaze_abi_strings[] = {
42+ "auto",
43+ "m64",
44+};
45+
46+enum microblaze_abi
47+microblaze_abi (struct gdbarch *gdbarch)
48+{
49+ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
50+ return tdep->microblaze_abi;
51+}
52 /* The registers of the Xilinx microblaze processor. */
53
54+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
55+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
56+
57+static void
58+microblaze_abi_update (const char *ignore_args,
59+ int from_tty, struct cmd_list_element *c)
60+{
61+ struct gdbarch_info info;
62+
63+ /* Force the architecture to update, and (if it's a microblaze architecture)
64+ * microblaze_gdbarch_init will take care of the rest. */
65+// gdbarch_info_init (&info);
66+ gdbarch_update_p (info);
67+}
68+
69+
70+static enum microblaze_abi
71+global_microblaze_abi (void)
72+{
73+ int i;
74+
75+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
76+ if (microblaze_abi_strings[i] == microblaze_abi_string)
77+ return (enum microblaze_abi) i;
78+
79+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
80+}
81+
82+static void
83+show_microblaze_abi (struct ui_file *file,
84+ int from_tty,
85+ struct cmd_list_element *ignored_cmd,
86+ const char *ignored_value)
87+{
88+ enum microblaze_abi global_abi = global_microblaze_abi ();
89+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
90+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
91+
92+#if 1
93+ if (global_abi == MICROBLAZE_ABI_AUTO)
94+ fprintf_filtered
95+ (file,
96+ "The microblaze ABI is set automatically (currently \"%s\").\n",
97+ actual_abi_str);
98+ else if (global_abi == actual_abi)
99+ fprintf_filtered
100+ (file,
101+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
102+ actual_abi_str);
103+ else
104+ {
105+#endif
106+ /* Probably shouldn't happen... */
107+ fprintf_filtered (file,
108+ "The (auto detected) microblaze ABI \"%s\" is in use "
109+ "even though the user setting was \"%s\".\n",
110+ actual_abi_str, microblaze_abi_strings[global_abi]);
111+ }
112+}
113+
114+static void
115+show_microblaze_command (const char *args, int from_tty)
116+{
117+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
118+}
119+
120+static void
121+set_microblaze_command (const char *args, int from_tty)
122+{
123+ printf_unfiltered
124+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
125+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
126+}
127+
128 static const char * const microblaze_register_names[] =
129 {
130 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
131@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] =
132 static unsigned int microblaze_debug_flag = 0;
133 int reg_size = 4;
134
135+unsigned int
136+microblaze_abi_regsize (struct gdbarch *gdbarch)
137+{
138+ switch (microblaze_abi (gdbarch))
139+ {
140+ case MICROBLAZE_ABI_M64:
141+ return 8;
142+ default:
143+ return 4;
144+ }
145+}
146+
147 #define microblaze_debug(fmt, ...) \
148 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
149- fmt, ## __VA_ARGS__)
150+ fmt, ## __VA_ARGS__)
151
152
153 /* Return the name of register REGNUM. */
154@@ -868,15 +967,30 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
155 {
156 struct gdbarch *gdbarch;
157 tdesc_arch_data_up tdesc_data;
158+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
159 const struct target_desc *tdesc = info.target_desc;
160
161+ /* What has the user specified from the command line? */
162+ wanted_abi = global_microblaze_abi ();
163+ if (gdbarch_debug)
164+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
165+ wanted_abi);
166+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
167+ microblaze_abi = wanted_abi;
168+
169 /* If there is already a candidate, use it. */
170 arches = gdbarch_list_lookup_by_info (arches, &info);
171- if (arches != NULL)
172+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
173 return arches->gdbarch;
174+
175+ if (microblaze_abi == MICROBLAZE_ABI_M64)
176+ {
177+ tdesc = tdesc_microblaze64;
178+ reg_size = 8;
179+ }
180 if (tdesc == NULL)
181 {
182- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
183+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
184 {
185 tdesc = tdesc_microblaze64;
186 reg_size = 8;
187@@ -891,7 +1005,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
188 int valid_p;
189 int i;
190
191- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
192+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
193 feature = tdesc_find_feature (tdesc,
194 "org.gnu.gdb.microblaze64.core");
195 else
196@@ -905,7 +1019,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
197 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
198 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
199 microblaze_register_names[i]);
200- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
201+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
202 feature = tdesc_find_feature (tdesc,
203 "org.gnu.gdb.microblaze64.stack-protect");
204 else
205@@ -955,7 +1069,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
206 set_gdbarch_ptr_bit (gdbarch, 64);
207 break;
208 }
209-
210+ if(microblaze_abi == MICROBLAZE_ABI_M64)
211+ set_gdbarch_ptr_bit (gdbarch, 64);
212
213 /* Map Dwarf2 registers to GDB registers. */
214 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
215@@ -1014,7 +1129,38 @@ void
216 _initialize_microblaze_tdep ()
217 {
218 register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
219+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
220+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
221+
222+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
223
224+ add_setshow_prefix_cmd ("microblaze", no_class,
225+ _("Various microblaze specific commands."),
226+ _("Various microblaze specific commands."),
227+ &setmicroblazecmdlist,&showmicroblazecmdlist,
228+ &setlist,&showlist);
229+#if 0
230+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
231+ _("Various microblaze specific commands."),
232+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
233+
234+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
235+ _("Various microblaze specific commands."),
236+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
237+#endif
238+
239+ /* Allow the user to override the ABI. */
240+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
241+ &microblaze_abi_string, _("\
242+Set the microblaze ABI used by this program."), _("\
243+Show the microblaze ABI used by this program."), _("\
244+This option can be set to one of:\n\
245+ auto - the default ABI associated with the current binary\n\
246+ m64"),
247+ microblaze_abi_update,
248+ show_microblaze_abi,
249+ &setmicroblazecmdlist, &showmicroblazecmdlist);
250+
251 initialize_tdesc_microblaze_with_stack_protect ();
252 initialize_tdesc_microblaze ();
253 initialize_tdesc_microblaze64_with_stack_protect ();
254@@ -1029,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."),
255 NULL,
256 &setdebuglist, &showdebuglist);
257
258-
259 }
260diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
261index f4d810303ca..babd6c36926 100644
262--- a/gdb/microblaze-tdep.h
263+++ b/gdb/microblaze-tdep.h
264@@ -19,9 +19,17 @@
265
266 #ifndef MICROBLAZE_TDEP_H
267 #define MICROBLAZE_TDEP_H 1
268-
269+#include "objfiles.h"
270 #include "gdbarch.h"
271
272+struct gdbarch;
273+enum microblaze_abi
274+ {
275+ MICROBLAZE_ABI_AUTO = 0,
276+ MICROBLAZE_ABI_M64,
277+ };
278+
279+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
280 /* Microblaze architecture-specific information. */
281 struct microblaze_gregset
282 {
283@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep
284 {
285 int dummy; // declare something.
286
287+ enum microblaze_abi microblaze_abi {};
288+ enum microblaze_abi found_abi {};
289 /* Register sets. */
290 struct regset *gregset;
291 size_t sizeof_gregset;
292 struct regset *fpregset;
293 size_t sizeof_fpregset;
294+ int register_size;
295 };
296
297 /* Register numbers. */
298--
2992.37.1 (Apple Git-137.1)
300
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch
deleted file mode 100644
index bbd1f0b2..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch
+++ /dev/null
@@ -1,48 +0,0 @@
1From 44fa1ecfbd8a5fe0cfea12a175fa041686842a0c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 10 May 2016 08:47:05 -0700
4Subject: [PATCH 7/9] resolve restrict keyword conflict
5
6GCC detects that we call 'restrict' as param name in function
7signatures and complains since both params are called 'restrict'
8therefore we use __restrict to denote the C99 keywork
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 gnulib/import/sys_time.in.h | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h
18index 90a67d18426..664641a1fe8 100644
19--- a/gnulib/import/sys_time.in.h
20+++ b/gnulib/import/sys_time.in.h
21@@ -93,20 +93,20 @@ struct timeval
22 # define gettimeofday rpl_gettimeofday
23 # endif
24 _GL_FUNCDECL_RPL (gettimeofday, int,
25- (struct timeval *restrict, void *restrict)
26+ (struct timeval *__restrict, void *__restrict)
27 _GL_ARG_NONNULL ((1)));
28 _GL_CXXALIAS_RPL (gettimeofday, int,
29- (struct timeval *restrict, void *restrict));
30+ (struct timeval *__restrict, void *__restrict));
31 # else
32 # if !@HAVE_GETTIMEOFDAY@
33 _GL_FUNCDECL_SYS (gettimeofday, int,
34- (struct timeval *restrict, void *restrict)
35+ (struct timeval *__restrict, void *__restrict)
36 _GL_ARG_NONNULL ((1)));
37 # endif
38 /* Need to cast, because on glibc systems, by default, the second argument is
39 struct timezone *. */
40 _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
41- (struct timeval *restrict, void *restrict));
42+ (struct timeval *__restrict, void *__restrict));
43 # endif
44 _GL_CXXALIASWARN (gettimeofday);
45 # if defined __cplusplus && defined GNULIB_NAMESPACE
46--
472.36.1
48
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
new file mode 100644
index 00000000..27c04153
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-these-changes-will-make-64-bit-vectors-as-default-ta.patch
@@ -0,0 +1,35 @@
1From b6735e00ff7c60f8e66527402dd541b4217ce38f Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 19 Apr 2021 14:33:27 +0530
4Subject: [PATCH 07/54] these changes will make 64 bit vectors as default
5 target types when we built gdb with microblaze 64 bit type targets,for
6 instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/config.bfd | 8 ++++++++
11 1 file changed, 8 insertions(+)
12
13diff --git a/bfd/config.bfd b/bfd/config.bfd
14index 3a7d427778c..9a4b26be8f8 100644
15--- a/bfd/config.bfd
16+++ b/bfd/config.bfd
17@@ -880,7 +880,15 @@ case "${targ}" in
18 targ_defvec=metag_elf32_vec
19 targ_underscore=yes
20 ;;
21+ microblazeel*-*64)
22+ targ_defvec=microblaze_elf64_le_vec
23+ targ_selvecs=microblaze_elf64_vec
24+ ;;
25
26+ microblaze*-*64)
27+ targ_defvec=microblaze_elf64_vec
28+ targ_selvecs=microblaze_elf64_le_vec
29+ ;;
30 microblazeel*-*)
31 targ_defvec=microblaze_elf32_le_vec
32 targ_selvecs=microblaze_elf32_vec
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
new file mode 100644
index 00000000..54e53f6f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Added-m64-abi-for-64-bit-target-descriptions.-set-m6.patch
@@ -0,0 +1,4104 @@
1From 89f7a0c3e8b3bc37a37280bacec724f764503f38 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 9 Nov 2021 16:19:17 +0530
4Subject: [PATCH 08/54] Added m64 abi for 64 bit target descriptions. set m64
5 abi for 64 bit elf.
6
7Conflicts:
8 gdb/microblaze-tdep.c
9 gdb/microblaze-tdep.h
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/elf64-microblaze.c | 3810 ++++++++++++++++++++++++++++++++++++++++
14 gdb/microblaze-tdep.c | 160 +-
15 gdb/microblaze-tdep.h | 13 +-
16 3 files changed, 3975 insertions(+), 8 deletions(-)
17 create mode 100755 bfd/elf64-microblaze.c
18
19diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
20new file mode 100755
21index 00000000000..6cd9753a592
22--- /dev/null
23+++ b/bfd/elf64-microblaze.c
24@@ -0,0 +1,3810 @@
25+/* Xilinx MicroBlaze-specific support for 32-bit ELF
26+
27+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
28+
29+ This file is part of BFD, the Binary File Descriptor library.
30+
31+ This program is free software; you can redistribute it and/or modify
32+ it under the terms of the GNU General Public License as published by
33+ the Free Software Foundation; either version 3 of the License, or
34+ (at your option) any later version.
35+
36+ This program is distributed in the hope that it will be useful,
37+ but WITHOUT ANY WARRANTY; without even the implied warranty of
38+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39+ GNU General Public License for more details.
40+
41+ You should have received a copy of the GNU General Public License
42+ along with this program; if not, write to the
43+ Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
44+ Boston, MA 02110-1301, USA. */
45+
46+
47+#include "sysdep.h"
48+#include "bfd.h"
49+#include "bfdlink.h"
50+#include "libbfd.h"
51+#include "elf-bfd.h"
52+#include "elf/microblaze.h"
53+#include <assert.h>
54+
55+#define USE_RELA /* Only USE_REL is actually significant, but this is
56+ here are a reminder... */
57+#define INST_WORD_SIZE 4
58+
59+static int ro_small_data_pointer = 0;
60+static int rw_small_data_pointer = 0;
61+
62+static reloc_howto_type * microblaze_elf_howto_table [(int) R_MICROBLAZE_max];
63+
64+static reloc_howto_type microblaze_elf_howto_raw[] =
65+{
66+ /* This reloc does nothing. */
67+ HOWTO (R_MICROBLAZE_NONE, /* Type. */
68+ 0, /* Rightshift. */
69+ 0, /* Size. */
70+ 0, /* Bitsize. */
71+ false, /* PC_relative. */
72+ 0, /* Bitpos. */
73+ complain_overflow_dont, /* Complain on overflow. */
74+ NULL, /* Special Function. */
75+ "R_MICROBLAZE_NONE", /* Name. */
76+ false, /* Partial Inplace. */
77+ 0, /* Source Mask. */
78+ 0, /* Dest Mask. */
79+ false), /* PC relative offset? */
80+
81+ /* A standard 32 bit relocation. */
82+ HOWTO (R_MICROBLAZE_32, /* Type. */
83+ 0, /* Rightshift. */
84+ 4, /* Size. */
85+ 32, /* Bitsize. */
86+ false, /* PC_relative. */
87+ 0, /* Bitpos. */
88+ complain_overflow_bitfield, /* Complain on overflow. */
89+ bfd_elf_generic_reloc,/* Special Function. */
90+ "R_MICROBLAZE_32", /* Name. */
91+ false, /* Partial Inplace. */
92+ 0, /* Source Mask. */
93+ 0xffffffff, /* Dest Mask. */
94+ false), /* PC relative offset? */
95+
96+ /* A standard PCREL 32 bit relocation. */
97+ HOWTO (R_MICROBLAZE_32_PCREL,/* Type. */
98+ 0, /* Rightshift. */
99+ 4, /* Size. */
100+ 32, /* Bitsize. */
101+ true, /* PC_relative. */
102+ 0, /* Bitpos. */
103+ complain_overflow_bitfield, /* Complain on overflow. */
104+ bfd_elf_generic_reloc,/* Special Function. */
105+ "R_MICROBLAZE_32_PCREL", /* Name. */
106+ true, /* Partial Inplace. */
107+ 0, /* Source Mask. */
108+ 0xffffffff, /* Dest Mask. */
109+ true), /* PC relative offset? */
110+
111+ /* A 64 bit PCREL relocation. Table-entry not really used. */
112+ HOWTO (R_MICROBLAZE_64_PCREL,/* Type. */
113+ 0, /* Rightshift. */
114+ 4, /* Size. */
115+ 16, /* Bitsize. */
116+ true, /* PC_relative. */
117+ 0, /* Bitpos. */
118+ complain_overflow_dont, /* Complain on overflow. */
119+ bfd_elf_generic_reloc,/* Special Function. */
120+ "R_MICROBLAZE_64_PCREL", /* Name. */
121+ false, /* Partial Inplace. */
122+ 0, /* Source Mask. */
123+ 0x0000ffff, /* Dest Mask. */
124+ true), /* PC relative offset? */
125+
126+ /* The low half of a PCREL 32 bit relocation. */
127+ HOWTO (R_MICROBLAZE_32_PCREL_LO, /* Type. */
128+ 0, /* Rightshift. */
129+ 4, /* Size. */
130+ 16, /* Bitsize. */
131+ true, /* PC_relative. */
132+ 0, /* Bitpos. */
133+ complain_overflow_signed, /* Complain on overflow. */
134+ bfd_elf_generic_reloc, /* Special Function. */
135+ "R_MICROBLAZE_32_PCREL_LO", /* Name. */
136+ false, /* Partial Inplace. */
137+ 0, /* Source Mask. */
138+ 0x0000ffff, /* Dest Mask. */
139+ true), /* PC relative offset? */
140+
141+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
142+ 0, /* Rightshift. */
143+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
144+ 64, /* Bitsize. */
145+ false, /* PC_relative. */
146+ 0, /* Bitpos. */
147+ complain_overflow_dont, /* Complain on overflow. */
148+ bfd_elf_generic_reloc,/* Special Function. */
149+ "R_MICROBLAZE_IMML_64", /* Name. */
150+ false, /* Partial Inplace. */
151+ 0, /* Source Mask. */
152+ 0xffffffffffffff, /* Dest Mask. */
153+ false), /* PC relative offset? */
154+
155+ /* A 64 bit relocation. Table entry not really used. */
156+ HOWTO (R_MICROBLAZE_64, /* Type. */
157+ 0, /* Rightshift. */
158+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
159+ 16, /* Bitsize. */
160+ false, /* PC_relative. */
161+ 0, /* Bitpos. */
162+ complain_overflow_dont, /* Complain on overflow. */
163+ bfd_elf_generic_reloc,/* Special Function. */
164+ "R_MICROBLAZE_64", /* Name. */
165+ false, /* Partial Inplace. */
166+ 0, /* Source Mask. */
167+ 0x0000ffff, /* Dest Mask. */
168+ false), /* PC relative offset? */
169+
170+ /* The low half of a 32 bit relocation. */
171+ HOWTO (R_MICROBLAZE_32_LO, /* Type. */
172+ 0, /* Rightshift. */
173+ 4, /* Size. */
174+ 16, /* Bitsize. */
175+ false, /* PC_relative. */
176+ 0, /* Bitpos. */
177+ complain_overflow_signed, /* Complain on overflow. */
178+ bfd_elf_generic_reloc,/* Special Function. */
179+ "R_MICROBLAZE_32_LO", /* Name. */
180+ false, /* Partial Inplace. */
181+ 0, /* Source Mask. */
182+ 0x0000ffff, /* Dest Mask. */
183+ false), /* PC relative offset? */
184+
185+ /* Read-only small data section relocation. */
186+ HOWTO (R_MICROBLAZE_SRO32, /* Type. */
187+ 0, /* Rightshift. */
188+ 4, /* Size. */
189+ 16, /* Bitsize. */
190+ false, /* PC_relative. */
191+ 0, /* Bitpos. */
192+ complain_overflow_bitfield, /* Complain on overflow. */
193+ bfd_elf_generic_reloc,/* Special Function. */
194+ "R_MICROBLAZE_SRO32", /* Name. */
195+ false, /* Partial Inplace. */
196+ 0, /* Source Mask. */
197+ 0x0000ffff, /* Dest Mask. */
198+ false), /* PC relative offset? */
199+
200+ /* Read-write small data area relocation. */
201+ HOWTO (R_MICROBLAZE_SRW32, /* Type. */
202+ 0, /* Rightshift. */
203+ 4, /* Size. */
204+ 16, /* Bitsize. */
205+ false, /* PC_relative. */
206+ 0, /* Bitpos. */
207+ complain_overflow_bitfield, /* Complain on overflow. */
208+ bfd_elf_generic_reloc,/* Special Function. */
209+ "R_MICROBLAZE_SRW32", /* Name. */
210+ false, /* Partial Inplace. */
211+ 0, /* Source Mask. */
212+ 0x0000ffff, /* Dest Mask. */
213+ false), /* PC relative offset? */
214+
215+ /* This reloc does nothing. Used for relaxation. */
216+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
217+ 0, /* Rightshift. */
218+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
219+ 32, /* Bitsize. */
220+ true, /* PC_relative. */
221+ 0, /* Bitpos. */
222+ complain_overflow_bitfield, /* Complain on overflow. */
223+ NULL, /* Special Function. */
224+ "R_MICROBLAZE_32_NONE",/* Name. */
225+ false, /* Partial Inplace. */
226+ 0, /* Source Mask. */
227+ 0, /* Dest Mask. */
228+ false), /* PC relative offset? */
229+
230+ /* This reloc does nothing. Used for relaxation. */
231+ HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
232+ 0, /* Rightshift. */
233+ 0, /* Size. */
234+ 0, /* Bitsize. */
235+ true, /* PC_relative. */
236+ 0, /* Bitpos. */
237+ complain_overflow_dont, /* Complain on overflow. */
238+ NULL, /* Special Function. */
239+ "R_MICROBLAZE_64_NONE",/* Name. */
240+ false, /* Partial Inplace. */
241+ 0, /* Source Mask. */
242+ 0, /* Dest Mask. */
243+ false), /* PC relative offset? */
244+
245+ /* Symbol Op Symbol relocation. */
246+ HOWTO (R_MICROBLAZE_32_SYM_OP_SYM, /* Type. */
247+ 0, /* Rightshift. */
248+ 4, /* Size. */
249+ 32, /* Bitsize. */
250+ false, /* PC_relative. */
251+ 0, /* Bitpos. */
252+ complain_overflow_bitfield, /* Complain on overflow. */
253+ bfd_elf_generic_reloc,/* Special Function. */
254+ "R_MICROBLAZE_32_SYM_OP_SYM", /* Name. */
255+ false, /* Partial Inplace. */
256+ 0, /* Source Mask. */
257+ 0xffffffff, /* Dest Mask. */
258+ false), /* PC relative offset? */
259+
260+ /* GNU extension to record C++ vtable hierarchy. */
261+ HOWTO (R_MICROBLAZE_GNU_VTINHERIT, /* Type. */
262+ 0, /* Rightshift. */
263+ 4, /* Size. */
264+ 0, /* Bitsize. */
265+ false, /* PC_relative. */
266+ 0, /* Bitpos. */
267+ complain_overflow_dont,/* Complain on overflow. */
268+ NULL, /* Special Function. */
269+ "R_MICROBLAZE_GNU_VTINHERIT", /* Name. */
270+ false, /* Partial Inplace. */
271+ 0, /* Source Mask. */
272+ 0, /* Dest Mask. */
273+ false), /* PC relative offset? */
274+
275+ /* GNU extension to record C++ vtable member usage. */
276+ HOWTO (R_MICROBLAZE_GNU_VTENTRY, /* Type. */
277+ 0, /* Rightshift. */
278+ 4, /* Size. */
279+ 0, /* Bitsize. */
280+ false, /* PC_relative. */
281+ 0, /* Bitpos. */
282+ complain_overflow_dont,/* Complain on overflow. */
283+ _bfd_elf_rel_vtable_reloc_fn, /* Special Function. */
284+ "R_MICROBLAZE_GNU_VTENTRY", /* Name. */
285+ false, /* Partial Inplace. */
286+ 0, /* Source Mask. */
287+ 0, /* Dest Mask. */
288+ false), /* PC relative offset? */
289+
290+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
291+ HOWTO (R_MICROBLAZE_GOTPC_64, /* Type. */
292+ 0, /* Rightshift. */
293+ 4, /* Size. */
294+ 16, /* Bitsize. */
295+ true, /* PC_relative. */
296+ 0, /* Bitpos. */
297+ complain_overflow_dont, /* Complain on overflow. */
298+ bfd_elf_generic_reloc, /* Special Function. */
299+ "R_MICROBLAZE_GOTPC_64", /* Name. */
300+ false, /* Partial Inplace. */
301+ 0, /* Source Mask. */
302+ 0x0000ffff, /* Dest Mask. */
303+ true), /* PC relative offset? */
304+
305+ /* A 64 bit TEXTPCREL relocation. Table-entry not really used. */
306+ HOWTO (R_MICROBLAZE_TEXTPCREL_64, /* Type. */
307+ 0, /* Rightshift. */
308+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
309+ 16, /* Bitsize. */
310+ true, /* PC_relative. */
311+ 0, /* Bitpos. */
312+ complain_overflow_dont, /* Complain on overflow. */
313+ bfd_elf_generic_reloc, /* Special Function. */
314+ "R_MICROBLAZE_TEXTPCREL_64", /* Name. */
315+ false, /* Partial Inplace. */
316+ 0, /* Source Mask. */
317+ 0x0000ffff, /* Dest Mask. */
318+ true), /* PC relative offset? */
319+
320+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
321+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
322+ 0, /* Rightshift. */
323+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
324+ 16, /* Bitsize. */
325+ true, /* PC_relative. */
326+ 0, /* Bitpos. */
327+ complain_overflow_dont, /* Complain on overflow. */
328+ bfd_elf_generic_reloc, /* Special Function. */
329+ "R_MICROBLAZE_GPC_64", /* Name. */
330+ false, /* Partial Inplace. */
331+ 0, /* Source Mask. */
332+ 0x0000ffff, /* Dest Mask. */
333+ true), /* PC relative offset? */
334+
335+ /* A 64 bit GOT relocation. Table-entry not really used. */
336+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
337+ 0, /* Rightshift. */
338+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
339+ 16, /* Bitsize. */
340+ false, /* PC_relative. */
341+ 0, /* Bitpos. */
342+ complain_overflow_dont, /* Complain on overflow. */
343+ bfd_elf_generic_reloc,/* Special Function. */
344+ "R_MICROBLAZE_GOT_64",/* Name. */
345+ false, /* Partial Inplace. */
346+ 0, /* Source Mask. */
347+ 0x0000ffff, /* Dest Mask. */
348+ false), /* PC relative offset? */
349+
350+ /* A 64 bit TEXTREL relocation. Table-entry not really used. */
351+ HOWTO (R_MICROBLAZE_TEXTREL_64, /* Type. */
352+ 0, /* Rightshift. */
353+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
354+ 16, /* Bitsize. */
355+ false, /* PC_relative. */
356+ 0, /* Bitpos. */
357+ complain_overflow_dont, /* Complain on overflow. */
358+ bfd_elf_generic_reloc,/* Special Function. */
359+ "R_MICROBLAZE_TEXTREL_64",/* Name. */
360+ false, /* Partial Inplace. */
361+ 0, /* Source Mask. */
362+ 0x0000ffff, /* Dest Mask. */
363+ false), /* PC relative offset? */
364+
365+ /* A 64 bit PLT relocation. Table-entry not really used. */
366+ HOWTO (R_MICROBLAZE_PLT_64, /* Type. */
367+ 0, /* Rightshift. */
368+ 4, /* Size. */
369+ 16, /* Bitsize. */
370+ true, /* PC_relative. */
371+ 0, /* Bitpos. */
372+ complain_overflow_dont, /* Complain on overflow. */
373+ bfd_elf_generic_reloc,/* Special Function. */
374+ "R_MICROBLAZE_PLT_64",/* Name. */
375+ false, /* Partial Inplace. */
376+ 0, /* Source Mask. */
377+ 0x0000ffff, /* Dest Mask. */
378+ true), /* PC relative offset? */
379+
380+ /* Table-entry not really used. */
381+ HOWTO (R_MICROBLAZE_REL, /* Type. */
382+ 0, /* Rightshift. */
383+ 4, /* Size. */
384+ 16, /* Bitsize. */
385+ true, /* PC_relative. */
386+ 0, /* Bitpos. */
387+ complain_overflow_dont, /* Complain on overflow. */
388+ bfd_elf_generic_reloc,/* Special Function. */
389+ "R_MICROBLAZE_REL", /* Name. */
390+ false, /* Partial Inplace. */
391+ 0, /* Source Mask. */
392+ 0x0000ffff, /* Dest Mask. */
393+ true), /* PC relative offset? */
394+
395+ /* Table-entry not really used. */
396+ HOWTO (R_MICROBLAZE_JUMP_SLOT,/* Type. */
397+ 0, /* Rightshift. */
398+ 4, /* Size. */
399+ 16, /* Bitsize. */
400+ true, /* PC_relative. */
401+ 0, /* Bitpos. */
402+ complain_overflow_dont, /* Complain on overflow. */
403+ bfd_elf_generic_reloc,/* Special Function. */
404+ "R_MICROBLAZE_JUMP_SLOT", /* Name. */
405+ false, /* Partial Inplace. */
406+ 0, /* Source Mask. */
407+ 0x0000ffff, /* Dest Mask. */
408+ true), /* PC relative offset? */
409+
410+ /* Table-entry not really used. */
411+ HOWTO (R_MICROBLAZE_GLOB_DAT,/* Type. */
412+ 0, /* Rightshift. */
413+ 4, /* Size. */
414+ 16, /* Bitsize. */
415+ true, /* PC_relative. */
416+ 0, /* Bitpos. */
417+ complain_overflow_dont, /* Complain on overflow. */
418+ bfd_elf_generic_reloc,/* Special Function. */
419+ "R_MICROBLAZE_GLOB_DAT", /* Name. */
420+ false, /* Partial Inplace. */
421+ 0, /* Source Mask. */
422+ 0x0000ffff, /* Dest Mask. */
423+ true), /* PC relative offset? */
424+
425+ /* A 64 bit GOT relative relocation. Table-entry not really used. */
426+ HOWTO (R_MICROBLAZE_GOTOFF_64, /* Type. */
427+ 0, /* Rightshift. */
428+ 4, /* Size. */
429+ 16, /* Bitsize. */
430+ false, /* PC_relative. */
431+ 0, /* Bitpos. */
432+ complain_overflow_dont, /* Complain on overflow. */
433+ bfd_elf_generic_reloc,/* Special Function. */
434+ "R_MICROBLAZE_GOTOFF_64", /* Name. */
435+ false, /* Partial Inplace. */
436+ 0, /* Source Mask. */
437+ 0x0000ffff, /* Dest Mask. */
438+ false), /* PC relative offset? */
439+
440+ /* A 32 bit GOT relative relocation. Table-entry not really used. */
441+ HOWTO (R_MICROBLAZE_GOTOFF_32, /* Type. */
442+ 0, /* Rightshift. */
443+ 4, /* Size. */
444+ 16, /* Bitsize. */
445+ false, /* PC_relative. */
446+ 0, /* Bitpos. */
447+ complain_overflow_dont, /* Complain on overflow. */
448+ bfd_elf_generic_reloc, /* Special Function. */
449+ "R_MICROBLAZE_GOTOFF_32", /* Name. */
450+ false, /* Partial Inplace. */
451+ 0, /* Source Mask. */
452+ 0x0000ffff, /* Dest Mask. */
453+ false), /* PC relative offset? */
454+
455+ /* COPY relocation. Table-entry not really used. */
456+ HOWTO (R_MICROBLAZE_COPY, /* Type. */
457+ 0, /* Rightshift. */
458+ 4, /* Size. */
459+ 16, /* Bitsize. */
460+ false, /* PC_relative. */
461+ 0, /* Bitpos. */
462+ complain_overflow_dont, /* Complain on overflow. */
463+ bfd_elf_generic_reloc,/* Special Function. */
464+ "R_MICROBLAZE_COPY", /* Name. */
465+ false, /* Partial Inplace. */
466+ 0, /* Source Mask. */
467+ 0x0000ffff, /* Dest Mask. */
468+ false), /* PC relative offset? */
469+
470+ /* Marker relocs for TLS. */
471+ HOWTO (R_MICROBLAZE_TLS,
472+ 0, /* rightshift */
473+ 2, /* size (0 = byte, 1 = short, 2 = long) */
474+ 32, /* bitsize */
475+ false, /* pc_relative */
476+ 0, /* bitpos */
477+ complain_overflow_dont, /* complain_on_overflow */
478+ bfd_elf_generic_reloc, /* special_function */
479+ "R_MICROBLAZE_TLS", /* name */
480+ false, /* partial_inplace */
481+ 0, /* src_mask */
482+ 0x0000ffff, /* dst_mask */
483+ false), /* pcrel_offset */
484+
485+ HOWTO (R_MICROBLAZE_TLSGD,
486+ 0, /* rightshift */
487+ 4, /* size */
488+ 32, /* bitsize */
489+ false, /* pc_relative */
490+ 0, /* bitpos */
491+ complain_overflow_dont, /* complain_on_overflow */
492+ bfd_elf_generic_reloc, /* special_function */
493+ "R_MICROBLAZE_TLSGD", /* name */
494+ false, /* partial_inplace */
495+ 0, /* src_mask */
496+ 0x0000ffff, /* dst_mask */
497+ false), /* pcrel_offset */
498+
499+ HOWTO (R_MICROBLAZE_TLSLD,
500+ 0, /* rightshift */
501+ 2, /* size (0 = byte, 1 = short, 2 = long) */
502+ 32, /* bitsize */
503+ false, /* pc_relative */
504+ 0, /* bitpos */
505+ complain_overflow_dont, /* complain_on_overflow */
506+ bfd_elf_generic_reloc, /* special_function */
507+ "R_MICROBLAZE_TLSLD", /* name */
508+ false, /* partial_inplace */
509+ 0, /* src_mask */
510+ 0x0000ffff, /* dst_mask */
511+ false), /* pcrel_offset */
512+
513+ /* Computes the load module index of the load module that contains the
514+ definition of its TLS sym. */
515+ HOWTO (R_MICROBLAZE_TLSDTPMOD32,
516+ 0, /* rightshift */
517+ 2, /* size (0 = byte, 1 = short, 2 = long) */
518+ 32, /* bitsize */
519+ false, /* pc_relative */
520+ 0, /* bitpos */
521+ complain_overflow_dont, /* complain_on_overflow */
522+ bfd_elf_generic_reloc, /* special_function */
523+ "R_MICROBLAZE_TLSDTPMOD32", /* name */
524+ false, /* partial_inplace */
525+ 0, /* src_mask */
526+ 0x0000ffff, /* dst_mask */
527+ false), /* pcrel_offset */
528+
529+ /* Computes a dtv-relative displacement, the difference between the value
530+ of sym+add and the base address of the thread-local storage block that
531+ contains the definition of sym, minus 0x8000. Used for initializing GOT */
532+ HOWTO (R_MICROBLAZE_TLSDTPREL32,
533+ 0, /* rightshift */
534+ 4, /* size */
535+ 32, /* bitsize */
536+ false, /* pc_relative */
537+ 0, /* bitpos */
538+ complain_overflow_dont, /* complain_on_overflow */
539+ bfd_elf_generic_reloc, /* special_function */
540+ "R_MICROBLAZE_TLSDTPREL32", /* name */
541+ false, /* partial_inplace */
542+ 0, /* src_mask */
543+ 0x0000ffff, /* dst_mask */
544+ false), /* pcrel_offset */
545+
546+ /* Computes a dtv-relative displacement, the difference between the value
547+ of sym+add and the base address of the thread-local storage block that
548+ contains the definition of sym, minus 0x8000. */
549+ HOWTO (R_MICROBLAZE_TLSDTPREL64,
550+ 0, /* rightshift */
551+ 4, /* size */
552+ 32, /* bitsize */
553+ false, /* pc_relative */
554+ 0, /* bitpos */
555+ complain_overflow_dont, /* complain_on_overflow */
556+ bfd_elf_generic_reloc, /* special_function */
557+ "R_MICROBLAZE_TLSDTPREL64", /* name */
558+ false, /* partial_inplace */
559+ 0, /* src_mask */
560+ 0x0000ffff, /* dst_mask */
561+ false), /* pcrel_offset */
562+
563+ /* Computes a tp-relative displacement, the difference between the value of
564+ sym+add and the value of the thread pointer (r13). */
565+ HOWTO (R_MICROBLAZE_TLSGOTTPREL32,
566+ 0, /* rightshift */
567+ 4, /* size */
568+ 32, /* bitsize */
569+ false, /* pc_relative */
570+ 0, /* bitpos */
571+ complain_overflow_dont, /* complain_on_overflow */
572+ bfd_elf_generic_reloc, /* special_function */
573+ "R_MICROBLAZE_TLSGOTTPREL32", /* name */
574+ false, /* partial_inplace */
575+ 0, /* src_mask */
576+ 0x0000ffff, /* dst_mask */
577+ false), /* pcrel_offset */
578+
579+ /* Computes a tp-relative displacement, the difference between the value of
580+ sym+add and the value of the thread pointer (r13). */
581+ HOWTO (R_MICROBLAZE_TLSTPREL32,
582+ 0, /* rightshift */
583+ 4, /* size */
584+ 32, /* bitsize */
585+ false, /* pc_relative */
586+ 0, /* bitpos */
587+ complain_overflow_dont, /* complain_on_overflow */
588+ bfd_elf_generic_reloc, /* special_function */
589+ "R_MICROBLAZE_TLSTPREL32", /* name */
590+ false, /* partial_inplace */
591+ 0, /* src_mask */
592+ 0x0000ffff, /* dst_mask */
593+ false), /* pcrel_offset */
594+
595+};
596+
597+#ifndef NUM_ELEM
598+#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
599+#endif
600+
601+/* Initialize the microblaze_elf_howto_table, so that linear accesses can be done. */
602+
603+static void
604+microblaze_elf_howto_init (void)
605+{
606+ unsigned int i;
607+
608+ for (i = NUM_ELEM (microblaze_elf_howto_raw); i--;)
609+ {
610+ unsigned int type;
611+
612+ type = microblaze_elf_howto_raw[i].type;
613+
614+ BFD_ASSERT (type < NUM_ELEM (microblaze_elf_howto_table));
615+
616+ microblaze_elf_howto_table [type] = & microblaze_elf_howto_raw [i];
617+ }
618+}
619+
620+static reloc_howto_type *
621+microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
622+ bfd_reloc_code_real_type code)
623+{
624+ enum elf_microblaze_reloc_type microblaze_reloc = R_MICROBLAZE_NONE;
625+
626+ switch (code)
627+ {
628+ case BFD_RELOC_NONE:
629+ microblaze_reloc = R_MICROBLAZE_NONE;
630+ break;
631+ case BFD_RELOC_MICROBLAZE_32_NONE:
632+ microblaze_reloc = R_MICROBLAZE_32_NONE;
633+ break;
634+ case BFD_RELOC_MICROBLAZE_64_NONE:
635+ microblaze_reloc = R_MICROBLAZE_64_NONE;
636+ break;
637+ case BFD_RELOC_32:
638+ microblaze_reloc = R_MICROBLAZE_32;
639+ break;
640+ /* RVA is treated the same as 64 */
641+ case BFD_RELOC_RVA:
642+ microblaze_reloc = R_MICROBLAZE_IMML_64;
643+ break;
644+ case BFD_RELOC_32_PCREL:
645+ microblaze_reloc = R_MICROBLAZE_32_PCREL;
646+ break;
647+ case BFD_RELOC_64_PCREL:
648+ microblaze_reloc = R_MICROBLAZE_64_PCREL;
649+ break;
650+ case BFD_RELOC_MICROBLAZE_32_LO_PCREL:
651+ microblaze_reloc = R_MICROBLAZE_32_PCREL_LO;
652+ break;
653+ case BFD_RELOC_64:
654+ microblaze_reloc = R_MICROBLAZE_64;
655+ break;
656+ case BFD_RELOC_MICROBLAZE_32_LO:
657+ microblaze_reloc = R_MICROBLAZE_32_LO;
658+ break;
659+ case BFD_RELOC_MICROBLAZE_32_ROSDA:
660+ microblaze_reloc = R_MICROBLAZE_SRO32;
661+ break;
662+ case BFD_RELOC_MICROBLAZE_32_RWSDA:
663+ microblaze_reloc = R_MICROBLAZE_SRW32;
664+ break;
665+ case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
666+ microblaze_reloc = R_MICROBLAZE_32_SYM_OP_SYM;
667+ break;
668+ case BFD_RELOC_VTABLE_INHERIT:
669+ microblaze_reloc = R_MICROBLAZE_GNU_VTINHERIT;
670+ break;
671+ case BFD_RELOC_VTABLE_ENTRY:
672+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
673+ break;
674+ case BFD_RELOC_MICROBLAZE_EA64:
675+ microblaze_reloc = R_MICROBLAZE_IMML_64;
676+ break;
677+ case BFD_RELOC_MICROBLAZE_64_GOTPC:
678+ microblaze_reloc = R_MICROBLAZE_GOTPC_64;
679+ break;
680+ case BFD_RELOC_MICROBLAZE_64_GPC:
681+ microblaze_reloc = R_MICROBLAZE_GPC_64;
682+ break;
683+ case BFD_RELOC_MICROBLAZE_64_GOT:
684+ microblaze_reloc = R_MICROBLAZE_GOT_64;
685+ break;
686+ case BFD_RELOC_MICROBLAZE_64_TEXTPCREL:
687+ microblaze_reloc = R_MICROBLAZE_TEXTPCREL_64;
688+ break;
689+ case BFD_RELOC_MICROBLAZE_64_TEXTREL:
690+ microblaze_reloc = R_MICROBLAZE_TEXTREL_64;
691+ break;
692+ case BFD_RELOC_MICROBLAZE_64_PLT:
693+ microblaze_reloc = R_MICROBLAZE_PLT_64;
694+ break;
695+ case BFD_RELOC_MICROBLAZE_64_GOTOFF:
696+ microblaze_reloc = R_MICROBLAZE_GOTOFF_64;
697+ break;
698+ case BFD_RELOC_MICROBLAZE_32_GOTOFF:
699+ microblaze_reloc = R_MICROBLAZE_GOTOFF_32;
700+ break;
701+ case BFD_RELOC_MICROBLAZE_64_TLSGD:
702+ microblaze_reloc = R_MICROBLAZE_TLSGD;
703+ break;
704+ case BFD_RELOC_MICROBLAZE_64_TLSLD:
705+ microblaze_reloc = R_MICROBLAZE_TLSLD;
706+ break;
707+ case BFD_RELOC_MICROBLAZE_32_TLSDTPREL:
708+ microblaze_reloc = R_MICROBLAZE_TLSDTPREL32;
709+ break;
710+ case BFD_RELOC_MICROBLAZE_64_TLSDTPREL:
711+ microblaze_reloc = R_MICROBLAZE_TLSDTPREL64;
712+ break;
713+ case BFD_RELOC_MICROBLAZE_32_TLSDTPMOD:
714+ microblaze_reloc = R_MICROBLAZE_TLSDTPMOD32;
715+ break;
716+ case BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL:
717+ microblaze_reloc = R_MICROBLAZE_TLSGOTTPREL32;
718+ break;
719+ case BFD_RELOC_MICROBLAZE_64_TLSTPREL:
720+ microblaze_reloc = R_MICROBLAZE_TLSTPREL32;
721+ break;
722+ case BFD_RELOC_MICROBLAZE_COPY:
723+ microblaze_reloc = R_MICROBLAZE_COPY;
724+ break;
725+ default:
726+ return (reloc_howto_type *) NULL;
727+ }
728+
729+ if (!microblaze_elf_howto_table [R_MICROBLAZE_32])
730+ /* Initialize howto table if needed. */
731+ microblaze_elf_howto_init ();
732+
733+ return microblaze_elf_howto_table [(int) microblaze_reloc];
734+};
735+
736+static reloc_howto_type *
737+microblaze_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
738+ const char *r_name)
739+{
740+ unsigned int i;
741+
742+ for (i = 0; i < NUM_ELEM (microblaze_elf_howto_raw); i++)
743+ if (microblaze_elf_howto_raw[i].name != NULL
744+ && strcasecmp (microblaze_elf_howto_raw[i].name, r_name) == 0)
745+ return &microblaze_elf_howto_raw[i];
746+
747+ return NULL;
748+}
749+
750+/* Set the howto pointer for a RCE ELF reloc. */
751+
752+static bool
753+microblaze_elf_info_to_howto (bfd * abfd,
754+ arelent * cache_ptr,
755+ Elf_Internal_Rela * dst)
756+{
757+ unsigned int r_type;
758+
759+ if (!microblaze_elf_howto_table [R_MICROBLAZE_32])
760+ /* Initialize howto table if needed. */
761+ microblaze_elf_howto_init ();
762+
763+ r_type = ELF64_R_TYPE (dst->r_info);
764+ if (r_type >= R_MICROBLAZE_max)
765+ {
766+ /* xgettext:c-format */
767+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
768+ abfd, r_type);
769+ bfd_set_error (bfd_error_bad_value);
770+ return false;
771+ }
772+
773+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
774+ return true;
775+}
776+
777+struct _microblaze_elf_section_data
778+{
779+ struct bfd_elf_section_data elf;
780+ /* Count of used relaxation table entries. */
781+ size_t relax_count;
782+ /* Relaxation table. */
783+ struct relax_table *relax;
784+};
785+
786+#define microblaze_elf_section_data(sec) \
787+ ((struct _microblaze_elf_section_data *) elf_section_data (sec))
788+
789+static bool
790+microblaze_elf_new_section_hook (bfd *abfd, asection *sec)
791+{
792+ if (!sec->used_by_bfd)
793+ {
794+ struct _microblaze_elf_section_data *sdata;
795+ size_t amt = sizeof (*sdata);
796+
797+ sdata = bfd_zalloc (abfd, amt);
798+ if (sdata == NULL)
799+ return false;
800+ sec->used_by_bfd = sdata;
801+ }
802+
803+ return _bfd_elf_new_section_hook (abfd, sec);
804+}
805+
806+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
807+
808+static bool
809+microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
810+{
811+ if (name[0] == 'L' && name[1] == '.')
812+ return true;
813+
814+ if (name[0] == '$' && name[1] == 'L')
815+ return true;
816+
817+ /* With gcc, the labels go back to starting with '.', so we accept
818+ the generic ELF local label syntax as well. */
819+ return _bfd_elf_is_local_label_name (abfd, name);
820+}
821+
822+/* The microblaze linker (like many others) needs to keep track of
823+ the number of relocs that it decides to copy as dynamic relocs in
824+ check_relocs for each symbol. This is so that it can later discard
825+ them if they are found to be unnecessary. We store the information
826+ in a field extending the regular ELF linker hash table. */
827+
828+struct elf64_mb_dyn_relocs
829+{
830+ struct elf64_mb_dyn_relocs *next;
831+
832+ /* The input section of the reloc. */
833+ asection *sec;
834+
835+ /* Total number of relocs copied for the input section. */
836+ bfd_size_type count;
837+
838+ /* Number of pc-relative relocs copied for the input section. */
839+ bfd_size_type pc_count;
840+};
841+
842+/* ELF linker hash entry. */
843+
844+struct elf64_mb_link_hash_entry
845+{
846+ struct elf_link_hash_entry elf;
847+
848+ /* Track dynamic relocs copied for this symbol. */
849+ struct elf64_mb_dyn_relocs *dyn_relocs;
850+
851+ /* TLS Reference Types for the symbol; Updated by check_relocs */
852+#define TLS_GD 1 /* GD reloc. */
853+#define TLS_LD 2 /* LD reloc. */
854+#define TLS_TPREL 4 /* TPREL reloc, => IE. */
855+#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
856+#define TLS_TLS 16 /* Any TLS reloc. */
857+ unsigned char tls_mask;
858+
859+};
860+
861+#define IS_TLS_GD(x) (x == (TLS_TLS | TLS_GD))
862+#define IS_TLS_LD(x) (x == (TLS_TLS | TLS_LD))
863+#define IS_TLS_DTPREL(x) (x == (TLS_TLS | TLS_DTPREL))
864+#define IS_TLS_NONE(x) (x == 0)
865+
866+#define elf64_mb_hash_entry(ent) ((struct elf64_mb_link_hash_entry *)(ent))
867+
868+/* ELF linker hash table. */
869+
870+struct elf64_mb_link_hash_table
871+{
872+ struct elf_link_hash_table elf;
873+
874+ /* Short-cuts to get to dynamic linker sections. */
875+ asection *sgot;
876+ asection *sgotplt;
877+ asection *srelgot;
878+ asection *splt;
879+ asection *srelplt;
880+ asection *sdynbss;
881+ asection *srelbss;
882+
883+ /* Small local sym to section mapping cache. */
884+ struct sym_cache sym_sec;
885+
886+ /* TLS Local Dynamic GOT Entry */
887+ union {
888+ bfd_signed_vma refcount;
889+ bfd_vma offset;
890+ } tlsld_got;
891+};
892+
893+/* Nonzero if this section has TLS related relocations. */
894+#define has_tls_reloc sec_flg0
895+
896+/* Get the ELF linker hash table from a link_info structure. */
897+
898+#define elf64_mb_hash_table(p) \
899+ ((is_elf_hash_table ((p)->hash) \
900+ && elf_hash_table_id (elf_hash_table (p)) == MICROBLAZE_ELF_DATA) \
901+ ? (struct elf64_mb_link_hash_table *) (p)->hash : NULL)
902+
903+/* Create an entry in a microblaze ELF linker hash table. */
904+
905+static struct bfd_hash_entry *
906+link_hash_newfunc (struct bfd_hash_entry *entry,
907+ struct bfd_hash_table *table,
908+ const char *string)
909+{
910+ /* Allocate the structure if it has not already been allocated by a
911+ subclass. */
912+ if (entry == NULL)
913+ {
914+ entry = bfd_hash_allocate (table,
915+ sizeof (struct elf64_mb_link_hash_entry));
916+ if (entry == NULL)
917+ return entry;
918+ }
919+
920+ /* Call the allocation method of the superclass. */
921+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
922+ if (entry != NULL)
923+ {
924+ struct elf64_mb_link_hash_entry *eh;
925+
926+ eh = (struct elf64_mb_link_hash_entry *) entry;
927+ eh->tls_mask = 0;
928+ }
929+
930+ return entry;
931+}
932+
933+/* Create a mb ELF linker hash table. */
934+
935+static struct bfd_link_hash_table *
936+microblaze_elf_link_hash_table_create (bfd *abfd)
937+{
938+ struct elf64_mb_link_hash_table *ret;
939+ size_t amt = sizeof (struct elf64_mb_link_hash_table);
940+
941+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt);
942+ if (ret == NULL)
943+ return NULL;
944+
945+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
946+ sizeof (struct elf64_mb_link_hash_entry),
947+ MICROBLAZE_ELF_DATA))
948+ {
949+ free (ret);
950+ return NULL;
951+ }
952+
953+ return &ret->elf.root;
954+}
955+
956+/* Set the values of the small data pointers. */
957+
958+static void
959+microblaze_elf_final_sdp (struct bfd_link_info *info)
960+{
961+ struct bfd_link_hash_entry *h;
962+
963+ h = bfd_link_hash_lookup (info->hash, RO_SDA_ANCHOR_NAME, false, false, true);
964+ if (h != (struct bfd_link_hash_entry *) NULL
965+ && h->type == bfd_link_hash_defined)
966+ ro_small_data_pointer = (h->u.def.value
967+ + h->u.def.section->output_section->vma
968+ + h->u.def.section->output_offset);
969+
970+ h = bfd_link_hash_lookup (info->hash, RW_SDA_ANCHOR_NAME, false, false, true);
971+ if (h != (struct bfd_link_hash_entry *) NULL
972+ && h->type == bfd_link_hash_defined)
973+ rw_small_data_pointer = (h->u.def.value
974+ + h->u.def.section->output_section->vma
975+ + h->u.def.section->output_offset);
976+}
977+
978+static bfd_vma
979+dtprel_base (struct bfd_link_info *info)
980+{
981+ /* If tls_sec is NULL, we should have signalled an error already. */
982+ if (elf_hash_table (info)->tls_sec == NULL)
983+ return 0;
984+ return elf_hash_table (info)->tls_sec->vma;
985+}
986+
987+/* The size of the thread control block. */
988+#define TCB_SIZE 8
989+
990+/* Output a simple dynamic relocation into SRELOC. */
991+
992+static void
993+microblaze_elf_output_dynamic_relocation (bfd *output_bfd,
994+ asection *sreloc,
995+ unsigned long reloc_index,
996+ unsigned long indx,
997+ int r_type,
998+ bfd_vma offset,
999+ bfd_vma addend)
1000+{
1001+
1002+ Elf_Internal_Rela rel;
1003+
1004+ rel.r_info = ELF64_R_INFO (indx, r_type);
1005+ rel.r_offset = offset;
1006+ rel.r_addend = addend;
1007+
1008+ bfd_elf64_swap_reloca_out (output_bfd, &rel,
1009+ (sreloc->contents + reloc_index * sizeof (Elf64_External_Rela)));
1010+}
1011+
1012+/* This code is taken from elf64-m32r.c
1013+ There is some attempt to make this function usable for many architectures,
1014+ both USE_REL and USE_RELA ['twould be nice if such a critter existed],
1015+ if only to serve as a learning tool.
1016+
1017+ The RELOCATE_SECTION function is called by the new ELF backend linker
1018+ to handle the relocations for a section.
1019+
1020+ The relocs are always passed as Rela structures; if the section
1021+ actually uses Rel structures, the r_addend field will always be
1022+ zero.
1023+
1024+ This function is responsible for adjust the section contents as
1025+ necessary, and (if using Rela relocs and generating a
1026+ relocatable output file) adjusting the reloc addend as
1027+ necessary.
1028+
1029+ This function does not have to worry about setting the reloc
1030+ address or the reloc symbol index.
1031+
1032+ LOCAL_SYMS is a pointer to the swapped in local symbols.
1033+
1034+ LOCAL_SECTIONS is an array giving the section in the input file
1035+ corresponding to the st_shndx field of each local symbol.
1036+
1037+ The global hash table entry for the global symbols can be found
1038+ via elf_sym_hashes (input_bfd).
1039+
1040+ When generating relocatable output, this function must handle
1041+ STB_LOCAL/STT_SECTION symbols specially. The output symbol is
1042+ going to be the section symbol corresponding to the output
1043+ section, which means that the addend must be adjusted
1044+ accordingly. */
1045+
1046+static int
1047+microblaze_elf_relocate_section (bfd *output_bfd,
1048+ struct bfd_link_info *info,
1049+ bfd *input_bfd,
1050+ asection *input_section,
1051+ bfd_byte *contents,
1052+ Elf_Internal_Rela *relocs,
1053+ Elf_Internal_Sym *local_syms,
1054+ asection **local_sections)
1055+{
1056+ struct elf64_mb_link_hash_table *htab;
1057+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1058+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
1059+ Elf_Internal_Rela *rel, *relend;
1060+ int endian = (bfd_little_endian (output_bfd)) ? 0 : 2;
1061+ /* Assume success. */
1062+ bool ret = true;
1063+ asection *sreloc;
1064+ bfd_vma *local_got_offsets;
1065+ unsigned int tls_type;
1066+
1067+ if (!microblaze_elf_howto_table[R_MICROBLAZE_max-1])
1068+ microblaze_elf_howto_init ();
1069+
1070+ htab = elf64_mb_hash_table (info);
1071+ if (htab == NULL)
1072+ return false;
1073+
1074+ local_got_offsets = elf_local_got_offsets (input_bfd);
1075+
1076+ sreloc = elf_section_data (input_section)->sreloc;
1077+
1078+ rel = relocs;
1079+ relend = relocs + input_section->reloc_count;
1080+ for (; rel < relend; rel++)
1081+ {
1082+ int r_type;
1083+ reloc_howto_type *howto;
1084+ unsigned long r_symndx;
1085+ bfd_vma addend = rel->r_addend;
1086+ bfd_vma offset = rel->r_offset;
1087+ struct elf_link_hash_entry *h;
1088+ Elf_Internal_Sym *sym;
1089+ asection *sec;
1090+ const char *sym_name;
1091+ bfd_reloc_status_type r = bfd_reloc_ok;
1092+ const char *errmsg = NULL;
1093+ bool unresolved_reloc = false;
1094+
1095+ h = NULL;
1096+ r_type = ELF64_R_TYPE (rel->r_info);
1097+ tls_type = 0;
1098+
1099+ if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max)
1100+ {
1101+ /* xgettext:c-format */
1102+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
1103+ input_bfd, (int) r_type);
1104+ bfd_set_error (bfd_error_bad_value);
1105+ ret = false;
1106+ continue;
1107+ }
1108+
1109+ howto = microblaze_elf_howto_table[r_type];
1110+ r_symndx = ELF64_R_SYM (rel->r_info);
1111+
1112+ if (bfd_link_relocatable (info))
1113+ {
1114+ /* This is a relocatable link. We don't have to change
1115+ anything, unless the reloc is against a section symbol,
1116+ in which case we have to adjust according to where the
1117+ section symbol winds up in the output section. */
1118+ sec = NULL;
1119+ if (r_symndx >= symtab_hdr->sh_info)
1120+ /* External symbol. */
1121+ continue;
1122+
1123+ /* Local symbol. */
1124+ sym = local_syms + r_symndx;
1125+ sym_name = "<local symbol>";
1126+ /* STT_SECTION: symbol is associated with a section. */
1127+ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
1128+ /* Symbol isn't associated with a section. Nothing to do. */
1129+ continue;
1130+
1131+ sec = local_sections[r_symndx];
1132+ addend += sec->output_offset + sym->st_value;
1133+#ifndef USE_REL
1134+ /* This can't be done for USE_REL because it doesn't mean anything
1135+ and elf_link_input_bfd asserts this stays zero. */
1136+ /* rel->r_addend = addend; */
1137+#endif
1138+
1139+#ifndef USE_REL
1140+ /* Addends are stored with relocs. We're done. */
1141+ continue;
1142+#else /* USE_REL */
1143+ /* If partial_inplace, we need to store any additional addend
1144+ back in the section. */
1145+ if (!howto->partial_inplace)
1146+ continue;
1147+ /* ??? Here is a nice place to call a special_function like handler. */
1148+ r = _bfd_relocate_contents (howto, input_bfd, addend,
1149+ contents + offset);
1150+#endif /* USE_REL */
1151+ }
1152+ else
1153+ {
1154+ bfd_vma relocation;
1155+ bool resolved_to_zero;
1156+
1157+ /* This is a final link. */
1158+ sym = NULL;
1159+ sec = NULL;
1160+ unresolved_reloc = false;
1161+
1162+ if (r_symndx < symtab_hdr->sh_info)
1163+ {
1164+ /* Local symbol. */
1165+ sym = local_syms + r_symndx;
1166+ sec = local_sections[r_symndx];
1167+ if (sec == 0)
1168+ continue;
1169+ sym_name = "<local symbol>";
1170+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1171+ /* r_addend may have changed if the reference section was
1172+ a merge section. */
1173+ addend = rel->r_addend;
1174+ }
1175+ else
1176+ {
1177+ /* External symbol. */
1178+ bool warned ATTRIBUTE_UNUSED;
1179+ bool ignored ATTRIBUTE_UNUSED;
1180+
1181+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
1182+ r_symndx, symtab_hdr, sym_hashes,
1183+ h, sec, relocation,
1184+ unresolved_reloc, warned, ignored);
1185+ sym_name = h->root.root.string;
1186+ }
1187+
1188+ /* Sanity check the address. */
1189+ if (offset > bfd_get_section_limit (input_bfd, input_section))
1190+ {
1191+ r = bfd_reloc_outofrange;
1192+ goto check_reloc;
1193+ }
1194+
1195+ resolved_to_zero = (h != NULL
1196+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
1197+
1198+ switch ((int) r_type)
1199+ {
1200+ case (int) R_MICROBLAZE_SRO32 :
1201+ {
1202+ const char *name;
1203+
1204+ /* Only relocate if the symbol is defined. */
1205+ if (sec)
1206+ {
1207+ name = bfd_section_name (sec);
1208+
1209+ if (strcmp (name, ".sdata2") == 0
1210+ || strcmp (name, ".sbss2") == 0)
1211+ {
1212+ if (ro_small_data_pointer == 0)
1213+ microblaze_elf_final_sdp (info);
1214+ if (ro_small_data_pointer == 0)
1215+ {
1216+ ret = false;
1217+ r = bfd_reloc_undefined;
1218+ goto check_reloc;
1219+ }
1220+
1221+ /* At this point `relocation' contains the object's
1222+ address. */
1223+ relocation -= ro_small_data_pointer;
1224+ /* Now it contains the offset from _SDA2_BASE_. */
1225+ r = _bfd_final_link_relocate (howto, input_bfd,
1226+ input_section,
1227+ contents, offset,
1228+ relocation, addend);
1229+ }
1230+ else
1231+ {
1232+ _bfd_error_handler
1233+ /* xgettext:c-format */
1234+ (_("%pB: the target (%s) of an %s relocation"
1235+ " is in the wrong section (%pA)"),
1236+ input_bfd,
1237+ sym_name,
1238+ microblaze_elf_howto_table[(int) r_type]->name,
1239+ sec);
1240+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1241+ ret = false;
1242+ continue;
1243+ }
1244+ }
1245+ }
1246+ break;
1247+
1248+ case (int) R_MICROBLAZE_SRW32 :
1249+ {
1250+ const char *name;
1251+
1252+ /* Only relocate if the symbol is defined. */
1253+ if (sec)
1254+ {
1255+ name = bfd_section_name (sec);
1256+
1257+ if (strcmp (name, ".sdata") == 0
1258+ || strcmp (name, ".sbss") == 0)
1259+ {
1260+ if (rw_small_data_pointer == 0)
1261+ microblaze_elf_final_sdp (info);
1262+ if (rw_small_data_pointer == 0)
1263+ {
1264+ ret = false;
1265+ r = bfd_reloc_undefined;
1266+ goto check_reloc;
1267+ }
1268+
1269+ /* At this point `relocation' contains the object's
1270+ address. */
1271+ relocation -= rw_small_data_pointer;
1272+ /* Now it contains the offset from _SDA_BASE_. */
1273+ r = _bfd_final_link_relocate (howto, input_bfd,
1274+ input_section,
1275+ contents, offset,
1276+ relocation, addend);
1277+ }
1278+ else
1279+ {
1280+ _bfd_error_handler
1281+ /* xgettext:c-format */
1282+ (_("%pB: the target (%s) of an %s relocation"
1283+ " is in the wrong section (%pA)"),
1284+ input_bfd,
1285+ sym_name,
1286+ microblaze_elf_howto_table[(int) r_type]->name,
1287+ sec);
1288+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1289+ ret = false;
1290+ continue;
1291+ }
1292+ }
1293+ }
1294+ break;
1295+
1296+ case (int) R_MICROBLAZE_32_SYM_OP_SYM:
1297+ break; /* Do nothing. */
1298+
1299+ case (int) R_MICROBLAZE_GOTPC_64:
1300+ relocation = (htab->elf.sgotplt->output_section->vma
1301+ + htab->elf.sgotplt->output_offset);
1302+ relocation -= (input_section->output_section->vma
1303+ + input_section->output_offset
1304+ + offset + INST_WORD_SIZE);
1305+ relocation += addend;
1306+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1307+ contents + offset + endian);
1308+ bfd_put_16 (input_bfd, relocation & 0xffff,
1309+ contents + offset + endian + INST_WORD_SIZE);
1310+ break;
1311+
1312+ case (int) R_MICROBLAZE_TEXTPCREL_64:
1313+ relocation = input_section->output_section->vma;
1314+ relocation -= (input_section->output_section->vma
1315+ + input_section->output_offset
1316+ + offset + INST_WORD_SIZE);
1317+ relocation += addend;
1318+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1319+ contents + offset + endian);
1320+ bfd_put_16 (input_bfd, relocation & 0xffff,
1321+ contents + offset + endian + INST_WORD_SIZE);
1322+ break;
1323+
1324+ case (int) R_MICROBLAZE_PLT_64:
1325+ {
1326+ bfd_vma immediate;
1327+ if (htab->elf.splt != NULL && h != NULL
1328+ && h->plt.offset != (bfd_vma) -1)
1329+ {
1330+ relocation = (htab->elf.splt->output_section->vma
1331+ + htab->elf.splt->output_offset
1332+ + h->plt.offset);
1333+ unresolved_reloc = false;
1334+ immediate = relocation - (input_section->output_section->vma
1335+ + input_section->output_offset
1336+ + offset + INST_WORD_SIZE);
1337+ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
1338+ contents + offset + endian);
1339+ bfd_put_16 (input_bfd, immediate & 0xffff,
1340+ contents + offset + endian + INST_WORD_SIZE);
1341+ }
1342+ else
1343+ {
1344+ relocation -= (input_section->output_section->vma
1345+ + input_section->output_offset
1346+ + offset + INST_WORD_SIZE);
1347+ immediate = relocation;
1348+ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
1349+ contents + offset + endian);
1350+ bfd_put_16 (input_bfd, immediate & 0xffff,
1351+ contents + offset + endian + INST_WORD_SIZE);
1352+ }
1353+ break;
1354+ }
1355+
1356+ case (int) R_MICROBLAZE_TLSGD:
1357+ tls_type = (TLS_TLS | TLS_GD);
1358+ goto dogot;
1359+ case (int) R_MICROBLAZE_TLSLD:
1360+ tls_type = (TLS_TLS | TLS_LD);
1361+ /* Fall through. */
1362+ dogot:
1363+ case (int) R_MICROBLAZE_GOT_64:
1364+ {
1365+ bfd_vma *offp;
1366+ bfd_vma off, off2;
1367+ unsigned long indx;
1368+ bfd_vma static_value;
1369+
1370+ bool need_relocs = false;
1371+ if (htab->elf.sgot == NULL)
1372+ abort ();
1373+
1374+ indx = 0;
1375+ offp = NULL;
1376+
1377+ /* 1. Identify GOT Offset;
1378+ 2. Compute Static Values
1379+ 3. Process Module Id, Process Offset
1380+ 4. Fixup Relocation with GOT offset value. */
1381+
1382+ /* 1. Determine GOT Offset to use : TLS_LD, global, local */
1383+ if (IS_TLS_LD (tls_type))
1384+ offp = &htab->tlsld_got.offset;
1385+ else if (h != NULL)
1386+ {
1387+ if (htab->elf.sgotplt != NULL
1388+ && h->got.offset != (bfd_vma) -1)
1389+ offp = &h->got.offset;
1390+ else
1391+ abort ();
1392+ }
1393+ else
1394+ {
1395+ if (local_got_offsets == NULL)
1396+ abort ();
1397+ offp = &local_got_offsets[r_symndx];
1398+ }
1399+
1400+ if (!offp)
1401+ abort ();
1402+
1403+ off = (*offp) & ~1;
1404+ off2 = off;
1405+
1406+ if (IS_TLS_LD(tls_type) || IS_TLS_GD(tls_type))
1407+ off2 = off + 4;
1408+
1409+ /* Symbol index to use for relocs */
1410+ if (h != NULL)
1411+ {
1412+ bool dyn =
1413+ elf_hash_table (info)->dynamic_sections_created;
1414+
1415+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
1416+ bfd_link_pic (info),
1417+ h)
1418+ && (!bfd_link_pic (info)
1419+ || !SYMBOL_REFERENCES_LOCAL (info, h)))
1420+ indx = h->dynindx;
1421+ }
1422+
1423+ /* Need to generate relocs ? */
1424+ if ((bfd_link_pic (info) || indx != 0)
1425+ && (h == NULL
1426+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1427+ || h->root.type != bfd_link_hash_undefweak))
1428+ need_relocs = true;
1429+
1430+ /* 2. Compute/Emit Static value of r-expression */
1431+ static_value = relocation + addend;
1432+
1433+ /* 3. Process module-id and offset */
1434+ if (! ((*offp) & 1) )
1435+ {
1436+ bfd_vma got_offset;
1437+
1438+ got_offset = (htab->elf.sgot->output_section->vma
1439+ + htab->elf.sgot->output_offset
1440+ + off);
1441+
1442+ /* Process module-id */
1443+ if (IS_TLS_LD(tls_type))
1444+ {
1445+ if (! bfd_link_pic (info))
1446+ bfd_put_32 (output_bfd, 1,
1447+ htab->elf.sgot->contents + off);
1448+ else
1449+ microblaze_elf_output_dynamic_relocation
1450+ (output_bfd,
1451+ htab->elf.srelgot,
1452+ htab->elf.srelgot->reloc_count++,
1453+ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
1454+ got_offset, 0);
1455+ }
1456+ else if (IS_TLS_GD(tls_type))
1457+ {
1458+ if (! need_relocs)
1459+ bfd_put_32 (output_bfd, 1,
1460+ htab->elf.sgot->contents + off);
1461+ else
1462+ microblaze_elf_output_dynamic_relocation
1463+ (output_bfd,
1464+ htab->elf.srelgot,
1465+ htab->elf.srelgot->reloc_count++,
1466+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
1467+ got_offset, indx ? 0 : static_value);
1468+ }
1469+
1470+ /* Process Offset */
1471+ if (htab->elf.srelgot == NULL)
1472+ abort ();
1473+
1474+ got_offset = (htab->elf.sgot->output_section->vma
1475+ + htab->elf.sgot->output_offset
1476+ + off2);
1477+ if (IS_TLS_LD(tls_type))
1478+ {
1479+ /* For LD, offset should be 0 */
1480+ *offp |= 1;
1481+ bfd_put_32 (output_bfd, 0,
1482+ htab->elf.sgot->contents + off2);
1483+ }
1484+ else if (IS_TLS_GD(tls_type))
1485+ {
1486+ *offp |= 1;
1487+ static_value -= dtprel_base(info);
1488+ if (need_relocs)
1489+ microblaze_elf_output_dynamic_relocation
1490+ (output_bfd,
1491+ htab->elf.srelgot,
1492+ htab->elf.srelgot->reloc_count++,
1493+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
1494+ got_offset, indx ? 0 : static_value);
1495+ else
1496+ bfd_put_32 (output_bfd, static_value,
1497+ htab->elf.sgot->contents + off2);
1498+ }
1499+ else
1500+ {
1501+ bfd_put_32 (output_bfd, static_value,
1502+ htab->elf.sgot->contents + off2);
1503+
1504+ /* Relocs for dyn symbols generated by
1505+ finish_dynamic_symbols */
1506+ if (bfd_link_pic (info) && h == NULL)
1507+ {
1508+ *offp |= 1;
1509+ microblaze_elf_output_dynamic_relocation
1510+ (output_bfd,
1511+ htab->elf.srelgot,
1512+ htab->elf.srelgot->reloc_count++,
1513+ /* symindex= */ indx, R_MICROBLAZE_REL,
1514+ got_offset, static_value);
1515+ }
1516+ }
1517+ }
1518+
1519+ /* 4. Fixup Relocation with GOT offset value
1520+ Compute relative address of GOT entry for applying
1521+ the current relocation */
1522+ relocation = htab->elf.sgot->output_section->vma
1523+ + htab->elf.sgot->output_offset
1524+ + off
1525+ - htab->elf.sgotplt->output_section->vma
1526+ - htab->elf.sgotplt->output_offset;
1527+
1528+ /* Apply Current Relocation */
1529+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1530+ contents + offset + endian);
1531+ bfd_put_16 (input_bfd, relocation & 0xffff,
1532+ contents + offset + endian + INST_WORD_SIZE);
1533+
1534+ unresolved_reloc = false;
1535+ break;
1536+ }
1537+
1538+ case (int) R_MICROBLAZE_GOTOFF_64:
1539+ {
1540+ bfd_vma immediate;
1541+ unsigned short lo, high;
1542+ relocation += addend;
1543+ relocation -= (htab->elf.sgotplt->output_section->vma
1544+ + htab->elf.sgotplt->output_offset);
1545+ /* Write this value into correct location. */
1546+ immediate = relocation;
1547+ lo = immediate & 0x0000ffff;
1548+ high = (immediate >> 16) & 0x0000ffff;
1549+ bfd_put_16 (input_bfd, high, contents + offset + endian);
1550+ bfd_put_16 (input_bfd, lo,
1551+ contents + offset + INST_WORD_SIZE + endian);
1552+ break;
1553+ }
1554+
1555+ case (int) R_MICROBLAZE_GOTOFF_32:
1556+ {
1557+ relocation += addend;
1558+ relocation -= (htab->elf.sgotplt->output_section->vma
1559+ + htab->elf.sgotplt->output_offset);
1560+ /* Write this value into correct location. */
1561+ bfd_put_32 (input_bfd, relocation, contents + offset);
1562+ break;
1563+ }
1564+
1565+ case (int) R_MICROBLAZE_TLSDTPREL64:
1566+ relocation += addend;
1567+ relocation -= dtprel_base(info);
1568+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1569+ contents + offset + endian);
1570+ bfd_put_16 (input_bfd, relocation & 0xffff,
1571+ contents + offset + endian + INST_WORD_SIZE);
1572+ break;
1573+ case (int) R_MICROBLAZE_TEXTREL_64:
1574+ case (int) R_MICROBLAZE_TEXTREL_32_LO:
1575+ case (int) R_MICROBLAZE_64_PCREL :
1576+ case (int) R_MICROBLAZE_64:
1577+ case (int) R_MICROBLAZE_32:
1578+ case (int) R_MICROBLAZE_IMML_64:
1579+ {
1580+ /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
1581+ from removed linkonce sections, or sections discarded by
1582+ a linker script. */
1583+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
1584+ {
1585+ relocation += addend;
1586+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
1587+ bfd_put_32 (input_bfd, relocation, contents + offset);
1588+ else if (r_type == R_MICROBLAZE_IMML_64)
1589+ bfd_put_64 (input_bfd, relocation, contents + offset);
1590+ else
1591+ {
1592+ if (r_type == R_MICROBLAZE_64_PCREL)
1593+ relocation -= (input_section->output_section->vma
1594+ + input_section->output_offset
1595+ + offset + INST_WORD_SIZE);
1596+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1597+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1598+ relocation -= input_section->output_section->vma;
1599+
1600+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1601+ bfd_put_16 (input_bfd, relocation & 0xffff,
1602+ contents + offset + endian);
1603+
1604+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
1605+ if ((insn & 0xff000000) == 0xb2000000)
1606+ {
1607+ insn &= ~0x00ffffff;
1608+ insn |= (relocation >> 16) & 0xffffff;
1609+ bfd_put_32 (input_bfd, insn,
1610+ contents + offset + endian);
1611+ }
1612+ else
1613+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1614+ contents + offset + endian);
1615+ bfd_put_16 (input_bfd, relocation & 0xffff,
1616+ contents + offset + endian + INST_WORD_SIZE);
1617+ }
1618+ break;
1619+ }
1620+
1621+ if ((bfd_link_pic (info)
1622+ && (h == NULL
1623+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1624+ && !resolved_to_zero)
1625+ || h->root.type != bfd_link_hash_undefweak)
1626+ && (!howto->pc_relative
1627+ || (h != NULL
1628+ && h->dynindx != -1
1629+ && (!info->symbolic
1630+ || !h->def_regular))))
1631+ || (!bfd_link_pic (info)
1632+ && h != NULL
1633+ && h->dynindx != -1
1634+ && !h->non_got_ref
1635+ && ((h->def_dynamic
1636+ && !h->def_regular)
1637+ || h->root.type == bfd_link_hash_undefweak
1638+ || h->root.type == bfd_link_hash_undefined)))
1639+ {
1640+ Elf_Internal_Rela outrel;
1641+ bfd_byte *loc;
1642+ bool skip;
1643+
1644+ /* When generating a shared object, these relocations
1645+ are copied into the output file to be resolved at run
1646+ time. */
1647+
1648+ BFD_ASSERT (sreloc != NULL);
1649+
1650+ skip = false;
1651+
1652+ outrel.r_offset =
1653+ _bfd_elf_section_offset (output_bfd, info, input_section,
1654+ rel->r_offset);
1655+ if (outrel.r_offset == (bfd_vma) -1)
1656+ skip = true;
1657+ else if (outrel.r_offset == (bfd_vma) -2)
1658+ skip = true;
1659+ outrel.r_offset += (input_section->output_section->vma
1660+ + input_section->output_offset);
1661+
1662+ if (skip)
1663+ memset (&outrel, 0, sizeof outrel);
1664+ /* h->dynindx may be -1 if the symbol was marked to
1665+ become local. */
1666+ else if (h != NULL
1667+ && ((! info->symbolic && h->dynindx != -1)
1668+ || !h->def_regular))
1669+ {
1670+ BFD_ASSERT (h->dynindx != -1);
1671+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
1672+ outrel.r_addend = addend;
1673+ }
1674+ else
1675+ {
1676+ if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64)
1677+ {
1678+ outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
1679+ outrel.r_addend = relocation + addend;
1680+ }
1681+ else
1682+ {
1683+ BFD_FAIL ();
1684+ _bfd_error_handler
1685+ (_("%pB: probably compiled without -fPIC?"),
1686+ input_bfd);
1687+ bfd_set_error (bfd_error_bad_value);
1688+ return false;
1689+ }
1690+ }
1691+
1692+ loc = sreloc->contents;
1693+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
1694+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
1695+ break;
1696+ }
1697+ else
1698+ {
1699+ relocation += addend;
1700+ if (r_type == R_MICROBLAZE_32)
1701+ bfd_put_32 (input_bfd, relocation, contents + offset);
1702+ else if (r_type == R_MICROBLAZE_IMML_64)
1703+ bfd_put_64 (input_bfd, relocation, contents + offset + endian);
1704+ else
1705+ {
1706+ if (r_type == R_MICROBLAZE_64_PCREL)
1707+ {
1708+ if (!input_section->output_section->vma &&
1709+ !input_section->output_offset && !offset)
1710+ relocation -= (input_section->output_section->vma
1711+ + input_section->output_offset
1712+ + offset);
1713+ else
1714+ relocation -= (input_section->output_section->vma
1715+ + input_section->output_offset + offset + INST_WORD_SIZE);
1716+ }
1717+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1718+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1719+ relocation -= input_section->output_section->vma;
1720+
1721+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1722+ {
1723+ bfd_put_16 (input_bfd, relocation & 0xffff,
1724+ contents + offset + endian);
1725+ }
1726+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
1727+ if ((insn & 0xff000000) == 0xb2000000)
1728+ {
1729+ insn &= ~0x00ffffff;
1730+ insn |= (relocation >> 16) & 0xffffff;
1731+ bfd_put_32 (input_bfd, insn,
1732+ contents + offset + endian);
1733+ }
1734+ else
1735+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1736+ contents + offset + endian);
1737+ bfd_put_16 (input_bfd, relocation & 0xffff,
1738+ contents + offset + endian + INST_WORD_SIZE);
1739+ }
1740+ break;
1741+ }
1742+ }
1743+
1744+ default :
1745+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
1746+ contents, offset,
1747+ relocation, addend);
1748+ break;
1749+ }
1750+ }
1751+
1752+ check_reloc:
1753+
1754+ if (r != bfd_reloc_ok)
1755+ {
1756+ /* FIXME: This should be generic enough to go in a utility. */
1757+ const char *name;
1758+
1759+ if (h != NULL)
1760+ name = h->root.root.string;
1761+ else
1762+ {
1763+ name = (bfd_elf_string_from_elf_section
1764+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
1765+ if (name == NULL || *name == '\0')
1766+ name = bfd_section_name (sec);
1767+ }
1768+
1769+ if (errmsg != NULL)
1770+ goto common_error;
1771+
1772+ switch (r)
1773+ {
1774+ case bfd_reloc_overflow:
1775+ (*info->callbacks->reloc_overflow)
1776+ (info, (h ? &h->root : NULL), name, howto->name,
1777+ (bfd_vma) 0, input_bfd, input_section, offset);
1778+ break;
1779+
1780+ case bfd_reloc_undefined:
1781+ (*info->callbacks->undefined_symbol)
1782+ (info, name, input_bfd, input_section, offset, true);
1783+ break;
1784+
1785+ case bfd_reloc_outofrange:
1786+ errmsg = _("internal error: out of range error");
1787+ goto common_error;
1788+
1789+ case bfd_reloc_notsupported:
1790+ errmsg = _("internal error: unsupported relocation error");
1791+ goto common_error;
1792+
1793+ case bfd_reloc_dangerous:
1794+ errmsg = _("internal error: dangerous error");
1795+ goto common_error;
1796+
1797+ default:
1798+ errmsg = _("internal error: unknown error");
1799+ /* Fall through. */
1800+ common_error:
1801+ (*info->callbacks->warning) (info, errmsg, name, input_bfd,
1802+ input_section, offset);
1803+ break;
1804+ }
1805+ }
1806+ }
1807+
1808+ return ret;
1809+}
1810+
1811+/* Merge backend specific data from an object file to the output
1812+ object file when linking.
1813+
1814+ Note: We only use this hook to catch endian mismatches. */
1815+static bool
1816+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
1817+{
1818+ /* Check if we have the same endianess. */
1819+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
1820+ return false;
1821+
1822+ return true;
1823+}
1824+
1825+
1826+/* Calculate fixup value for reference. */
1827+
1828+static size_t
1829+calc_fixup (bfd_vma start, bfd_vma size, asection *sec)
1830+{
1831+ bfd_vma end = start + size;
1832+ size_t i, fixup = 0;
1833+ struct _microblaze_elf_section_data *sdata;
1834+
1835+ if (sec == NULL || (sdata = microblaze_elf_section_data (sec)) == NULL)
1836+ return 0;
1837+
1838+ /* Look for addr in relax table, total fixup value. */
1839+ for (i = 0; i < sdata->relax_count; i++)
1840+ {
1841+ if (end <= sdata->relax[i].addr)
1842+ break;
1843+ if (end != start && start > sdata->relax[i].addr)
1844+ continue;
1845+ fixup += sdata->relax[i].size;
1846+ }
1847+ return fixup;
1848+}
1849+
1850+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
1851+ a 32-bit instruction. */
1852+static void
1853+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
1854+{
1855+ unsigned long instr = bfd_get_32 (abfd, bfd_addr);
1856+
1857+ if ((instr & 0xff000000) == 0xb2000000)
1858+ {
1859+ instr &= ~0x00ffffff;
1860+ instr |= (val & 0xffffff);
1861+ bfd_put_32 (abfd, instr, bfd_addr);
1862+ }
1863+ else
1864+ {
1865+ instr &= ~0x0000ffff;
1866+ instr |= (val & 0x0000ffff);
1867+ bfd_put_32 (abfd, instr, bfd_addr);
1868+ }
1869+}
1870+
1871+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
1872+ two consecutive 32-bit instructions. */
1873+static void
1874+microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
1875+{
1876+ unsigned long instr_hi;
1877+ unsigned long instr_lo;
1878+
1879+ instr_hi = bfd_get_32 (abfd, bfd_addr);
1880+ if ((instr_hi & 0xff000000) == 0xb2000000)
1881+ {
1882+ instr_hi &= ~0x00ffffff;
1883+ instr_hi |= (val >> 16) & 0xffffff;
1884+ bfd_put_32 (abfd, instr_hi,bfd_addr);
1885+ }
1886+ else
1887+ {
1888+ instr_hi &= ~0x0000ffff;
1889+ instr_hi |= ((val >> 16) & 0x0000ffff);
1890+ bfd_put_32 (abfd, instr_hi, bfd_addr);
1891+ }
1892+ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
1893+ instr_lo &= ~0x0000ffff;
1894+ instr_lo |= (val & 0x0000ffff);
1895+ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE);
1896+}
1897+
1898+static bool
1899+microblaze_elf_relax_section (bfd *abfd,
1900+ asection *sec,
1901+ struct bfd_link_info *link_info,
1902+ bool *again)
1903+{
1904+ Elf_Internal_Shdr *symtab_hdr;
1905+ Elf_Internal_Rela *internal_relocs;
1906+ Elf_Internal_Rela *irel, *irelend;
1907+ bfd_byte *contents = NULL;
1908+ int rel_count;
1909+ unsigned int shndx;
1910+ size_t i, sym_index;
1911+ asection *o;
1912+ struct elf_link_hash_entry *sym_hash;
1913+ Elf_Internal_Sym *isymbuf, *isymend;
1914+ Elf_Internal_Sym *isym;
1915+ size_t symcount;
1916+ size_t offset;
1917+ bfd_vma src, dest;
1918+ struct _microblaze_elf_section_data *sdata;
1919+
1920+ /* We only do this once per section. We may be able to delete some code
1921+ by running multiple passes, but it is not worth it. */
1922+ *again = false;
1923+
1924+ /* Only do this for a text section. */
1925+ if (bfd_link_relocatable (link_info)
1926+ || (sec->flags & SEC_RELOC) == 0
1927+ || (sec->flags & SEC_CODE) == 0
1928+ || sec->reloc_count == 0
1929+ || (sdata = microblaze_elf_section_data (sec)) == NULL)
1930+ return true;
1931+
1932+ BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0));
1933+
1934+ /* If this is the first time we have been called for this section,
1935+ initialize the cooked size. */
1936+ if (sec->size == 0)
1937+ sec->size = sec->rawsize;
1938+
1939+ /* Get symbols for this section. */
1940+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
1941+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
1942+ symcount = symtab_hdr->sh_size / sizeof (Elf64_External_Sym);
1943+ if (isymbuf == NULL)
1944+ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, symcount,
1945+ 0, NULL, NULL, NULL);
1946+ BFD_ASSERT (isymbuf != NULL);
1947+
1948+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
1949+ if (internal_relocs == NULL)
1950+ goto error_return;
1951+
1952+ sdata->relax_count = 0;
1953+ sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
1954+ * sizeof (*sdata->relax));
1955+ if (sdata->relax == NULL)
1956+ goto error_return;
1957+
1958+ irelend = internal_relocs + sec->reloc_count;
1959+ rel_count = 0;
1960+ for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
1961+ {
1962+ bfd_vma symval;
1963+ if ((ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
1964+ && (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64 )
1965+&& (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_TEXTREL_64))
1966+ continue; /* Can't delete this reloc. */
1967+
1968+ /* Get the section contents. */
1969+ if (contents == NULL)
1970+ {
1971+ if (elf_section_data (sec)->this_hdr.contents != NULL)
1972+ contents = elf_section_data (sec)->this_hdr.contents;
1973+ else
1974+ {
1975+ contents = (bfd_byte *) bfd_malloc (sec->size);
1976+ if (contents == NULL)
1977+ goto error_return;
1978+ if (!bfd_get_section_contents (abfd, sec, contents,
1979+ (file_ptr) 0, sec->size))
1980+ goto error_return;
1981+ elf_section_data (sec)->this_hdr.contents = contents;
1982+ }
1983+ }
1984+
1985+ /* Get the value of the symbol referred to by the reloc. */
1986+ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
1987+ {
1988+ /* A local symbol. */
1989+ asection *sym_sec;
1990+
1991+ isym = isymbuf + ELF64_R_SYM (irel->r_info);
1992+ if (isym->st_shndx == SHN_UNDEF)
1993+ sym_sec = bfd_und_section_ptr;
1994+ else if (isym->st_shndx == SHN_ABS)
1995+ sym_sec = bfd_abs_section_ptr;
1996+ else if (isym->st_shndx == SHN_COMMON)
1997+ sym_sec = bfd_com_section_ptr;
1998+ else
1999+ sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
2000+
2001+ symval = _bfd_elf_rela_local_sym (abfd, isym, &sym_sec, irel);
2002+ }
2003+ else
2004+ {
2005+ unsigned long indx;
2006+ struct elf_link_hash_entry *h;
2007+
2008+ indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info;
2009+ h = elf_sym_hashes (abfd)[indx];
2010+ BFD_ASSERT (h != NULL);
2011+
2012+ if (h->root.type != bfd_link_hash_defined
2013+ && h->root.type != bfd_link_hash_defweak)
2014+ /* This appears to be a reference to an undefined
2015+ symbol. Just ignore it--it will be caught by the
2016+ regular reloc processing. */
2017+ continue;
2018+
2019+ symval = (h->root.u.def.value
2020+ + h->root.u.def.section->output_section->vma
2021+ + h->root.u.def.section->output_offset);
2022+ }
2023+
2024+ /* If this is a PC-relative reloc, subtract the instr offset from
2025+ the symbol value. */
2026+ if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_64_PCREL)
2027+ {
2028+ symval = symval + irel->r_addend
2029+ - (irel->r_offset
2030+ + sec->output_section->vma
2031+ + sec->output_offset);
2032+ }
2033+ else if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_TEXTREL_64)
2034+ {
2035+ symval = symval + irel->r_addend - (sec->output_section->vma);
2036+ }
2037+ else
2038+ symval += irel->r_addend;
2039+
2040+ if ((symval & 0xffff8000) == 0
2041+ || (symval & 0xffff8000) == 0xffff8000)
2042+ {
2043+ /* We can delete this instruction. */
2044+ sdata->relax[sdata->relax_count].addr = irel->r_offset;
2045+ sdata->relax[sdata->relax_count].size = INST_WORD_SIZE;
2046+ sdata->relax_count++;
2047+
2048+ /* Rewrite relocation type. */
2049+ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info))
2050+ {
2051+ case R_MICROBLAZE_64_PCREL:
2052+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2053+ (int) R_MICROBLAZE_32_PCREL_LO);
2054+ break;
2055+ case R_MICROBLAZE_64:
2056+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2057+ (int) R_MICROBLAZE_32_LO);
2058+ break;
2059+ case R_MICROBLAZE_TEXTREL_64:
2060+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2061+ (int) R_MICROBLAZE_TEXTREL_32_LO);
2062+ break;
2063+ default:
2064+ /* Cannot happen. */
2065+ BFD_ASSERT (false);
2066+ }
2067+ }
2068+ } /* Loop through all relocations. */
2069+
2070+ /* Loop through the relocs again, and see if anything needs to change. */
2071+ if (sdata->relax_count > 0)
2072+ {
2073+ shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
2074+ rel_count = 0;
2075+ sdata->relax[sdata->relax_count].addr = sec->size;
2076+
2077+ for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
2078+ {
2079+ bfd_vma nraddr;
2080+
2081+ /* Get the new reloc address. */
2082+ nraddr = irel->r_offset - calc_fixup (irel->r_offset, 0, sec);
2083+ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info))
2084+ {
2085+ default:
2086+ break;
2087+ case R_MICROBLAZE_64_PCREL:
2088+ break;
2089+ case R_MICROBLAZE_64:
2090+ case R_MICROBLAZE_32_LO:
2091+ /* If this reloc is against a symbol defined in this
2092+ section, we must check the addend to see it will put the value in
2093+ range to be adjusted, and hence must be changed. */
2094+ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
2095+ {
2096+ isym = isymbuf + ELF64_R_SYM (irel->r_info);
2097+ /* Only handle relocs against .text. */
2098+ if (isym->st_shndx == shndx
2099+ && ELF64_ST_TYPE (isym->st_info) == STT_SECTION)
2100+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
2101+ }
2102+ break;
2103+ case R_MICROBLAZE_IMML_64:
2104+ {
2105+ /* This was a PC-relative instruction that was
2106+ completely resolved. */
2107+ int sfix, efix;
2108+ unsigned int val;
2109+ bfd_vma target_address;
2110+ target_address = irel->r_addend + irel->r_offset;
2111+ sfix = calc_fixup (irel->r_offset, 0, sec);
2112+ efix = calc_fixup (target_address, 0, sec);
2113+
2114+ /* Validate the in-band val. */
2115+ val = bfd_get_64 (abfd, contents + irel->r_offset);
2116+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2117+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2118+ }
2119+ irel->r_addend -= (efix - sfix);
2120+ /* Should use HOWTO. */
2121+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2122+ irel->r_addend);
2123+ }
2124+ break;
2125+ case R_MICROBLAZE_NONE:
2126+ case R_MICROBLAZE_32_NONE:
2127+ {
2128+ /* This was a PC-relative instruction that was
2129+ completely resolved. */
2130+ size_t sfix, efix;
2131+ unsigned int val;
2132+ bfd_vma target_address;
2133+ target_address = irel->r_addend + irel->r_offset;
2134+ sfix = calc_fixup (irel->r_offset, 0, sec);
2135+ efix = calc_fixup (target_address, 0, sec);
2136+
2137+ /* Validate the in-band val. */
2138+ val = bfd_get_32 (abfd, contents + irel->r_offset);
2139+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2140+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2141+ }
2142+ irel->r_addend -= (efix - sfix);
2143+ /* Should use HOWTO. */
2144+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
2145+ irel->r_addend);
2146+ }
2147+ break;
2148+ case R_MICROBLAZE_64_NONE:
2149+ {
2150+ /* This was a PC-relative 64-bit instruction that was
2151+ completely resolved. */
2152+ size_t sfix, efix;
2153+ bfd_vma target_address;
2154+ target_address = irel->r_addend + irel->r_offset + INST_WORD_SIZE;
2155+ sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
2156+ efix = calc_fixup (target_address, 0, sec);
2157+ irel->r_addend -= (efix - sfix);
2158+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2159+ irel->r_addend);
2160+ }
2161+ break;
2162+ }
2163+ irel->r_offset = nraddr;
2164+ } /* Change all relocs in this section. */
2165+
2166+ /* Look through all other sections. */
2167+ for (o = abfd->sections; o != NULL; o = o->next)
2168+ {
2169+ Elf_Internal_Rela *irelocs;
2170+ Elf_Internal_Rela *irelscan, *irelscanend;
2171+ bfd_byte *ocontents;
2172+
2173+ if (o == sec
2174+ || (o->flags & SEC_RELOC) == 0
2175+ || o->reloc_count == 0)
2176+ continue;
2177+
2178+ /* We always cache the relocs. Perhaps, if info->keep_memory is
2179+ false, we should free them, if we are permitted to. */
2180+
2181+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, true);
2182+ if (irelocs == NULL)
2183+ goto error_return;
2184+
2185+ ocontents = NULL;
2186+ irelscanend = irelocs + o->reloc_count;
2187+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2188+ {
2189+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2190+ {
2191+ unsigned int val;
2192+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2193+ continue;
2194+
2195+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2196+
2197+ /* hax: We only do the following fixup for debug location lists. */
2198+ if (strcmp(".debug_loc", o->name))
2199+ continue;
2200+
2201+ /* This was a PC-relative instruction that was completely resolved. */
2202+ if (ocontents == NULL)
2203+ {
2204+ if (elf_section_data (o)->this_hdr.contents != NULL)
2205+ ocontents = elf_section_data (o)->this_hdr.contents;
2206+ else
2207+ {
2208+ /* We always cache the section contents.
2209+ Perhaps, if info->keep_memory is false, we
2210+ should free them, if we are permitted to. */
2211+
2212+ if (o->rawsize == 0)
2213+ o->rawsize = o->size;
2214+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2215+ if (ocontents == NULL)
2216+ goto error_return;
2217+ if (!bfd_get_section_contents (abfd, o, ocontents,
2218+ (file_ptr) 0,
2219+ o->rawsize))
2220+ goto error_return;
2221+ elf_section_data (o)->this_hdr.contents = ocontents;
2222+ }
2223+ }
2224+
2225+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
2226+ if (val != irelscan->r_addend) {
2227+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
2228+ }
2229+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
2230+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
2231+ irelscan->r_addend);
2232+ }
2233+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
2234+ || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
2235+ {
2236+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2237+ continue;
2238+
2239+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2240+
2241+ /* Look at the reloc only if the value has been resolved. */
2242+ if (isym->st_shndx == shndx
2243+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2244+ {
2245+ if (ocontents == NULL)
2246+ {
2247+ if (elf_section_data (o)->this_hdr.contents != NULL)
2248+ ocontents = elf_section_data (o)->this_hdr.contents;
2249+ else
2250+ {
2251+ /* We always cache the section contents.
2252+ Perhaps, if info->keep_memory is false, we
2253+ should free them, if we are permitted to. */
2254+ if (o->rawsize == 0)
2255+ o->rawsize = o->size;
2256+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2257+ if (ocontents == NULL)
2258+ goto error_return;
2259+ if (!bfd_get_section_contents (abfd, o, ocontents,
2260+ (file_ptr) 0,
2261+ o->rawsize))
2262+ goto error_return;
2263+ elf_section_data (o)->this_hdr.contents = ocontents;
2264+ }
2265+
2266+ }
2267+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
2268+ }
2269+ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
2270+ {
2271+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2272+ continue;
2273+
2274+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2275+
2276+ /* Look at the reloc only if the value has been resolved. */
2277+ if (ocontents == NULL)
2278+ {
2279+ if (elf_section_data (o)->this_hdr.contents != NULL)
2280+ ocontents = elf_section_data (o)->this_hdr.contents;
2281+ else
2282+ {
2283+ /* We always cache the section contents.
2284+ Perhaps, if info->keep_memory is false, we
2285+ should free them, if we are permitted to. */
2286+
2287+ if (o->rawsize == 0)
2288+ o->rawsize = o->size;
2289+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2290+ if (ocontents == NULL)
2291+ goto error_return;
2292+ if (!bfd_get_section_contents (abfd, o, ocontents,
2293+ (file_ptr) 0,
2294+ o->rawsize))
2295+ goto error_return;
2296+ elf_section_data (o)->this_hdr.contents = ocontents;
2297+ }
2298+ }
2299+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
2300+ + isym->st_value,
2301+ 0,
2302+ sec);
2303+ }
2304+ }
2305+ else if ((ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_PCREL_LO)
2306+ || (ELF32_R_TYPE (irelscan->r_info)
2307+ == (int) R_MICROBLAZE_32_LO)
2308+ || (ELF32_R_TYPE (irelscan->r_info)
2309+ == (int) R_MICROBLAZE_TEXTREL_32_LO))
2310+ {
2311+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2312+ continue;
2313+
2314+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2315+
2316+ /* Look at the reloc only if the value has been resolved. */
2317+ if (isym->st_shndx == shndx
2318+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2319+ {
2320+ bfd_vma immediate;
2321+ bfd_vma target_address;
2322+
2323+ if (ocontents == NULL)
2324+ {
2325+ if (elf_section_data (o)->this_hdr.contents != NULL)
2326+ ocontents = elf_section_data (o)->this_hdr.contents;
2327+ else
2328+ {
2329+ /* We always cache the section contents.
2330+ Perhaps, if info->keep_memory is false, we
2331+ should free them, if we are permitted to. */
2332+ if (o->rawsize == 0)
2333+ o->rawsize = o->size;
2334+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2335+ if (ocontents == NULL)
2336+ goto error_return;
2337+ if (!bfd_get_section_contents (abfd, o, ocontents,
2338+ (file_ptr) 0,
2339+ o->rawsize))
2340+ goto error_return;
2341+ elf_section_data (o)->this_hdr.contents = ocontents;
2342+ }
2343+ }
2344+
2345+ unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
2346+ immediate = instr & 0x0000ffff;
2347+ target_address = immediate;
2348+ offset = calc_fixup (target_address, 0, sec);
2349+ immediate -= offset;
2350+ irelscan->r_addend -= offset;
2351+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
2352+ irelscan->r_addend);
2353+ }
2354+ }
2355+
2356+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64
2357+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64))
2358+ {
2359+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2360+ continue;
2361+
2362+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2363+
2364+ /* Look at the reloc only if the value has been resolved. */
2365+ if (isym->st_shndx == shndx
2366+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2367+ {
2368+ bfd_vma immediate;
2369+
2370+ if (ocontents == NULL)
2371+ {
2372+ if (elf_section_data (o)->this_hdr.contents != NULL)
2373+ ocontents = elf_section_data (o)->this_hdr.contents;
2374+ else
2375+ {
2376+ /* We always cache the section contents.
2377+ Perhaps, if info->keep_memory is false, we
2378+ should free them, if we are permitted to. */
2379+
2380+ if (o->rawsize == 0)
2381+ o->rawsize = o->size;
2382+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2383+ if (ocontents == NULL)
2384+ goto error_return;
2385+ if (!bfd_get_section_contents (abfd, o, ocontents,
2386+ (file_ptr) 0,
2387+ o->rawsize))
2388+ goto error_return;
2389+ elf_section_data (o)->this_hdr.contents = ocontents;
2390+ }
2391+ }
2392+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents
2393+ + irelscan->r_offset);
2394+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
2395+ + irelscan->r_offset
2396+ + INST_WORD_SIZE);
2397+ if ((instr_hi & 0xff000000) == 0xb2000000)
2398+ immediate = (instr_hi & 0x00ffffff) << 24;
2399+ else
2400+ immediate = (instr_hi & 0x0000ffff) << 16;
2401+ immediate |= (instr_lo & 0x0000ffff);
2402+ offset = calc_fixup (irelscan->r_addend, 0, sec);
2403+ immediate -= offset;
2404+ irelscan->r_addend -= offset;
2405+
2406+ }
2407+ }
2408+ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
2409+ {
2410+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
2411+ continue;
2412+
2413+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2414+
2415+ /* Look at the reloc only if the value has been resolved. */
2416+ if (isym->st_shndx == shndx
2417+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2418+ {
2419+ bfd_vma immediate;
2420+ bfd_vma target_address;
2421+
2422+ if (ocontents == NULL)
2423+ {
2424+ if (elf_section_data (o)->this_hdr.contents != NULL)
2425+ ocontents = elf_section_data (o)->this_hdr.contents;
2426+ else
2427+ {
2428+ /* We always cache the section contents.
2429+ Perhaps, if info->keep_memory is false, we
2430+ should free them, if we are permitted to. */
2431+ if (o->rawsize == 0)
2432+ o->rawsize = o->size;
2433+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2434+ if (ocontents == NULL)
2435+ goto error_return;
2436+ if (!bfd_get_section_contents (abfd, o, ocontents,
2437+ (file_ptr) 0,
2438+ o->rawsize))
2439+ goto error_return;
2440+ elf_section_data (o)->this_hdr.contents = ocontents;
2441+ }
2442+ }
2443+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents
2444+ + irelscan->r_offset);
2445+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
2446+ + irelscan->r_offset
2447+ + INST_WORD_SIZE);
2448+ if ((instr_hi & 0xff000000) == 0xb2000000)
2449+ immediate = (instr_hi & 0x00ffffff) << 24;
2450+ else
2451+ immediate = (instr_hi & 0x0000ffff) << 16;
2452+ immediate |= (instr_lo & 0x0000ffff);
2453+ target_address = immediate;
2454+ offset = calc_fixup (target_address, 0, sec);
2455+ immediate -= offset;
2456+ irelscan->r_addend -= offset;
2457+ microblaze_bfd_write_imm_value_64 (abfd, ocontents
2458+ + irelscan->r_offset, immediate);
2459+ }
2460+ }
2461+ }
2462+ }
2463+
2464+ /* Adjust the local symbols defined in this section. */
2465+ isymend = isymbuf + symtab_hdr->sh_info;
2466+ for (isym = isymbuf; isym < isymend; isym++)
2467+ {
2468+ if (isym->st_shndx == shndx)
2469+ {
2470+ isym->st_value -= calc_fixup (isym->st_value, 0, sec);
2471+ if (isym->st_size)
2472+ isym->st_size -= calc_fixup (isym->st_value, isym->st_size, sec);
2473+ }
2474+ }
2475+
2476+ /* Now adjust the global symbols defined in this section. */
2477+ isym = isymbuf + symtab_hdr->sh_info;
2478+ symcount = (symtab_hdr->sh_size / sizeof (Elf64_External_Sym)) - symtab_hdr->sh_info;
2479+ for (sym_index = 0; sym_index < symcount; sym_index++)
2480+ {
2481+ sym_hash = elf_sym_hashes (abfd)[sym_index];
2482+ if ((sym_hash->root.type == bfd_link_hash_defined
2483+ || sym_hash->root.type == bfd_link_hash_defweak)
2484+ && sym_hash->root.u.def.section == sec)
2485+ {
2486+ sym_hash->root.u.def.value -= calc_fixup (sym_hash->root.u.def.value,
2487+ 0, sec);
2488+ if (sym_hash->size)
2489+ sym_hash->size -= calc_fixup (sym_hash->root.u.def.value,
2490+ sym_hash->size, sec);
2491+ }
2492+ }
2493+
2494+ /* Physically move the code and change the cooked size. */
2495+ dest = sdata->relax[0].addr;
2496+ for (i = 0; i < sdata->relax_count; i++)
2497+ {
2498+ size_t len;
2499+ src = sdata->relax[i].addr + sdata->relax[i].size;
2500+ len = (sdata->relax[i+1].addr - sdata->relax[i].addr
2501+ - sdata->relax[i].size);
2502+
2503+ memmove (contents + dest, contents + src, len);
2504+ sec->size -= sdata->relax[i].size;
2505+ dest += len;
2506+ }
2507+
2508+ elf_section_data (sec)->relocs = internal_relocs;
2509+
2510+ elf_section_data (sec)->this_hdr.contents = contents;
2511+
2512+ symtab_hdr->contents = (bfd_byte *) isymbuf;
2513+ }
2514+
2515+ if (internal_relocs != NULL
2516+ && elf_section_data (sec)->relocs != internal_relocs)
2517+ free (internal_relocs);
2518+
2519+ if (contents != NULL
2520+ && elf_section_data (sec)->this_hdr.contents != contents)
2521+ {
2522+ if (! link_info->keep_memory)
2523+ free (contents);
2524+ else
2525+ {
2526+ /* Cache the section contents for elf_link_input_bfd. */
2527+ elf_section_data (sec)->this_hdr.contents = contents;
2528+ }
2529+ }
2530+
2531+ if (sdata->relax_count == 0)
2532+ {
2533+ *again = false;
2534+ free (sdata->relax);
2535+ sdata->relax = NULL;
2536+ }
2537+ else
2538+ *again = true;
2539+ return true;
2540+
2541+ error_return:
2542+ if (isymbuf != NULL
2543+ && symtab_hdr->contents != (unsigned char *) isymbuf)
2544+ free (isymbuf);
2545+ if (internal_relocs != NULL
2546+ && elf_section_data (sec)->relocs != internal_relocs)
2547+ free (internal_relocs);
2548+ if (contents != NULL
2549+ && elf_section_data (sec)->this_hdr.contents != contents)
2550+ free (contents);
2551+ free (sdata->relax);
2552+ sdata->relax = NULL;
2553+ sdata->relax_count = 0;
2554+ return false;
2555+}
2556+
2557+/* Return the section that should be marked against GC for a given
2558+ relocation. */
2559+
2560+static asection *
2561+microblaze_elf_gc_mark_hook (asection *sec,
2562+ struct bfd_link_info * info,
2563+ Elf_Internal_Rela * rel,
2564+ struct elf_link_hash_entry * h,
2565+ Elf_Internal_Sym * sym)
2566+{
2567+ if (h != NULL)
2568+ switch (ELF64_R_TYPE (rel->r_info))
2569+ {
2570+ case R_MICROBLAZE_GNU_VTINHERIT:
2571+ case R_MICROBLAZE_GNU_VTENTRY:
2572+ return NULL;
2573+ }
2574+
2575+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2576+}
2577+
2578+/* Update the got entry reference counts for the section being removed. */
2579+
2580+static bool
2581+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
2582+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
2583+ asection * sec ATTRIBUTE_UNUSED,
2584+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
2585+{
2586+ return true;
2587+}
2588+
2589+/* PIC support. */
2590+
2591+#define PLT_ENTRY_SIZE 16
2592+
2593+#define PLT_ENTRY_WORD_0 0xb0000000 /* "imm 0". */
2594+#define PLT_ENTRY_WORD_1 0xe9940000 /* "lwi r12,r20,0" - relocated to lwi r12,r20,func@GOT. */
2595+#define PLT_ENTRY_WORD_1_NOPIC 0xe9800000 /* "lwi r12,r0,0" - non-PIC object. */
2596+#define PLT_ENTRY_WORD_2 0x98186000 /* "brad r12". */
2597+#define PLT_ENTRY_WORD_3 0x80000000 /* "nop". */
2598+
2599+/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
2600+ shortcuts to them in our hash table. */
2601+
2602+static bool
2603+update_local_sym_info (bfd *abfd,
2604+ Elf_Internal_Shdr *symtab_hdr,
2605+ unsigned long r_symndx,
2606+ unsigned int tls_type)
2607+{
2608+ bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
2609+ unsigned char *local_got_tls_masks;
2610+
2611+ if (local_got_refcounts == NULL)
2612+ {
2613+ bfd_size_type size = symtab_hdr->sh_info;
2614+
2615+ size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks));
2616+ local_got_refcounts = bfd_zalloc (abfd, size);
2617+ if (local_got_refcounts == NULL)
2618+ return false;
2619+ elf_local_got_refcounts (abfd) = local_got_refcounts;
2620+ }
2621+
2622+ local_got_tls_masks =
2623+ (unsigned char *) (local_got_refcounts + symtab_hdr->sh_info);
2624+ local_got_tls_masks[r_symndx] |= tls_type;
2625+ local_got_refcounts[r_symndx] += 1;
2626+
2627+ return true;
2628+}
2629+/* Look through the relocs for a section during the first phase. */
2630+
2631+static bool
2632+microblaze_elf_check_relocs (bfd * abfd,
2633+ struct bfd_link_info * info,
2634+ asection * sec,
2635+ const Elf_Internal_Rela * relocs)
2636+{
2637+ Elf_Internal_Shdr * symtab_hdr;
2638+ struct elf_link_hash_entry ** sym_hashes;
2639+ struct elf_link_hash_entry ** sym_hashes_end;
2640+ const Elf_Internal_Rela * rel;
2641+ const Elf_Internal_Rela * rel_end;
2642+ struct elf64_mb_link_hash_table *htab;
2643+ asection *sreloc = NULL;
2644+
2645+ if (bfd_link_relocatable (info))
2646+ return true;
2647+
2648+ htab = elf64_mb_hash_table (info);
2649+ if (htab == NULL)
2650+ return false;
2651+
2652+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
2653+ sym_hashes = elf_sym_hashes (abfd);
2654+ sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf64_External_Sym);
2655+ if (!elf_bad_symtab (abfd))
2656+ sym_hashes_end -= symtab_hdr->sh_info;
2657+
2658+ rel_end = relocs + sec->reloc_count;
2659+
2660+ for (rel = relocs; rel < rel_end; rel++)
2661+ {
2662+ unsigned int r_type;
2663+ struct elf_link_hash_entry * h;
2664+ unsigned long r_symndx;
2665+ unsigned char tls_type = 0;
2666+
2667+ r_symndx = ELF64_R_SYM (rel->r_info);
2668+ r_type = ELF64_R_TYPE (rel->r_info);
2669+
2670+ if (r_symndx < symtab_hdr->sh_info)
2671+ h = NULL;
2672+ else
2673+ {
2674+ h = sym_hashes [r_symndx - symtab_hdr->sh_info];
2675+ while (h->root.type == bfd_link_hash_indirect
2676+ || h->root.type == bfd_link_hash_warning)
2677+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
2678+ /* PR15323, ref flags aren't set for references in the same
2679+ object. */
2680+ h->root.non_ir_ref_regular = 1;
2681+ }
2682+
2683+ switch (r_type)
2684+ {
2685+ /* This relocation describes the C++ object vtable hierarchy.
2686+ Reconstruct it for later use during GC. */
2687+ case R_MICROBLAZE_GNU_VTINHERIT:
2688+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
2689+ return false;
2690+ break;
2691+
2692+ /* This relocation describes which C++ vtable entries are actually
2693+ used. Record for later use during GC. */
2694+ case R_MICROBLAZE_GNU_VTENTRY:
2695+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
2696+ return false;
2697+ break;
2698+
2699+ /* This relocation requires .plt entry. */
2700+ case R_MICROBLAZE_PLT_64:
2701+ if (h != NULL)
2702+ {
2703+ h->needs_plt = 1;
2704+ h->plt.refcount += 1;
2705+ }
2706+ break;
2707+
2708+ /* This relocation requires .got entry. */
2709+ case R_MICROBLAZE_TLSGD:
2710+ tls_type |= (TLS_TLS | TLS_GD);
2711+ goto dogottls;
2712+ case R_MICROBLAZE_TLSLD:
2713+ tls_type |= (TLS_TLS | TLS_LD);
2714+ /* Fall through. */
2715+ dogottls:
2716+ sec->has_tls_reloc = 1;
2717+ /* Fall through. */
2718+ case R_MICROBLAZE_GOT_64:
2719+ if (htab->elf.sgot == NULL)
2720+ {
2721+ if (htab->elf.dynobj == NULL)
2722+ htab->elf.dynobj = abfd;
2723+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2724+ return false;
2725+ }
2726+ if (h != NULL)
2727+ {
2728+ h->got.refcount += 1;
2729+ elf64_mb_hash_entry (h)->tls_mask |= tls_type;
2730+ }
2731+ else
2732+ {
2733+ if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) )
2734+ return false;
2735+ }
2736+ break;
2737+
2738+ case R_MICROBLAZE_GOTOFF_64:
2739+ case R_MICROBLAZE_GOTOFF_32:
2740+ if (htab->elf.sgot == NULL)
2741+ {
2742+ if (htab->elf.dynobj == NULL)
2743+ htab->elf.dynobj = abfd;
2744+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2745+ return false;
2746+ }
2747+ break;
2748+
2749+ case R_MICROBLAZE_64:
2750+ case R_MICROBLAZE_64_PCREL:
2751+ case R_MICROBLAZE_32:
2752+ case R_MICROBLAZE_IMML_64:
2753+ {
2754+ if (h != NULL && !bfd_link_pic (info))
2755+ {
2756+ /* we may need a copy reloc. */
2757+ h->non_got_ref = 1;
2758+
2759+ /* we may also need a .plt entry. */
2760+ h->plt.refcount += 1;
2761+ if (ELF64_R_TYPE (rel->r_info) != R_MICROBLAZE_64_PCREL)
2762+ h->pointer_equality_needed = 1;
2763+ }
2764+
2765+
2766+ /* If we are creating a shared library, and this is a reloc
2767+ against a global symbol, or a non PC relative reloc
2768+ against a local symbol, then we need to copy the reloc
2769+ into the shared library. However, if we are linking with
2770+ -Bsymbolic, we do not need to copy a reloc against a
2771+ global symbol which is defined in an object we are
2772+ including in the link (i.e., DEF_REGULAR is set). At
2773+ this point we have not seen all the input files, so it is
2774+ possible that DEF_REGULAR is not set now but will be set
2775+ later (it is never cleared). In case of a weak definition,
2776+ DEF_REGULAR may be cleared later by a strong definition in
2777+ a shared library. We account for that possibility below by
2778+ storing information in the relocs_copied field of the hash
2779+ table entry. A similar situation occurs when creating
2780+ shared libraries and symbol visibility changes render the
2781+ symbol local.
2782+
2783+ If on the other hand, we are creating an executable, we
2784+ may need to keep relocations for symbols satisfied by a
2785+ dynamic library if we manage to avoid copy relocs for the
2786+ symbol. */
2787+
2788+ if ((bfd_link_pic (info)
2789+ && (sec->flags & SEC_ALLOC) != 0
2790+ && (r_type != R_MICROBLAZE_64_PCREL
2791+ || (h != NULL
2792+ && (! info->symbolic
2793+ || h->root.type == bfd_link_hash_defweak
2794+ || !h->def_regular))))
2795+ || (!bfd_link_pic (info)
2796+ && (sec->flags & SEC_ALLOC) != 0
2797+ && h != NULL
2798+ && (h->root.type == bfd_link_hash_defweak
2799+ || !h->def_regular)))
2800+ {
2801+ struct elf64_mb_dyn_relocs *p;
2802+ struct elf64_mb_dyn_relocs **head;
2803+
2804+ /* When creating a shared object, we must copy these
2805+ relocs into the output file. We create a reloc
2806+ section in dynobj and make room for the reloc. */
2807+
2808+ if (sreloc == NULL)
2809+ {
2810+ bfd *dynobj;
2811+
2812+ if (htab->elf.dynobj == NULL)
2813+ htab->elf.dynobj = abfd;
2814+ dynobj = htab->elf.dynobj;
2815+
2816+ sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj,
2817+ 2, abfd, 1);
2818+ if (sreloc == NULL)
2819+ return false;
2820+ }
2821+
2822+ /* If this is a global symbol, we count the number of
2823+ relocations we need for this symbol. */
2824+ if (h != NULL)
2825+ head = &h->dyn_relocs;
2826+ else
2827+ {
2828+ /* Track dynamic relocs needed for local syms too.
2829+ We really need local syms available to do this
2830+ easily. Oh well. */
2831+
2832+ asection *s;
2833+ Elf_Internal_Sym *isym;
2834+ void *vpp;
2835+
2836+ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
2837+ abfd, r_symndx);
2838+ if (isym == NULL)
2839+ return false;
2840+
2841+ s = bfd_section_from_elf_index (abfd, isym->st_shndx);
2842+ if (s == NULL)
2843+ return false;
2844+
2845+ vpp = &elf_section_data (s)->local_dynrel;
2846+ head = (struct elf64_mb_dyn_relocs **) vpp;
2847+ }
2848+
2849+ p = *head;
2850+ if (p == NULL || p->sec != sec)
2851+ {
2852+ size_t amt = sizeof *p;
2853+ p = ((struct elf64_mb_dyn_relocs *)
2854+ bfd_alloc (htab->elf.dynobj, amt));
2855+ if (p == NULL)
2856+ return false;
2857+ p->next = *head;
2858+ *head = p;
2859+ p->sec = sec;
2860+ p->count = 0;
2861+ p->pc_count = 0;
2862+ }
2863+
2864+ p->count += 1;
2865+ if (r_type == R_MICROBLAZE_64_PCREL)
2866+ p->pc_count += 1;
2867+ }
2868+ }
2869+ break;
2870+ }
2871+ }
2872+
2873+ return true;
2874+}
2875+
2876+static bool
2877+microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
2878+{
2879+ struct elf64_mb_link_hash_table *htab;
2880+
2881+ htab = elf64_mb_hash_table (info);
2882+ if (htab == NULL)
2883+ return false;
2884+
2885+ if (!htab->sgot && !_bfd_elf_create_got_section (dynobj, info))
2886+ return false;
2887+
2888+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
2889+ return false;
2890+
2891+ htab->splt = bfd_get_linker_section (dynobj, ".plt");
2892+ htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
2893+ htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
2894+ if (!bfd_link_pic (info))
2895+ htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
2896+
2897+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
2898+ || (!bfd_link_pic (info) && !htab->srelbss))
2899+ abort ();
2900+
2901+ return true;
2902+}
2903+
2904+/* Copy the extra info we tack onto an elf_link_hash_entry. */
2905+
2906+static void
2907+microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
2908+ struct elf_link_hash_entry *dir,
2909+ struct elf_link_hash_entry *ind)
2910+{
2911+ struct elf64_mb_link_hash_entry *edir, *eind;
2912+
2913+ edir = (struct elf64_mb_link_hash_entry *) dir;
2914+ eind = (struct elf64_mb_link_hash_entry *) ind;
2915+
2916+ if (eind->dyn_relocs != NULL)
2917+ {
2918+ if (edir->dyn_relocs != NULL)
2919+ {
2920+ struct elf64_mb_dyn_relocs **pp;
2921+ struct elf64_mb_dyn_relocs *p;
2922+
2923+ if (ind->root.type == bfd_link_hash_indirect)
2924+ abort ();
2925+
2926+ /* Add reloc counts against the weak sym to the strong sym
2927+ list. Merge any entries against the same section. */
2928+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
2929+ {
2930+ struct elf64_mb_dyn_relocs *q;
2931+
2932+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
2933+ if (q->sec == p->sec)
2934+ {
2935+ q->pc_count += p->pc_count;
2936+ q->count += p->count;
2937+ *pp = p->next;
2938+ break;
2939+ }
2940+ if (q == NULL)
2941+ pp = &p->next;
2942+ }
2943+ *pp = edir->dyn_relocs;
2944+ }
2945+
2946+ edir->dyn_relocs = eind->dyn_relocs;
2947+ eind->dyn_relocs = NULL;
2948+ }
2949+
2950+ edir->tls_mask |= eind->tls_mask;
2951+
2952+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
2953+}
2954+
2955+static bool
2956+microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
2957+ struct elf_link_hash_entry *h)
2958+{
2959+ struct elf64_mb_link_hash_table *htab;
2960+ struct elf64_mb_link_hash_entry * eh;
2961+ struct elf64_mb_dyn_relocs *p;
2962+ asection *sdynbss;
2963+ asection *s, *srel;
2964+ unsigned int power_of_two;
2965+ bfd *dynobj;
2966+
2967+ htab = elf64_mb_hash_table (info);
2968+ if (htab == NULL)
2969+ return false;
2970+
2971+ /* If this is a function, put it in the procedure linkage table. We
2972+ will fill in the contents of the procedure linkage table later,
2973+ when we know the address of the .got section. */
2974+ if (h->type == STT_FUNC
2975+ || h->needs_plt)
2976+ {
2977+ if (h->plt.refcount <= 0
2978+ || SYMBOL_CALLS_LOCAL (info, h)
2979+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
2980+ && h->root.type == bfd_link_hash_undefweak))
2981+ {
2982+ /* This case can occur if we saw a PLT reloc in an input
2983+ file, but the symbol was never referred to by a dynamic
2984+ object, or if all references were garbage collected. In
2985+ such a case, we don't actually need to build a procedure
2986+ linkage table, and we can just do a PC32 reloc instead. */
2987+ h->plt.offset = (bfd_vma) -1;
2988+ h->needs_plt = 0;
2989+ }
2990+
2991+ return true;
2992+ }
2993+ else
2994+ /* It's possible that we incorrectly decided a .plt reloc was
2995+ needed for an R_MICROBLAZE_64_PCREL reloc to a non-function sym in
2996+ check_relocs. We can't decide accurately between function and
2997+ non-function syms in check-relocs; Objects loaded later in
2998+ the link may change h->type. So fix it now. */
2999+ h->plt.offset = (bfd_vma) -1;
3000+
3001+ /* If this is a weak symbol, and there is a real definition, the
3002+ processor independent code will have arranged for us to see the
3003+ real definition first, and we can just use the same value. */
3004+ if (h->is_weakalias)
3005+ {
3006+ struct elf_link_hash_entry *def = weakdef (h);
3007+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
3008+ h->root.u.def.section = def->root.u.def.section;
3009+ h->root.u.def.value = def->root.u.def.value;
3010+ return true;
3011+ }
3012+
3013+ /* This is a reference to a symbol defined by a dynamic object which
3014+ is not a function. */
3015+
3016+ /* If we are creating a shared library, we must presume that the
3017+ only references to the symbol are via the global offset table.
3018+ For such cases we need not do anything here; the relocations will
3019+ be handled correctly by relocate_section. */
3020+ if (bfd_link_pic (info))
3021+ return true;
3022+
3023+ /* If there are no references to this symbol that do not use the
3024+ GOT, we don't need to generate a copy reloc. */
3025+ if (!h->non_got_ref)
3026+ return true;
3027+
3028+ /* If -z nocopyreloc was given, we won't generate them either. */
3029+ if (info->nocopyreloc)
3030+ {
3031+ h->non_got_ref = 0;
3032+ return true;
3033+ }
3034+
3035+ eh = (struct elf64_mb_link_hash_entry *) h;
3036+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
3037+ {
3038+ s = p->sec->output_section;
3039+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
3040+ break;
3041+ }
3042+
3043+ /* If we didn't find any dynamic relocs in read-only sections, then
3044+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
3045+ if (p == NULL)
3046+ {
3047+ h->non_got_ref = 0;
3048+ return true;
3049+ }
3050+
3051+ /* We must allocate the symbol in our .dynbss section, which will
3052+ become part of the .bss section of the executable. There will be
3053+ an entry for this symbol in the .dynsym section. The dynamic
3054+ object will contain position independent code, so all references
3055+ from the dynamic object to this symbol will go through the global
3056+ offset table. The dynamic linker will use the .dynsym entry to
3057+ determine the address it must put in the global offset table, so
3058+ both the dynamic object and the regular object will refer to the
3059+ same memory location for the variable. */
3060+
3061+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
3062+ to copy the initial value out of the dynamic object and into the
3063+ runtime process image. */
3064+ dynobj = elf_hash_table (info)->dynobj;
3065+ BFD_ASSERT (dynobj != NULL);
3066+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
3067+ {
3068+ htab->srelbss->size += sizeof (Elf64_External_Rela);
3069+ h->needs_copy = 1;
3070+ }
3071+
3072+ /* We need to figure out the alignment required for this symbol. I
3073+ have no idea how ELF linkers handle this. */
3074+ power_of_two = bfd_log2 (h->size);
3075+ if (power_of_two > 3)
3076+ power_of_two = 3;
3077+
3078+ sdynbss = htab->sdynbss;
3079+ /* Apply the required alignment. */
3080+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
3081+ if (power_of_two > sdynbss->alignment_power)
3082+ {
3083+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
3084+ return false;
3085+ }
3086+
3087+ /* Define the symbol as being at this point in the section. */
3088+ h->root.u.def.section = s;
3089+ h->root.u.def.value = s->size;
3090+
3091+ /* Increment the section size to make room for the symbol. */
3092+ s->size += h->size;
3093+ return true;
3094+}
3095+
3096+/* Allocate space in .plt, .got and associated reloc sections for
3097+ dynamic relocs. */
3098+
3099+static bool
3100+allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
3101+{
3102+ struct bfd_link_info *info;
3103+ struct elf64_mb_link_hash_table *htab;
3104+ struct elf64_mb_link_hash_entry *eh;
3105+ struct elf64_mb_dyn_relocs *p;
3106+
3107+ if (h->root.type == bfd_link_hash_indirect)
3108+ return true;
3109+
3110+ info = (struct bfd_link_info *) dat;
3111+ htab = elf64_mb_hash_table (info);
3112+ if (htab == NULL)
3113+ return false;
3114+
3115+ if (htab->elf.dynamic_sections_created
3116+ && h->plt.refcount > 0)
3117+ {
3118+ /* Make sure this symbol is output as a dynamic symbol.
3119+ Undefined weak syms won't yet be marked as dynamic. */
3120+ if (h->dynindx == -1
3121+ && !h->forced_local)
3122+ {
3123+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3124+ return false;
3125+ }
3126+
3127+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
3128+ {
3129+ asection *s = htab->elf.splt;
3130+
3131+ /* The first entry in .plt is reserved. */
3132+ if (s->size == 0)
3133+ s->size = PLT_ENTRY_SIZE;
3134+
3135+ h->plt.offset = s->size;
3136+
3137+ /* If this symbol is not defined in a regular file, and we are
3138+ not generating a shared library, then set the symbol to this
3139+ location in the .plt. This is required to make function
3140+ pointers compare as equal between the normal executable and
3141+ the shared library. */
3142+ if (! bfd_link_pic (info)
3143+ && !h->def_regular)
3144+ {
3145+ h->root.u.def.section = s;
3146+ h->root.u.def.value = h->plt.offset;
3147+ }
3148+
3149+ /* Make room for this entry. */
3150+ s->size += PLT_ENTRY_SIZE;
3151+
3152+ /* We also need to make an entry in the .got.plt section, which
3153+ will be placed in the .got section by the linker script. */
3154+ htab->elf.sgotplt->size += 4;
3155+
3156+ /* We also need to make an entry in the .rel.plt section. */
3157+ htab->elf.srelplt->size += sizeof (Elf64_External_Rela);
3158+ }
3159+ else
3160+ {
3161+ h->plt.offset = (bfd_vma) -1;
3162+ h->needs_plt = 0;
3163+ }
3164+ }
3165+ else
3166+ {
3167+ h->plt.offset = (bfd_vma) -1;
3168+ h->needs_plt = 0;
3169+ }
3170+
3171+ eh = (struct elf64_mb_link_hash_entry *) h;
3172+ if (h->got.refcount > 0)
3173+ {
3174+ unsigned int need;
3175+ asection *s;
3176+
3177+ /* Make sure this symbol is output as a dynamic symbol.
3178+ Undefined weak syms won't yet be marked as dynamic. */
3179+ if (h->dynindx == -1
3180+ && !h->forced_local)
3181+ {
3182+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3183+ return false;
3184+ }
3185+
3186+ need = 0;
3187+ if ((eh->tls_mask & TLS_TLS) != 0)
3188+ {
3189+ /* Handle TLS Symbol */
3190+ if ((eh->tls_mask & TLS_LD) != 0)
3191+ {
3192+ if (!eh->elf.def_dynamic)
3193+ /* We'll just use htab->tlsld_got.offset. This should
3194+ always be the case. It's a little odd if we have
3195+ a local dynamic reloc against a non-local symbol. */
3196+ htab->tlsld_got.refcount += 1;
3197+ else
3198+ need += 8;
3199+ }
3200+ if ((eh->tls_mask & TLS_GD) != 0)
3201+ need += 8;
3202+ }
3203+ else
3204+ {
3205+ /* Regular (non-TLS) symbol */
3206+ need += 4;
3207+ }
3208+ if (need == 0)
3209+ {
3210+ h->got.offset = (bfd_vma) -1;
3211+ }
3212+ else
3213+ {
3214+ s = htab->elf.sgot;
3215+ h->got.offset = s->size;
3216+ s->size += need;
3217+ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4);
3218+ }
3219+ }
3220+ else
3221+ h->got.offset = (bfd_vma) -1;
3222+
3223+ if (eh->dyn_relocs == NULL)
3224+ return true;
3225+
3226+ /* In the shared -Bsymbolic case, discard space allocated for
3227+ dynamic pc-relative relocs against symbols which turn out to be
3228+ defined in regular objects. For the normal shared case, discard
3229+ space for pc-relative relocs that have become local due to symbol
3230+ visibility changes. */
3231+
3232+ if (bfd_link_pic (info))
3233+ {
3234+ if (h->def_regular
3235+ && (h->forced_local
3236+ || info->symbolic))
3237+ {
3238+ struct elf64_mb_dyn_relocs **pp;
3239+
3240+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
3241+ {
3242+ p->count -= p->pc_count;
3243+ p->pc_count = 0;
3244+ if (p->count == 0)
3245+ *pp = p->next;
3246+ else
3247+ pp = &p->next;
3248+ }
3249+ }
3250+ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
3251+ h->dyn_relocs = NULL;
3252+ }
3253+ else
3254+ {
3255+ /* For the non-shared case, discard space for relocs against
3256+ symbols which turn out to need copy relocs or are not
3257+ dynamic. */
3258+
3259+ if (!h->non_got_ref
3260+ && ((h->def_dynamic
3261+ && !h->def_regular)
3262+ || (htab->elf.dynamic_sections_created
3263+ && (h->root.type == bfd_link_hash_undefweak
3264+ || h->root.type == bfd_link_hash_undefined))))
3265+ {
3266+ /* Make sure this symbol is output as a dynamic symbol.
3267+ Undefined weak syms won't yet be marked as dynamic. */
3268+ if (h->dynindx == -1
3269+ && !h->forced_local)
3270+ {
3271+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3272+ return false;
3273+ }
3274+
3275+ /* If that succeeded, we know we'll be keeping all the
3276+ relocs. */
3277+ if (h->dynindx != -1)
3278+ goto keep;
3279+ }
3280+
3281+ h->dyn_relocs = NULL;
3282+
3283+ keep: ;
3284+ }
3285+
3286+ /* Finally, allocate space. */
3287+ for (p = h->dyn_relocs; p != NULL; p = p->next)
3288+ {
3289+ asection *sreloc = elf_section_data (p->sec)->sreloc;
3290+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
3291+ }
3292+
3293+ return true;
3294+}
3295+
3296+/* Set the sizes of the dynamic sections. */
3297+
3298+static bool
3299+microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
3300+ struct bfd_link_info *info)
3301+{
3302+ struct elf64_mb_link_hash_table *htab;
3303+ bfd *dynobj;
3304+ asection *s;
3305+ bfd *ibfd;
3306+
3307+ htab = elf64_mb_hash_table (info);
3308+ if (htab == NULL)
3309+ return false;
3310+
3311+ dynobj = htab->elf.dynobj;
3312+ BFD_ASSERT (dynobj != NULL);
3313+
3314+ /* Set up .got offsets for local syms, and space for local dynamic
3315+ relocs. */
3316+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
3317+ {
3318+ bfd_signed_vma *local_got;
3319+ bfd_signed_vma *end_local_got;
3320+ bfd_size_type locsymcount;
3321+ Elf_Internal_Shdr *symtab_hdr;
3322+ unsigned char *lgot_masks;
3323+ asection *srel;
3324+
3325+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
3326+ continue;
3327+
3328+ for (s = ibfd->sections; s != NULL; s = s->next)
3329+ {
3330+ struct elf_dyn_relocs *p;
3331+
3332+ for (p = ((struct elf64_mb_dyn_relocs *)
3333+ elf_section_data (s)->local_dynrel);
3334+ p != NULL;
3335+ p = p->next)
3336+ {
3337+ if (!bfd_is_abs_section (p->sec)
3338+ && bfd_is_abs_section (p->sec->output_section))
3339+ {
3340+ /* Input section has been discarded, either because
3341+ it is a copy of a linkonce section or due to
3342+ linker script /DISCARD/, so we'll be discarding
3343+ the relocs too. */
3344+ }
3345+ else if (p->count != 0)
3346+ {
3347+ srel = elf_section_data (p->sec)->sreloc;
3348+ srel->size += p->count * sizeof (Elf64_External_Rela);
3349+ if ((p->sec->output_section->flags & SEC_READONLY) != 0)
3350+ info->flags |= DF_TEXTREL;
3351+ }
3352+ }
3353+ }
3354+
3355+ local_got = elf_local_got_refcounts (ibfd);
3356+ if (!local_got)
3357+ continue;
3358+
3359+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
3360+ locsymcount = symtab_hdr->sh_info;
3361+ end_local_got = local_got + locsymcount;
3362+ lgot_masks = (unsigned char *) end_local_got;
3363+ s = htab->elf.sgot;
3364+ srel = htab->elf.srelgot;
3365+
3366+ for (; local_got < end_local_got; ++local_got, ++lgot_masks)
3367+ {
3368+ if (*local_got > 0)
3369+ {
3370+ unsigned int need = 0;
3371+ if ((*lgot_masks & TLS_TLS) != 0)
3372+ {
3373+ if ((*lgot_masks & TLS_GD) != 0)
3374+ need += 8;
3375+ if ((*lgot_masks & TLS_LD) != 0)
3376+ htab->tlsld_got.refcount += 1;
3377+ }
3378+ else
3379+ need += 4;
3380+
3381+ if (need == 0)
3382+ {
3383+ *local_got = (bfd_vma) -1;
3384+ }
3385+ else
3386+ {
3387+ *local_got = s->size;
3388+ s->size += need;
3389+ if (bfd_link_pic (info))
3390+ srel->size += need * (sizeof (Elf64_External_Rela) / 4);
3391+ }
3392+ }
3393+ else
3394+ *local_got = (bfd_vma) -1;
3395+ }
3396+ }
3397+
3398+ /* Allocate global sym .plt and .got entries, and space for global
3399+ sym dynamic relocs. */
3400+ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
3401+
3402+ if (htab->tlsld_got.refcount > 0)
3403+ {
3404+ htab->tlsld_got.offset = htab->elf.sgot->size;
3405+ htab->elf.sgot->size += 8;
3406+ if (bfd_link_pic (info))
3407+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
3408+ }
3409+ else
3410+ htab->tlsld_got.offset = (bfd_vma) -1;
3411+
3412+ if (elf_hash_table (info)->dynamic_sections_created)
3413+ {
3414+ /* Make space for the trailing nop in .plt. */
3415+ if (htab->elf.splt->size > 0)
3416+ htab->elf.splt->size += 4;
3417+ }
3418+
3419+ /* The check_relocs and adjust_dynamic_symbol entry points have
3420+ determined the sizes of the various dynamic sections. Allocate
3421+ memory for them. */
3422+ for (s = dynobj->sections; s != NULL; s = s->next)
3423+ {
3424+ const char *name;
3425+ bool strip = false;
3426+
3427+ if ((s->flags & SEC_LINKER_CREATED) == 0)
3428+ continue;
3429+
3430+ /* It's OK to base decisions on the section name, because none
3431+ of the dynobj section names depend upon the input files. */
3432+ name = bfd_section_name (s);
3433+
3434+ if (startswith (name, ".rela"))
3435+ {
3436+ if (s->size == 0)
3437+ {
3438+ /* If we don't need this section, strip it from the
3439+ output file. This is to handle .rela.bss and
3440+ .rela.plt. We must create it in
3441+ create_dynamic_sections, because it must be created
3442+ before the linker maps input sections to output
3443+ sections. The linker does that before
3444+ adjust_dynamic_symbol is called, and it is that
3445+ function which decides whether anything needs to go
3446+ into these sections. */
3447+ strip = true;
3448+ }
3449+ else
3450+ {
3451+ /* We use the reloc_count field as a counter if we need
3452+ to copy relocs into the output file. */
3453+ s->reloc_count = 0;
3454+ }
3455+ }
3456+ else if (s != htab->elf.splt
3457+ && s != htab->elf.sgot
3458+ && s != htab->elf.sgotplt
3459+ && s != htab->elf.sdynbss
3460+ && s != htab->elf.sdynrelro)
3461+ {
3462+ /* It's not one of our sections, so don't allocate space. */
3463+ continue;
3464+ }
3465+
3466+ if (strip)
3467+ {
3468+ s->flags |= SEC_EXCLUDE;
3469+ continue;
3470+ }
3471+
3472+ /* Allocate memory for the section contents. */
3473+ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
3474+ Unused entries should be reclaimed before the section's contents
3475+ are written out, but at the moment this does not happen. Thus in
3476+ order to prevent writing out garbage, we initialise the section's
3477+ contents to zero. */
3478+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
3479+ if (s->contents == NULL && s->size != 0)
3480+ return false;
3481+ }
3482+
3483+ /* ??? Force DF_BIND_NOW? */
3484+ info->flags |= DF_BIND_NOW;
3485+ return _bfd_elf_add_dynamic_tags (output_bfd, info, true);
3486+}
3487+
3488+/* Finish up dynamic symbol handling. We set the contents of various
3489+ dynamic sections here. */
3490+
3491+static bool
3492+microblaze_elf_finish_dynamic_symbol (bfd *output_bfd,
3493+ struct bfd_link_info *info,
3494+ struct elf_link_hash_entry *h,
3495+ Elf_Internal_Sym *sym)
3496+{
3497+ struct elf64_mb_link_hash_table *htab;
3498+ struct elf64_mb_link_hash_entry *eh = elf64_mb_hash_entry(h);
3499+
3500+ htab = elf64_mb_hash_table (info);
3501+ if (htab == NULL)
3502+ return false;
3503+
3504+ if (h->plt.offset != (bfd_vma) -1)
3505+ {
3506+ asection *splt;
3507+ asection *srela;
3508+ asection *sgotplt;
3509+ Elf_Internal_Rela rela;
3510+ bfd_byte *loc;
3511+ bfd_vma plt_index;
3512+ bfd_vma got_offset;
3513+ bfd_vma got_addr;
3514+
3515+ /* This symbol has an entry in the procedure linkage table. Set
3516+ it up. */
3517+ BFD_ASSERT (h->dynindx != -1);
3518+
3519+ splt = htab->elf.splt;
3520+ srela = htab->elf.srelplt;
3521+ sgotplt = htab->elf.sgotplt;
3522+ BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL);
3523+
3524+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */
3525+ got_offset = (plt_index + 3) * 4; /* 3 reserved ??? */
3526+ got_addr = got_offset;
3527+
3528+ /* For non-PIC objects we need absolute address of the GOT entry. */
3529+ if (!bfd_link_pic (info))
3530+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset;
3531+
3532+ /* Fill in the entry in the procedure linkage table. */
3533+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
3534+ splt->contents + h->plt.offset);
3535+ if (bfd_link_pic (info))
3536+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff),
3537+ splt->contents + h->plt.offset + 4);
3538+ else
3539+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1_NOPIC + (got_addr & 0xffff),
3540+ splt->contents + h->plt.offset + 4);
3541+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_2,
3542+ splt->contents + h->plt.offset + 8);
3543+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_3,
3544+ splt->contents + h->plt.offset + 12);
3545+
3546+ /* Any additions to the .got section??? */
3547+ /* bfd_put_32 (output_bfd,
3548+ splt->output_section->vma + splt->output_offset + h->plt.offset + 4,
3549+ sgotplt->contents + got_offset); */
3550+
3551+ /* Fill in the entry in the .rela.plt section. */
3552+ rela.r_offset = (sgotplt->output_section->vma
3553+ + sgotplt->output_offset
3554+ + got_offset);
3555+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_JUMP_SLOT);
3556+ rela.r_addend = 0;
3557+ loc = srela->contents;
3558+ loc += plt_index * sizeof (Elf64_External_Rela);
3559+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
3560+
3561+ if (!h->def_regular)
3562+ {
3563+ /* Mark the symbol as undefined, rather than as defined in
3564+ the .plt section. Zero the value. */
3565+ sym->st_shndx = SHN_UNDEF;
3566+ sym->st_value = 0;
3567+ }
3568+ }
3569+
3570+ /* h->got.refcount to be checked ? */
3571+ if (h->got.offset != (bfd_vma) -1 &&
3572+ ! ((h->got.offset & 1) ||
3573+ IS_TLS_LD(eh->tls_mask) || IS_TLS_GD(eh->tls_mask)))
3574+ {
3575+ asection *sgot;
3576+ asection *srela;
3577+ bfd_vma offset;
3578+
3579+ /* This symbol has an entry in the global offset table. Set it
3580+ up. */
3581+
3582+ sgot = htab->elf.sgot;
3583+ srela = htab->elf.srelgot;
3584+ BFD_ASSERT (sgot != NULL && srela != NULL);
3585+
3586+ offset = (sgot->output_section->vma + sgot->output_offset
3587+ + (h->got.offset &~ (bfd_vma) 1));
3588+
3589+ /* If this is a -Bsymbolic link, and the symbol is defined
3590+ locally, we just want to emit a RELATIVE reloc. Likewise if
3591+ the symbol was forced to be local because of a version file.
3592+ The entry in the global offset table will already have been
3593+ initialized in the relocate_section function. */
3594+ if (bfd_link_pic (info)
3595+ && ((info->symbolic && h->def_regular)
3596+ || h->dynindx == -1))
3597+ {
3598+ asection *sec = h->root.u.def.section;
3599+ bfd_vma value;
3600+
3601+ value = h->root.u.def.value;
3602+ if (sec->output_section != NULL)
3603+ /* PR 21180: If the output section is NULL, then the symbol is no
3604+ longer needed, and in theory the GOT entry is redundant. But
3605+ it is too late to change our minds now... */
3606+ value += sec->output_section->vma + sec->output_offset;
3607+
3608+ microblaze_elf_output_dynamic_relocation (output_bfd,
3609+ srela, srela->reloc_count++,
3610+ /* symindex= */ 0,
3611+ R_MICROBLAZE_REL, offset,
3612+ value);
3613+ }
3614+ else
3615+ {
3616+ microblaze_elf_output_dynamic_relocation (output_bfd,
3617+ srela, srela->reloc_count++,
3618+ h->dynindx,
3619+ R_MICROBLAZE_GLOB_DAT,
3620+ offset, 0);
3621+ }
3622+
3623+ bfd_put_32 (output_bfd, (bfd_vma) 0,
3624+ sgot->contents + (h->got.offset &~ (bfd_vma) 1));
3625+ }
3626+
3627+ if (h->needs_copy)
3628+ {
3629+ asection *s;
3630+ Elf_Internal_Rela rela;
3631+ bfd_byte *loc;
3632+
3633+ /* This symbols needs a copy reloc. Set it up. */
3634+
3635+ BFD_ASSERT (h->dynindx != -1);
3636+
3637+ rela.r_offset = (h->root.u.def.value
3638+ + h->root.u.def.section->output_section->vma
3639+ + h->root.u.def.section->output_offset);
3640+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_COPY);
3641+ rela.r_addend = 0;
3642+ if (h->root.u.def.section == htab->elf.sdynrelro)
3643+ s = htab->elf.sreldynrelro;
3644+ else
3645+ s = htab->elf.srelbss;
3646+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
3647+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
3648+ }
3649+
3650+ /* Mark some specially defined symbols as absolute. */
3651+ if (h == htab->elf.hdynamic
3652+ || h == htab->elf.hgot
3653+ || h == htab->elf.hplt)
3654+ sym->st_shndx = SHN_ABS;
3655+
3656+ return true;
3657+}
3658+
3659+
3660+/* Finish up the dynamic sections. */
3661+
3662+static bool
3663+microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
3664+ struct bfd_link_info *info)
3665+{
3666+ bfd *dynobj;
3667+ asection *sdyn, *sgot;
3668+ struct elf64_mb_link_hash_table *htab;
3669+
3670+ htab = elf64_mb_hash_table (info);
3671+ if (htab == NULL)
3672+ return false;
3673+
3674+ dynobj = htab->elf.dynobj;
3675+
3676+ sdyn = bfd_get_linker_section (dynobj, ".dynamic");
3677+
3678+ if (htab->elf.dynamic_sections_created)
3679+ {
3680+ asection *splt;
3681+ Elf64_External_Dyn *dyncon, *dynconend;
3682+
3683+ dyncon = (Elf64_External_Dyn *) sdyn->contents;
3684+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
3685+ for (; dyncon < dynconend; dyncon++)
3686+ {
3687+ Elf_Internal_Dyn dyn;
3688+ asection *s;
3689+ bool size;
3690+
3691+ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
3692+
3693+ switch (dyn.d_tag)
3694+ {
3695+ case DT_PLTGOT:
3696+ s = htab->elf.sgotplt;
3697+ size = false;
3698+ break;
3699+
3700+ case DT_PLTRELSZ:
3701+ s = htab->elf.srelplt;
3702+ size = true;
3703+ break;
3704+
3705+ case DT_JMPREL:
3706+ s = htab->elf.srelplt;
3707+ size = false;
3708+ break;
3709+
3710+ default:
3711+ continue;
3712+ }
3713+
3714+ if (s == NULL)
3715+ dyn.d_un.d_val = 0;
3716+ else
3717+ {
3718+ if (!size)
3719+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
3720+ else
3721+ dyn.d_un.d_val = s->size;
3722+ }
3723+ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
3724+ }
3725+
3726+ splt = htab->elf.splt;
3727+ BFD_ASSERT (splt != NULL && sdyn != NULL);
3728+
3729+ /* Clear the first entry in the procedure linkage table,
3730+ and put a nop in the last four bytes. */
3731+ if (splt->size > 0)
3732+ {
3733+ memset (splt->contents, 0, PLT_ENTRY_SIZE);
3734+ bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */,
3735+ splt->contents + splt->size - 4);
3736+
3737+ if (splt->output_section != bfd_abs_section_ptr)
3738+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
3739+ }
3740+ }
3741+
3742+ /* Set the first entry in the global offset table to the address of
3743+ the dynamic section. */
3744+ sgot = htab->elf.sgotplt;
3745+ if (sgot && sgot->size > 0)
3746+ {
3747+ if (sdyn == NULL)
3748+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
3749+ else
3750+ bfd_put_32 (output_bfd,
3751+ sdyn->output_section->vma + sdyn->output_offset,
3752+ sgot->contents);
3753+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
3754+ }
3755+
3756+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
3757+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
3758+
3759+ return true;
3760+}
3761+
3762+/* Hook called by the linker routine which adds symbols from an object
3763+ file. We use it to put .comm items in .sbss, and not .bss. */
3764+
3765+static bool
3766+microblaze_elf_add_symbol_hook (bfd *abfd,
3767+ struct bfd_link_info *info,
3768+ Elf_Internal_Sym *sym,
3769+ const char **namep ATTRIBUTE_UNUSED,
3770+ flagword *flagsp ATTRIBUTE_UNUSED,
3771+ asection **secp,
3772+ bfd_vma *valp)
3773+{
3774+ if (sym->st_shndx == SHN_COMMON
3775+ && !bfd_link_relocatable (info)
3776+ && sym->st_size <= elf_gp_size (abfd))
3777+ {
3778+ /* Common symbols less than or equal to -G nn bytes are automatically
3779+ put into .sbss. */
3780+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3781+ if (*secp == NULL
3782+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON | SEC_SMALL_DATA))
3783+ return false;
3784+
3785+ *valp = sym->st_size;
3786+ }
3787+
3788+ return true;
3789+}
3790+
3791+#define TARGET_LITTLE_SYM microblaze_elf64_le_vec
3792+#define TARGET_LITTLE_NAME "elf64-microblazeel"
3793+
3794+#define TARGET_BIG_SYM microblaze_elf64_vec
3795+#define TARGET_BIG_NAME "elf64-microblaze"
3796+
3797+#define ELF_ARCH bfd_arch_microblaze
3798+#define ELF_TARGET_ID MICROBLAZE_ELF_DATA
3799+#define ELF_MACHINE_CODE EM_MICROBLAZE
3800+#define ELF_MACHINE_ALT1 EM_MICROBLAZE_OLD
3801+#define ELF_MAXPAGESIZE 0x1000
3802+#define elf_info_to_howto microblaze_elf_info_to_howto
3803+#define elf_info_to_howto_rel NULL
3804+
3805+#define bfd_elf64_bfd_reloc_type_lookup microblaze_elf_reloc_type_lookup
3806+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3807+#define bfd_elf64_new_section_hook microblaze_elf_new_section_hook
3808+#define elf_backend_relocate_section microblaze_elf_relocate_section
3809+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3810+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
3811+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3812+
3813+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3814+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
3815+#define elf_backend_check_relocs microblaze_elf_check_relocs
3816+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3817+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
3818+#define elf_backend_can_gc_sections 1
3819+#define elf_backend_can_refcount 1
3820+#define elf_backend_want_got_plt 1
3821+#define elf_backend_plt_readonly 1
3822+#define elf_backend_got_header_size 12
3823+#define elf_backend_want_dynrelro 1
3824+#define elf_backend_rela_normal 1
3825+#define elf_backend_dtrel_excludes_plt 1
3826+
3827+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
3828+#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections
3829+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
3830+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
3831+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
3832+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
3833+
3834+#include "elf64-target.h"
3835diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
3836index 9450882e850..f265e8fc608 100644
3837--- a/gdb/microblaze-tdep.c
3838+++ b/gdb/microblaze-tdep.c
3839@@ -65,8 +65,95 @@
3840 #define IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) \
3841 ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
3842
3843+static const char *microblaze_abi_string;
3844+
3845+static const char *const microblaze_abi_strings[] = {
3846+ "auto",
3847+ "m64",
3848+};
3849+
3850+enum microblaze_abi
3851+microblaze_abi (struct gdbarch *gdbarch)
3852+{
3853+ microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
3854+ return tdep->microblaze_abi;
3855+}
3856 /* The registers of the Xilinx microblaze processor. */
3857
3858+ static struct cmd_list_element *setmicroblazecmdlist = NULL;
3859+ static struct cmd_list_element *showmicroblazecmdlist = NULL;
3860+
3861+static void
3862+microblaze_abi_update (const char *ignore_args,
3863+ int from_tty, struct cmd_list_element *c)
3864+{
3865+ struct gdbarch_info info;
3866+
3867+ /* Force the architecture to update, and (if it's a microblaze architecture)
3868+ * microblaze_gdbarch_init will take care of the rest. */
3869+// gdbarch_info_init (&info);
3870+ gdbarch_update_p (info);
3871+}
3872+
3873+
3874+static enum microblaze_abi
3875+global_microblaze_abi (void)
3876+{
3877+ int i;
3878+
3879+ for (i = 0; microblaze_abi_strings[i] != NULL; i++)
3880+ if (microblaze_abi_strings[i] == microblaze_abi_string)
3881+ return (enum microblaze_abi) i;
3882+
3883+// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
3884+}
3885+
3886+static void
3887+show_microblaze_abi (struct ui_file *file,
3888+ int from_tty,
3889+ struct cmd_list_element *ignored_cmd,
3890+ const char *ignored_value)
3891+{
3892+ enum microblaze_abi global_abi = global_microblaze_abi ();
3893+ enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
3894+ const char *actual_abi_str = microblaze_abi_strings[actual_abi];
3895+
3896+#if 1
3897+ if (global_abi == MICROBLAZE_ABI_AUTO)
3898+ fprintf_filtered
3899+ (file,
3900+ "The microblaze ABI is set automatically (currently \"%s\").\n",
3901+ actual_abi_str);
3902+ else if (global_abi == actual_abi)
3903+ fprintf_filtered
3904+ (file,
3905+ "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
3906+ actual_abi_str);
3907+ else
3908+ {
3909+#endif
3910+ /* Probably shouldn't happen... */
3911+ fprintf_filtered (file,
3912+ "The (auto detected) microblaze ABI \"%s\" is in use "
3913+ "even though the user setting was \"%s\".\n",
3914+ actual_abi_str, microblaze_abi_strings[global_abi]);
3915+ }
3916+}
3917+
3918+static void
3919+show_microblaze_command (const char *args, int from_tty)
3920+{
3921+ help_list (showmicroblazecmdlist, "show microblaze ", all_commands, gdb_stdout);
3922+}
3923+
3924+static void
3925+set_microblaze_command (const char *args, int from_tty)
3926+{
3927+ printf_unfiltered
3928+ ("\"set microblaze\" must be followed by an appropriate subcommand.\n");
3929+ help_list (setmicroblazecmdlist, "set microblaze ", all_commands, gdb_stdout);
3930+}
3931+
3932 static const char * const microblaze_register_names[] =
3933 {
3934 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
3935@@ -85,9 +172,21 @@ static const char * const microblaze_register_names[] =
3936 static unsigned int microblaze_debug_flag = 0;
3937 int reg_size = 4;
3938
3939+unsigned int
3940+microblaze_abi_regsize (struct gdbarch *gdbarch)
3941+{
3942+ switch (microblaze_abi (gdbarch))
3943+ {
3944+ case MICROBLAZE_ABI_M64:
3945+ return 8;
3946+ default:
3947+ return 4;
3948+ }
3949+}
3950+
3951 #define microblaze_debug(fmt, ...) \
3952 debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
3953- fmt, ## __VA_ARGS__)
3954+ fmt, ## __VA_ARGS__)
3955
3956
3957 /* Return the name of register REGNUM. */
3958@@ -867,15 +966,30 @@ static struct gdbarch *
3959 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
3960 {
3961 tdesc_arch_data_up tdesc_data;
3962+ enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
3963 const struct target_desc *tdesc = info.target_desc;
3964
3965+ /* What has the user specified from the command line? */
3966+ wanted_abi = global_microblaze_abi ();
3967+ if (gdbarch_debug)
3968+ fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
3969+ wanted_abi);
3970+ if (wanted_abi != MICROBLAZE_ABI_AUTO)
3971+ microblaze_abi = wanted_abi;
3972+
3973 /* If there is already a candidate, use it. */
3974 arches = gdbarch_list_lookup_by_info (arches, &info);
3975- if (arches != NULL)
3976+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
3977 return arches->gdbarch;
3978+
3979+ if (microblaze_abi == MICROBLAZE_ABI_M64)
3980+ {
3981+ tdesc = tdesc_microblaze64;
3982+ reg_size = 8;
3983+ }
3984 if (tdesc == NULL)
3985 {
3986- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
3987+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
3988 {
3989 tdesc = tdesc_microblaze64;
3990 reg_size = 8;
3991@@ -890,7 +1004,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
3992 int valid_p;
3993 int i;
3994
3995- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
3996+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
3997 feature = tdesc_find_feature (tdesc,
3998 "org.gnu.gdb.microblaze64.core");
3999 else
4000@@ -904,7 +1018,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
4001 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
4002 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
4003 microblaze_register_names[i]);
4004- if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
4005+ if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
4006 feature = tdesc_find_feature (tdesc,
4007 "org.gnu.gdb.microblaze64.stack-protect");
4008 else
4009@@ -954,7 +1068,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
4010 set_gdbarch_ptr_bit (gdbarch, 64);
4011 break;
4012 }
4013-
4014+ if(microblaze_abi == MICROBLAZE_ABI_M64)
4015+ set_gdbarch_ptr_bit (gdbarch, 64);
4016
4017 /* Map Dwarf2 registers to GDB registers. */
4018 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
4019@@ -1014,6 +1129,38 @@ _initialize_microblaze_tdep ()
4020 {
4021 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
4022
4023+// static struct cmd_list_element *setmicroblazecmdlist = NULL;
4024+// static struct cmd_list_element *showmicroblazecmdlist = NULL;
4025+
4026+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
4027+
4028+ add_setshow_prefix_cmd ("microblaze", no_class,
4029+ _("Various microblaze specific commands."),
4030+ _("Various microblaze specific commands."),
4031+ &setmicroblazecmdlist,&showmicroblazecmdlist,
4032+ &setlist,&showlist);
4033+#if 0
4034+ add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
4035+ _("Various microblaze specific commands."),
4036+ &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
4037+
4038+ add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
4039+ _("Various microblaze specific commands."),
4040+ &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
4041+#endif
4042+
4043+ /* Allow the user to override the ABI. */
4044+ add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
4045+ &microblaze_abi_string, _("\
4046+Set the microblaze ABI used by this program."), _("\
4047+Show the microblaze ABI used by this program."), _("\
4048+This option can be set to one of:\n\
4049+ auto - the default ABI associated with the current binary\n\
4050+ m64"),
4051+ microblaze_abi_update,
4052+ show_microblaze_abi,
4053+ &setmicroblazecmdlist, &showmicroblazecmdlist);
4054+
4055 initialize_tdesc_microblaze_with_stack_protect ();
4056 initialize_tdesc_microblaze ();
4057 initialize_tdesc_microblaze64_with_stack_protect ();
4058@@ -1028,5 +1175,4 @@ When non-zero, microblaze specific debugging is enabled."),
4059 NULL,
4060 &setdebuglist, &showdebuglist);
4061
4062-
4063 }
4064diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
4065index 542cdd82070..17a4bb5190c 100644
4066--- a/gdb/microblaze-tdep.h
4067+++ b/gdb/microblaze-tdep.h
4068@@ -19,9 +19,17 @@
4069
4070 #ifndef MICROBLAZE_TDEP_H
4071 #define MICROBLAZE_TDEP_H 1
4072-
4073+#include "objfiles.h"
4074 #include "gdbarch.h"
4075
4076+struct gdbarch;
4077+enum microblaze_abi
4078+ {
4079+ MICROBLAZE_ABI_AUTO = 0,
4080+ MICROBLAZE_ABI_M64,
4081+ };
4082+
4083+enum microblaze_abi microblaze_abi (struct gdbarch *gdbarch);
4084 /* Microblaze architecture-specific information. */
4085 struct microblaze_gregset
4086 {
4087@@ -35,11 +43,14 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep_base
4088 {
4089 int dummy; // declare something.
4090
4091+ enum microblaze_abi microblaze_abi {};
4092+ enum microblaze_abi found_abi {};
4093 /* Register sets. */
4094 struct regset *gregset;
4095 size_t sizeof_gregset;
4096 struct regset *fpregset;
4097 size_t sizeof_fpregset;
4098+ int register_size;
4099 };
4100
4101 /* Register numbers. */
4102--
41032.34.1
4104
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch
deleted file mode 100644
index 3e293276..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1From 48906e1038e469b429aa35d0f967730a929c3880 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 15 Jan 2023 00:16:25 -0800
4Subject: [PATCH 8/8] Define alignof using _Alignof when using C11 or newer
5
6WG14 N2350 made very clear that it is an UB having type definitions
7within "offsetof" [1]. This patch enhances the implementation of macro
8alignof_slot to use builtin "_Alignof" to avoid undefined behavior on
9when using std=c11 or newer
10
11clang 16+ has started to flag this [2]
12
13Fixes build when using -std >= gnu11 and using clang16+
14
15Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
16may support C11, exclude those compilers too
17
18gnulib needs this fix and then it will be applied to downstream packages
19like gdb [3]
20
21[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
22[2] https://reviews.llvm.org/D133574
23[3] https://public-inbox.org/bug-gnulib/20230114232744.215167-1-raj.khem@gmail.com/T/#u
24
25Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=2d404c7dd974cc65f894526f4a1b76bc1dcd8d82]
26Signed-off-by: Khem Raj <raj.khem@gmail.com>
27---
28 libiberty/sha1.c | 10 ++++++++++
29 1 file changed, 10 insertions(+)
30
31diff --git a/libiberty/sha1.c b/libiberty/sha1.c
32index 504f06d3b9b..790ada82443 100644
33--- a/libiberty/sha1.c
34+++ b/libiberty/sha1.c
35@@ -229,7 +229,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
36 if (len >= 64)
37 {
38 #if !_STRING_ARCH_unaligned
39+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
40+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
41+ clang versions < 8.0.0 have the same bug. */
42+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
43+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
44+ && !defined __clang__) \
45+ || (defined __clang__ && __clang_major__ < 8))
46 # define alignof(type) offsetof (struct { char c; type x; }, x)
47+#else
48+# define alignof(type) _Alignof(type)
49+#endif
50 # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
51 if (UNALIGNED_P (buffer))
52 while (len > 64)
53--
542.39.0
55
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch
deleted file mode 100644
index ed1310ce..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 5bdd15553daef7370ca3c1f12d8f14247fdd4907 Mon Sep 17 00:00:00 2001
2From: Yousong Zhou <yszhou4tech@gmail.com>
3Date: Fri, 24 Mar 2017 10:36:03 +0800
4Subject: [PATCH 8/9] Fix invalid sigprocmask call
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The POSIX document says
10
11 The pthread_sigmask() and sigprocmask() functions shall fail if:
12
13 [EINVAL]
14 The value of the how argument is not equal to one of the defined values.
15
16and this is how musl-libc is currently doing. Fix the call to be safe
17and correct
18
19 [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
20
21gdb/ChangeLog:
222017-03-24 Yousong Zhou <yszhou4tech@gmail.com>
23
24 * common/signals-state-save-restore.c (save_original_signals_state):
25 Fix invalid sigprocmask call.
26
27Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek]
28Signed-off-by: André Draszik <adraszik@tycoint.com>
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30---
31 gdbsupport/signals-state-save-restore.cc | 2 +-
32 1 file changed, 1 insertion(+), 1 deletion(-)
33
34diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc
35index 92e799d3551..a4a0234272a 100644
36--- a/gdbsupport/signals-state-save-restore.cc
37+++ b/gdbsupport/signals-state-save-restore.cc
38@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
39 int i;
40 int res;
41
42- res = gdb_sigmask (0, NULL, &original_signal_mask);
43+ res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask);
44 if (res == -1)
45 perror_with_name (("sigprocmask"));
46
47--
482.36.1
49
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
new file mode 100644
index 00000000..6769e1ee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-Depth-Total-number-of-inline-functions-refer-inline-.patch
@@ -0,0 +1,74 @@
1From c37f307714121981fa91766c539913f7912643b7 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 21 Jul 2022 11:45:01 +0530
4Subject: [PATCH 09/54] =?UTF-8?q?Depth:=20Total=20number=20of=20inline=20f?=
5 =?UTF-8?q?unctions=20[refer=20inline-frame.c]=20state->skipped=5Fframes?=
6 =?UTF-8?q?=20:=20Number=20of=20inline=20functions=20skipped.=20the=20curr?=
7 =?UTF-8?q?ent=20unwind=5Fpc=20is=20causing=20an=20issue=20when=20we=20try?=
8 =?UTF-8?q?=20to=20step=20into=20inline=20functions[Depth=20is=20becoming?=
9 =?UTF-8?q?=200].=20It=E2=80=99s=20incrementing=20pc=20by=208=20even=20wit?=
10 =?UTF-8?q?h=20si=20instruction.?=
11MIME-Version: 1.0
12Content-Type: text/plain; charset=UTF-8
13Content-Transfer-Encoding: 8bit
14
15Signed-off-by: Aayush Misra <aayushm@amd.com>
16---
17 gdb/features/microblaze64.xml | 1 +
18 gdb/microblaze-tdep.c | 14 +++-----------
19 2 files changed, 4 insertions(+), 11 deletions(-)
20
21diff --git a/gdb/features/microblaze64.xml b/gdb/features/microblaze64.xml
22index 515d18e65cf..9c1b7d22003 100644
23--- a/gdb/features/microblaze64.xml
24+++ b/gdb/features/microblaze64.xml
25@@ -7,5 +7,6 @@
26
27 <!DOCTYPE target SYSTEM "gdb-target.dtd">
28 <target>
29+ <architecture>microblaze64</architecture>
30 <xi:include href="microblaze64-core.xml"/>
31 </target>
32diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
33index f265e8fc608..3e541789fac 100644
34--- a/gdb/microblaze-tdep.c
35+++ b/gdb/microblaze-tdep.c
36@@ -513,16 +513,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
37 static CORE_ADDR
38 microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
39 {
40- gdb_byte buf[4];
41 CORE_ADDR pc;
42-
43- frame_unwind_register (next_frame, MICROBLAZE_PC_REGNUM, buf);
44- pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
45- /* For sentinel frame, return address is actual PC. For other frames,
46- return address is pc+8. This is a workaround because gcc does not
47- generate correct return address in CIE. */
48- if (frame_relative_level (next_frame) >= 0)
49- pc += 8;
50+ pc=frame_unwind_register_unsigned (next_frame, MICROBLAZE_PC_REGNUM);
51 return pc;
52 }
53
54@@ -553,7 +545,6 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
55 ostart_pc = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL,
56 &cache);
57
58-
59 if (ostart_pc > start_pc)
60 return ostart_pc;
61 return start_pc;
62@@ -660,7 +651,8 @@ static const struct frame_unwind microblaze_frame_unwind =
63 microblaze_frame_this_id,
64 microblaze_frame_prev_register,
65 NULL,
66- default_frame_sniffer
67+ default_frame_sniffer,
68+ NULL,
69 };
70
71 static CORE_ADDR
72--
732.34.1
74
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch
deleted file mode 100644
index 6a930420..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdb-gdserver-Fix-ABI-settings-for-gdbserver.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 53b76bb548720367032a51a6d604c975b10bb30e Mon Sep 17 00:00:00 2001
2From: Aayush Misra <aayushm@amd.com>
3Date: Fri, 29 Mar 2024 14:59:16 +0530
4Subject: [PATCH] gdb/gdserver: Fix ABI settings for gdbserver
5
6Upstream-Status: Pending
7
8---
9 gdb/microblaze-tdep.c | 7 ++++---
10 1 file changed, 4 insertions(+), 3 deletions(-)
11
12diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
13index 38ba38e8c7d..35cec286d8f 100644
14--- a/gdb/microblaze-tdep.c
15+++ b/gdb/microblaze-tdep.c
16@@ -1120,12 +1120,13 @@ void _initialize_microblaze_tdep ();
17 void
18 _initialize_microblaze_tdep ()
19 {
20+ //Setting abi to auto manually, should be able to modify in 'arch'_gdbarch_init function
21+ microblaze_abi_string = microblaze_abi_strings[0];
22+
23 register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
24-// static struct cmd_list_element *setmicroblazecmdlist = NULL;
25-// static struct cmd_list_element *showmicroblazecmdlist = NULL;
26
27- /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
28
29+ /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
30 add_setshow_prefix_cmd ("microblaze", no_class,
31 _("Various microblaze specific commands."),
32 _("Various microblaze specific commands."),
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch
deleted file mode 100644
index f53d3bd1..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From bc3b1f6aacf2d8fe66b022fbfcf28cd82c76e52f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 29 Nov 2018 18:00:23 -0800
4Subject: [PATCH 9/9] gdbserver ctrl-c handling
5
6This problem was created by the upstream commit 78708b7c8c
7After applying the commit, it will send SIGINT to the process
8group(-signal_pid).
9But if we use gdbserver send SIGINT, and the attached process is not a
10process
11group leader, then the "kill (-signal_pid, SIGINT)" returns error and
12fails to
13interrupt the attached process.
14
15Upstream-Status: Submitted
16[https://sourceware.org/bugzilla/show_bug.cgi?id=18945]
17
18Author: Josh Gao
19Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21---
22 gdbserver/linux-low.cc | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
26index 7726a4a0c36..f750e074a03 100644
27--- a/gdbserver/linux-low.cc
28+++ b/gdbserver/linux-low.cc
29@@ -5496,7 +5496,7 @@ linux_process_target::request_interrupt ()
30 {
31 /* Send a SIGINT to the process group. This acts just like the user
32 typed a ^C on the controlling terminal. */
33- ::kill (-signal_pid, SIGINT);
34+ ::kill (signal_pid, SIGINT);
35 }
36
37 bool
38--
392.36.1
40
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
new file mode 100644
index 00000000..e5c88f01
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-gdb-14-build-errors-for-microblaze-xilinx-elf-20.patch
@@ -0,0 +1,133 @@
1From 6b6632b730808a012738f9eddf621abd6463e317 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:53:04 +0530
4Subject: [PATCH 10/54] Fix gdb-14 build errors for microblaze-xilinx-elf
5 2023.2 merge
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/elf64-microblaze.c | 12 ++++++++++++
10 gdb/frame.c | 2 +-
11 gdb/microblaze-tdep.c | 17 +++++++++++------
12 3 files changed, 24 insertions(+), 7 deletions(-)
13
14diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
15index 6cd9753a592..119d266f95a 100755
16--- a/bfd/elf64-microblaze.c
17+++ b/bfd/elf64-microblaze.c
18@@ -750,6 +750,18 @@ microblaze_elf_info_to_howto (bfd * abfd,
19 return true;
20 }
21
22+/* Relax table contains information about instructions which can
23+ be removed by relaxation -- replacing a long address with a
24+ short address. */
25+struct relax_table
26+{
27+ /* Address where bytes may be deleted. */
28+ bfd_vma addr;
29+
30+ /* Number of bytes to be deleted. */
31+ size_t size;
32+};
33+
34 struct _microblaze_elf_section_data
35 {
36 struct bfd_elf_section_data elf;
37diff --git a/gdb/frame.c b/gdb/frame.c
38index c4d967e01d5..8be230e0617 100644
39--- a/gdb/frame.c
40+++ b/gdb/frame.c
41@@ -1315,7 +1315,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
42 int i;
43
44 const gdb_byte *buf = NULL;
45- if (value_entirely_available(value)) {
46+ if (value->entirely_available()) {
47 gdb::array_view<const gdb_byte> buf = value->contents ();
48 }
49
50diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
51index 3e541789fac..f7d9d6419ce 100644
52--- a/gdb/microblaze-tdep.c
53+++ b/gdb/microblaze-tdep.c
54@@ -75,7 +75,7 @@ static const char *const microblaze_abi_strings[] = {
55 enum microblaze_abi
56 microblaze_abi (struct gdbarch *gdbarch)
57 {
58- microblaze_gdbarch_tdep *tdep = (microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
59+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
60 return tdep->microblaze_abi;
61 }
62 /* The registers of the Xilinx microblaze processor. */
63@@ -120,12 +120,12 @@ show_microblaze_abi (struct ui_file *file,
64
65 #if 1
66 if (global_abi == MICROBLAZE_ABI_AUTO)
67- fprintf_filtered
68+ gdb_printf
69 (file,
70 "The microblaze ABI is set automatically (currently \"%s\").\n",
71 actual_abi_str);
72 else if (global_abi == actual_abi)
73- fprintf_filtered
74+ gdb_printf
75 (file,
76 "The microblaze ABI is assumed to be \"%s\" (due to user setting).\n",
77 actual_abi_str);
78@@ -133,7 +133,7 @@ show_microblaze_abi (struct ui_file *file,
79 {
80 #endif
81 /* Probably shouldn't happen... */
82- fprintf_filtered (file,
83+ gdb_printf (file,
84 "The (auto detected) microblaze ABI \"%s\" is in use "
85 "even though the user setting was \"%s\".\n",
86 actual_abi_str, microblaze_abi_strings[global_abi]);
87@@ -934,7 +934,7 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
88 void *cb_data,
89 const struct regcache *regcache)
90 {
91- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
92+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
93
94 cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
95
96@@ -942,6 +942,8 @@ microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
97 }
98
99
100+#if 0
101+// compilation errors - function is not actually used ?
102 static void
103 make_regs (struct gdbarch *arch)
104 {
105@@ -953,6 +955,7 @@ make_regs (struct gdbarch *arch)
106 set_gdbarch_ptr_bit (arch, 64);
107 }
108 }
109+#endif
110
111 static struct gdbarch *
112 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
113@@ -964,7 +967,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
114 /* What has the user specified from the command line? */
115 wanted_abi = global_microblaze_abi ();
116 if (gdbarch_debug)
117- fprintf_unfiltered (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
118+ gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
119 wanted_abi);
120 if (wanted_abi != MICROBLAZE_ABI_AUTO)
121 microblaze_abi = wanted_abi;
122@@ -1038,6 +1041,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
123 gdbarch *gdbarch
124 = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep));
125
126+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
127+
128 tdep->gregset = NULL;
129 tdep->sizeof_gregset = 0;
130 tdep->fpregset = NULL;
131--
1322.34.1
133
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
new file mode 100644
index 00000000..d7e51502
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0011-fix-gdb-microblaze-xilinx-elf-crash-issue-on-invocat.patch
@@ -0,0 +1,28 @@
1From 389711a13933a60323d368d5e5f1f54bd171b16b Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 29 Feb 2024 10:55:16 +0530
4Subject: [PATCH 11/54] fix gdb microblaze-xilinx-elf crash issue on invocation
5 Regression from merging microblaze 64-bit support
6
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 gdb/microblaze-tdep.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
13index f7d9d6419ce..d4b9ef837e5 100644
14--- a/gdb/microblaze-tdep.c
15+++ b/gdb/microblaze-tdep.c
16@@ -1124,6 +1124,9 @@ void _initialize_microblaze_tdep ();
17 void
18 _initialize_microblaze_tdep ()
19 {
20+ //Setting abi to auto manually, should be able to modify in 'arch'_gdbarch_init function
21+ microblaze_abi_string = microblaze_abi_strings[0];
22+
23 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
24
25 // static struct cmd_list_element *setmicroblazecmdlist = NULL;
26--
272.34.1
28
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
new file mode 100644
index 00000000..8e966788
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0013-Disable-the-warning-message-for-eh_frame_hdr.patch
@@ -0,0 +1,35 @@
1From ee4f6d0c1ea82b531d7481692e499fc0b35c88a8 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 13/54] Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7
8Conflicts:
9 bfd/elf-eh-frame.c
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/elf-eh-frame.c | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
16index bf7a9902355..21029b59632 100644
17--- a/bfd/elf-eh-frame.c
18+++ b/bfd/elf-eh-frame.c
19@@ -1045,10 +1045,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
20 goto success;
21
22 free_no_table:
23+/* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
24+if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
25 _bfd_error_handler
26 /* xgettext:c-format */
27 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
28 abfd, sec);
29+}
30 hdr_info->u.dwarf.table = false;
31 free (sec_info);
32 success:
33--
342.34.1
35
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
new file mode 100644
index 00000000..41118c1a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0015-upstream-change-to-garbage-collection-sweep-causes-m.patch
@@ -0,0 +1,43 @@
1From 6531ec7f986fff48b9efc883526018f494cf88fb Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 15/54] upstream change to garbage collection sweep causes mb
5 regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21
22Conflicts:
23 bfd/elflink.c
24Signed-off-by: Aayush Misra <aayushm@amd.com>
25---
26 bfd/elflink.c | 1 -
27 1 file changed, 1 deletion(-)
28
29diff --git a/bfd/elflink.c b/bfd/elflink.c
30index ca162145f7e..0524019641e 100644
31--- a/bfd/elflink.c
32+++ b/bfd/elflink.c
33@@ -6608,7 +6608,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
34
35 inf = (struct elf_gc_sweep_symbol_info *) data;
36 (*inf->hide_symbol) (inf->info, h, true);
37- h->def_regular = 0;
38 h->ref_regular = 0;
39 h->ref_regular_nonweak = 0;
40 }
41--
422.34.1
43
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch
new file mode 100644
index 00000000..30a7322d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0016-Add-new-bit-field-instructions.patch
@@ -0,0 +1,88 @@
1From 50a52ab3ad64b8525a970744dbb1c5f67dc24886 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 16/54] Add new bit-field instructions
5
6This patches adds new bsefi and bsifi instructions.
7BSEFI- The instruction shall extract a bit field from a
8register and place it right-adjusted in the destination register.
9The other bits in the destination register shall be set to zero
10BSIFI- The instruction shall insert a right-adjusted bit field
11from a register at another position in the destination register.
12The rest of the bits in the destination register shall be unchanged
13
14Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
15
16Conflicts:
17 opcodes/microblaze-dis.c
18
19Conflicts:
20 gas/config/tc-microblaze.c
21 opcodes/microblaze-opc.h
22
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
26 opcodes/microblaze-dis.c | 18 +++++++++-
27 opcodes/microblaze-opc.h | 6 ++++
28 3 files changed, 93 insertions(+), 2 deletions(-)
29
30Index: gdb-14.2/opcodes/microblaze-dis.c
31===================================================================
32--- gdb-14.2.orig/opcodes/microblaze-dis.c
33+++ gdb-14.2/opcodes/microblaze-dis.c
34@@ -113,7 +113,19 @@ get_field_immw (struct string_buf *buf,
35 }
36
37 static char *
38-get_field_rfsl (struct string_buf *buf, long instr)
39+get_field_imm5width (struct string_buf *buf, long instr)
40+{
41+ char *p = strbuf (buf);
42+
43+ if (instr & 0x00004000)
44+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
45+ else
46+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
47+ return p;
48+}
49+
50+static char *
51+get_field_rfsl (struct string_buf *buf,long instr)
52 {
53 char *p = strbuf (buf);
54
55@@ -462,6 +474,10 @@ print_insn_microblaze (bfd_vma memaddr,
56 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
57 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
58 break;
59+ /* For bit field insns. */
60+ case INST_TYPE_RD_R1_IMM5_IMM5:
61+ print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
62+ break;
63 /* For tuqula instruction */
64 case INST_TYPE_RD:
65 print_func (stream, "\t%s", get_field_rd (&buf, inst));
66Index: gdb-14.2/opcodes/microblaze-opc.h
67===================================================================
68--- gdb-14.2.orig/opcodes/microblaze-opc.h
69+++ gdb-14.2/opcodes/microblaze-opc.h
70@@ -68,6 +68,9 @@
71 #define INST_TYPE_R1_IMML 24
72 #define INST_TYPE_RD_R1_IMMW_IMMS 21
73
74+/* For bsefi and bsifi */
75+#define INST_TYPE_RD_R1_IMM5_IMM5 21
76+
77 #define INST_TYPE_NONE 25
78
79
80@@ -587,5 +590,8 @@ char pvr_register_prefix[] = "rpvr";
81 #define MIN_IMML ((long) 0xffffff8000000000L)
82 #define MAX_IMML ((long) 0x0000007fffffffffL)
83
84+#define MIN_IMM_WIDTH ((int) 0x00000001)
85+#define MAX_IMM_WIDTH ((int) 0x00000020)
86+
87 #endif /* MICROBLAZE_OPC */
88
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..dc78da6b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0019-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,150 @@
1From 45f177e5de751f11c2d084c4d836d7f8ef754cb4 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 19/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/bfd-in2.h | 10 ++++++++++
17 bfd/libbfd.h | 2 ++
18 bfd/reloc.c | 12 ++++++++++++
19 gas/config/tc-microblaze.h | 4 +++-
20 ld/Makefile.am | 2 ++
21 ld/configure.tgt | 3 +++
22 opcodes/microblaze-dis.c | 8 ++++++--
23 opcodes/microblaze-opc.h | 11 +++++++----
24 8 files changed, 45 insertions(+), 7 deletions(-)
25
26Index: gdb-14.2/bfd/bfd-in2.h
27===================================================================
28--- gdb-14.2.orig/bfd/bfd-in2.h
29+++ gdb-14.2/bfd/bfd-in2.h
30@@ -6489,12 +6489,22 @@ done here - only used for relaxing */
31 BFD_RELOC_MICROBLAZE_64_NONE,
32
33 /* This is a 64 bit reloc that stores the 32 bit pc relative
34+ * +value in two words (with an imml instruction). No relocation is
35+ * +done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_64,
37+
38+/* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). The relocation is
40 PC-relative GOT offset */
41 BFD_RELOC_MICROBLAZE_64_GOTPC,
42
43 /* This is a 64 bit reloc that stores the 32 bit pc relative
44 value in two words (with an imml instruction). The relocation is
45+PC-relative GOT offset */
46+ BFD_RELOC_MICROBLAZE_64_GPC,
47+
48+/* This is a 64 bit reloc that stores the 32 bit pc relative
49+value in two words (with an imml instruction). The relocation is
50 PC-relative GOT offset */
51 BFD_RELOC_MICROBLAZE_64_GPC,
52
53Index: gdb-14.2/bfd/libbfd.h
54===================================================================
55--- gdb-14.2.orig/bfd/libbfd.h
56+++ gdb-14.2/bfd/libbfd.h
57@@ -3012,7 +3012,9 @@ static const char *const bfd_reloc_code_
58 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
59 "BFD_RELOC_MICROBLAZE_32_NONE",
60 "BFD_RELOC_MICROBLAZE_64_NONE",
61+ "BFD_RELOC_MICROBLAZE_64",
62 "BFD_RELOC_MICROBLAZE_64_GOTPC",
63+ "BFD_RELOC_MICROBLAZE_64_GPC",
64 "BFD_RELOC_MICROBLAZE_64_GOT",
65 "BFD_RELOC_MICROBLAZE_64_PLT",
66 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
67Index: gdb-14.2/bfd/reloc.c
68===================================================================
69--- gdb-14.2.orig/bfd/reloc.c
70+++ gdb-14.2/bfd/reloc.c
71@@ -6703,6 +6703,12 @@ ENUMDOC
72 ENUM
73 BFD_RELOC_MICROBLAZE_64_NONE
74 ENUMDOC
75+ This is a 32 bit reloc that stores the 32 bit pc relative
76+ value in two words (with an imml instruction). No relocation is
77+ done here - only used for relaxing
78+ENUM
79+ BFD_RELOC_MICROBLAZE_64
80+ENUMDOC
81 This is a 64 bit reloc that stores the 32 bit pc relative
82 value in two words (with an imm instruction). No relocation is
83 done here - only used for relaxing
84@@ -6710,6 +6716,12 @@ ENUM
85 BFD_RELOC_MICROBLAZE_64_GOTPC
86 ENUMDOC
87 This is a 64 bit reloc that stores the 32 bit pc relative
88+ value in two words (with an imml instruction). No relocation is
89+ done here - only used for relaxing
90+ENUM
91+ BFD_RELOC_MICROBLAZE_64_GPC
92+ENUMDOC
93+ This is a 64 bit reloc that stores the 32 bit pc relative
94 value in two words (with an imm instruction). The relocation is
95 PC-relative GOT offset
96 ENUM
97Index: gdb-14.2/opcodes/microblaze-dis.c
98===================================================================
99--- gdb-14.2.orig/opcodes/microblaze-dis.c
100+++ gdb-14.2/opcodes/microblaze-dis.c
101@@ -457,6 +457,10 @@ print_insn_microblaze (bfd_vma memaddr,
102 case INST_TYPE_R1_R2_SPECIAL:
103 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
104 get_field_r2 (&buf, inst));
105+ break;
106+ case INST_TYPE_IMML:
107+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
108+ /* TODO: Also print symbol */
109 break;
110 case INST_TYPE_RD_IMM15:
111 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
112@@ -475,8 +479,8 @@ print_insn_microblaze (bfd_vma memaddr,
113 get_field_immw (&buf, inst), get_field_imms (&buf, inst));
114 break;
115 /* For bit field insns. */
116- case INST_TYPE_RD_R1_IMM5_IMM5:
117- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst),get_field_r1(&buf, inst),get_field_imm5width (&buf, inst), get_field_imm5 (&buf, inst));
118+ case INST_TYPE_RD_R1_IMMW_IMMS:
119+ 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));
120 break;
121 /* For tuqula instruction */
122 case INST_TYPE_RD:
123Index: gdb-14.2/opcodes/microblaze-opc.h
124===================================================================
125--- gdb-14.2.orig/opcodes/microblaze-opc.h
126+++ gdb-14.2/opcodes/microblaze-opc.h
127@@ -69,7 +69,13 @@
128 #define INST_TYPE_RD_R1_IMMW_IMMS 21
129
130 /* For bsefi and bsifi */
131-#define INST_TYPE_RD_R1_IMM5_IMM5 21
132+#define INST_TYPE_RD_R1_IMMW_IMMS 21
133+
134+/* For 64-bit instructions */
135+#define INST_TYPE_IMML 22
136+#define INST_TYPE_RD_R1_IMML 23
137+#define INST_TYPE_R1_IMML 24
138+#define INST_TYPE_RD_R1_IMMW_IMMS 21
139
140 #define INST_TYPE_NONE 25
141
142@@ -590,8 +596,5 @@ char pvr_register_prefix[] = "rpvr";
143 #define MIN_IMML ((long) 0xffffff8000000000L)
144 #define MAX_IMML ((long) 0x0000007fffffffffL)
145
146-#define MIN_IMM_WIDTH ((int) 0x00000001)
147-#define MAX_IMM_WIDTH ((int) 0x00000020)
148-
149 #endif /* MICROBLAZE_OPC */
150
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..a1efcf41
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0020-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,82 @@
1From 8ec9b2fe49c8e1e367213fa0b8d6b6f0fedc3456 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 20/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 23 +++++++++++++++++++++++
17 ld/emulparams/elf64microblazeel.sh | 23 +++++++++++++++++++++++
18 2 files changed, 46 insertions(+)
19 create mode 100644 ld/emulparams/elf64microblaze.sh
20 create mode 100644 ld/emulparams/elf64microblazeel.sh
21
22diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
23new file mode 100644
24index 00000000000..9c7b0eb7080
25--- /dev/null
26+++ b/ld/emulparams/elf64microblaze.sh
27@@ -0,0 +1,23 @@
28+SCRIPT_NAME=elfmicroblaze
29+OUTPUT_FORMAT="elf64-microblazeel"
30+#BIG_OUTPUT_FORMAT="elf64-microblaze"
31+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
32+#TEXT_START_ADDR=0
33+NONPAGED_TEXT_START_ADDR=0x28
34+ALIGNMENT=4
35+MAXPAGESIZE=4
36+ARCH=microblaze
37+EMBEDDED=yes
38+
39+NOP=0x80000000
40+
41+# Hmmm, there's got to be a better way. This sets the stack to the
42+# top of the simulator memory (2^19 bytes).
43+#PAGE_SIZE=0x1000
44+#DATA_ADDR=0x10000
45+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
46+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
47+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
48+
49+TEMPLATE_NAME=elf32
50+#GENERATE_SHLIB_SCRIPT=yes
51diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
52new file mode 100644
53index 00000000000..9c7b0eb7080
54--- /dev/null
55+++ b/ld/emulparams/elf64microblazeel.sh
56@@ -0,0 +1,23 @@
57+SCRIPT_NAME=elfmicroblaze
58+OUTPUT_FORMAT="elf64-microblazeel"
59+#BIG_OUTPUT_FORMAT="elf64-microblaze"
60+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
61+#TEXT_START_ADDR=0
62+NONPAGED_TEXT_START_ADDR=0x28
63+ALIGNMENT=4
64+MAXPAGESIZE=4
65+ARCH=microblaze
66+EMBEDDED=yes
67+
68+NOP=0x80000000
69+
70+# Hmmm, there's got to be a better way. This sets the stack to the
71+# top of the simulator memory (2^19 bytes).
72+#PAGE_SIZE=0x1000
73+#DATA_ADDR=0x10000
74+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
75+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
76+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
77+
78+TEMPLATE_NAME=elf32
79+#GENERATE_SHLIB_SCRIPT=yes
80--
812.34.1
82
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..caf24b8d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0021-Added-relocations-for-MB-X.patch
@@ -0,0 +1,69 @@
1From 818a103460da557761aacc0d21b9b087721d2d3e Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 21/54] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/reloc.c | 26 ++++++++++++++------------
16 gas/config/tc-microblaze.c | 11 +++++++++++
17 2 files changed, 25 insertions(+), 12 deletions(-)
18
19Index: gdb-14.2/bfd/reloc.c
20===================================================================
21--- gdb-14.2.orig/bfd/reloc.c
22+++ gdb-14.2/bfd/reloc.c
23@@ -6703,12 +6703,6 @@ ENUMDOC
24 ENUM
25 BFD_RELOC_MICROBLAZE_64_NONE
26 ENUMDOC
27- This is a 32 bit reloc that stores the 32 bit pc relative
28- value in two words (with an imml instruction). No relocation is
29- done here - only used for relaxing
30-ENUM
31- BFD_RELOC_MICROBLAZE_64
32-ENUMDOC
33 This is a 64 bit reloc that stores the 32 bit pc relative
34 value in two words (with an imm instruction). No relocation is
35 done here - only used for relaxing
36@@ -6716,12 +6710,6 @@ ENUM
37 BFD_RELOC_MICROBLAZE_64_GOTPC
38 ENUMDOC
39 This is a 64 bit reloc that stores the 32 bit pc relative
40- value in two words (with an imml instruction). No relocation is
41- done here - only used for relaxing
42-ENUM
43- BFD_RELOC_MICROBLAZE_64_GPC
44-ENUMDOC
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 PC-relative GOT offset
48 ENUM
49@@ -7976,6 +7964,20 @@ ENUMX
50 ENUMDOC
51 Linux eBPF relocations.
52
53+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
54+ to two words (uses imml instruction).
55+ENUM
56+BFD_RELOC_MICROBLAZE_64,
57+ENUMDOC
58+ This is a 64 bit reloc that stores the 64 bit pc relative
59+ value in two words (with an imml instruction). No relocation is
60+ done here - only used for relaxing
61+ENUM
62+BFD_RELOC_MICROBLAZE_64_PCREL,
63+ENUMDOC
64+ This is a 32 bit reloc that stores the 32 bit pc relative
65+ value in two words (with an imml instruction). No relocation is
66+ done here - only used for relaxing
67 ENUM
68 BFD_RELOC_EPIPHANY_SIMM8
69 ENUMDOC
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
new file mode 100644
index 00000000..2023287a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0022-initial-support-for-MicroBlaze-64-bit-m64.patch
@@ -0,0 +1,113 @@
1From 587d5179ce81a4f67ebec321063f6c3c9b1673cb Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 22/54] initial support for MicroBlaze 64 bit [-m64]
5
6Conflicts:
7 bfd/elf32-microblaze.c
8 include/elf/common.h
9 ld/Makefile.am
10 ld/Makefile.in
11signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
12 Mahesh Bodapati<mbodapat@xilinx.com>
13
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 bfd/elf64-microblaze.c | 8 +
17 bfd/reloc.c | 42 ++-
18 gas/config/tc-microblaze.c | 558 ++++++++++++++++++++++++++++++++-----
19 3 files changed, 507 insertions(+), 101 deletions(-)
20
21Index: gdb-14.2/bfd/elf64-microblaze.c
22===================================================================
23--- gdb-14.2.orig/bfd/elf64-microblaze.c
24+++ gdb-14.2/bfd/elf64-microblaze.c
25@@ -1666,6 +1666,14 @@ microblaze_elf_relocate_section (bfd *ou
26 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
27 outrel.r_addend = relocation + addend;
28 }
29+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
30+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
31+ {
32+ insn &= ~0x00ffffff;
33+ insn |= (relocation >> 16) & 0xffffff;
34+ bfd_put_32 (input_bfd, insn,
35+ contents + offset + endian);
36+ }
37 else
38 {
39 BFD_FAIL ();
40Index: gdb-14.2/bfd/reloc.c
41===================================================================
42--- gdb-14.2.orig/bfd/reloc.c
43+++ gdb-14.2/bfd/reloc.c
44@@ -6703,13 +6703,31 @@ ENUMDOC
45 ENUM
46 BFD_RELOC_MICROBLAZE_64_NONE
47 ENUMDOC
48+ This is a 32 bit reloc that stores the 32 bit pc relative
49+ value in two words (with an imml instruction). No relocation is
50+ done here - only used for relaxing
51+ENUM
52+ BFD_RELOC_MICROBLAZE_64
53+ENUMDOC
54 This is a 64 bit reloc that stores the 32 bit pc relative
55 value in two words (with an imm instruction). No relocation is
56 done here - only used for relaxing
57 ENUM
58+BFD_RELOC_MICROBLAZE_64_PCREL,
59+ENUMDOC
60+ This is a 32 bit reloc that stores the 32 bit pc relative
61+ value in two words (with an imml instruction). No relocation is
62+ done here - only used for relaxing
63+ENUM
64 BFD_RELOC_MICROBLAZE_64_GOTPC
65 ENUMDOC
66 This is a 64 bit reloc that stores the 32 bit pc relative
67+ value in two words (with an imml instruction). No relocation is
68+ done here - only used for relaxing
69+ENUM
70+ BFD_RELOC_MICROBLAZE_64_GPC
71+ENUMDOC
72+ This is a 64 bit reloc that stores the 32 bit pc relative
73 value in two words (with an imm instruction). The relocation is
74 PC-relative GOT offset
75 ENUM
76@@ -7942,18 +7960,6 @@ ENUMDOC
77 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
78 to two words (uses imml instruction).
79 ENUM
80-BFD_RELOC_MICROBLAZE_64,
81-ENUMDOC
82- This is a 64 bit reloc that stores the 64 bit pc relative
83- value in two words (with an imml instruction). No relocation is
84- done here - only used for relaxing
85-ENUM
86-BFD_RELOC_MICROBLAZE_64_PCREL,
87-ENUMDOC
88- This is a 32 bit reloc that stores the 32 bit pc relative
89- value in two words (with an imml instruction). No relocation is
90- done here - only used for relaxing
91-ENUM
92 BFD_RELOC_BPF_64
93 ENUMX
94 BFD_RELOC_BPF_DISP32
95@@ -7967,18 +7973,6 @@ ENUMDOC
96 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
97 to two words (uses imml instruction).
98 ENUM
99-BFD_RELOC_MICROBLAZE_64,
100-ENUMDOC
101- This is a 64 bit reloc that stores the 64 bit pc relative
102- value in two words (with an imml instruction). No relocation is
103- done here - only used for relaxing
104-ENUM
105-BFD_RELOC_MICROBLAZE_64_PCREL,
106-ENUMDOC
107- This is a 32 bit reloc that stores the 32 bit pc relative
108- value in two words (with an imml instruction). No relocation is
109- done here - only used for relaxing
110-ENUM
111 BFD_RELOC_EPIPHANY_SIMM8
112 ENUMDOC
113 Adapteva EPIPHANY - 8 bit signed pc-relative displacement
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch
new file mode 100644
index 00000000..54b0cc45
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0023-Added-relocations-for-MB-X.patch
@@ -0,0 +1,84 @@
1From 4992c1383473b2a37551b7391f1eb836d2a447d3 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 23/54] Added relocations for MB-X
5
6Conflicts:
7 bfd/bfd-in2.h
8 gas/config/tc-microblaze.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12
13Signed-off-by: Aayush Misra <aayushm@amd.com>
14---
15 bfd/libbfd.h | 2 --
16 bfd/reloc.c | 26 ++++++++-------
17 gas/config/tc-microblaze.c | 68 ++++++++++++--------------------------
18 3 files changed, 36 insertions(+), 60 deletions(-)
19
20Index: gdb-14.2/bfd/libbfd.h
21===================================================================
22--- gdb-14.2.orig/bfd/libbfd.h
23+++ gdb-14.2/bfd/libbfd.h
24@@ -3012,9 +3012,7 @@ static const char *const bfd_reloc_code_
25 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
26 "BFD_RELOC_MICROBLAZE_32_NONE",
27 "BFD_RELOC_MICROBLAZE_64_NONE",
28- "BFD_RELOC_MICROBLAZE_64",
29 "BFD_RELOC_MICROBLAZE_64_GOTPC",
30- "BFD_RELOC_MICROBLAZE_64_GPC",
31 "BFD_RELOC_MICROBLAZE_64_GOT",
32 "BFD_RELOC_MICROBLAZE_64_PLT",
33 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
34Index: gdb-14.2/bfd/reloc.c
35===================================================================
36--- gdb-14.2.orig/bfd/reloc.c
37+++ gdb-14.2/bfd/reloc.c
38@@ -6669,6 +6669,20 @@ ENUM
39 ENUMDOC
40 Address of a GOT entry.
41
42+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
43+ to two words (uses imml instruction).
44+ENUM
45+BFD_RELOC_MICROBLAZE_64,
46+ENUMDOC
47+ This is a 64 bit reloc that stores the 64 bit pc relative
48+ value in two words (with an imml instruction). No relocation is
49+ done here - only used for relaxing
50+ENUM
51+BFD_RELOC_MICROBLAZE_64_PCREL,
52+ENUMDOC
53+ This is a 32 bit reloc that stores the 32 bit pc relative
54+ value in two words (with an imml instruction). No relocation is
55+ done here - only used for relaxing
56 ENUM
57 BFD_RELOC_MICROBLAZE_32_LO
58 ENUMDOC
59@@ -6707,12 +6721,6 @@ ENUMDOC
60 value in two words (with an imml instruction). No relocation is
61 done here - only used for relaxing
62 ENUM
63- BFD_RELOC_MICROBLAZE_64
64-ENUMDOC
65- This is a 64 bit reloc that stores the 32 bit pc relative
66- value in two words (with an imm instruction). No relocation is
67- done here - only used for relaxing
68-ENUM
69 BFD_RELOC_MICROBLAZE_64_PCREL,
70 ENUMDOC
71 This is a 32 bit reloc that stores the 32 bit pc relative
72@@ -6725,12 +6733,6 @@ ENUMDOC
73 value in two words (with an imml instruction). No relocation is
74 done here - only used for relaxing
75 ENUM
76- BFD_RELOC_MICROBLAZE_64_GPC
77-ENUMDOC
78- This is a 64 bit reloc that stores the 32 bit pc relative
79- value in two words (with an imm instruction). The relocation is
80- PC-relative GOT offset
81-ENUM
82 BFD_RELOC_MICROBLAZE_64_GOT
83 ENUMDOC
84 This is a 64 bit reloc that stores the 32 bit pc relative
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch
new file mode 100644
index 00000000..e495e207
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0025-Fixed-address-computation-issues-with-64bit-address-.patch
@@ -0,0 +1,35 @@
1From 33e22262c6c43af6e7e075df0665838b5b3859a6 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 25/54] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
6
7Conflicts:
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
10
11Conflicts:
12 bfd/elf64-microblaze.c
13
14Conflicts:
15 bfd/elf64-microblaze.c
16
17Signed-off-by: Aayush Misra <aayushm@amd.com>
18---
19 bfd/elf64-microblaze.c | 2 +-
20 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
21 2 files changed, 67 insertions(+), 9 deletions(-)
22
23Index: gdb-14.2/bfd/elf64-microblaze.c
24===================================================================
25--- gdb-14.2.orig/bfd/elf64-microblaze.c
26+++ gdb-14.2/bfd/elf64-microblaze.c
27@@ -2131,7 +2131,7 @@ microblaze_elf_relax_section (bfd *abfd,
28 efix = calc_fixup (target_address, 0, sec);
29
30 /* Validate the in-band val. */
31- val = bfd_get_32 (abfd, contents + irel->r_offset);
32+ val = bfd_get_64 (abfd, contents + irel->r_offset);
33 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
34 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
35 }
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
new file mode 100644
index 00000000..f6598cee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0028-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -0,0 +1,26 @@
1From 646b229752b9816b25d2b9ffe79b895b69742745 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 28/54] fixing the long & long long mingw toolchain issue
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gas/config/tc-microblaze.c | 10 +++++-----
9 opcodes/microblaze-opc.h | 4 ++--
10 2 files changed, 7 insertions(+), 7 deletions(-)
11
12Index: gdb-14.2/opcodes/microblaze-opc.h
13===================================================================
14--- gdb-14.2.orig/opcodes/microblaze-opc.h
15+++ gdb-14.2/opcodes/microblaze-opc.h
16@@ -593,8 +593,8 @@ char pvr_register_prefix[] = "rpvr";
17 #define MIN_IMM6_WIDTH ((int) 0x00000001)
18 #define MAX_IMM6_WIDTH ((int) 0x00000040)
19
20-#define MIN_IMML ((long) 0xffffff8000000000L)
21-#define MAX_IMML ((long) 0x0000007fffffffffL)
22+#define MIN_IMML ((long long) 0xffffff8000000000L)
23+#define MAX_IMML ((long long) 0x0000007fffffffffL)
24
25 #endif /* MICROBLAZE_OPC */
26
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch
new file mode 100644
index 00000000..8e9585a0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0029-Added-support-to-new-arithmetic-single-register-inst.patch
@@ -0,0 +1,176 @@
1From 1a9a688939dfbf7cca9685b326c0387672c567b4 Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 29/54] Added support to new arithmetic single register
5 instructions
6
7Conflicts:
8 opcodes/microblaze-dis.c
9
10Conflicts:
11 gas/config/tc-microblaze.c
12 opcodes/microblaze-dis.c
13
14Conflicts:
15 gas/config/tc-microblaze.c
16signed-off-by:Nagaraju <nmekala@xilinx.com>
17 Mahesh <mbodapat@xilinx.com>
18
19Signed-off-by: Aayush Misra <aayushm@amd.com>
20---
21 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
22 opcodes/microblaze-dis.c | 11 +++
23 opcodes/microblaze-opc.h | 43 ++++++++++-
24 opcodes/microblaze-opcm.h | 5 +-
25 4 files changed, 200 insertions(+), 6 deletions(-)
26
27Index: gdb-14.2/opcodes/microblaze-dis.c
28===================================================================
29--- gdb-14.2.orig/opcodes/microblaze-dis.c
30+++ gdb-14.2/opcodes/microblaze-dis.c
31@@ -143,6 +143,14 @@ get_field_imm15 (struct string_buf *buf,
32 return p;
33 }
34
35+get_field_imm16 (struct string_buf *buf, long instr)
36+{
37+ char *p = strbuf (buf);
38+
39+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
40+ return p;
41+}
42+
43 static char *
44 get_field_special (struct string_buf *buf, long instr,
45 const struct op_code_struct *op)
46@@ -473,6 +481,9 @@ print_insn_microblaze (bfd_vma memaddr,
47 /* For mbar 16 or sleep insn. */
48 case INST_TYPE_NONE:
49 break;
50+ case INST_TYPE_RD_IMML:
51+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
52+ break;
53 /* For bit field insns. */
54 case INST_TYPE_RD_R1_IMMW_IMMS:
55 print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
56Index: gdb-14.2/opcodes/microblaze-opc.h
57===================================================================
58--- gdb-14.2.orig/opcodes/microblaze-opc.h
59+++ gdb-14.2/opcodes/microblaze-opc.h
60@@ -78,6 +78,7 @@
61 #define INST_TYPE_RD_R1_IMMW_IMMS 21
62
63 #define INST_TYPE_NONE 25
64+#define INST_TYPE_RD_IMML 26
65
66
67
68@@ -93,6 +94,7 @@
69 #define IMMVAL_MASK_MFS 0x0000
70
71 #define OPCODE_MASK_H 0xFC000000 /* High 6 bits only. */
72+#define OPCODE_MASK_LIMM 0xFC1F0000 /* High 6 bits and 12-16 bits */
73 #define OPCODE_MASK_H1 0xFFE00000 /* High 11 bits. */
74 #define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16. */
75 #define OPCODE_MASK_H12 0xFFFF0000 /* High 16. */
76@@ -115,6 +117,33 @@
77 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
78 #define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
79
80+/*Defines to identify 64-bit single reg instructions */
81+#define ADDLI_ONE_REG_MASK 0x68000000
82+#define ADDLIC_ONE_REG_MASK 0x68020000
83+#define ADDLIK_ONE_REG_MASK 0x68040000
84+#define ADDLIKC_ONE_REG_MASK 0x68060000
85+#define RSUBLI_ONE_REG_MASK 0x68010000
86+#define RSUBLIC_ONE_REG_MASK 0x68030000
87+#define RSUBLIK_ONE_REG_MASK 0x68050000
88+#define RSUBLIKC_ONE_REG_MASK 0x68070000
89+#define ORLI_ONE_REG_MASK 0x68100000
90+#define ANDLI_ONE_REG_MASK 0x68110000
91+#define XORLI_ONE_REG_MASK 0x68120000
92+#define ANDLNI_ONE_REG_MASK 0x68130000
93+#define ADDLI_MASK 0x20000000
94+#define ADDLIC_MASK 0x28000000
95+#define ADDLIK_MASK 0x30000000
96+#define ADDLIKC_MASK 0x38000000
97+#define RSUBLI_MASK 0x24000000
98+#define RSUBLIC_MASK 0x2C000000
99+#define RSUBLIK_MASK 0x34000000
100+#define RSUBLIKC_MASK 0x3C000000
101+#define ANDLI_MASK 0xA4000000
102+#define ANDLNI_MASK 0xAC000000
103+#define ORLI_MASK 0xA0000000
104+#define XORLI_MASK 0xA8000000
105+
106+
107 /* New Mask for msrset, msrclr insns. */
108 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
109 /* Mask for mbar insn. */
110@@ -123,7 +152,7 @@
111 #define DELAY_SLOT 1
112 #define NO_DELAY_SLOT 0
113
114-#define MAX_OPCODES 412
115+#define MAX_OPCODES 424
116
117 const struct op_code_struct
118 {
119@@ -452,13 +481,21 @@ const struct op_code_struct
120 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
121 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
122 {"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 */
123+ {"addli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68000000, OPCODE_MASK_LIMM, addli, arithmetic_inst },
124 {"rsubli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x24000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
125+ {"rsubli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68010000, OPCODE_MASK_LIMM, rsubli, arithmetic_inst },
126 {"addlic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x28000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
127+ {"addlic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68020000, OPCODE_MASK_LIMM, addlic, arithmetic_inst },
128 {"rsublic", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x2C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
129+ {"rsublic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68030000, OPCODE_MASK_LIMM, rsublic, arithmetic_inst },
130 {"addlik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
131+ {"addlik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68040000, OPCODE_MASK_LIMM, addlik, arithmetic_inst },
132 {"rsublik", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x34000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
133+ {"rsublik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68050000, OPCODE_MASK_LIMM, rsublik, arithmetic_inst },
134 {"addlikc", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x38000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
135+ {"addlikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68060000, OPCODE_MASK_LIMM, addlikc, arithmetic_inst },
136 {"rsublikc",INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3C000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* Identical to 32-bit */
137+ {"rsublikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68070000, OPCODE_MASK_LIMM, rsublikc, arithmetic_inst },
138 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
139 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
140 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
141@@ -509,9 +546,13 @@ const struct op_code_struct
142 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
143 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
144 {"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 */
145+ {"orli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68100000, OPCODE_MASK_LIMM, orli, arithmetic_inst },
146 {"andli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA4000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
147+ {"andli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68110000, OPCODE_MASK_LIMM, andli, arithmetic_inst },
148 {"xorli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA8000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
149+ {"xorli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68120000, OPCODE_MASK_LIMM, xorli, arithmetic_inst },
150 {"andnli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xAC000000, OPCODE_MASK_H, invalid_inst, logical_inst }, /* Identical to 32-bit */
151+ {"andnli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68130000, OPCODE_MASK_LIMM, andnli, arithmetic_inst },
152 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
153 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
154 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
155Index: gdb-14.2/opcodes/microblaze-opcm.h
156===================================================================
157--- gdb-14.2.orig/opcodes/microblaze-opcm.h
158+++ gdb-14.2/opcodes/microblaze-opcm.h
159@@ -62,7 +62,9 @@ enum microblaze_instr
160 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
161
162 /* 64-bit instructions */
163- addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
164+ addl, addli, addlic, addlik, addlikc, rsubl, rsubli, rsublic, rsublik, rsublikc,
165+ addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
166+ andli, andnli, orli, xorli,
167 bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
168 andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
169 brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
170@@ -167,5 +169,6 @@ enum microblaze_instr_type
171
172 /* Imm mask for msrset, msrclr instructions. */
173 #define IMM15_MASK 0x00007FFF
174+#define IMM16_MASK 0x0000FFFF
175
176 #endif /* MICROBLAZE-OPCM */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch
new file mode 100644
index 00000000..72b9cc9f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0030-double-imml-generation-for-64-bit-values.patch
@@ -0,0 +1,29 @@
1From 6967f52fe0ebebb4bdf437cb1e683d9e87a013ff Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 30/54] double imml generation for 64 bit values.
5
6Conflicts:
7 gas/config/tc-microblaze.c
8
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++-------
12 opcodes/microblaze-opc.h | 4 +-
13 2 files changed, 262 insertions(+), 63 deletions(-)
14
15Index: gdb-14.2/opcodes/microblaze-opc.h
16===================================================================
17--- gdb-14.2.orig/opcodes/microblaze-opc.h
18+++ gdb-14.2/opcodes/microblaze-opc.h
19@@ -634,8 +634,8 @@ char pvr_register_prefix[] = "rpvr";
20 #define MIN_IMM6_WIDTH ((int) 0x00000001)
21 #define MAX_IMM6_WIDTH ((int) 0x00000040)
22
23-#define MIN_IMML ((long long) 0xffffff8000000000L)
24-#define MAX_IMML ((long long) 0x0000007fffffffffL)
25+#define MIN_IMML ((long long) -9223372036854775808)
26+#define MAX_IMML ((long long) 9223372036854775807)
27
28 #endif /* MICROBLAZE_OPC */
29
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
new file mode 100644
index 00000000..700ec4c3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0035-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
@@ -0,0 +1,44 @@
1From 9ff4551a70734606139f3ecd146cf0a1c45e0fb0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 22:01:23 +0530
4Subject: [PATCH 35/54] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14Signed-off-by: Aayush Misra <aayushm@amd.com>
15---
16 ld/emulparams/elf64microblaze.sh | 2 +-
17 ld/emulparams/elf64microblazeel.sh | 2 +-
18 2 files changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
21index 9c7b0eb7080..7b4c7c411bd 100644
22--- a/ld/emulparams/elf64microblaze.sh
23+++ b/ld/emulparams/elf64microblaze.sh
24@@ -19,5 +19,5 @@ NOP=0x80000000
25 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
26 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
27
28-TEMPLATE_NAME=elf32
29+TEMPLATE_NAME=elf
30 #GENERATE_SHLIB_SCRIPT=yes
31diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
32index 9c7b0eb7080..7b4c7c411bd 100644
33--- a/ld/emulparams/elf64microblazeel.sh
34+++ b/ld/emulparams/elf64microblazeel.sh
35@@ -19,5 +19,5 @@ NOP=0x80000000
36 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
37 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
38
39-TEMPLATE_NAME=elf32
40+TEMPLATE_NAME=elf
41 #GENERATE_SHLIB_SCRIPT=yes
42--
432.34.1
44
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
new file mode 100644
index 00000000..88c0dc4e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0036-Invalid-data-offsets-pointer-after-relaxation.-Propo.patch
@@ -0,0 +1,79 @@
1From a233cd9a21bc94c47c1d33cc10a9e24a5d5b8126 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:04:07 +0530
4Subject: [PATCH 36/54] Invalid data offsets (pointer) after relaxation.
5 Proposed patch from community member (dednev@rambler.ru) against 2021.1
6 [CR-1115232]
7
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/elf32-microblaze.c | 18 ++++++++++++++++++
11 1 file changed, 18 insertions(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 6ba28e757be..7a4d35493e9 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2174,6 +2174,9 @@ microblaze_elf_relax_section (bfd *abfd,
18 {
19 unsigned int val;
20
21+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
22+ continue;
23+
24 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25
26 /* hax: We only do the following fixup for debug location lists. */
27@@ -2213,6 +2216,9 @@ microblaze_elf_relax_section (bfd *abfd,
28 }
29 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)// || ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
30 {
31+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
32+ continue;
33+
34 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
35
36 /* Look at the reloc only if the value has been resolved. */
37@@ -2245,6 +2251,9 @@ microblaze_elf_relax_section (bfd *abfd,
38 }
39 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
40 {
41+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
42+ continue;
43+
44 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
45
46 /* Look at the reloc only if the value has been resolved. */
47@@ -2282,6 +2291,9 @@ microblaze_elf_relax_section (bfd *abfd,
48 || (ELF32_R_TYPE (irelscan->r_info)
49 == (int) R_MICROBLAZE_TEXTREL_32_LO))
50 {
51+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
52+ continue;
53+
54 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
55
56 /* Look at the reloc only if the value has been resolved. */
57@@ -2328,6 +2340,9 @@ microblaze_elf_relax_section (bfd *abfd,
58 || (ELF32_R_TYPE (irelscan->r_info)
59 == (int) R_MICROBLAZE_TEXTREL_64))
60 {
61+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
62+ continue;
63+
64 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
65
66 /* Look at the reloc only if the value has been resolved. */
67@@ -2362,6 +2377,9 @@ microblaze_elf_relax_section (bfd *abfd,
68 }
69 else if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
70 {
71+ if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
72+ continue;
73+
74 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
75
76 /* Look at the reloc only if the value has been resolved. */
77--
782.34.1
79
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
new file mode 100644
index 00000000..3cae48dc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0037-Double-free-with-ld-no-keep-memory.-Proposed-patches.patch
@@ -0,0 +1,107 @@
1From 2d0e4a0b3a9ce2ffebc5892cf34219ac01a2475e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:59:19 +0530
4Subject: [PATCH 37/54] Double free with ld --no-keep-memory. Proposed patches
5 from the community member (dednev@rambler.ru) for 2021.1. [CR-1115233]
6
7Conflicts:
8 bfd/elf32-microblaze.c
9 bfd/elf64-microblaze.c
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/elf32-microblaze.c | 40 ++++++++++++++++++++++------------------
14 1 file changed, 22 insertions(+), 18 deletions(-)
15
16diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
17index 7a4d35493e9..554a80ae0e4 100644
18--- a/bfd/elf32-microblaze.c
19+++ b/bfd/elf32-microblaze.c
20@@ -1881,10 +1881,8 @@ microblaze_elf_relax_section (bfd *abfd,
21 {
22 Elf_Internal_Shdr *symtab_hdr;
23 Elf_Internal_Rela *internal_relocs;
24- Elf_Internal_Rela *free_relocs = NULL;
25 Elf_Internal_Rela *irel, *irelend;
26 bfd_byte *contents = NULL;
27- bfd_byte *free_contents = NULL;
28 int rel_count;
29 unsigned int shndx;
30 size_t i, sym_index;
31@@ -1928,8 +1926,6 @@ microblaze_elf_relax_section (bfd *abfd,
32 internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
33 if (internal_relocs == NULL)
34 goto error_return;
35- if (! link_info->keep_memory)
36- free_relocs = internal_relocs;
37
38 sdata->relax_count = 0;
39 sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
40@@ -1957,7 +1953,6 @@ microblaze_elf_relax_section (bfd *abfd,
41 contents = (bfd_byte *) bfd_malloc (sec->size);
42 if (contents == NULL)
43 goto error_return;
44- free_contents = contents;
45
46 if (!bfd_get_section_contents (abfd, sec, contents,
47 (file_ptr) 0, sec->size))
48@@ -2473,25 +2468,26 @@ microblaze_elf_relax_section (bfd *abfd,
49 }
50
51 elf_section_data (sec)->relocs = internal_relocs;
52- free_relocs = NULL;
53
54 elf_section_data (sec)->this_hdr.contents = contents;
55- free_contents = NULL;
56
57 symtab_hdr->contents = (bfd_byte *) isymbuf;
58 }
59
60- free (free_relocs);
61- free_relocs = NULL;
62+ if (internal_relocs != NULL
63+ && elf_section_data (sec)->relocs != internal_relocs)
64+ free (internal_relocs);
65
66- if (free_contents != NULL)
67- {
68- if (!link_info->keep_memory)
69- free (free_contents);
70+ if (contents != NULL
71+ && elf_section_data (sec)->this_hdr.contents != contents)
72+ {
73+ if (! link_info->keep_memory)
74+ free (contents);
75 else
76- /* Cache the section contents for elf_link_input_bfd. */
77- elf_section_data (sec)->this_hdr.contents = contents;
78- free_contents = NULL;
79+ {
80+ /* Cache the section contents for elf_link_input_bfd. */
81+ elf_section_data (sec)->this_hdr.contents = contents;
82+ }
83 }
84
85 if (sdata->relax_count == 0)
86@@ -2505,8 +2501,16 @@ microblaze_elf_relax_section (bfd *abfd,
87 return true;
88
89 error_return:
90- free (free_relocs);
91- free (free_contents);
92+
93+ if (isymbuf != NULL
94+ && symtab_hdr->contents != (unsigned char *) isymbuf)
95+ free (isymbuf);
96+ if (internal_relocs != NULL
97+ && elf_section_data (sec)->relocs != internal_relocs)
98+ free (internal_relocs);
99+ if (contents != NULL
100+ && elf_section_data (sec)->this_hdr.contents != contents)
101+ free (contents);
102 free (sdata->relax);
103 sdata->relax = NULL;
104 sdata->relax_count = 0;
105--
1062.34.1
107
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch
new file mode 100644
index 00000000..a27a9807
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0038-MB-binutils-Upstream-port-issues.patch
@@ -0,0 +1,83 @@
1From 06e678ebb6c136c85f73ba8a4a064f9050ae47ce 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/54] MB binutils Upstream port issues.
5
6It's resolving the seg faults with ADDLIK
7Conflicts:
8 bfd/elf64-microblaze.c
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 gas/config/tc-microblaze.c | 2 +-
13 opcodes/microblaze-dis.c | 12 ++++++------
14 opcodes/microblaze-opc.h | 2 +-
15 3 files changed, 8 insertions(+), 8 deletions(-)
16
17Index: gdb-14.2/opcodes/microblaze-dis.c
18===================================================================
19--- gdb-14.2.orig/opcodes/microblaze-dis.c
20+++ gdb-14.2/opcodes/microblaze-dis.c
21@@ -153,7 +153,7 @@ get_field_imm16 (struct string_buf *buf,
22
23 static char *
24 get_field_special (struct string_buf *buf, long instr,
25- const struct op_code_struct *op)
26+ struct op_code_struct *op)
27 {
28 char *p = strbuf (buf);
29 char *spr;
30@@ -226,11 +226,11 @@ get_field_special (struct string_buf *bu
31 static unsigned long
32 read_insn_microblaze (bfd_vma memaddr,
33 struct disassemble_info *info,
34- const struct op_code_struct **opr)
35+ struct op_code_struct **opr)
36 {
37 unsigned char ibytes[4];
38 int status;
39- const struct op_code_struct *op;
40+ struct op_code_struct *op;
41 unsigned long inst;
42
43 status = info->read_memory_func (memaddr, ibytes, 4, info);
44@@ -266,7 +266,7 @@ print_insn_microblaze (bfd_vma memaddr,
45 fprintf_ftype print_func = info->fprintf_func;
46 void *stream = info->stream;
47 unsigned long inst, prev_inst;
48- const struct op_code_struct *op, *pop;
49+ struct op_code_struct *op, *pop;
50 int immval = 0;
51 bool immfound = false;
52 static bfd_vma prev_insn_addr = -1; /* Init the prev insn addr. */
53@@ -518,7 +518,7 @@ get_insn_microblaze (long inst,
54 enum microblaze_instr_type *insn_type,
55 short *delay_slots)
56 {
57- const struct op_code_struct *op;
58+ struct op_code_struct *op;
59 *isunsignedimm = false;
60
61 /* Just a linear search of the table. */
62@@ -560,7 +560,7 @@ microblaze_get_target_address (long inst
63 bool *targetvalid,
64 bool *unconditionalbranch)
65 {
66- const struct op_code_struct *op;
67+ struct op_code_struct *op;
68 long targetaddr = 0;
69
70 *unconditionalbranch = false;
71Index: gdb-14.2/opcodes/microblaze-opc.h
72===================================================================
73--- gdb-14.2.orig/opcodes/microblaze-opc.h
74+++ gdb-14.2/opcodes/microblaze-opc.h
75@@ -154,7 +154,7 @@
76
77 #define MAX_OPCODES 424
78
79-const struct op_code_struct
80+struct op_code_struct
81 {
82 const char * name;
83 short inst_type; /* Registers and immediate values involved. */
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch
new file mode 100644
index 00000000..3372de27
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0039-Initial-port-of-core-reading-support-Added-support-f.patch
@@ -0,0 +1,89 @@
1From e907440fcfce0828efa7b059ef0c6d61c7736d02 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 10 Oct 2022 16:37:53 +0530
4Subject: [PATCH 39/54] Initial port of core reading support Added support for
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.
7
8Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
9Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
10Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 gdb/microblaze-linux-tdep.c | 11 +++++++++++
14 gdb/microblaze-tdep.c | 37 +++++++++++++++++++++++++++++++++++++
15 2 files changed, 48 insertions(+)
16
17diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
18index 39592a43f7c..20daef2ccd4 100644
19--- a/gdb/microblaze-linux-tdep.c
20+++ b/gdb/microblaze-linux-tdep.c
21@@ -193,6 +193,17 @@ microblaze_linux_init_abi (struct gdbarch_info info,
22 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
23 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
24
25+ /* BFD target for core files. */
26+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
27+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
28+ else
29+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
30+
31+
32+ /* Shared library handling. */
33+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
34+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
35+
36 /* Enable TLS support. */
37 set_gdbarch_fetch_tls_load_module_address (gdbarch,
38 svr4_fetch_objfile_link_map);
39diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
40index d4b9ef837e5..363fee34040 100644
41--- a/gdb/microblaze-tdep.c
42+++ b/gdb/microblaze-tdep.c
43@@ -957,6 +957,43 @@ make_regs (struct gdbarch *arch)
44 }
45 #endif
46
47+void
48+microblaze_supply_gregset (const struct regset *regset,
49+ struct regcache *regcache,
50+ int regnum, const void *gregs)
51+{
52+ const unsigned int *regs = (const unsigned int *)gregs;
53+ if (regnum >= 0)
54+ regcache->raw_supply (regnum, regs + regnum);
55+
56+ if (regnum == -1) {
57+ int i;
58+
59+ for (i = 0; i < 50; i++) {
60+ regcache->raw_supply (i, regs + i);
61+ }
62+ }
63+}
64+
65+
66+/* Return the appropriate register set for the core section identified
67+ by SECT_NAME and SECT_SIZE. */
68+
69+static void
70+microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
71+ iterate_over_regset_sections_cb *cb,
72+ void *cb_data,
73+ const struct regcache *regcache)
74+{
75+ struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
76+
77+ cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
78+
79+ cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
80+}
81+
82+
83+
84 static struct gdbarch *
85 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
86 {
87--
882.34.1
89
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
new file mode 100644
index 00000000..3ea09e7e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0040-Fix-build-issues-after-Xilinx-2023.2-binutils-merge.patch
@@ -0,0 +1,185 @@
1From 73b456c4d8f64ec01b170a49330e6de66716eb1a Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 10:41:33 +0530
4Subject: [PATCH 40/54] Fix build issues after Xilinx 2023.2 binutils merge
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 10 ------
10 gdb/microblaze-tdep.c | 71 ++++++++++++++--------------------------
11 opcodes/microblaze-dis.c | 10 ------
12 3 files changed, 25 insertions(+), 66 deletions(-)
13
14diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
15index 9dcf233f19f..4b022dbfba1 100644
16--- a/bfd/bfd-in2.h
17+++ b/bfd/bfd-in2.h
18@@ -6473,11 +6473,6 @@ done here - only used for relaxing */
19 * +done here - only used for relaxing */
20 BFD_RELOC_MICROBLAZE_64_PCREL,
21
22-/* This is a 64 bit reloc that stores the 32 bit relative
23- * +value in two words (with an imml instruction). No relocation is
24- * +done here - only used for relaxing */
25- BFD_RELOC_MICROBLAZE_64,
26-
27 /* This is a 64 bit reloc that stores the 32 bit relative
28 * +value in two words (with an imml instruction). No relocation is
29 * +done here - only used for relaxing */
30@@ -6503,11 +6498,6 @@ value in two words (with an imml instruction). The relocation is
31 PC-relative GOT offset */
32 BFD_RELOC_MICROBLAZE_64_GPC,
33
34-/* This is a 64 bit reloc that stores the 32 bit pc relative
35-value in two words (with an imml instruction). The relocation is
36-PC-relative GOT offset */
37- BFD_RELOC_MICROBLAZE_64_GPC,
38-
39 /* This is a 64 bit reloc that stores the 32 bit pc relative
40 value in two words (with an imm instruction). The relocation is
41 GOT offset */
42diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
43index 363fee34040..818306f2197 100644
44--- a/gdb/microblaze-tdep.c
45+++ b/gdb/microblaze-tdep.c
46@@ -70,6 +70,7 @@ static const char *microblaze_abi_string;
47 static const char *const microblaze_abi_strings[] = {
48 "auto",
49 "m64",
50+ NULL
51 };
52
53 enum microblaze_abi
54@@ -105,7 +106,7 @@ global_microblaze_abi (void)
55 if (microblaze_abi_strings[i] == microblaze_abi_string)
56 return (enum microblaze_abi) i;
57
58-// internal_error (__FILE__, __LINE__, _("unknown ABI string"));
59+ internal_error (__FILE__, __LINE__, _("unknown ABI string"));
60 }
61
62 static void
63@@ -894,16 +895,31 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
64 }
65
66 static void
67-microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
68+microblaze_register_g_packet_guesses (struct gdbarch *gdbarch, enum microblaze_abi abi)
69 {
70
71- register_remote_g_packet_guess (gdbarch,
72- 4 * MICROBLAZE_NUM_CORE_REGS,
73- tdesc_microblaze64);
74+ if (abi == MICROBLAZE_ABI_M64)
75+ {
76+
77+ register_remote_g_packet_guess (gdbarch,
78+ 8 * MICROBLAZE_NUM_CORE_REGS,
79+ tdesc_microblaze64);
80+
81+ register_remote_g_packet_guess (gdbarch,
82+ 8 * MICROBLAZE_NUM_REGS,
83+ tdesc_microblaze64_with_stack_protect);
84+ }
85+ else
86+ {
87+
88+ register_remote_g_packet_guess (gdbarch,
89+ 4 * MICROBLAZE_NUM_CORE_REGS,
90+ tdesc_microblaze);
91
92- register_remote_g_packet_guess (gdbarch,
93- 4 * MICROBLAZE_NUM_REGS,
94- tdesc_microblaze64_with_stack_protect);
95+ register_remote_g_packet_guess (gdbarch,
96+ 4 * MICROBLAZE_NUM_REGS,
97+ tdesc_microblaze_with_stack_protect);
98+ }
99 }
100
101 void
102@@ -957,43 +973,6 @@ make_regs (struct gdbarch *arch)
103 }
104 #endif
105
106-void
107-microblaze_supply_gregset (const struct regset *regset,
108- struct regcache *regcache,
109- int regnum, const void *gregs)
110-{
111- const unsigned int *regs = (const unsigned int *)gregs;
112- if (regnum >= 0)
113- regcache->raw_supply (regnum, regs + regnum);
114-
115- if (regnum == -1) {
116- int i;
117-
118- for (i = 0; i < 50; i++) {
119- regcache->raw_supply (i, regs + i);
120- }
121- }
122-}
123-
124-
125-/* Return the appropriate register set for the core section identified
126- by SECT_NAME and SECT_SIZE. */
127-
128-static void
129-microblaze_iterate_over_regset_sections (struct gdbarch *gdbarch,
130- iterate_over_regset_sections_cb *cb,
131- void *cb_data,
132- const struct regcache *regcache)
133-{
134- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
135-
136- cb(".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
137-
138- cb(".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
139-}
140-
141-
142-
143 static struct gdbarch *
144 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
145 {
146@@ -1134,7 +1113,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
147
148 set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc);
149
150- //microblaze_register_g_packet_guesses (gdbarch);
151+ // microblaze_register_g_packet_guesses (gdbarch, microblaze_abi);
152
153 frame_base_set_default (gdbarch, &microblaze_frame_base);
154
155diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
156index 540ddecafd4..00712d5eaf1 100644
157--- a/opcodes/microblaze-dis.c
158+++ b/opcodes/microblaze-dis.c
159@@ -466,10 +466,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
160 print_func (stream, "\t%s, %s", get_field_r1 (&buf, inst),
161 get_field_r2 (&buf, inst));
162 break;
163- case INST_TYPE_IMML:
164- print_func (stream, "\t%s", get_field_imml (&buf, inst));
165- /* TODO: Also print symbol */
166- break;
167 case INST_TYPE_RD_IMM15:
168 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
169 get_field_imm15 (&buf, inst));
170@@ -484,12 +480,6 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
171 case INST_TYPE_RD_IMML:
172 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
173 break;
174- /* For bit field insns. */
175- case INST_TYPE_RD_R1_IMMW_IMMS:
176- print_func (stream, "\t%s, %s, %s, %s", get_field_rd (&buf, inst), get_field_r1(&buf, inst),
177- get_field_immw (&buf, inst), get_field_imms (&buf, inst));
178- break;
179- /* For bit field insns. */
180 case INST_TYPE_RD_R1_IMMW_IMMS:
181 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));
182 break;
183--
1842.34.1
185
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch
new file mode 100644
index 00000000..6f5a5f1e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0041-disable-truncated-register-warning-gdb-remote.c.patch
@@ -0,0 +1,26 @@
1From a96aee31c41e4d851531100a0716401c3464f6ef Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 14 Mar 2024 15:44:56 +0530
4Subject: [PATCH 41/54] disable truncated register warning (gdb/remote.c)
5
6Signed-off-by: Aayush Misra <aayushm@amd.com>
7---
8 gdb/remote.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/gdb/remote.c b/gdb/remote.c
12index ae08c980efc..8055c8f62e6 100644
13--- a/gdb/remote.c
14+++ b/gdb/remote.c
15@@ -8678,7 +8678,7 @@ remote_target::process_g_packet (struct regcache *regcache)
16 if (rsa->regs[i].pnum == -1)
17 continue;
18
19- if (offset >= sizeof_g_packet)
20+ if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
21 rsa->regs[i].in_g_packet = 0;
22 else if (offset + reg_size > sizeof_g_packet)
23 error (_("Truncated register %d in remote 'g' packet"), i);
24--
252.34.1
26
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
new file mode 100644
index 00000000..0b5f27b4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0042-Fix-unresolved-conflicts-from-binutils_2_42_merge.patch
@@ -0,0 +1,42 @@
1From f9ffc37f48bd9213e89c8821cd07fc679e113007 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:20:48 +0530
4Subject: [PATCH 42/54] Fix unresolved conflicts from binutils_2_42_merge
5
6opcodes/microblaze-dis.c
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 opcodes/microblaze-dis.c | 15 ++++++++++-----
12 1 file changed, 10 insertions(+), 5 deletions(-)
13
14diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
15index 00712d5eaf1..31dbad46b75 100644
16--- a/opcodes/microblaze-dis.c
17+++ b/opcodes/microblaze-dis.c
18@@ -478,11 +478,16 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
19 case INST_TYPE_NONE:
20 break;
21 case INST_TYPE_RD_IMML:
22- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
23- break;
24- case INST_TYPE_RD_R1_IMMW_IMMS:
25- 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));
26- break;
27+ print_func (stream, "\t%s, %s",
28+ get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
29+ break;
30+ case INST_TYPE_RD_R1_IMMW_IMMS:
31+ print_func (stream, "\t%s, %s, %s, %s",
32+ get_field_rd (&buf, inst),
33+ get_field_r1(&buf, inst),
34+ get_field_immw (&buf, inst),
35+ get_field_imms (&buf, inst));
36+ break;
37 /* For tuqula instruction */
38 case INST_TYPE_RD:
39 print_func (stream, "\t%s", get_field_rd (&buf, inst));
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
new file mode 100644
index 00000000..5e1fb44f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0043-microblaze_gdbarch_init-set-microblaze_abi-based-on-.patch
@@ -0,0 +1,177 @@
1From 03df31becbc7dc6d35189fec3b4b2c7dfd3a8103 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 10:59:40 +0530
4Subject: [PATCH 43/54] microblaze_gdbarch_init: set microblaze_abi based on
5 wanted_abi and found_abi
6
7Earlier found_abi was declared but not set, instead gdbarch_info info
8was checked every time. Also, microblaze_abi remained undefined for 32-bit
9machines. As a result, gdb would show 64-bit registers when connecting
10to 32-bit targets with all register values garbled (r5 ended up in r2).
11This defect is fixed. found_abi is set from gdbarch_info, microblaze_abi
12is set based on wanted_abi and found_abi. Now upon connecting to a 32-bit
13remote target (mb-qemu) registers have the correct 32-bit size.
14
15Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
16Signed-off-by: Aayush Misra <aayushm@amd.com>
17---
18 gdb/microblaze-tdep.c | 73 +++++++++++++++++++------------------------
19 1 file changed, 33 insertions(+), 40 deletions(-)
20
21diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
22index 818306f2197..47863819724 100644
23--- a/gdb/microblaze-tdep.c
24+++ b/gdb/microblaze-tdep.c
25@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
26 const char *ignored_value)
27 {
28 enum microblaze_abi global_abi = global_microblaze_abi ();
29- enum microblaze_abi actual_abi = microblaze_abi (target_gdbarch ());
30+ enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
31 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
32
33 #if 1
34@@ -203,6 +203,13 @@ microblaze_register_name (struct gdbarch *gdbarch, int regnum)
35 static struct type *
36 microblaze_register_type (struct gdbarch *gdbarch, int regnum)
37 {
38+
39+ int mb_reg_size = microblaze_abi_regsize(gdbarch);
40+
41+ if (gdbarch_debug)
42+ gdb_printf (gdb_stdlog, "microblaze_register_type: reg_size = %d\n",
43+ mb_reg_size);
44+
45 if (regnum == MICROBLAZE_SP_REGNUM)
46 return builtin_type (gdbarch)->builtin_data_ptr;
47
48@@ -980,34 +987,38 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
49 enum microblaze_abi microblaze_abi, found_abi, wanted_abi;
50 const struct target_desc *tdesc = info.target_desc;
51
52+ /* If there is already a candidate, use it. */
53+ arches = gdbarch_list_lookup_by_info (arches, &info);
54+ if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
55+ return arches->gdbarch;
56+
57 /* What has the user specified from the command line? */
58 wanted_abi = global_microblaze_abi ();
59 if (gdbarch_debug)
60 gdb_printf (gdb_stdlog, "microblaze_gdbarch_init: wanted_abi = %d\n",
61 wanted_abi);
62+
63+ found_abi = MICROBLAZE_ABI_AUTO;
64+
65+ if (info.bfd_arch_info->mach == bfd_mach_microblaze64)
66+ found_abi = MICROBLAZE_ABI_M64;
67+
68 if (wanted_abi != MICROBLAZE_ABI_AUTO)
69 microblaze_abi = wanted_abi;
70-
71- /* If there is already a candidate, use it. */
72- arches = gdbarch_list_lookup_by_info (arches, &info);
73- if ((arches != NULL) && (microblaze_abi != MICROBLAZE_ABI_M64))
74- return arches->gdbarch;
75+ else
76+ microblaze_abi = found_abi;
77
78 if (microblaze_abi == MICROBLAZE_ABI_M64)
79 {
80- tdesc = tdesc_microblaze64;
81- reg_size = 8;
82+ tdesc = tdesc_microblaze64;
83+ reg_size = 8;
84 }
85- if (tdesc == NULL)
86+ else
87 {
88- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
89- {
90- tdesc = tdesc_microblaze64;
91- reg_size = 8;
92- }
93- else
94- tdesc = tdesc_microblaze;
95+ tdesc = tdesc_microblaze;
96+ reg_size = 4;
97 }
98+
99 /* Check any target description for validity. */
100 if (tdesc_has_registers (tdesc))
101 {
102@@ -1015,7 +1026,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
103 int valid_p;
104 int i;
105
106- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
107+ if (microblaze_abi == MICROBLAZE_ABI_M64)
108 feature = tdesc_find_feature (tdesc,
109 "org.gnu.gdb.microblaze64.core");
110 else
111@@ -1029,7 +1040,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
112 for (i = 0; i < MICROBLAZE_NUM_REGS; i++)
113 valid_p &= tdesc_numbered_register (feature, tdesc_data.get(), i,
114 microblaze_register_names[i]);
115- if ((info.bfd_arch_info->mach == bfd_mach_microblaze64) || (microblaze_abi == MICROBLAZE_ABI_M64))
116+ if (microblaze_abi == MICROBLAZE_ABI_M64)
117 feature = tdesc_find_feature (tdesc,
118 "org.gnu.gdb.microblaze64.stack-protect");
119 else
120@@ -1075,15 +1086,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
121
122 /* Register set.
123 make_regs (gdbarch); */
124- switch (info.bfd_arch_info->mach)
125- {
126- case bfd_mach_microblaze64:
127- set_gdbarch_ptr_bit (gdbarch, 64);
128- break;
129- }
130- if(microblaze_abi == MICROBLAZE_ABI_M64)
131+ if (microblaze_abi == MICROBLAZE_ABI_M64)
132 set_gdbarch_ptr_bit (gdbarch, 64);
133-
134+ else
135+ set_gdbarch_ptr_bit (gdbarch, 32);
136+
137 /* Map Dwarf2 registers to GDB registers. */
138 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
139
140@@ -1105,8 +1112,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
141 microblaze_breakpoint::bp_from_kind);
142 // set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
143
144-// set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
145-
146 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
147
148 set_gdbarch_frame_args_skip (gdbarch, 8);
149@@ -1145,9 +1150,6 @@ _initialize_microblaze_tdep ()
150
151 gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
152
153-// static struct cmd_list_element *setmicroblazecmdlist = NULL;
154-// static struct cmd_list_element *showmicroblazecmdlist = NULL;
155-
156 /* Add root prefix command for all "set microblaze"/"show microblaze" commands. */
157
158 add_setshow_prefix_cmd ("microblaze", no_class,
159@@ -1155,15 +1157,6 @@ _initialize_microblaze_tdep ()
160 _("Various microblaze specific commands."),
161 &setmicroblazecmdlist,&showmicroblazecmdlist,
162 &setlist,&showlist);
163-#if 0
164- add_prefix_cmd ("microblaze", no_class, set_microblaze_command,
165- _("Various microblaze specific commands."),
166- &setmicroblazecmdlist, "set microblaze ", 0, &setlist);
167-
168- add_prefix_cmd ("microblaze", no_class, show_microblaze_command,
169- _("Various microblaze specific commands."),
170- &showmicroblazecmdlist, "show microblaze ", 0, &showlist);
171-#endif
172
173 /* Allow the user to override the ABI. */
174 add_setshow_enum_cmd ("abi", class_obscure, microblaze_abi_strings,
175--
1762.34.1
177
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
new file mode 100644
index 00000000..f949a982
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0044-Start-bfd_mach_microblaze-values-from-0-0-1-instead-.patch
@@ -0,0 +1,32 @@
1From 254bd83017b21301c73e7501c71b2cf128ac18d9 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 11:36:32 +0530
4Subject: [PATCH 44/54] Start bfd_mach_microblaze values from 0 (0,1) instead
5 of (1,2)
6
7Before 64-bit support there was only bfd_mach_microblaze (implicitly set to 0),
8setting microblaze_mach_microblaze64 to 1
9
10Signed-off-by: Aayush Misra <aayushm@amd.com>
11---
12 bfd/archures.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/bfd/archures.c b/bfd/archures.c
16index 2994a09bc37..e552349319f 100644
17--- a/bfd/archures.c
18+++ b/bfd/archures.c
19@@ -515,8 +515,8 @@ DESCRIPTION
20 . bfd_arch_lm32, {* Lattice Mico32. *}
21 .#define bfd_mach_lm32 1
22 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
23-.#define bfd_mach_microblaze 1
24-.#define bfd_mach_microblaze64 2
25+.#define bfd_mach_microblaze 0
26+.#define bfd_mach_microblaze64 1
27 . bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *}
28 .#define bfd_mach_kv3_unknown 0
29 .#define bfd_mach_kv3_1 1
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
new file mode 100644
index 00000000..6e4137ef
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0045-Fix-build-issues-bfd-reloc.c-add-missing-relocs-used.patch
@@ -0,0 +1,61 @@
1From b2377a83918c814fd3b6ee2cd46a5f413f97a08e Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:37:11 +0530
4Subject: [PATCH 45/54] Fix build issues - bfd/reloc.c add missing relocs used
5 elsewhere
6
7 BFD_RELOC_MICROBLAZE_EA64
8 BFD_RELOC_MICROBLAZE_64_GPC
9
10Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/reloc.c | 16 +++++++++++-----
14 1 file changed, 11 insertions(+), 5 deletions(-)
15
16diff --git a/bfd/reloc.c b/bfd/reloc.c
17index fc28e27662f..5afe1518cd0 100644
18--- a/bfd/reloc.c
19+++ b/bfd/reloc.c
20@@ -6672,13 +6672,19 @@ ENUMDOC
21 This is a 64 bit reloc that stores 64-bit thread pointer relative offset
22 to two words (uses imml instruction).
23 ENUM
24-BFD_RELOC_MICROBLAZE_64,
25+BFD_RELOC_MICROBLAZE_64
26 ENUMDOC
27 This is a 64 bit reloc that stores the 64 bit pc relative
28 value in two words (with an imml instruction). No relocation is
29 done here - only used for relaxing
30 ENUM
31-BFD_RELOC_MICROBLAZE_64_PCREL,
32+BFD_RELOC_MICROBLAZE_EA64
33+ENUMDOC
34+ This is a 64 bit reloc that stores the 64 bit pc relative
35+ value in two words (with an imml instruction). No relocation is
36+ done here - only used for relaxing
37+ENUM
38+BFD_RELOC_MICROBLAZE_64_PCREL
39 ENUMDOC
40 This is a 32 bit reloc that stores the 32 bit pc relative
41 value in two words (with an imml instruction). No relocation is
42@@ -6721,13 +6727,13 @@ ENUMDOC
43 value in two words (with an imml instruction). No relocation is
44 done here - only used for relaxing
45 ENUM
46-BFD_RELOC_MICROBLAZE_64_PCREL,
47+BFD_RELOC_MICROBLAZE_64_GOTPC
48 ENUMDOC
49- This is a 32 bit reloc that stores the 32 bit pc relative
50+ This is a 64 bit reloc that stores the 32 bit pc relative
51 value in two words (with an imml instruction). No relocation is
52 done here - only used for relaxing
53 ENUM
54- BFD_RELOC_MICROBLAZE_64_GOTPC
55+ BFD_RELOC_MICROBLAZE_64_GPC
56 ENUMDOC
57 This is a 64 bit reloc that stores the 32 bit pc relative
58 value in two words (with an imml instruction). No relocation is
59--
602.34.1
61
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
new file mode 100644
index 00000000..e9383c6f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0046-Regenerate-bfd-bfd-in2.h-bfd-libbfd.h.patch
@@ -0,0 +1,125 @@
1From 4d201d0a948ab6160f449d41a50a6794dd3efde7 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 15:47:56 +0530
4Subject: [PATCH 46/54] Regenerate - bfd/bfd-in2.h bfd/libbfd.h
5
6Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
7Signed-off-by: Aayush Misra <aayushm@amd.com>
8---
9 bfd/bfd-in2.h | 65 +++++++++++++++++++++++++++++----------------------
10 1 file changed, 37 insertions(+), 28 deletions(-)
11
12diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
13index 4b022dbfba1..171de10910c 100644
14--- a/bfd/bfd-in2.h
15+++ b/bfd/bfd-in2.h
16@@ -1771,8 +1771,8 @@ enum bfd_architecture
17 bfd_arch_lm32, /* Lattice Mico32. */
18 #define bfd_mach_lm32 1
19 bfd_arch_microblaze,/* Xilinx MicroBlaze. */
20-#define bfd_mach_microblaze 1
21-#define bfd_mach_microblaze64 2
22+#define bfd_mach_microblaze 0
23+#define bfd_mach_microblaze64 1
24 bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */
25 #define bfd_mach_kv3_unknown 0
26 #define bfd_mach_kv3_1 1
27@@ -6440,9 +6440,27 @@ the linker could optimize the movq to a leaq if possible. */
28 /* Relative offset within page of GOT slot. */
29 BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12,
30
31-/* Address of a GOT entry. */
32+/* Address of a GOT entry.
33+
34+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
35+to two words (uses imml instruction). */
36 BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT,
37
38+/* This is a 64 bit reloc that stores the 64 bit pc relative
39+value in two words (with an imml instruction). No relocation is
40+done here - only used for relaxing */
41+ BFD_RELOC_MICROBLAZE_64,
42+
43+/* This is a 64 bit reloc that stores the 64 bit pc relative
44+value in two words (with an imml instruction). No relocation is
45+done here - only used for relaxing */
46+ BFD_RELOC_MICROBLAZE_EA64,
47+
48+/* This is a 32 bit reloc that stores the 32 bit pc relative
49+value in two words (with an imml instruction). No relocation is
50+done here - only used for relaxing */
51+ BFD_RELOC_MICROBLAZE_64_PCREL,
52+
53 /* This is a 32 bit reloc for the microblaze that stores the
54 low 16 bits of a value */
55 BFD_RELOC_MICROBLAZE_32_LO,
56@@ -6468,34 +6486,19 @@ value in two words (with an imm instruction). No relocation is
57 done here - only used for relaxing */
58 BFD_RELOC_MICROBLAZE_32_NONE,
59
60-/* This is a 64 bit reloc that stores the 32 bit pc relative
61- * +value in two words (with an imml instruction). No relocation is
62- * +done here - only used for relaxing */
63- BFD_RELOC_MICROBLAZE_64_PCREL,
64-
65-/* This is a 64 bit reloc that stores the 32 bit relative
66- * +value in two words (with an imml instruction). No relocation is
67- * +done here - only used for relaxing */
68- BFD_RELOC_MICROBLAZE_EA64,
69-
70-/* This is a 64 bit reloc that stores the 32 bit pc relative
71- * +value in two words (with an imm instruction). No relocation is
72- * +done here - only used for relaxing */
73- BFD_RELOC_MICROBLAZE_64_NONE,
74-
75-/* This is a 64 bit reloc that stores the 32 bit pc relative
76- * +value in two words (with an imml instruction). No relocation is
77- * +done here - only used for relaxing */
78- BFD_RELOC_MICROBLAZE_64,
79+/* This is a 32 bit reloc that stores the 32 bit pc relative
80+value in two words (with an imml instruction). No relocation is
81+done here - only used for relaxing */
82+ BFD_RELOC_MICROBLAZE_64_NONE,
83
84 /* This is a 64 bit reloc that stores the 32 bit pc relative
85-value in two words (with an imm instruction). The relocation is
86-PC-relative GOT offset */
87+value in two words (with an imml instruction). No relocation is
88+done here - only used for relaxing */
89 BFD_RELOC_MICROBLAZE_64_GOTPC,
90
91 /* This is a 64 bit reloc that stores the 32 bit pc relative
92-value in two words (with an imml instruction). The relocation is
93-PC-relative GOT offset */
94+value in two words (with an imml instruction). No relocation is
95+done here - only used for relaxing */
96 BFD_RELOC_MICROBLAZE_64_GPC,
97
98 /* This is a 64 bit reloc that stores the 32 bit pc relative
99@@ -7199,7 +7202,10 @@ assembler and not (currently) written to any object files. */
100 BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
101 BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
102
103-/* Tilera TILE-Gx Relocations. */
104+/* Tilera TILE-Gx Relocations.
105+
106+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
107+to two words (uses imml instruction). */
108 BFD_RELOC_TILEGX_HW0,
109 BFD_RELOC_TILEGX_HW1,
110 BFD_RELOC_TILEGX_HW2,
111@@ -7310,7 +7316,10 @@ assembler and not (currently) written to any object files. */
112 BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD,
113 BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD,
114
115-/* Linux eBPF relocations. */
116+/* Linux eBPF relocations.
117+
118+This is a 64 bit reloc that stores 64-bit thread pointer relative offset
119+to two words (uses imml instruction). */
120 BFD_RELOC_BPF_64,
121 BFD_RELOC_BPF_DISP32,
122 BFD_RELOC_BPF_DISPCALL32,
123--
1242.34.1
125
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
new file mode 100644
index 00000000..d31eb8ee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0047-gdb-remote.c-revert-earlier-change-to-process_g_pack.patch
@@ -0,0 +1,32 @@
1From 2a1036ac7639aa3b67b1f1ad7e1a6e7c4c22704b Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 28 Mar 2024 16:32:22 +0530
4Subject: [PATCH 47/54] gdb/remote.c - revert earlier change to
5 process_g_packet
6
7When connecting to remote target, gdb (microblaze-xilinx-elf) was
8generating Truncated register 29 error when parsing the g packet,
9workaround added being reverted.
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/remote.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/gdb/remote.c b/gdb/remote.c
18index 8055c8f62e6..ae08c980efc 100644
19--- a/gdb/remote.c
20+++ b/gdb/remote.c
21@@ -8678,7 +8678,7 @@ remote_target::process_g_packet (struct regcache *regcache)
22 if (rsa->regs[i].pnum == -1)
23 continue;
24
25- if (offset >= sizeof_g_packet || (offset + reg_size > sizeof_g_packet))
26+ if (offset >= sizeof_g_packet)
27 rsa->regs[i].in_g_packet = 0;
28 else if (offset + reg_size > sizeof_g_packet)
29 error (_("Truncated register %d in remote 'g' packet"), i);
30--
312.34.1
32
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
new file mode 100644
index 00000000..f9cbb4a6
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0048-Fix-build-issues-after-Xilinx-2023.2-binutils-patch-.patch
@@ -0,0 +1,46 @@
1From 6a5887919f00da84c973ec61c59efcd7d0fb120e Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Mon, 1 Apr 2024 16:21:28 +0530
4Subject: [PATCH 48/54] Fix build issues after Xilinx 2023.2 binutils patch
5 merge
6
7binutils/readelf.c - duplicate case statement
8gas/config/tc-microblaze.c - Missing , between array elements
9gas/config/tc-microblaze.c - A whole hunk ended up in wrong function/switch
10
11Signed-off-by: Aayush Misra <aayushm@amd.com>
12---
13 bfd/libbfd.h | 6 +-
14 binutils/readelf.c | 5 -
15 gas/config/tc-microblaze.c | 375 +++++++++++++++++++------------------
16 3 files changed, 192 insertions(+), 194 deletions(-)
17
18Index: gdb-14.2/bfd/libbfd.h
19===================================================================
20--- gdb-14.2.orig/bfd/libbfd.h
21+++ gdb-14.2/bfd/libbfd.h
22@@ -3005,6 +3005,9 @@ static const char *const bfd_reloc_code_
23 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGE21",
24 "BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12",
25 "BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT",
26+ "BFD_RELOC_MICROBLAZE_64",
27+ "BFD_RELOC_MICROBLAZE_EA64",
28+ "BFD_RELOC_MICROBLAZE_64_PCREL",
29 "BFD_RELOC_MICROBLAZE_32_LO",
30 "BFD_RELOC_MICROBLAZE_32_LO_PCREL",
31 "BFD_RELOC_MICROBLAZE_32_ROSDA",
32@@ -3013,13 +3016,12 @@ static const char *const bfd_reloc_code_
33 "BFD_RELOC_MICROBLAZE_32_NONE",
34 "BFD_RELOC_MICROBLAZE_64_NONE",
35 "BFD_RELOC_MICROBLAZE_64_GOTPC",
36+ "BFD_RELOC_MICROBLAZE_64_GPC",
37 "BFD_RELOC_MICROBLAZE_64_GOT",
38 "BFD_RELOC_MICROBLAZE_64_PLT",
39 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
40 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
41 "BFD_RELOC_MICROBLAZE_COPY",
42- "BFD_RELOC_MICROBLAZE_64",
43- "BFD_RELOC_MICROBLAZE_64_PCREL",
44 "BFD_RELOC_MICROBLAZE_64_TLS",
45 "BFD_RELOC_MICROBLAZE_64_TLSGD",
46 "BFD_RELOC_MICROBLAZE_64_TLSLD",
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch
new file mode 100644
index 00000000..76fcef7d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0049-Add-back-R_MICROBLAZE_NONE-for-linker-relaxation-pro.patch
@@ -0,0 +1,27 @@
1From bf491bdb2e4d30c14968be096969da700dedfc64 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Wed, 17 Apr 2024 16:14:14 +0530
4Subject: [PATCH 49/54] Add back R_MICROBLAZE_NONE for linker relaxation
5 processing
6
7Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 bfd/elf32-microblaze.c | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 554a80ae0e4..ec6613b6572 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2102,6 +2102,7 @@ microblaze_elf_relax_section (bfd *abfd,
18 irel->r_addend);
19 }
20 break;
21+ case R_MICROBLAZE_NONE:
22 case R_MICROBLAZE_32_NONE:
23 {
24 /* This was a PC-relative instruction that was
25--
262.34.1
27
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch
new file mode 100644
index 00000000..c9da78c3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0050-When-unwinding-pc-value-adjust-return-pc-value.patch
@@ -0,0 +1,92 @@
1From d8b25fd6d8cac000bb8f5ad65ada949447322fca Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Wed, 1 May 2024 11:12:32 +0530
4Subject: [PATCH 50/54] When unwinding pc value, adjust return pc value
5
6A call (branch and link) instruction can include a delay slot, the
7value of pc stored in the link register for Microblaze architecture
8is the pc value corresponding to last executed instruction (call)
9in the caller. The return instruction (branch reg) includes an
10offset of 8 so that when function returns execution continues from
11the address at : link register + 8, as the instruction in delay slot
12(link register + 4) is already executed at the time of call.
13
14Handle this by adjusting pc value during unwind-pc.
15
16Basically restoring code to do this that seems to have been removed
17as part of a gdb patch (gdb patch #8, Xilinx Yocto 2023.2)
18
19That patch caused hundreds of regressions in gdb testuite, including
20gdb.base/advance.exp, which is now fixed.
21
22Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
23Signed-off-by: Aayush Misra <aayushm@amd.com>
24---
25 gdb/microblaze-tdep.c | 24 ++++++++++++++++++------
26 1 file changed, 18 insertions(+), 6 deletions(-)
27
28diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
29index 47863819724..f87e406ada0 100644
30--- a/gdb/microblaze-tdep.c
31+++ b/gdb/microblaze-tdep.c
32@@ -523,6 +523,12 @@ microblaze_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
33 {
34 CORE_ADDR pc;
35 pc=frame_unwind_register_unsigned (next_frame, MICROBLAZE_PC_REGNUM);
36+ /* For sentinel frame, return address is actual PC. For other frames,
37+ return address is pc+8. This is a workaround because gcc does not
38+ generate correct return address in CIE. */
39+ if (frame_relative_level (next_frame) >= 0)
40+ pc = pc + 8;
41+ microblaze_debug ("unwind pc = 0x%x\n", (int) pc);
42 return pc;
43 }
44
45@@ -615,6 +621,7 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
46 struct microblaze_frame_cache *cache =
47 microblaze_frame_cache (this_frame, this_cache);
48
49+#if 1
50 if ((regnum == MICROBLAZE_SP_REGNUM &&
51 cache->register_offsets[MICROBLAZE_SP_REGNUM])
52 || (regnum == MICROBLAZE_FP_REGNUM &&
53@@ -625,15 +632,22 @@ if ((regnum == MICROBLAZE_SP_REGNUM &&
54
55 if (regnum == MICROBLAZE_PC_REGNUM)
56 {
57- regnum = 15;
58+ regnum = MICROBLAZE_PREV_PC_REGNUM;
59+
60+ microblaze_debug ("prev pc is r15 @ frame offset 0x%x\n",
61+ (int) cache->register_offsets[regnum] );
62+
63 return frame_unwind_got_memory (this_frame, regnum,
64 cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
65-
66 }
67+
68 if (regnum == MICROBLAZE_SP_REGNUM)
69 regnum = 1;
70-#if 0
71
72+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
73+ regnum);
74+
75+#else
76 if (cache->frameless_p)
77 {
78 if (regnum == MICROBLAZE_PC_REGNUM)
79@@ -646,9 +660,7 @@ if (regnum == MICROBLAZE_SP_REGNUM)
80 else
81 return trad_frame_get_prev_register (this_frame, cache->saved_regs,
82 regnum);
83-#endif
84- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
85- regnum);
86+#endif
87 }
88
89 static const struct frame_unwind microblaze_frame_unwind =
90--
912.34.1
92
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch
new file mode 100644
index 00000000..887ee56e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0051-info-reg-pc-does-not-print-symbolic-value.patch
@@ -0,0 +1,116 @@
1From 66c0cc9a030667111d4b632314502e868e5e8e37 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:30:22 +0530
4Subject: [PATCH 51/54] info reg pc does not print symbolic value
5
6Problem - Test gdb.base/pc-fp.exp fails
7Fix - Change feature/microblaze-core.xml add type=code_ptr for pc
8
9Files changed
10 features/microblaze-core.xml
11 features/microblaze.c (generated)
12 features/microblaze-with-stack-protect.c (generated)
13
14Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
15Signed-off-by: Aayush Misra <aayushm@amd.com>
16---
17 gdb/features/microblaze-core.xml | 4 ++--
18 gdb/features/microblaze-with-stack-protect.c | 10 ++++++----
19 gdb/features/microblaze.c | 8 ++++----
20 3 files changed, 12 insertions(+), 10 deletions(-)
21
22diff --git a/gdb/features/microblaze-core.xml b/gdb/features/microblaze-core.xml
23index ac052365773..205cdf94a27 100644
24--- a/gdb/features/microblaze-core.xml
25+++ b/gdb/features/microblaze-core.xml
26@@ -8,7 +8,7 @@
27 <!DOCTYPE feature SYSTEM "gdb-target.dtd">
28 <feature name="org.gnu.gdb.microblaze.core">
29 <reg name="r0" bitsize="32" regnum="0"/>
30- <reg name="r1" bitsize="32"/>
31+ <reg name="r1" bitsize="32" type="data_ptr"/>
32 <reg name="r2" bitsize="32"/>
33 <reg name="r3" bitsize="32"/>
34 <reg name="r4" bitsize="32"/>
35@@ -39,7 +39,7 @@
36 <reg name="r29" bitsize="32"/>
37 <reg name="r30" bitsize="32"/>
38 <reg name="r31" bitsize="32"/>
39- <reg name="rpc" bitsize="32"/>
40+ <reg name="rpc" bitsize="32" type="code_ptr"/>
41 <reg name="rmsr" bitsize="32"/>
42 <reg name="rear" bitsize="32"/>
43 <reg name="resr" bitsize="32"/>
44diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
45index 8ab9565a047..95e3eed1a4e 100644
46--- a/gdb/features/microblaze-with-stack-protect.c
47+++ b/gdb/features/microblaze-with-stack-protect.c
48@@ -14,7 +14,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
49
50 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
51 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
52- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
53+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
54 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
55 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
56 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
57@@ -45,7 +45,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
58 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
59 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
60 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
61- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
62+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
63 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
64 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
65 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
66@@ -70,10 +70,12 @@ initialize_tdesc_microblaze_with_stack_protect (void)
67 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
68 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
69 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
70-
71- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
72 tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
73 tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
74
75+ feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
76+ tdesc_create_reg (feature, "slr", 59, 1, NULL, 32, "int");
77+ tdesc_create_reg (feature, "shr", 60, 1, NULL, 32, "int");
78+
79 tdesc_microblaze_with_stack_protect = result.release ();
80 }
81diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
82index ed12e5bcfd2..ff4865b2acc 100644
83--- a/gdb/features/microblaze.c
84+++ b/gdb/features/microblaze.c
85@@ -14,7 +14,7 @@ initialize_tdesc_microblaze (void)
86
87 feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
88 tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
89- tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
90+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
91 tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
92 tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
93 tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
94@@ -45,7 +45,7 @@ initialize_tdesc_microblaze (void)
95 tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
96 tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
97 tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
98- tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "int");
99+ tdesc_create_reg (feature, "rpc", 32, 1, NULL, 32, "code_ptr");
100 tdesc_create_reg (feature, "rmsr", 33, 1, NULL, 32, "int");
101 tdesc_create_reg (feature, "rear", 34, 1, NULL, 32, "int");
102 tdesc_create_reg (feature, "resr", 35, 1, NULL, 32, "int");
103@@ -70,8 +70,8 @@ initialize_tdesc_microblaze (void)
104 tdesc_create_reg (feature, "rtlbsx", 54, 1, NULL, 32, "int");
105 tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
106 tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
107- tdesc_create_reg (feature, "slr", 57, 1, NULL, 64, "uint64");
108- tdesc_create_reg (feature, "shr", 58, 1, NULL, 64, "uint64");
109+ tdesc_create_reg (feature, "slr", 57, 1, NULL, 32, "int");
110+ tdesc_create_reg (feature, "shr", 58, 1, NULL, 32, "int");
111
112 tdesc_microblaze = result.release ();
113 }
114--
1152.34.1
116
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch
new file mode 100644
index 00000000..89318eec
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0052-Wrong-target-description-accepted-by-microblaze-arch.patch
@@ -0,0 +1,51 @@
1From 0982e0c2733aa773d88876e68320b072e5b2a9ad Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 9 May 2024 11:34:04 +0530
4Subject: [PATCH 52/54] Wrong target description accepted by microblaze
5 architecture
6
7Fix - Modify microblaze_gdbarch_init, set tdesc only when it is NULL
8
9Files changed - gdb/microblaze-tdep.c
10
11Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
12Signed-off-by: Aayush Misra <aayushm@amd.com>
13---
14 gdb/microblaze-tdep.c | 21 ++++++++++++---------
15 1 file changed, 12 insertions(+), 9 deletions(-)
16
17diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
18index f87e406ada0..4d8c76bcf4c 100644
19--- a/gdb/microblaze-tdep.c
20+++ b/gdb/microblaze-tdep.c
21@@ -1020,15 +1020,18 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
22 else
23 microblaze_abi = found_abi;
24
25- if (microblaze_abi == MICROBLAZE_ABI_M64)
26- {
27- tdesc = tdesc_microblaze64;
28- reg_size = 8;
29- }
30- else
31- {
32- tdesc = tdesc_microblaze;
33- reg_size = 4;
34+ if (tdesc == NULL)
35+ {
36+ if (microblaze_abi == MICROBLAZE_ABI_M64)
37+ {
38+ tdesc = tdesc_microblaze64;
39+ reg_size = 8;
40+ }
41+ else
42+ {
43+ tdesc = tdesc_microblaze;
44+ reg_size = 4;
45+ }
46 }
47
48 /* Check any target description for validity. */
49--
502.34.1
51
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
new file mode 100644
index 00000000..2cb3ff06
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch
@@ -0,0 +1,42 @@
1From 31b8744afcb31825083a23bbc08b6e00772ebd07 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Thu, 23 May 2024 16:02:59 +0530
4Subject: [PATCH 53/54] Merge gdb/microblaze-linux-tdep.c to gdb-14 and fix
5 compilation issues.
6
7Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
8Signed-off-by: Aayush Misra <aayushm@amd.com>
9---
10 gdb/microblaze-linux-tdep.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
12
13diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
14index 20daef2ccd4..16d3a0b5196 100644
15--- a/gdb/microblaze-linux-tdep.c
16+++ b/gdb/microblaze-linux-tdep.c
17@@ -48,10 +48,12 @@ microblaze_debug (const char *fmt, ...)
18 if (microblaze_debug_flag)
19 {
20 va_list args;
21+ string_file file (gdb_stdout->can_emit_style_escape ());
22
23 va_start (args, fmt);
24 printf_unfiltered ("MICROBLAZE LINUX: ");
25- vprintf_unfiltered (fmt, args);
26+ file.vprintf (fmt, args);
27+ gdb_stdout->puts_unfiltered (file.string ().c_str ());
28 va_end (args);
29 }
30 }
31@@ -145,7 +147,7 @@ static void
32 microblaze_linux_init_abi (struct gdbarch_info info,
33 struct gdbarch *gdbarch)
34 {
35- struct microblaze_gdbarch_tdep *tdep =(microblaze_gdbarch_tdep *) gdbarch_tdep (gdbarch);
36+ struct microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
37
38 tdep->sizeof_gregset = 200;
39
40--
412.34.1
42
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
new file mode 100644
index 00000000..eb6bde20
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch
@@ -0,0 +1,29 @@
1From 8a7a8b724a87c532096004f43b987c352474a905 Mon Sep 17 00:00:00 2001
2From: Gopi Kumar Bulusu <gopi@sankhya.com>
3Date: Fri, 19 Jul 2024 12:39:24 +0530
4Subject: [PATCH 54/54] Roll back an improvement which inlines target_gdbarch
5 () inherited from binutils 2.42 merge that causes compilation issues on gdb
6 14.2
7
8Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
9Signed-off-by: Aayush Misra <aayushm@amd.com>
10---
11 gdb/microblaze-tdep.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
15index 4d8c76bcf4c..cb6697654b0 100644
16--- a/gdb/microblaze-tdep.c
17+++ b/gdb/microblaze-tdep.c
18@@ -116,7 +116,7 @@ show_microblaze_abi (struct ui_file *file,
19 const char *ignored_value)
20 {
21 enum microblaze_abi global_abi = global_microblaze_abi ();
22- enum microblaze_abi actual_abi = microblaze_abi (current_inferior ()->arch ());
23+ enum microblaze_abi actual_abi = microblaze_abi ( target_gdbarch () );
24 const char *actual_abi_str = microblaze_abi_strings[actual_abi];
25
26 #if 1
27--
282.34.1
29
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch
new file mode 100644
index 00000000..a0ac4d39
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch
@@ -0,0 +1,26 @@
1Fix compilation error on Linux native GDB
2
3Signed-off-by: Mark Hatle <mark.hatle@amd.com>
4
5Index: gdb-14.2/gdb/microblaze-linux-nat.c
6===================================================================
7--- gdb-14.2.orig/gdb/microblaze-linux-nat.c
8+++ gdb-14.2/gdb/microblaze-linux-nat.c
9@@ -96,7 +96,7 @@ static int
10 microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
11 {
12 int u_addr = -1;
13- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
14+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
15 /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
16 * interface, and not the wordsize of the program's ABI. */
17 int wordsize = sizeof (long);
18@@ -191,7 +192,7 @@ static void
19 fetch_register (struct regcache *regcache, int tid, int regno)
20 {
21 struct gdbarch *gdbarch = regcache->arch ();
22- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
23+ microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch);
24 /* This isn't really an address. But ptrace thinks of it as one. */
25 CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
26 int bytes_transferred;
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch b/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch
deleted file mode 100644
index c2db4c0d..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 1add37b567a7dee39d99f37b37802034c3fce9c4 Mon Sep 17 00:00:00 2001
2From: Andreas Schwab <schwab@linux-m68k.org>
3Date: Sun, 20 Mar 2022 14:01:54 +0100
4Subject: [PATCH] Add support for readline 8.2
5
6In readline 8.2 the type of rl_completer_word_break_characters changed to
7include const.
8
9Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1add37b567a7dee39d99f37b37802034c3fce9c4]
10Signed-off-by: Alexander Kanavin <alex@linutronix.de>
11---
12 gdb/completer.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/gdb/completer.c b/gdb/completer.c
16index d3900ae2014..a51c16ac7f8 100644
17--- a/gdb/completer.c
18+++ b/gdb/completer.c
19@@ -36,7 +36,7 @@
20 calling a hook instead so we eliminate the CLI dependency. */
21 #include "gdbcmd.h"
22
23-/* Needed for rl_completer_word_break_characters() and for
24+/* Needed for rl_completer_word_break_characters and for
25 rl_filename_completion_function. */
26 #include "readline/readline.h"
27
28@@ -2011,7 +2011,7 @@ gdb_completion_word_break_characters_throw ()
29 rl_basic_quote_characters = NULL;
30 }
31
32- return rl_completer_word_break_characters;
33+ return (char *) rl_completer_word_break_characters;
34 }
35
36 char *
37--
382.31.1
39
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb b/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb
deleted file mode 100644
index ca915d68..00000000
--- a/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb
+++ /dev/null
@@ -1,39 +0,0 @@
1require gdb-common.inc
2
3inherit gettext pkgconfig
4
5#LDFLAGS:append = " -s"
6#export CFLAGS:append=" -L${STAGING_LIBDIR}"
7
8# cross-canadian must not see this
9PACKAGES =+ "gdbserver"
10FILES:gdbserver = "${bindir}/gdbserver"
11
12require gdb.inc
13
14inherit python3-dir
15
16EXTRA_OEMAKE:append:libc-musl = "\
17 gt_cv_func_gnugettext1_libc=yes \
18 gt_cv_func_gnugettext2_libc=yes \
19 gl_cv_func_working_strerror=yes \
20 gl_cv_func_strerror_0_works=yes \
21 gl_cv_func_gettimeofday_clobber=no \
22 "
23
24do_configure:prepend() {
25 if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
26 cat > ${UNPACKDIR}/python << EOF
27#!/bin/sh
28case "\$2" in
29 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;;
30 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;;
31 --exec-prefix) echo "${exec_prefix}" ;;
32 *) exit 1 ;;
33esac
34exit 0
35EOF
36 chmod +x ${UNPACKDIR}/python
37 fi
38}
39