summaryrefslogtreecommitdiffstats
path: root/meta-microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze')
-rw-r--r--meta-microblaze/conf/layer.conf16
-rw-r--r--meta-microblaze/recipes-core/glibc/glibc_%.bbappend (renamed from meta-microblaze/recipes-core/glibc/glibc_2.36.bbappend)0
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch61
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch2
-rw-r--r--meta-microblaze/recipes-core/newlib/libgloss_%.bbappend (renamed from meta-microblaze/recipes-core/newlib/libgloss_4.2.%.bbappend)0
-rw-r--r--meta-microblaze/recipes-core/newlib/newlib_%.bbappend (renamed from meta-microblaze/recipes-core/newlib/newlib_4.2.%.bbappend)0
-rw-r--r--meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend4
-rw-r--r--meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch2
-rw-r--r--meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch39
-rw-r--r--meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch54
-rw-r--r--meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch102
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch17
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend2
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc39
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch65
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch64
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch34
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch310
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch42
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch33
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch101
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0008-Add-new-bit-field-instructions.patch241
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0009-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch33
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-constant-range-check-issue.patch26
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-Compiler-will-give-error-messages-i.patch36
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch5247
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch36
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch349
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch361
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0016-Fixing-the-branch-related-issues.patch28
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch227
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0018-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch167
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0019-fixing-the-.bss-relocation-issue.patch113
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch46
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0021-Revert-ld-Remove-unused-expression-state.patch82
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-long-long-long-mingw-toolchain-issue.patch57
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-support-to-new-arithmetic-single-register-inst.patch369
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch545
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch86
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch38
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch39
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch30
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0029-gas-revert-moving-of-md_pseudo_table-from-const.patch83
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0030-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch43
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch142
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0032-Patch-MicroBlaze-Double-free-with-ld-no-keep-memory.patch195
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0033-Patch-MB-MB-binutils-Upstream-port-issues.patch536
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0034-Patch-MicroBlaze-By-default-the-linker-will-generate.patch27
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-for-objdump-issue-for-mb32-el.patch37
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-for-missing-instructions-in-dump.patch34
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc114
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-common.inc118
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc123
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc187
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross.inc163
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc249
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc310
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc120
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb7
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc21
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source.inc45
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-target.inc259
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc107
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch239
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch134
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch64
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch53
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch403
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch40
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch99
-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.patch55
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch113
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch51
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch510
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch99
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch83
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch182
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch31
-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.patch28
-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/0026-rust-recursion-limit.patch92
-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_12.2.bb14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-common.inc163
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc58
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc.inc53
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran.inc88
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend1
-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.inc20
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch2
-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-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch2
-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.patch2
-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-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch4
-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-Change-order-of-CFLAGS.patch30
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-Patch-MicroBlaze-Added-m64-abi-for-64-bit-target-des.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch48
-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/0008-Patch-MicroBlaze.patch4
-rw-r--r--meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch40
-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
-rw-r--r--meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch6
-rw-r--r--meta-microblaze/recipes-devtools/python/python3_%.bbappend3
-rw-r--r--meta-microblaze/recipes-extended/grep/files/m4-stack-direction-microblaze.patch11
-rw-r--r--meta-microblaze/recipes-extended/grep/grep_%.bbappend4
-rw-r--r--meta-microblaze/recipes-extended/xz/xz_%.bbappend5
-rw-r--r--meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend14
211 files changed, 6207 insertions, 10068 deletions
diff --git a/meta-microblaze/conf/layer.conf b/meta-microblaze/conf/layer.conf
index bccf61d0..d1443c16 100644
--- a/meta-microblaze/conf/layer.conf
+++ b/meta-microblaze/conf/layer.conf
@@ -11,7 +11,7 @@ BBFILE_PRIORITY_xilinx-microblaze = "5"
11 11
12LAYERDEPENDS_xilinx-microblaze = "core" 12LAYERDEPENDS_xilinx-microblaze = "core"
13 13
14LAYERSERIES_COMPAT_xilinx-microblaze = "langdale" 14LAYERSERIES_COMPAT_xilinx-microblaze = "scarthgap"
15 15
16# Microblaze does not support stack-protector! 16# Microblaze does not support stack-protector!
17SECURITY_STACK_PROTECTOR:microblaze = "" 17SECURITY_STACK_PROTECTOR:microblaze = ""
@@ -19,3 +19,17 @@ SECURITY_STACK_PROTECTOR:microblaze = ""
19OLDEST_KERNEL:microblaze = "3.15" 19OLDEST_KERNEL:microblaze = "3.15"
20 20
21INHERIT += "rust_microblaze" 21INHERIT += "rust_microblaze"
22
23# We want to use gcc 12.x for the microblaze stuff, and 13.x for any host tooling
24GCCVERSION:microblaze = "12.2.%"
25SDKGCCVERSION:microblaze = "13.%"
26
27GDBVERSION:microblaze = "12.1"
28# canon-prefix-map doesn't exist in gcc 12.x
29DEBUG_PREFIX_MAP:remove:microblaze = "-fcanon-prefix-map"
30
31MICROBLAZE_SKIP_MSG = ""
32MICROBLAZE_SKIP_MSG:microblaze = "This recipe does not currently work on microblaze."
33
34# ../../../alsa-lib-1.2.9/src/control/control.c:3648:1: error: symver is only supported on ELF platforms
35SKIP_RECIPE[alsa-lib] = "${MICROBLAZE_SKIP_MSG}"
diff --git a/meta-microblaze/recipes-core/glibc/glibc_2.36.bbappend b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend
index d42bcca5..d42bcca5 100644
--- a/meta-microblaze/recipes-core/glibc/glibc_2.36.bbappend
+++ b/meta-microblaze/recipes-core/glibc/glibc_%.bbappend
diff --git a/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch
index 584aab11..31076208 100644
--- a/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch
@@ -17,6 +17,9 @@ Changelog
17 * microblaze/configure: Likewise. 17 * microblaze/configure: Likewise.
18 18
19Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 19Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
20
21Upstream-Status: Pending
22
20--- 23---
21 libgloss/config/microblaze.mt | 30 ++++++++++++++++++++++++++++++ 24 libgloss/config/microblaze.mt | 30 ++++++++++++++++++++++++++++++
22 libgloss/microblaze/configure | 2 +- 25 libgloss/microblaze/configure | 2 +-
@@ -24,11 +27,10 @@ Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
24 3 files changed, 32 insertions(+), 2 deletions(-) 27 3 files changed, 32 insertions(+), 2 deletions(-)
25 create mode 100644 libgloss/config/microblaze.mt 28 create mode 100644 libgloss/config/microblaze.mt
26 29
27diff --git a/libgloss/config/microblaze.mt b/libgloss/config/microblaze.mt 30Index: git/libgloss/config/microblaze.mt
28new file mode 100644 31===================================================================
29index 000000000..e8fb922dd
30--- /dev/null 32--- /dev/null
31+++ b/libgloss/config/microblaze.mt 33+++ git/libgloss/config/microblaze.mt
32@@ -0,0 +1,30 @@ 34@@ -0,0 +1,30 @@
33+# 35+#
34+# Match default.mt to compile generic objects but continue building 36+# Match default.mt to compile generic objects but continue building
@@ -60,32 +62,27 @@ index 000000000..e8fb922dd
60+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? 62+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
61+write.o: ${srcdir}/../write.c 63+write.o: ${srcdir}/../write.c
62+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? 64+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
63diff --git a/libgloss/microblaze/configure b/libgloss/microblaze/configure 65Index: git/libgloss/configure
64index 05f68682c..faa23c584 100755 66===================================================================
65--- a/libgloss/microblaze/configure 67--- git.orig/libgloss/configure
66+++ b/libgloss/microblaze/configure 68+++ git/libgloss/configure
67@@ -2550,7 +2550,7 @@ test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS 69@@ -2909,6 +2909,7 @@ case "${target}" in
68 70 ac_config_files="$ac_config_files microblaze/Makefile"
69
70 host_makefile_frag=${srcdir}/../config/default.mh
71-target_makefile_frag=${srcdir}/../config/default.mt
72+target_makefile_frag=${srcdir}/../config/microblaze.mt
73 71
74 host_makefile_frag_path=$host_makefile_frag 72 subdirs="$subdirs microblaze"
75 73+ target_makefile_frag=${srcdir}/config/microblaze.mt
76diff --git a/libgloss/microblaze/configure.ac b/libgloss/microblaze/configure.ac 74 ;;
77index 5eda42e73..d5c789d40 100644 75 mt-*-*)
78--- a/libgloss/microblaze/configure.ac 76 ac_config_files="$ac_config_files mt/Makefile"
79+++ b/libgloss/microblaze/configure.ac 77Index: git/libgloss/configure.ac
80@@ -35,7 +35,7 @@ LIB_AM_PROG_AS 78===================================================================
81 AC_SUBST(bsp_prefix) 79--- git.orig/libgloss/configure.ac
82 80+++ git/libgloss/configure.ac
83 host_makefile_frag=${srcdir}/../config/default.mh 81@@ -172,6 +172,7 @@ case "${target}" in
84-target_makefile_frag=${srcdir}/../config/default.mt 82 microblaze*-*-*)
85+target_makefile_frag=${srcdir}/../config/microblaze.mt 83 AC_CONFIG_FILES([microblaze/Makefile])
86 84 subdirs="$subdirs microblaze"
87 dnl We have to assign the same value to other variables because autoconf 85+ target_makefile_frag=${srcdir}/config/microblaze.mt
88 dnl doesn't provide a mechanism to substitute a replacement keyword with 86 ;;
89-- 87 mt-*-*)
902.37.1 (Apple Git-137.1) 88 AC_CONFIG_FILES([mt/Makefile])
91
diff --git a/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch
index e39ee5b7..3c940329 100644
--- a/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 02/11] [Patch, microblaze]: Modified _exceptional_handler
6 to Superviosry call 6 to Superviosry call
7 7
8Signed-off-by:Nagaraju Mekala<nmekala@xilix.com> 8Signed-off-by:Nagaraju Mekala<nmekala@xilix.com>
9
10Upstream-Status: Pending
9--- 11---
10 libgloss/microblaze/_exception_handler.S | 1 - 12 libgloss/microblaze/_exception_handler.S | 1 -
11 1 file changed, 1 deletion(-) 13 1 file changed, 1 deletion(-)
diff --git a/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch
index e6404369..96b83269 100644
--- a/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 03/11] [LOCAL]: Add missing declarations for xil_printf to
6 6
7Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 7Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
8 8
9Upstream-Status: Pending
10
9Conflicts: 11Conflicts:
10 newlib/libc/include/stdio.h 12 newlib/libc/include/stdio.h
11--- 13---
diff --git a/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch
index 4fa3da7f..6d398bdc 100644
--- a/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch
@@ -4,6 +4,8 @@ Date: Mon, 23 Jan 2017 15:42:11 +0530
4Subject: [PATCH 04/11] [Local]: deleting the xil_printf.c file as now it part 4Subject: [PATCH 04/11] [Local]: deleting the xil_printf.c file as now it part
5 of BSP 5 of BSP
6 6
7Upstream-Status: Pending
8
7--- 9---
8 libgloss/microblaze/xil_printf.c | 284 ------------------------------- 10 libgloss/microblaze/xil_printf.c | 284 -------------------------------
9 1 file changed, 284 deletions(-) 11 1 file changed, 284 deletions(-)
diff --git a/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch
index 025f7192..1576e54d 100644
--- a/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch
@@ -3,6 +3,8 @@ From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 23 Jan 2017 15:44:17 +0530 3Date: Mon, 23 Jan 2017 15:44:17 +0530
4Subject: [PATCH 05/11] [Local]: deleting the xil_printf.o from MAKEFILE 4Subject: [PATCH 05/11] [Local]: deleting the xil_printf.o from MAKEFILE
5 5
6Upstream-Status: Pending
7
6--- 8---
7 libgloss/microblaze/Makefile.in | 2 +- 9 libgloss/microblaze/Makefile.in | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch
index 805e755e..779580b6 100644
--- a/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0006-MB-X-intial-commit.patch
@@ -3,6 +3,8 @@ From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 27 Jul 2018 16:10:36 +0530 3Date: Fri, 27 Jul 2018 16:10:36 +0530
4Subject: [PATCH 06/11] MB-X intial commit 4Subject: [PATCH 06/11] MB-X intial commit
5 5
6Upstream-Status: Pending
7
6--- 8---
7 libgloss/microblaze/crt0.S | 2 +- 9 libgloss/microblaze/crt0.S | 2 +-
8 libgloss/microblaze/crt1.S | 2 +- 10 libgloss/microblaze/crt1.S | 2 +-
diff --git a/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch
index ee7037a7..f3e20253 100644
--- a/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch
@@ -4,6 +4,8 @@ Date: Tue, 11 Sep 2018 14:32:20 +0530
4Subject: [PATCH 07/11] [Patch, Microblaze]: newlib port for microblaze m64 4Subject: [PATCH 07/11] [Patch, Microblaze]: newlib port for microblaze m64
5 flag... 5 flag...
6 6
7Upstream-Status: Pending
8
7Conflicts: 9Conflicts:
8 libgloss/microblaze/_hw_exception_handler.S 10 libgloss/microblaze/_hw_exception_handler.S
9 libgloss/microblaze/_interrupt_handler.S 11 libgloss/microblaze/_interrupt_handler.S
diff --git a/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch
index 915a26ef..b82d7b5c 100644
--- a/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch
@@ -4,6 +4,8 @@ Date: Fri, 28 Sep 2018 12:07:43 +0530
4Subject: [PATCH 08/11] fixing the bug in crt files, added addlik instead of 4Subject: [PATCH 08/11] fixing the bug in crt files, added addlik instead of
5 lli insn 5 lli insn
6 6
7Upstream-Status: Pending
8
7--- 9---
8 libgloss/microblaze/crt0.S | 6 +++--- 10 libgloss/microblaze/crt0.S | 6 +++---
9 libgloss/microblaze/crt1.S | 6 +++--- 11 libgloss/microblaze/crt1.S | 6 +++---
diff --git a/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch
index 40d69465..1a89c31b 100644
--- a/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0009-Patch-MicroBlaze-Added-MB-64-support-to-strcmp-strcp.patch
@@ -4,6 +4,8 @@ Date: Tue, 17 Nov 2020 13:06:41 +0530
4Subject: [PATCH 09/11] [Patch,MicroBlaze] : Added MB-64 support to 4Subject: [PATCH 09/11] [Patch,MicroBlaze] : Added MB-64 support to
5 strcmp/strcpy/strlen files Signed-off-by:Mahesh Bodapati<mbodapat@xilinx.com> 5 strcmp/strcpy/strlen files Signed-off-by:Mahesh Bodapati<mbodapat@xilinx.com>
6 6
7Upstream-Status: Pending
8
7--- 9---
8 newlib/libc/machine/microblaze/strcmp.c | 63 ++++++++++++++++++++++++- 10 newlib/libc/machine/microblaze/strcmp.c | 63 ++++++++++++++++++++++++-
9 newlib/libc/machine/microblaze/strcpy.c | 57 ++++++++++++++++++++++ 11 newlib/libc/machine/microblaze/strcpy.c | 57 ++++++++++++++++++++++
diff --git a/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch
index cd98dfa1..aaa2a009 100644
--- a/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0010-Patch-MicroBlaze-Removing-the-Assembly-implementatio.patch
@@ -5,6 +5,8 @@ Subject: [PATCH 10/11] [Patch,MicroBlaze] : Removing the Assembly
5 implementation of 64bit string function. 5 implementation of 64bit string function.
6 6
7Revisit in next release and fix it 7Revisit in next release and fix it
8
9Upstream-Status: Pending
8--- 10---
9 newlib/libc/machine/microblaze/mb_endian.h | 4 + 11 newlib/libc/machine/microblaze/mb_endian.h | 4 +
10 newlib/libc/machine/microblaze/strcmp.c | 95 ++++++++-------------- 12 newlib/libc/machine/microblaze/strcmp.c | 95 ++++++++--------------
diff --git a/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch
index ba5fcb8c..5e89db18 100644
--- a/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch
+++ b/meta-microblaze/recipes-core/newlib/files/0011-Fixed-the-bug-in-crtinit.s-for-MB-64.patch
@@ -3,6 +3,8 @@ From: Nagaraju <nmekala@xilinx.com>
3Date: Tue, 14 Jan 2020 22:32:30 +0530 3Date: Tue, 14 Jan 2020 22:32:30 +0530
4Subject: [PATCH 11/11] Fixed the bug in crtinit.s for MB-64 4Subject: [PATCH 11/11] Fixed the bug in crtinit.s for MB-64
5 5
6Upstream-Status: Pending
7
6--- 8---
7 libgloss/microblaze/crtinit.S | 2 +- 9 libgloss/microblaze/crtinit.S | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta-microblaze/recipes-core/newlib/libgloss_4.2.%.bbappend b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend
index 15be1732..15be1732 100644
--- a/meta-microblaze/recipes-core/newlib/libgloss_4.2.%.bbappend
+++ b/meta-microblaze/recipes-core/newlib/libgloss_%.bbappend
diff --git a/meta-microblaze/recipes-core/newlib/newlib_4.2.%.bbappend b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend
index d30e61ec..d30e61ec 100644
--- a/meta-microblaze/recipes-core/newlib/newlib_4.2.%.bbappend
+++ b/meta-microblaze/recipes-core/newlib/newlib_%.bbappend
diff --git a/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend
index 27001c4a..8be39fe2 100644
--- a/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend
+++ b/meta-microblaze/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend
@@ -3,8 +3,12 @@ RUSTTOOLS:microblaze ?= ""
3GSTEXAMPLES:microblaze ?= "" 3GSTEXAMPLES:microblaze ?= ""
4X11GLTOOLS:microblaze ?= "" 4X11GLTOOLS:microblaze ?= ""
53GTOOLS:microblaze ?= "" 53GTOOLS:microblaze ?= ""
6KEXECTOOLS:microblaze = ""
6 7
7RDEPENDS:${PN}:remove:microblaze = "\ 8RDEPENDS:${PN}:remove:microblaze = "\
9alsa-utils-amixer \
10alsa-utils-aplay \
11ltp \
8connman-tools \ 12connman-tools \
9connman-tests \ 13connman-tests \
10connman-client \ 14connman-client \
diff --git a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch
index a29214d5..88373e2b 100644
--- a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch
+++ b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch
@@ -8,6 +8,8 @@ Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
8Applied to current version of systemd 8Applied to current version of systemd
9Reworked to split microblaze and microblazeel 9Reworked to split microblaze and microblazeel
10 10
11Upstream-Status: Pending
12
11Signed-off-by: Mark Hatle <mark.hatle@amd.com> 13Signed-off-by: Mark Hatle <mark.hatle@amd.com>
12--- 14---
13 src/basic/architecture.c | 3 +++ 15 src/basic/architecture.c | 3 +++
diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch
index ecbf1f79..157b008a 100644
--- a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch
+++ b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch
@@ -1,28 +1,37 @@
1Microblaze does not support stack-protector: 1From ec286a0b613a9fa487be75b7c1c01e5c8ce62a1a Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@amd.com>
3Date: Fri, 22 Sep 2023 11:01:16 -0600
4Subject: [PATCH] meson.build: Microblaze does not support stack-protector
2 5
3| cc1: warning: '-fstack-protector' not supported for this target 6| cc1: warning: '-fstack-protector' not supported for this target
4| ninja: build stopped: subcommand failed. 7| ninja: build stopped: subcommand failed.
5 8
9Upstream-Status: Inappropriate [Configuration]
10
6Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> 11Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
12---
13 meson.build | 3 ---
14 1 file changed, 3 deletions(-)
7 15
8Index: git/meson.build 16diff --git a/meson.build b/meson.build
9=================================================================== 17index 395eca1943..8b87c5b3a2 100644
10--- git.orig/meson.build 18--- a/meson.build
11+++ git/meson.build 19+++ b/meson.build
12@@ -403,7 +403,6 @@ possible_link_flags = [ 20@@ -405,14 +405,11 @@ possible_common_cc_flags = [
13 '-Wl,--fatal-warnings',
14 '-Wl,-z,now',
15 '-Wl,-z,relro',
16- '-fstack-protector',
17 ]
18 21
19 if get_option('b_sanitize') == 'none'
20@@ -423,8 +422,6 @@ possible_cc_flags = possible_common_cc_f
21 '-fdiagnostics-show-option', 22 '-fdiagnostics-show-option',
22 '-fno-common', 23 '-fno-common',
23 '-fno-strict-aliasing',
24- '-fstack-protector', 24- '-fstack-protector',
25- '-fstack-protector-strong', 25- '-fstack-protector-strong',
26 '-fvisibility=hidden', 26 '-fstrict-flex-arrays',
27 '--param=ssp-buffer-size=4', 27 '--param=ssp-buffer-size=4',
28 ] 28 ]
29
30 possible_common_link_flags = [
31- '-fstack-protector',
32 ]
33
34 c_args = get_option('c_args')
35--
362.34.1
37
diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch
index 8cb618ec..3862803b 100644
--- a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch
+++ b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch
@@ -1,40 +1,49 @@
1For microblaze, replace the ONCE macro 1From 239d51b5b02ba766f34b3fce9803f8fd13097471 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@amd.com>
3Date: Fri, 22 Sep 2023 11:09:50 -0600
4Subject: [PATCH] macro-funcamental.h: Microblaze does not have atomic
5 functions
2 6
3For some reason the systemd developers decided that needed to hardcode 7For some reason the systemd developers decided that needed to hardcode
4the usage of __sync_bool_compare_and_swap, however not all architectures 8the usage of __atomic_exchange functions, however not all architectures
5define this. Microblaze is one such architecture, so we fall back to 9define this. Microblaze is one such architecture, so we fall back to
6a less 'safe' way of doing the work. However a quick inspection of 10a less safe way of doing the same thing. A quick inspection of
7the ONCE users shows that even if we end up with a race condition the 11the ONCE users show that even if we end up with a race condition the
8worst expected behavior could be multiple log messages. 12worst expected behavior could be multiple log messages.
9 13
10Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> 14Upstream-Status: Pending
11 15
12Index: git/src/fundamental/macro-fundamental.h 16Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13=================================================================== 17---
14--- git.orig/src/fundamental/macro-fundamental.h 18 src/fundamental/macro-fundamental.h | 17 +++++++++++++++++
15+++ git/src/fundamental/macro-fundamental.h 19 1 file changed, 17 insertions(+)
16@@ -109,11 +109,28 @@ 20
21diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h
22index 1d49765fce..f45f55cdfe 100644
23--- a/src/fundamental/macro-fundamental.h
24+++ b/src/fundamental/macro-fundamental.h
25@@ -116,11 +116,28 @@
17 * on this macro will run concurrently to all other code conditionalized 26 * on this macro will run concurrently to all other code conditionalized
18 * the same way, there's no ordering or completion enforced. */ 27 * the same way, there's no ordering or completion enforced. */
19 #define ONCE __ONCE(UNIQ_T(_once_, UNIQ)) 28 #define ONCE __ONCE(UNIQ_T(_once_, UNIQ))
20+#if !defined (__microblaze__) 29+#if !defined (__microblaze__)
21 #define __ONCE(o) \ 30 #define __ONCE(o) \
22 ({ \ 31 ({ \
23 static sd_bool (o) = sd_false; \ 32 static bool (o) = false; \
24 __sync_bool_compare_and_swap(&(o), sd_false, sd_true); \ 33 __atomic_exchange_n(&(o), true, __ATOMIC_SEQ_CST); \
25 }) 34 })
26+#else 35+#else
27+ /* Microblaze does not contain __sync_bool_compare_and_swap, so we do it 36+ /* Microblaze does not contain __atomic_exchange_n*, so we do it
28+ * the old fashioned way. Note, it's possible that ONCE may run more 37+ * the old fashioned way. Note, it's possible that ONCE may run more
29+ * then ONCE due to possible races, however it is not expected to cause 38+ * then ONCE due to possible races, however it is not expected to cause
30+ * an issue. */ 39+ * an issue with systemd usage. */
31+#define __ONCE(o) \ 40+#define __ONCE(o) \
32+ ({ \ 41+ ({ \
33+ static bool (o) = sd_false; \ 42+ static bool (o) = false; \
34+ bool rc = sd_false; \ 43+ bool rc = false; \
35+ if ((o) == sd_false) { \ 44+ if ((o) == false) { \
36+ (o) = sd_true; \ 45+ (o) = true; \
37+ rc = sd_true; \ 46+ rc = true; \
38+ } \ 47+ } \
39+ rc; \ 48+ rc; \
40+ }) 49+ })
@@ -42,3 +51,6 @@ Index: git/src/fundamental/macro-fundamental.h
42 51
43 #undef MAX 52 #undef MAX
44 #define MAX(a, b) __MAX(UNIQ, (a), UNIQ, (b)) 53 #define MAX(a, b) __MAX(UNIQ, (a), UNIQ, (b))
54--
552.34.1
56
diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch
index 3bf75d32..75e0300b 100644
--- a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch
+++ b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch
@@ -1,12 +1,24 @@
1Add microblaze syscalls to systemd 1From 2bd273c3a474b04b60c08c98fb7859fce28eac6d Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@amd.com>
3Date: Fri, 22 Sep 2023 10:26:47 -0600
4Subject: [PATCH] syscalls-microblaze.txt: Add microblaze syscalls to systemd
2 5
3Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> 6Upstream-Status: Pending
4 7
5Index: git/src/basic/meson.build 8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
6=================================================================== 9---
7--- git.orig/src/basic/meson.build 10 src/basic/meson.build | 1 +
8+++ git/src/basic/meson.build 11 src/basic/missing_syscall_def.h | 33 ++
9@@ -347,6 +347,7 @@ arch_list = [ 12 src/basic/missing_syscalls.py | 2 +
13 src/basic/syscalls-microblaze.txt | 598 ++++++++++++++++++++++++++++++
14 4 files changed, 634 insertions(+)
15 create mode 100644 src/basic/syscalls-microblaze.txt
16
17diff --git a/src/basic/meson.build b/src/basic/meson.build
18index 3af013b014..e77f7cef16 100644
19--- a/src/basic/meson.build
20+++ b/src/basic/meson.build
21@@ -190,6 +190,7 @@ arch_list = [
10 'ia64', 22 'ia64',
11 'loongarch64', 23 'loongarch64',
12 'm68k', 24 'm68k',
@@ -14,10 +26,10 @@ Index: git/src/basic/meson.build
14 'mips64', 26 'mips64',
15 'mips64n32', 27 'mips64n32',
16 'mipso32', 28 'mipso32',
17Index: git/src/basic/missing_syscall_def.h 29diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h
18=================================================================== 30index 402fdd00dc..94f41c1522 100644
19--- git.orig/src/basic/missing_syscall_def.h 31--- a/src/basic/missing_syscall_def.h
20+++ git/src/basic/missing_syscall_def.h 32+++ b/src/basic/missing_syscall_def.h
21@@ -16,6 +16,7 @@ 33@@ -16,6 +16,7 @@
22 # elif defined(__ia64__) 34 # elif defined(__ia64__)
23 # elif defined(__loongarch64) 35 # elif defined(__loongarch64)
@@ -26,7 +38,7 @@ Index: git/src/basic/missing_syscall_def.h
26 # elif defined(_MIPS_SIM) 38 # elif defined(_MIPS_SIM)
27 # if _MIPS_SIM == _MIPS_SIM_ABI32 39 # if _MIPS_SIM == _MIPS_SIM_ABI32
28 # elif _MIPS_SIM == _MIPS_SIM_NABI32 40 # elif _MIPS_SIM == _MIPS_SIM_NABI32
29@@ -58,6 +59,8 @@ 41@@ -59,6 +60,8 @@
30 # define systemd_NR_bpf 280 42 # define systemd_NR_bpf 280
31 # elif defined(__m68k__) 43 # elif defined(__m68k__)
32 # define systemd_NR_bpf 354 44 # define systemd_NR_bpf 354
@@ -35,7 +47,7 @@ Index: git/src/basic/missing_syscall_def.h
35 # elif defined(_MIPS_SIM) 47 # elif defined(_MIPS_SIM)
36 # if _MIPS_SIM == _MIPS_SIM_ABI32 48 # if _MIPS_SIM == _MIPS_SIM_ABI32
37 # define systemd_NR_bpf 4355 49 # define systemd_NR_bpf 4355
38@@ -124,6 +127,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf); 50@@ -127,6 +130,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf);
39 # define systemd_NR_close_range 436 51 # define systemd_NR_close_range 436
40 # elif defined(__m68k__) 52 # elif defined(__m68k__)
41 # define systemd_NR_close_range 436 53 # define systemd_NR_close_range 436
@@ -44,7 +56,7 @@ Index: git/src/basic/missing_syscall_def.h
44 # elif defined(_MIPS_SIM) 56 # elif defined(_MIPS_SIM)
45 # if _MIPS_SIM == _MIPS_SIM_ABI32 57 # if _MIPS_SIM == _MIPS_SIM_ABI32
46 # define systemd_NR_close_range 4436 58 # define systemd_NR_close_range 4436
47@@ -190,6 +195,8 @@ assert_cc(__NR_close_range == systemd_NR 59@@ -195,6 +200,8 @@ assert_cc(__NR_close_range == systemd_NR_close_range);
48 # define systemd_NR_copy_file_range 285 60 # define systemd_NR_copy_file_range 285
49 # elif defined(__m68k__) 61 # elif defined(__m68k__)
50 # define systemd_NR_copy_file_range 376 62 # define systemd_NR_copy_file_range 376
@@ -53,16 +65,7 @@ Index: git/src/basic/missing_syscall_def.h
53 # elif defined(_MIPS_SIM) 65 # elif defined(_MIPS_SIM)
54 # if _MIPS_SIM == _MIPS_SIM_ABI32 66 # if _MIPS_SIM == _MIPS_SIM_ABI32
55 # define systemd_NR_copy_file_range 4360 67 # define systemd_NR_copy_file_range 4360
56@@ -256,6 +263,8 @@ assert_cc(__NR_copy_file_range == system 68@@ -263,6 +270,8 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range);
57 # define systemd_NR_epoll_pwait2 441
58 # elif defined(__m68k__)
59 # define systemd_NR_epoll_pwait2 441
60+# elif defined(__microblaze__)
61+# define systemd_NR_epoll_pwait2 441
62 # elif defined(_MIPS_SIM)
63 # if _MIPS_SIM == _MIPS_SIM_ABI32
64 # define systemd_NR_epoll_pwait2 4441
65@@ -322,6 +331,8 @@ assert_cc(__NR_epoll_pwait2 == systemd_N
66 # define systemd_NR_getrandom 278 69 # define systemd_NR_getrandom 278
67 # elif defined(__m68k__) 70 # elif defined(__m68k__)
68 # define systemd_NR_getrandom 352 71 # define systemd_NR_getrandom 352
@@ -71,7 +74,7 @@ Index: git/src/basic/missing_syscall_def.h
71 # elif defined(_MIPS_SIM) 74 # elif defined(_MIPS_SIM)
72 # if _MIPS_SIM == _MIPS_SIM_ABI32 75 # if _MIPS_SIM == _MIPS_SIM_ABI32
73 # define systemd_NR_getrandom 4353 76 # define systemd_NR_getrandom 4353
74@@ -388,6 +399,8 @@ assert_cc(__NR_getrandom == systemd_NR_g 77@@ -331,6 +340,8 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom);
75 # define systemd_NR_memfd_create 279 78 # define systemd_NR_memfd_create 279
76 # elif defined(__m68k__) 79 # elif defined(__m68k__)
77 # define systemd_NR_memfd_create 353 80 # define systemd_NR_memfd_create 353
@@ -80,7 +83,7 @@ Index: git/src/basic/missing_syscall_def.h
80 # elif defined(_MIPS_SIM) 83 # elif defined(_MIPS_SIM)
81 # if _MIPS_SIM == _MIPS_SIM_ABI32 84 # if _MIPS_SIM == _MIPS_SIM_ABI32
82 # define systemd_NR_memfd_create 4354 85 # define systemd_NR_memfd_create 4354
83@@ -454,6 +467,8 @@ assert_cc(__NR_memfd_create == systemd_N 86@@ -399,6 +410,8 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create);
84 # define systemd_NR_mount_setattr 442 87 # define systemd_NR_mount_setattr 442
85 # elif defined(__m68k__) 88 # elif defined(__m68k__)
86 # define systemd_NR_mount_setattr 442 89 # define systemd_NR_mount_setattr 442
@@ -89,7 +92,7 @@ Index: git/src/basic/missing_syscall_def.h
89 # elif defined(_MIPS_SIM) 92 # elif defined(_MIPS_SIM)
90 # if _MIPS_SIM == _MIPS_SIM_ABI32 93 # if _MIPS_SIM == _MIPS_SIM_ABI32
91 # define systemd_NR_mount_setattr 4442 94 # define systemd_NR_mount_setattr 4442
92@@ -520,6 +535,8 @@ assert_cc(__NR_mount_setattr == systemd_ 95@@ -467,6 +480,8 @@ assert_cc(__NR_mount_setattr == systemd_NR_mount_setattr);
93 # define systemd_NR_move_mount 429 96 # define systemd_NR_move_mount 429
94 # elif defined(__m68k__) 97 # elif defined(__m68k__)
95 # define systemd_NR_move_mount 429 98 # define systemd_NR_move_mount 429
@@ -98,7 +101,7 @@ Index: git/src/basic/missing_syscall_def.h
98 # elif defined(_MIPS_SIM) 101 # elif defined(_MIPS_SIM)
99 # if _MIPS_SIM == _MIPS_SIM_ABI32 102 # if _MIPS_SIM == _MIPS_SIM_ABI32
100 # define systemd_NR_move_mount 4429 103 # define systemd_NR_move_mount 4429
101@@ -586,6 +603,8 @@ assert_cc(__NR_move_mount == systemd_NR_ 104@@ -535,6 +550,8 @@ assert_cc(__NR_move_mount == systemd_NR_move_mount);
102 # define systemd_NR_name_to_handle_at 264 105 # define systemd_NR_name_to_handle_at 264
103 # elif defined(__m68k__) 106 # elif defined(__m68k__)
104 # define systemd_NR_name_to_handle_at 340 107 # define systemd_NR_name_to_handle_at 340
@@ -107,7 +110,7 @@ Index: git/src/basic/missing_syscall_def.h
107 # elif defined(_MIPS_SIM) 110 # elif defined(_MIPS_SIM)
108 # if _MIPS_SIM == _MIPS_SIM_ABI32 111 # if _MIPS_SIM == _MIPS_SIM_ABI32
109 # define systemd_NR_name_to_handle_at 4339 112 # define systemd_NR_name_to_handle_at 4339
110@@ -652,6 +671,8 @@ assert_cc(__NR_name_to_handle_at == syst 113@@ -603,6 +620,8 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at);
111 # define systemd_NR_open_tree 428 114 # define systemd_NR_open_tree 428
112 # elif defined(__m68k__) 115 # elif defined(__m68k__)
113 # define systemd_NR_open_tree 428 116 # define systemd_NR_open_tree 428
@@ -116,7 +119,16 @@ Index: git/src/basic/missing_syscall_def.h
116 # elif defined(_MIPS_SIM) 119 # elif defined(_MIPS_SIM)
117 # if _MIPS_SIM == _MIPS_SIM_ABI32 120 # if _MIPS_SIM == _MIPS_SIM_ABI32
118 # define systemd_NR_open_tree 4428 121 # define systemd_NR_open_tree 4428
119@@ -784,6 +805,8 @@ assert_cc(__NR_openat2 == systemd_NR_ope 122@@ -671,6 +690,8 @@ assert_cc(__NR_open_tree == systemd_NR_open_tree);
123 # define systemd_NR_openat2 437
124 # elif defined(__m68k__)
125 # define systemd_NR_openat2 437
126+# elif defined(__microblaze__)
127+# define systemd_NR_openat2 437
128 # elif defined(_MIPS_SIM)
129 # if _MIPS_SIM == _MIPS_SIM_ABI32
130 # define systemd_NR_openat2 4437
131@@ -739,6 +760,8 @@ assert_cc(__NR_openat2 == systemd_NR_openat2);
120 # define systemd_NR_pidfd_open 434 132 # define systemd_NR_pidfd_open 434
121 # elif defined(__m68k__) 133 # elif defined(__m68k__)
122 # define systemd_NR_pidfd_open 434 134 # define systemd_NR_pidfd_open 434
@@ -125,7 +137,7 @@ Index: git/src/basic/missing_syscall_def.h
125 # elif defined(_MIPS_SIM) 137 # elif defined(_MIPS_SIM)
126 # if _MIPS_SIM == _MIPS_SIM_ABI32 138 # if _MIPS_SIM == _MIPS_SIM_ABI32
127 # define systemd_NR_pidfd_open 4434 139 # define systemd_NR_pidfd_open 4434
128@@ -850,6 +873,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_ 140@@ -807,6 +830,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open);
129 # define systemd_NR_pidfd_send_signal 424 141 # define systemd_NR_pidfd_send_signal 424
130 # elif defined(__m68k__) 142 # elif defined(__m68k__)
131 # define systemd_NR_pidfd_send_signal 424 143 # define systemd_NR_pidfd_send_signal 424
@@ -134,7 +146,7 @@ Index: git/src/basic/missing_syscall_def.h
134 # elif defined(_MIPS_SIM) 146 # elif defined(_MIPS_SIM)
135 # if _MIPS_SIM == _MIPS_SIM_ABI32 147 # if _MIPS_SIM == _MIPS_SIM_ABI32
136 # define systemd_NR_pidfd_send_signal 4424 148 # define systemd_NR_pidfd_send_signal 4424
137@@ -916,6 +941,8 @@ assert_cc(__NR_pidfd_send_signal == syst 149@@ -875,6 +900,8 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal);
138 # define systemd_NR_pkey_mprotect 288 150 # define systemd_NR_pkey_mprotect 288
139 # elif defined(__m68k__) 151 # elif defined(__m68k__)
140 # define systemd_NR_pkey_mprotect 381 152 # define systemd_NR_pkey_mprotect 381
@@ -143,7 +155,7 @@ Index: git/src/basic/missing_syscall_def.h
143 # elif defined(_MIPS_SIM) 155 # elif defined(_MIPS_SIM)
144 # if _MIPS_SIM == _MIPS_SIM_ABI32 156 # if _MIPS_SIM == _MIPS_SIM_ABI32
145 # define systemd_NR_pkey_mprotect 4363 157 # define systemd_NR_pkey_mprotect 4363
146@@ -982,6 +1009,8 @@ assert_cc(__NR_pkey_mprotect == systemd_ 158@@ -943,6 +970,8 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect);
147 # define systemd_NR_renameat2 276 159 # define systemd_NR_renameat2 276
148 # elif defined(__m68k__) 160 # elif defined(__m68k__)
149 # define systemd_NR_renameat2 351 161 # define systemd_NR_renameat2 351
@@ -152,7 +164,7 @@ Index: git/src/basic/missing_syscall_def.h
152 # elif defined(_MIPS_SIM) 164 # elif defined(_MIPS_SIM)
153 # if _MIPS_SIM == _MIPS_SIM_ABI32 165 # if _MIPS_SIM == _MIPS_SIM_ABI32
154 # define systemd_NR_renameat2 4351 166 # define systemd_NR_renameat2 4351
155@@ -1048,6 +1077,8 @@ assert_cc(__NR_renameat2 == systemd_NR_r 167@@ -1011,6 +1040,8 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2);
156 # define systemd_NR_setns 268 168 # define systemd_NR_setns 268
157 # elif defined(__m68k__) 169 # elif defined(__m68k__)
158 # define systemd_NR_setns 344 170 # define systemd_NR_setns 344
@@ -161,7 +173,7 @@ Index: git/src/basic/missing_syscall_def.h
161 # elif defined(_MIPS_SIM) 173 # elif defined(_MIPS_SIM)
162 # if _MIPS_SIM == _MIPS_SIM_ABI32 174 # if _MIPS_SIM == _MIPS_SIM_ABI32
163 # define systemd_NR_setns 4344 175 # define systemd_NR_setns 4344
164@@ -1114,6 +1145,8 @@ assert_cc(__NR_setns == systemd_NR_setns 176@@ -1079,6 +1110,8 @@ assert_cc(__NR_setns == systemd_NR_setns);
165 # define systemd_NR_statx 291 177 # define systemd_NR_statx 291
166 # elif defined(__m68k__) 178 # elif defined(__m68k__)
167 # define systemd_NR_statx 379 179 # define systemd_NR_statx 379
@@ -170,11 +182,11 @@ Index: git/src/basic/missing_syscall_def.h
170 # elif defined(_MIPS_SIM) 182 # elif defined(_MIPS_SIM)
171 # if _MIPS_SIM == _MIPS_SIM_ABI32 183 # if _MIPS_SIM == _MIPS_SIM_ABI32
172 # define systemd_NR_statx 4366 184 # define systemd_NR_statx 4366
173Index: git/src/basic/missing_syscalls.py 185diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py
174=================================================================== 186index 5ccf02adec..e09023abe1 100644
175--- git.orig/src/basic/missing_syscalls.py 187--- a/src/basic/missing_syscalls.py
176+++ git/src/basic/missing_syscalls.py 188+++ b/src/basic/missing_syscalls.py
177@@ -64,6 +64,8 @@ DEF_TEMPLATE_B = '''\ 189@@ -63,6 +63,8 @@ DEF_TEMPLATE_B = '''\
178 # define systemd_NR_{syscall} {nr_loongarch64} 190 # define systemd_NR_{syscall} {nr_loongarch64}
179 # elif defined(__m68k__) 191 # elif defined(__m68k__)
180 # define systemd_NR_{syscall} {nr_m68k} 192 # define systemd_NR_{syscall} {nr_m68k}
@@ -183,10 +195,11 @@ Index: git/src/basic/missing_syscalls.py
183 # elif defined(_MIPS_SIM) 195 # elif defined(_MIPS_SIM)
184 # if _MIPS_SIM == _MIPS_SIM_ABI32 196 # if _MIPS_SIM == _MIPS_SIM_ABI32
185 # define systemd_NR_{syscall} {nr_mipso32} 197 # define systemd_NR_{syscall} {nr_mipso32}
186Index: git/src/basic/syscalls-microblaze.txt 198diff --git a/src/basic/syscalls-microblaze.txt b/src/basic/syscalls-microblaze.txt
187=================================================================== 199new file mode 100644
200index 0000000000..3fc4cd6aef
188--- /dev/null 201--- /dev/null
189+++ git/src/basic/syscalls-microblaze.txt 202+++ b/src/basic/syscalls-microblaze.txt
190@@ -0,0 +1,598 @@ 203@@ -0,0 +1,598 @@
191+_llseek 140 204+_llseek 140
192+_newselect 142 205+_newselect 142
@@ -786,3 +799,6 @@ Index: git/src/basic/syscalls-microblaze.txt
786+waitpid 7 799+waitpid 7
787+write 4 800+write 4
788+writev 146 801+writev 146
802--
8032.34.1
804
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch
new file mode 100644
index 00000000..07712c98
--- /dev/null
+++ b/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch
@@ -0,0 +1,17 @@
1SECCOMP / Audit support needs to know about the microblaze architecture.
2
3Upstream-Status: Pending
4
5Signed-off-by: Mark Hatle <mark.hatle@amd.com>
6
7--- util-linux-2.39.1/include/audit-arch.h.orig 2023-08-23 14:55:54.318732126 -0600
8+++ util-linux-2.39.1/include/audit-arch.h 2023-08-23 15:02:51.058552660 -0600
9@@ -57,6 +57,8 @@
10 # else
11 # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64
12 # endif
13+#elif __microblaze__
14+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MICROBLAZE
15 #else
16 # error Unknown target architecture
17 #endif
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend
new file mode 100644
index 00000000..7774dda5
--- /dev/null
+++ b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux"
2SRC_URI:append:microblaze = " file://util-linux-microblaze.patch"
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
index 191d69ef..3701d245 100644
--- a/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
+++ b/meta-microblaze/recipes-devtools/binutils/binutils-microblaze.inc
@@ -1,43 +1,4 @@
1FILESEXTRAPATHS:append := ":${THISDIR}/binutils" 1FILESEXTRAPATHS:append := ":${THISDIR}/binutils"
2 2
3SRC_URI:append = " \
4 file://0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch \
5 file://0002-Add-mlittle-endian-and-mbig-endian-flags.patch \
6 file://0003-Disable-the-warning-message-for-eh_frame_hdr.patch \
7 file://0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \
8 file://0005-upstream-change-to-garbage-collection-sweep-causes-m.patch \
9 file://0006-Fix-bug-in-TLSTPREL-Relocation.patch \
10 file://0007-Added-Address-extension-instructions.patch \
11 file://0008-Add-new-bit-field-instructions.patch \
12 file://0009-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch \
13 file://0010-fixing-the-constant-range-check-issue.patch \
14 file://0011-Patch-Microblaze-Compiler-will-give-error-messages-i.patch \
15 file://0012-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch \
16 file://0013-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch \
17 file://0014-Added-relocations-for-MB-X.patch \
18 file://0015-Fixed-MB-x-relocation-issues.patch \
19 file://0016-Fixing-the-branch-related-issues.patch \
20 file://0017-Fixed-address-computation-issues-with-64bit-address.patch \
21 file://0018-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch \
22 file://0019-fixing-the-.bss-relocation-issue.patch \
23 file://0020-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch \
24 file://0021-Revert-ld-Remove-unused-expression-state.patch \
25 file://0022-fixing-the-long-long-long-mingw-toolchain-issue.patch \
26 file://0023-Added-support-to-new-arithmetic-single-register-inst.patch \
27 file://0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch \
28 file://0025-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch \
29 file://0026-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch \
30 file://0027-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch \
31 file://0028-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch \
32 file://0029-gas-revert-moving-of-md_pseudo_table-from-const.patch \
33 file://0030-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch \
34 file://0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch \
35 file://0032-Patch-MicroBlaze-Double-free-with-ld-no-keep-memory.patch \
36 file://0033-Patch-MB-MB-binutils-Upstream-port-issues.patch \
37 file://0034-Patch-MicroBlaze-By-default-the-linker-will-generate.patch \
38 file://0035-Fix-for-objdump-issue-for-mb32-el.patch \
39 file://0036-Fix-for-missing-instructions-in-dump.patch \
40 "
41
42LDGOLD_ALTS:microblaze = "" 3LDGOLD_ALTS:microblaze = ""
43USE_ALTERNATIVES_FOR:remove:microblaze = "gprof" 4USE_ALTERNATIVES_FOR:remove:microblaze = "gprof"
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
deleted file mode 100644
index d5fa21ce..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0001-Add-wdc.ext.clear-and-wdc.ext.flush-insns.patch
+++ /dev/null
@@ -1,65 +0,0 @@
1From 38ae9c3ae1270b9873e1cfa4397bae4a5269d1aa Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 01/34] Add wdc.ext.clear and wdc.ext.flush insns
5
6Added two new instructions, wdc.ext.clear and wdc.ext.flush,
7to enable MicroBlaze to flush an external cache, which is
8used with the new coherency support for multiprocessing.
9
10Signed-off-by:nagaraju <nmekala@xilix.com>
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12---
13 opcodes/microblaze-opc.h | 5 ++++-
14 opcodes/microblaze-opcm.h | 4 ++--
15 2 files changed, 6 insertions(+), 3 deletions(-)
16
17diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
18index ffb0f08c692..b8a0cf82516 100644
19--- a/opcodes/microblaze-opc.h
20+++ b/opcodes/microblaze-opc.h
21@@ -91,6 +91,7 @@
22 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
23 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
24 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
25+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
26 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
27
28 /* New Mask for msrset, msrclr insns. */
29@@ -101,7 +102,7 @@
30 #define DELAY_SLOT 1
31 #define NO_DELAY_SLOT 0
32
33-#define MAX_OPCODES 289
34+#define MAX_OPCODES 291
35
36 const struct op_code_struct
37 {
38@@ -174,7 +175,9 @@ const struct op_code_struct
39 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
40 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
41 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
42+ {"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 },
43 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
44+ {"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 },
45 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
46 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
47 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
48diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
49index 8e293465fec..e56c1d2d47c 100644
50--- a/opcodes/microblaze-opcm.h
51+++ b/opcodes/microblaze-opcm.h
52@@ -33,8 +33,8 @@ enum microblaze_instr
53 /* 'or/and/xor' are C++ keywords. */
54 microblaze_or, microblaze_and, microblaze_xor,
55 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
56- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
57- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
58+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br,
59+ brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
60 bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
61 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
62 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
63--
642.37.1 (Apple Git-137.1)
65
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
deleted file mode 100644
index 836d5b08..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0002-Add-mlittle-endian-and-mbig-endian-flags.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From d5645c82ce39b1950a6d0ee279088d10af390642 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 19 Mar 2013 17:18:23 +0530
4Subject: [PATCH 02/34] 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>
14---
15 gas/config/tc-microblaze.c | 9 +++++++++
16 1 file changed, 9 insertions(+)
17
18diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
19index 3db17a76ee7..c927331ea0a 100644
20--- a/gas/config/tc-microblaze.c
21+++ b/gas/config/tc-microblaze.c
22@@ -37,6 +37,8 @@
23
24 #define OPTION_EB (OPTION_MD_BASE + 0)
25 #define OPTION_EL (OPTION_MD_BASE + 1)
26+#define OPTION_LITTLE (OPTION_MD_BASE + 2)
27+#define OPTION_BIG (OPTION_MD_BASE + 3)
28
29 void microblaze_generate_symbol (char *sym);
30 static bool check_spl_reg (unsigned *);
31@@ -1854,6 +1856,8 @@ struct option md_longopts[] =
32 {
33 {"EB", no_argument, NULL, OPTION_EB},
34 {"EL", no_argument, NULL, OPTION_EL},
35+ {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
36+ {"mbig-endian", no_argument, NULL, OPTION_BIG},
37 { NULL, no_argument, NULL, 0}
38 };
39
40@@ -2507,9 +2511,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
41 switch (c)
42 {
43 case OPTION_EB:
44+ case OPTION_BIG:
45 target_big_endian = 1;
46 break;
47 case OPTION_EL:
48+ case OPTION_LITTLE:
49 target_big_endian = 0;
50 break;
51 default:
52@@ -2524,6 +2530,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
53 /* fprintf(stream, _("\
54 MicroBlaze options:\n\
55 -noSmall Data in the comm and data sections do not go into the small data section\n")); */
56+ fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
57+ fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
58+ fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
59 }
60
61
62--
632.37.1 (Apple Git-137.1)
64
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
deleted file mode 100644
index 156f5c78..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0003-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 6f53d25f9817f4d9fbc8d838b36d7026d184e63f 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 03/34] 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
10---
11 bfd/elf-eh-frame.c | 3 +++
12 1 file changed, 3 insertions(+)
13
14diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
15index 2e22d0c9215..db470ed43c3 100644
16--- a/bfd/elf-eh-frame.c
17+++ b/bfd/elf-eh-frame.c
18@@ -1044,10 +1044,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
19 goto success;
20
21 free_no_table:
22+/* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
23+if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
24 _bfd_error_handler
25 /* xgettext:c-format */
26 (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
27 abfd, sec);
28+}
29 hdr_info->u.dwarf.table = false;
30 free (sec_info);
31 success:
32--
332.37.1 (Apple Git-137.1)
34
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index e0bd25b9..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0004-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
+++ /dev/null
@@ -1,310 +0,0 @@
1From f7c540994e73e430e73d220109e911dff5961f16 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 8 Nov 2016 11:54:08 +0530
4Subject: [PATCH 04/34] [LOCAL]: Fix relaxation of assembler resolved
5 references,Fixup debug_loc sections after linker relaxation Adds a new
6 reloctype R_MICROBLAZE_32_NONE, used for passing reloc info from the
7 assembler to the linker when the linker manages to fully resolve a local
8 symbol reference.
9
10This is a workaround for design flaws in the assembler to
11linker interface with regards to linker relaxation.
12
13Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15
16Conflicts:
17 bfd/elf32-microblaze.c
18 binutils/readelf.c
19 include/elf/microblaze.h
20
21Conflicts:
22 binutils/readelf.c
23
24Conflicts:
25 bfd/elf32-microblaze.c
26---
27 bfd/bfd-in2.h | 5 ++
28 bfd/elf32-microblaze.c | 126 ++++++++++++++++++++++++++++---------
29 bfd/libbfd.h | 1 +
30 bfd/reloc.c | 6 ++
31 binutils/readelf.c | 4 ++
32 gas/config/tc-microblaze.c | 4 ++
33 include/elf/microblaze.h | 2 +
34 7 files changed, 119 insertions(+), 29 deletions(-)
35
36diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
37index 1f0f18a7e75..26e3bb2b34b 100644
38--- a/bfd/bfd-in2.h
39+++ b/bfd/bfd-in2.h
40@@ -5379,6 +5379,11 @@ value relative to the read-write small data area anchor */
41 expressions of the form "Symbol Op Symbol" */
42 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
43
44+/* This is a 32 bit reloc that stores the 32 bit pc relative
45+value in two words (with an imm instruction).No relocation is
46+done here - only used for relaxing */
47+ BFD_RELOC_MICROBLAZE_32_NONE,
48+
49 /* This is a 64 bit reloc that stores the 32 bit pc relative
50 value in two words (with an imm instruction). No relocation is
51 done here - only used for relaxing */
52diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
53index 013c32a1e51..7cf1b6eab5b 100644
54--- a/bfd/elf32-microblaze.c
55+++ b/bfd/elf32-microblaze.c
56@@ -175,6 +175,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
57 false), /* PC relative offset? */
58
59 /* This reloc does nothing. Used for relaxation. */
60+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
61+ 0, /* Rightshift. */
62+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
63+ 32, /* Bitsize. */
64+ true, /* PC_relative. */
65+ 0, /* Bitpos. */
66+ complain_overflow_bitfield, /* Complain on overflow. */
67+ NULL, /* Special Function. */
68+ "R_MICROBLAZE_32_NONE",/* Name. */
69+ false, /* Partial Inplace. */
70+ 0, /* Source Mask. */
71+ 0, /* Dest Mask. */
72+ false), /* PC relative offset? */
73+
74 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
75 0, /* Rightshift. */
76 0, /* Size. */
77@@ -560,7 +574,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
78 case BFD_RELOC_NONE:
79 microblaze_reloc = R_MICROBLAZE_NONE;
80 break;
81- case BFD_RELOC_MICROBLAZE_64_NONE:
82+ case BFD_RELOC_MICROBLAZE_32_NONE:
83+ microblaze_reloc = R_MICROBLAZE_32_NONE;
84+ break;
85+ case BFD_RELOC_MICROBLAZE_64_NONE:
86 microblaze_reloc = R_MICROBLAZE_64_NONE;
87 break;
88 case BFD_RELOC_32:
89@@ -1954,18 +1971,26 @@ microblaze_elf_relax_section (bfd *abfd,
90 }
91 break;
92 case R_MICROBLAZE_NONE:
93+ case R_MICROBLAZE_32_NONE:
94 {
95 /* This was a PC-relative instruction that was
96 completely resolved. */
97 size_t sfix, efix;
98+ unsigned int val;
99 bfd_vma target_address;
100 target_address = irel->r_addend + irel->r_offset;
101 sfix = calc_fixup (irel->r_offset, 0, sec);
102 efix = calc_fixup (target_address, 0, sec);
103- irel->r_addend -= (efix - sfix);
104- /* Should use HOWTO. */
105- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
106- irel->r_addend);
107+
108+ /* Validate the in-band val. */
109+ val = bfd_get_32 (abfd, contents + irel->r_offset);
110+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
111+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
112+ }
113+ irel->r_addend -= (efix - sfix);
114+ /* Should use HOWTO. */
115+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
116+ irel->r_addend);
117 }
118 break;
119 case R_MICROBLAZE_64_NONE:
120@@ -2009,30 +2034,73 @@ microblaze_elf_relax_section (bfd *abfd,
121 irelscanend = irelocs + o->reloc_count;
122 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
123 {
124- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
125- {
126- isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
127+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
128+ {
129+ unsigned int val;
130+
131+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
132+
133+ /* hax: We only do the following fixup for debug location lists. */
134+ if (strcmp(".debug_loc", o->name))
135+ continue;
136+
137+ /* This was a PC-relative instruction that was completely resolved. */
138+ if (ocontents == NULL)
139+ {
140+ if (elf_section_data (o)->this_hdr.contents != NULL)
141+ ocontents = elf_section_data (o)->this_hdr.contents;
142+ else
143+ {
144+ /* We always cache the section contents.
145+ Perhaps, if info->keep_memory is FALSE, we
146+ should free them, if we are permitted to. */
147+
148+ if (o->rawsize == 0)
149+ o->rawsize = o->size;
150+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
151+ if (ocontents == NULL)
152+ goto error_return;
153+ if (!bfd_get_section_contents (abfd, o, ocontents,
154+ (file_ptr) 0,
155+ o->rawsize))
156+ goto error_return;
157+ elf_section_data (o)->this_hdr.contents = ocontents;
158+ }
159+ }
160
161- /* Look at the reloc only if the value has been resolved. */
162- if (isym->st_shndx == shndx
163- && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
164- {
165- if (ocontents == NULL)
166- {
167- if (elf_section_data (o)->this_hdr.contents != NULL)
168- ocontents = elf_section_data (o)->this_hdr.contents;
169- else
170- {
171- /* We always cache the section contents.
172- Perhaps, if info->keep_memory is FALSE, we
173- should free them, if we are permitted to. */
174- if (o->rawsize == 0)
175- o->rawsize = o->size;
176- ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
177- if (ocontents == NULL)
178- goto error_return;
179- if (!bfd_get_section_contents (abfd, o, ocontents,
180- (file_ptr) 0,
181+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
182+ if (val != irelscan->r_addend) {
183+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
184+ }
185+
186+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
187+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
188+ irelscan->r_addend);
189+ }
190+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
191+ {
192+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
193+
194+ /* Look at the reloc only if the value has been resolved. */
195+ if (isym->st_shndx == shndx
196+ && (ELF32_ST_TYPE (isym->st_info) == STT_SECTION))
197+ {
198+ if (ocontents == NULL)
199+ {
200+ if (elf_section_data (o)->this_hdr.contents != NULL)
201+ ocontents = elf_section_data (o)->this_hdr.contents;
202+ else
203+ {
204+ /* We always cache the section contents.
205+ Perhaps, if info->keep_memory is FALSE, we
206+ should free them, if we are permitted to. */
207+ if (o->rawsize == 0)
208+ o->rawsize = o->size;
209+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
210+ if (ocontents == NULL)
211+ goto error_return;
212+ if (!bfd_get_section_contents (abfd, o, ocontents,
213+ (file_ptr) 0,
214 o->rawsize))
215 goto error_return;
216 elf_section_data (o)->this_hdr.contents = ocontents;
217@@ -2068,7 +2136,7 @@ microblaze_elf_relax_section (bfd *abfd,
218 elf_section_data (o)->this_hdr.contents = ocontents;
219 }
220 }
221- irelscan->r_addend -= calc_fixup (irel->r_addend
222+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
223 + isym->st_value,
224 0,
225 sec);
226diff --git a/bfd/libbfd.h b/bfd/libbfd.h
227index 29e8187f95f..ea2507d1879 100644
228--- a/bfd/libbfd.h
229+++ b/bfd/libbfd.h
230@@ -2989,6 +2989,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
231 "BFD_RELOC_MICROBLAZE_32_ROSDA",
232 "BFD_RELOC_MICROBLAZE_32_RWSDA",
233 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
234+ "BFD_RELOC_MICROBLAZE_32_NONE",
235 "BFD_RELOC_MICROBLAZE_64_NONE",
236 "BFD_RELOC_MICROBLAZE_64_GOTPC",
237 "BFD_RELOC_MICROBLAZE_64_GOT",
238diff --git a/bfd/reloc.c b/bfd/reloc.c
239index 36999fe9a40..5ac8a8536a7 100644
240--- a/bfd/reloc.c
241+++ b/bfd/reloc.c
242@@ -6867,6 +6867,12 @@ ENUM
243 ENUMDOC
244 This is a 32 bit reloc for the microblaze to handle
245 expressions of the form "Symbol Op Symbol"
246+ENUM
247+ BFD_RELOC_MICROBLAZE_32_NONE
248+ENUMDOC
249+ This is a 32 bit reloc that stores the 32 bit pc relative
250+ value in two words (with an imm instruction). No relocation is
251+ done here - only used for relaxing
252 ENUM
253 BFD_RELOC_MICROBLAZE_64_NONE
254 ENUMDOC
255diff --git a/binutils/readelf.c b/binutils/readelf.c
256index 0f5977bc072..acd12713361 100644
257--- a/binutils/readelf.c
258+++ b/binutils/readelf.c
259@@ -14621,6 +14621,10 @@ is_8bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
260 return reloc_type == 1; /* R_Z80_8. */
261 default:
262 return false;
263+ case EM_MICROBLAZE:
264+ return reloc_type == 33 /* R_MICROBLAZE_32_NONE. */
265+ || reloc_type == 0 /* R_MICROBLAZE_NONE. */
266+ || reloc_type == 9; /* R_MICROBLAZE_64_NONE. */
267 }
268 }
269
270diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
271index c927331ea0a..8018d1f5686 100644
272--- a/gas/config/tc-microblaze.c
273+++ b/gas/config/tc-microblaze.c
274@@ -2211,9 +2211,12 @@ md_apply_fix (fixS * fixP,
275 moves code around due to relaxing. */
276 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
277 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
278+ else if (fixP->fx_r_type == BFD_RELOC_32)
279+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
280 else
281 fixP->fx_r_type = BFD_RELOC_NONE;
282 fixP->fx_addsy = section_symbol (absolute_section);
283+ fixP->fx_done = 0;
284 }
285 return;
286 }
287@@ -2434,6 +2437,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
288 switch (fixp->fx_r_type)
289 {
290 case BFD_RELOC_NONE:
291+ case BFD_RELOC_MICROBLAZE_32_NONE:
292 case BFD_RELOC_MICROBLAZE_64_NONE:
293 case BFD_RELOC_32:
294 case BFD_RELOC_MICROBLAZE_32_LO:
295diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
296index 43ad3ad3904..a2e1ce4580f 100644
297--- a/include/elf/microblaze.h
298+++ b/include/elf/microblaze.h
299@@ -61,6 +61,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
300 RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */
301 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
302 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
303+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
304+
305 END_RELOC_NUMBERS (R_MICROBLAZE_max)
306
307 /* Global base address names. */
308--
3092.37.1 (Apple Git-137.1)
310
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
deleted file mode 100644
index 20dd1859..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0005-upstream-change-to-garbage-collection-sweep-causes-m.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 5f27701e5c8bd1784e1c814fb527a1f8f7755ad9 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 05/34] 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
24---
25 bfd/elflink.c | 1 -
26 1 file changed, 1 deletion(-)
27
28diff --git a/bfd/elflink.c b/bfd/elflink.c
29index 2b1450fa4e1..c50919060b3 100644
30--- a/bfd/elflink.c
31+++ b/bfd/elflink.c
32@@ -6576,7 +6576,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
33
34 inf = (struct elf_gc_sweep_symbol_info *) data;
35 (*inf->hide_symbol) (inf->info, h, true);
36- h->def_regular = 0;
37 h->ref_regular = 0;
38 h->ref_regular_nonweak = 0;
39 }
40--
412.37.1 (Apple Git-137.1)
42
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch
deleted file mode 100644
index 68a5d684..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0006-Fix-bug-in-TLSTPREL-Relocation.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 63c56c953483dd62a2c2ac8e750947a4673f9e86 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 15 Jun 2015 16:50:30 +0530
4Subject: [PATCH 06/34] Fix bug in TLSTPREL Relocation
5
6Fixed the problem related to the fixup/relocations TLSTPREL.
7When the fixup is applied the addend is not added at the correct offset
8of the instruction. The offset is hard coded considering its big endian
9and it fails for Little endian. This patch allows support for both
10big & little-endian compilers
11---
12 bfd/elf32-microblaze.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
16index 7cf1b6eab5b..edde04bafe4 100644
17--- a/bfd/elf32-microblaze.c
18+++ b/bfd/elf32-microblaze.c
19@@ -1484,9 +1484,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
20 relocation += addend;
21 relocation -= dtprel_base(info);
22 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
23- contents + offset + 2);
24+ contents + offset + endian);
25 bfd_put_16 (input_bfd, relocation & 0xffff,
26- contents + offset + 2 + INST_WORD_SIZE);
27+ contents + offset + endian + INST_WORD_SIZE);
28 break;
29 case (int) R_MICROBLAZE_TEXTREL_64:
30 case (int) R_MICROBLAZE_TEXTREL_32_LO:
31--
322.37.1 (Apple Git-137.1)
33
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
deleted file mode 100644
index ffaf6236..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0007-Added-Address-extension-instructions.patch
+++ /dev/null
@@ -1,101 +0,0 @@
1From 7e1cbc2f96a1905eecf3a211153735ed915a5ad5 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jan 2016 12:28:21 +0530
4Subject: [PATCH 07/34] Added Address extension instructions
5
6This patch adds the support of new instructions which are required
7for supporting Address extension feature.
8
9Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
10
11ChangeLog:
12 2016-01-18 Nagaraju Mekala <nmekala@xilix.com>
13
14 *microblaze-opc.h (op_code_struct): Update
15 Added new instructions
16 *microblaze-opcm.h (microblaze_instr): Update
17 Added new instructions
18
19Conflicts:
20 opcodes/microblaze-opcm.h
21---
22 opcodes/microblaze-opc.h | 11 +++++++++++
23 opcodes/microblaze-opcm.h | 10 +++++-----
24 2 files changed, 16 insertions(+), 5 deletions(-)
25
26diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
27index b8a0cf82516..d3f8e36199e 100644
28--- a/opcodes/microblaze-opc.h
29+++ b/opcodes/microblaze-opc.h
30@@ -178,8 +178,11 @@ const struct op_code_struct
31 {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
32 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
33 {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
34+ {"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 },
35 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
36+ {"mtse", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9500C000, OPCODE_MASK_H13S, mtse,special_inst },
37 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
38+ {"mfse", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94088000, OPCODE_MASK_H23S, mfse, special_inst },
39 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
40 {"brd", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98100000, OPCODE_MASK_H124, brd, branch_inst },
41 {"brld", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98140000, OPCODE_MASK_H24, brld, branch_inst },
42@@ -229,18 +232,24 @@ const struct op_code_struct
43 {"bgeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBEA00000, OPCODE_MASK_H1, bgeid, branch_inst },
44 {"lbu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000000, OPCODE_MASK_H4, lbu, memory_load_inst },
45 {"lbur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000200, OPCODE_MASK_H4, lbur, memory_load_inst },
46+ {"lbuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC0000080, OPCODE_MASK_H4, lbuea, memory_load_inst },
47 {"lhu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000000, OPCODE_MASK_H4, lhu, memory_load_inst },
48 {"lhur", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000200, OPCODE_MASK_H4, lhur, memory_load_inst },
49+ {"lhuea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC4000080, OPCODE_MASK_H4, lhuea, memory_load_inst },
50 {"lw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000000, OPCODE_MASK_H4, lw, memory_load_inst },
51 {"lwr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000200, OPCODE_MASK_H4, lwr, memory_load_inst },
52 {"lwx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000400, OPCODE_MASK_H4, lwx, memory_load_inst },
53+ {"lwea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000080, OPCODE_MASK_H4, lwea, memory_load_inst },
54 {"sb", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000000, OPCODE_MASK_H4, sb, memory_store_inst },
55 {"sbr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000200, OPCODE_MASK_H4, sbr, memory_store_inst },
56+ {"sbea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD0000080, OPCODE_MASK_H4, sbea, memory_store_inst },
57 {"sh", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000000, OPCODE_MASK_H4, sh, memory_store_inst },
58 {"shr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000200, OPCODE_MASK_H4, shr, memory_store_inst },
59+ {"shea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD4000080, OPCODE_MASK_H4, shea, memory_store_inst },
60 {"sw", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000000, OPCODE_MASK_H4, sw, memory_store_inst },
61 {"swr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000200, OPCODE_MASK_H4, swr, memory_store_inst },
62 {"swx", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000400, OPCODE_MASK_H4, swx, memory_store_inst },
63+ {"swea", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000080, OPCODE_MASK_H4, swea, memory_store_inst },
64 {"lbui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE0000000, OPCODE_MASK_H, lbui, memory_load_inst },
65 {"lhui", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE4000000, OPCODE_MASK_H, lhui, memory_load_inst },
66 {"lwi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, lwi, memory_load_inst },
67@@ -405,6 +414,8 @@ const struct op_code_struct
68 {"clz", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34, clz, special_inst },
69 {"mbar", INST_TYPE_IMM5, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN, mbar, special_inst },
70 {"sleep", INST_TYPE_NONE, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN, invalid_inst, special_inst }, /* translates to mbar 16. */
71+ {"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. */
72+ {"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. */
73 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
74 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
75 {"", 0, 0, 0, 0, 0, 0, 0, 0},
76diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
77index e56c1d2d47c..ad964560c17 100644
78--- a/opcodes/microblaze-opcm.h
79+++ b/opcodes/microblaze-opcm.h
80@@ -33,13 +33,13 @@ enum microblaze_instr
81 /* 'or/and/xor' are C++ keywords. */
82 microblaze_or, microblaze_and, microblaze_xor,
83 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
84- wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar, br,
85- brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
86- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
87+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, wdcclearea, mts, mtse,
88+ mfs, mfse, mbar, br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd,
89+ bne, bned, blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
90 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
91 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
92- bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
93- shr, sw, swr, swx, lbui, lhui, lwi,
94+ bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
95+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
96 sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
97 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
98 /* 'fsqrt' is a glibc:math.h symbol. */
99--
1002.37.1 (Apple Git-137.1)
101
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Add-new-bit-field-instructions.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0008-Add-new-bit-field-instructions.patch
deleted file mode 100644
index 3966566d..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0008-Add-new-bit-field-instructions.patch
+++ /dev/null
@@ -1,241 +0,0 @@
1From c02813b6a27e6eed281609e5d696bb67ac74c804 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 18 Jul 2016 12:24:28 +0530
4Subject: [PATCH 08/34] 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---
23 gas/config/tc-microblaze.c | 71 +++++++++++++++++++++++++++++++++++++-
24 opcodes/microblaze-dis.c | 20 +++++++++--
25 opcodes/microblaze-opc.h | 12 ++++++-
26 opcodes/microblaze-opcm.h | 6 +++-
27 4 files changed, 104 insertions(+), 5 deletions(-)
28
29diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
30index 8018d1f5686..1cb9b2519c3 100644
31--- a/gas/config/tc-microblaze.c
32+++ b/gas/config/tc-microblaze.c
33@@ -917,7 +917,7 @@ md_assemble (char * str)
34 unsigned reg2;
35 unsigned reg3;
36 unsigned isize;
37- unsigned int immed = 0, temp;
38+ unsigned int immed = 0, immed2 = 0, temp;
39 expressionS exp;
40 char name[20];
41
42@@ -1178,7 +1178,76 @@ md_assemble (char * str)
43 inst |= (reg2 << RA_LOW) & RA_MASK;
44 inst |= (immed << IMM_LOW) & IMM5_MASK;
45 break;
46+ case INST_TYPE_RD_R1_IMM5_IMM5:
47+ if (strcmp (op_end, ""))
48+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
49+ else
50+ {
51+ as_fatal (_("Error in statement syntax"));
52+ reg1 = 0;
53+ }
54+ if (strcmp (op_end, ""))
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+
62+ /* Check for spl registers. */
63+ if (check_spl_reg (&reg1))
64+ as_fatal (_("Cannot use special register with this instruction"));
65+ if (check_spl_reg (&reg2))
66+ as_fatal (_("Cannot use special register with this instruction"));
67
68+ /* Width immediate value. */
69+ if (strcmp (op_end, ""))
70+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH);
71+ else
72+ as_fatal (_("Error in statement syntax"));
73+ if (exp.X_op != O_constant)
74+ {
75+ as_warn (_("Symbol used as immediate width value for bit field instruction"));
76+ immed = 1;
77+ }
78+ else
79+ immed = exp.X_add_number;
80+ if (opcode->instr == bsefi && immed > 31)
81+ as_fatal (_("Width value must be less than 32"));
82+
83+ /* Shift immediate value. */
84+ if (strcmp (op_end, ""))
85+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM);
86+ else
87+ as_fatal (_("Error in statement syntax"));
88+ if (exp.X_op != O_constant)
89+ {
90+ as_warn (_("Symbol used as immediate shift value for bit field instruction"));
91+ immed2 = 0;
92+ }
93+ else
94+ {
95+ output = frag_more (isize);
96+ immed2 = exp.X_add_number;
97+ }
98+ if (immed2 != (immed2 % 32))
99+ {
100+ as_warn (_("Shift value greater than 32. using <value %% 32>"));
101+ immed2 = immed2 % 32;
102+ }
103+
104+ /* Check combined value. */
105+ if (immed + immed2 > 32)
106+ as_fatal (_("Width value + shift value must not be greater than 32"));
107+
108+ inst |= (reg1 << RD_LOW) & RD_MASK;
109+ inst |= (reg2 << RA_LOW) & RA_MASK;
110+ if (opcode->instr == bsefi)
111+ inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */
112+ else
113+ inst |= ((immed + immed2 - 1) & IMM5_MASK) << IMM_WIDTH_LOW; /* bsifi */
114+ inst |= (immed2 << IMM_LOW) & IMM5_MASK;
115+ break;
116 case INST_TYPE_R1_R2:
117 if (strcmp (op_end, ""))
118 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
119diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
120index b057492ba93..f57b98fc9f7 100644
121--- a/opcodes/microblaze-dis.c
122+++ b/opcodes/microblaze-dis.c
123@@ -91,7 +91,19 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
124 }
125
126 static char *
127-get_field_rfsl (struct string_buf *buf, long instr)
128+get_field_imm5width (struct string_buf *buf, long instr)
129+{
130+ char *p = strbuf (buf);
131+
132+ if (instr & 0x00004000)
133+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
134+ else
135+ sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
136+ return p;
137+}
138+
139+static char *
140+get_field_rfsl (struct string_buf *buf,long instr)
141 {
142 char *p = strbuf (buf);
143
144@@ -427,7 +439,11 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
145 /* For mbar 16 or sleep insn. */
146 case INST_TYPE_NONE:
147 break;
148- /* For tuqula instruction */
149+ /* For bit field insns. */
150+ case INST_TYPE_RD_R1_IMM5_IMM5:
151+ 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));
152+ break;
153+ /* For tuqula instruction */
154 case INST_TYPE_RD:
155 print_func (stream, "\t%s", get_field_rd (&buf, inst));
156 break;
157diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
158index d3f8e36199e..825c639a41e 100644
159--- a/opcodes/microblaze-opc.h
160+++ b/opcodes/microblaze-opc.h
161@@ -59,6 +59,9 @@
162 /* For mbar. */
163 #define INST_TYPE_IMM5 20
164
165+/* For bsefi and bsifi */
166+#define INST_TYPE_RD_R1_IMM5_IMM5 21
167+
168 #define INST_TYPE_NONE 25
169
170
171@@ -89,7 +92,9 @@
172 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
173 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
174 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
175+#define OPCODE_MASK_H3B 0xFC00C600 /* High 6 bits and bits 16, 17, 21, 22. */
176 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
177+#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */
178 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
179 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
180 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
181@@ -102,7 +107,7 @@
182 #define DELAY_SLOT 1
183 #define NO_DELAY_SLOT 0
184
185-#define MAX_OPCODES 291
186+#define MAX_OPCODES 301
187
188 const struct op_code_struct
189 {
190@@ -159,6 +164,8 @@ const struct op_code_struct
191 {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
192 {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
193 {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
194+ {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
195+ {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
196 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
197 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
198 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
199@@ -438,5 +445,8 @@ char pvr_register_prefix[] = "rpvr";
200 #define MIN_IMM5 ((int) 0x00000000)
201 #define MAX_IMM5 ((int) 0x0000001f)
202
203+#define MIN_IMM_WIDTH ((int) 0x00000001)
204+#define MAX_IMM_WIDTH ((int) 0x00000020)
205+
206 #endif /* MICROBLAZE_OPC */
207
208diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
209index ad964560c17..aa3401610d9 100644
210--- a/opcodes/microblaze-opcm.h
211+++ b/opcodes/microblaze-opcm.h
212@@ -29,7 +29,7 @@ enum microblaze_instr
213 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
214 mulh, mulhu, mulhsu,swapb,swaph,
215 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
216- ncget, ncput, muli, bslli, bsrai, bsrli, mului,
217+ ncget, ncput, muli, bslli, bsrai, bsrli, bsefi, bsifi, mului,
218 /* 'or/and/xor' are C++ keywords. */
219 microblaze_or, microblaze_and, microblaze_xor,
220 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
221@@ -130,6 +130,7 @@ enum microblaze_instr_type
222 #define RB_LOW 11 /* Low bit for RB. */
223 #define IMM_LOW 0 /* Low bit for immediate. */
224 #define IMM_MBAR 21 /* low bit for mbar instruction. */
225+#define IMM_WIDTH_LOW 6 /* Low bit for immediate width */
226
227 #define RD_MASK 0x03E00000
228 #define RA_MASK 0x001F0000
229@@ -142,6 +143,9 @@ enum microblaze_instr_type
230 /* Imm mask for mbar. */
231 #define IMM5_MBAR_MASK 0x03E00000
232
233+/* Imm mask for extract/insert width. */
234+#define IMM5_WIDTH_MASK 0x000007C0
235+
236 /* FSL imm mask for get, put instructions. */
237 #define RFSL_MASK 0x000000F
238
239--
2402.37.1 (Apple Git-137.1)
241
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0009-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0009-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
deleted file mode 100644
index 47caf9ed..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0009-Patch-Microblaze-fixed-bug-in-GCC-so-that-It-will-su.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 81fc7ef231ca2890dfa827b4e8f3d0da107f9be2 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Fri, 29 Sep 2017 18:00:23 +0530
4Subject: [PATCH 09/34] [Patch,Microblaze]: fixed bug in GCC so that It will
5 support .long 0U and .long 0u
6
7---
8 gas/expr.c | 9 +++++++++
9 1 file changed, 9 insertions(+)
10
11diff --git a/gas/expr.c b/gas/expr.c
12index 6ad8bee2733..a1281ef71a8 100644
13--- a/gas/expr.c
14+++ b/gas/expr.c
15@@ -832,6 +832,15 @@ operand (expressionS *expressionP, enum expr_mode mode)
16 break;
17 }
18 }
19+ if ((*input_line_pointer == 'U') || (*input_line_pointer == 'u'))
20+ {
21+ input_line_pointer--;
22+
23+ integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri)
24+ ? 0 : 10,
25+ expressionP);
26+ break;
27+ }
28 c = *input_line_pointer;
29 switch (c)
30 {
31--
322.37.1 (Apple Git-137.1)
33
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-constant-range-check-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-constant-range-check-issue.patch
deleted file mode 100644
index 1b279f7e..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0010-fixing-the-constant-range-check-issue.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From adfa8ca9782799670d87d03a01414aca5d9cc9e5 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Mon, 16 Oct 2017 15:44:23 +0530
4Subject: [PATCH 10/34] fixing the constant range check issue sample error: not
5 in range ffffffff80000000..7fffffff, not ffffffff70000000
6
7---
8 gas/config/tc-microblaze.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 1cb9b2519c3..086f8704156 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -757,7 +757,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
16 if ((e->X_add_number >> 31) == 1)
17 e->X_add_number |= -((addressT) (1U << 31));
18
19- if (e->X_add_number < min || e->X_add_number > max)
20+ if ((int)e->X_add_number < min || (int)e->X_add_number > max)
21 {
22 as_fatal (_("operand must be absolute in range %lx..%lx, not %lx"),
23 (long) min, (long) max, (long) e->X_add_number);
24--
252.37.1 (Apple Git-137.1)
26
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-Compiler-will-give-error-messages-i.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
deleted file mode 100644
index 81949e66..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0011-Patch-Microblaze-Compiler-will-give-error-messages-i.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 3efcb580af783ace64a9485af6bfee6dc18499ba Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 21 Feb 2018 12:32:02 +0530
4Subject: [PATCH 11/34] [Patch,Microblaze]: Compiler will give error messages
5 in more detail for mxl-gp-opt flag..
6
7---
8 ld/ldmain.c | 12 ++++++++++++
9 1 file changed, 12 insertions(+)
10
11diff --git a/ld/ldmain.c b/ld/ldmain.c
12index ea72b14a301..4e63b8fdf3b 100644
13--- a/ld/ldmain.c
14+++ b/ld/ldmain.c
15@@ -1564,6 +1564,18 @@ reloc_overflow (struct bfd_link_info *info,
16 break;
17 case bfd_link_hash_defined:
18 case bfd_link_hash_defweak:
19+
20+ if((strcmp(reloc_name,"R_MICROBLAZE_SRW32") == 0) && entry->type == bfd_link_hash_defined)
21+ {
22+ einfo (_(" relocation truncated to fit: don't enable small data pointer optimizations[mxl-gp-opt] if extern or multiple declarations used: "
23+ "%s against symbol `%T' defined in %A section in %B"),
24+ reloc_name, entry->root.string,
25+ entry->u.def.section,
26+ entry->u.def.section == bfd_abs_section_ptr
27+ ? info->output_bfd : entry->u.def.section->owner);
28+ break;
29+ }
30+
31 einfo (_(" relocation truncated to fit: "
32 "%s against symbol `%pT' defined in %pA section in %pB"),
33 reloc_name, entry->root.string,
34--
352.37.1 (Apple Git-137.1)
36
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch
deleted file mode 100644
index e0166274..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0012-Patch-MicroBlaze-initial-support-for-MicroBlaze-64-b.patch
+++ /dev/null
@@ -1,5247 +0,0 @@
1From 6d3b976c0f75225614d299faca766f9043bbd2d0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 1 Nov 2021 19:06:53 +0530
4Subject: [PATCH 12/34] [Patch,MicroBlaze] : initial support for MicroBlaze 64
5 bit [-m64]
6
7Conflicts:
8 bfd/elf32-microblaze.c
9 include/elf/common.h
10 ld/Makefile.am
11 ld/Makefile.in
12signed-off-by:Nagaraju Mekala<nmekala@xilinx.com>
13 Mahesh Bodapati<mbodapat@xilinx.com>
14---
15 bfd/Makefile.am | 2 +
16 bfd/Makefile.in | 3 +
17 bfd/bfd-in2.h | 10 +
18 bfd/config.bfd | 4 +
19 bfd/configure | 2 +
20 bfd/configure.ac | 2 +
21 bfd/cpu-microblaze.c | 53 +-
22 bfd/elf32-microblaze.c | 59 +-
23 bfd/elf64-microblaze.c | 3612 ++++++++++++++++++++++++++++
24 bfd/libbfd.h | 2 +
25 bfd/reloc.c | 12 +
26 bfd/targets.c | 6 +
27 gas/config/tc-microblaze.c | 419 +++-
28 gas/config/tc-microblaze.h | 4 +-
29 include/elf/common.h | 1 +
30 include/elf/microblaze.h | 2 +
31 ld/Makefile.am | 4 +
32 ld/Makefile.in | 6 +
33 ld/configure.tgt | 3 +
34 ld/emulparams/elf64microblaze.sh | 23 +
35 ld/emulparams/elf64microblazeel.sh | 23 +
36 opcodes/microblaze-dis.c | 36 +-
37 opcodes/microblaze-opc.h | 162 +-
38 opcodes/microblaze-opcm.h | 24 +-
39 24 files changed, 4408 insertions(+), 66 deletions(-)
40 create mode 100644 bfd/elf64-microblaze.c
41 create mode 100644 ld/emulparams/elf64microblaze.sh
42 create mode 100644 ld/emulparams/elf64microblazeel.sh
43
44diff --git a/bfd/Makefile.am b/bfd/Makefile.am
45index 670e0598f55..c76adec960a 100644
46--- a/bfd/Makefile.am
47+++ b/bfd/Makefile.am
48@@ -563,6 +563,7 @@ BFD64_BACKENDS = \
49 elf64-riscv.lo \
50 elfxx-riscv.lo \
51 elf64-s390.lo \
52+ elf64-microblaze.lo \
53 elf64-sparc.lo \
54 elf64-tilegx.lo \
55 elf64-x86-64.lo \
56@@ -600,6 +601,7 @@ BFD64_BACKENDS_CFILES = \
57 elf64-nfp.c \
58 elf64-ppc.c \
59 elf64-s390.c \
60+ elf64-microblaze.c \
61 elf64-sparc.c \
62 elf64-tilegx.c \
63 elf64-x86-64.c \
64diff --git a/bfd/Makefile.in b/bfd/Makefile.in
65index a26f74d7199..b0420bd440f 100644
66--- a/bfd/Makefile.in
67+++ b/bfd/Makefile.in
68@@ -1027,6 +1027,7 @@ BFD64_BACKENDS = \
69 elf64-riscv.lo \
70 elfxx-riscv.lo \
71 elf64-s390.lo \
72+ elf64-microblaze.lo \
73 elf64-sparc.lo \
74 elf64-tilegx.lo \
75 elf64-x86-64.lo \
76@@ -1064,6 +1065,7 @@ BFD64_BACKENDS_CFILES = \
77 elf64-nfp.c \
78 elf64-ppc.c \
79 elf64-s390.c \
80+ elf64-microblaze.c \
81 elf64-sparc.c \
82 elf64-tilegx.c \
83 elf64-x86-64.c \
84@@ -1647,6 +1649,7 @@ distclean-compile:
85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
86 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
87 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
88+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-microblaze.Plo@am__quote@
89 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
90 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-tilegx.Plo@am__quote@
91 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-x86-64.Plo@am__quote@
92diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
93index 26e3bb2b34b..6cf701abf10 100644
94--- a/bfd/bfd-in2.h
95+++ b/bfd/bfd-in2.h
96@@ -5389,11 +5389,21 @@ value in two words (with an imm instruction). No relocation is
97 done here - only used for relaxing */
98 BFD_RELOC_MICROBLAZE_64_NONE,
99
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,
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 PC-relative GOT offset */
108 BFD_RELOC_MICROBLAZE_64_GOTPC,
109
110+/* This is a 64 bit reloc that stores the 32 bit pc relative
111+value in two words (with an imml instruction). The relocation is
112+PC-relative GOT offset */
113+ BFD_RELOC_MICROBLAZE_64_GPC,
114+
115 /* This is a 64 bit reloc that stores the 32 bit pc relative
116 value in two words (with an imm instruction). The relocation is
117 GOT offset */
118diff --git a/bfd/config.bfd b/bfd/config.bfd
119index a4c6c8e8854..49208534de3 100644
120--- a/bfd/config.bfd
121+++ b/bfd/config.bfd
122@@ -855,11 +855,15 @@ case "${targ}" in
123 microblazeel*-*)
124 targ_defvec=microblaze_elf32_le_vec
125 targ_selvecs=microblaze_elf32_vec
126+ targ64_selvecs=microblaze_elf64_vec
127+ targ64_selvecs=microblaze_elf64_le_vec
128 ;;
129
130 microblaze*-*)
131 targ_defvec=microblaze_elf32_vec
132 targ_selvecs=microblaze_elf32_le_vec
133+ targ64_selvecs=microblaze_elf64_vec
134+ targ64_selvecs=microblaze_elf64_le_vec
135 ;;
136
137 #ifdef BFD64
138diff --git a/bfd/configure b/bfd/configure
139index 4f591b750d8..efeb1c2d717 100755
140--- a/bfd/configure
141+++ b/bfd/configure
142@@ -13546,6 +13546,8 @@ do
143 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
144 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
145 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
146+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
147+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
148 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
149 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
150 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
151diff --git a/bfd/configure.ac b/bfd/configure.ac
152index 6146efb5ae3..387a0af3703 100644
153--- a/bfd/configure.ac
154+++ b/bfd/configure.ac
155@@ -603,6 +603,8 @@ do
156 s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
157 score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
158 score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
159+ microblaze_elf64_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
160+ microblaze_elf64_le_vec) tb="$tb elf64-microblaze.lo elf64.lo $elf"; target_size=64 ;;
161 sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
162 sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
163 sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
164diff --git a/bfd/cpu-microblaze.c b/bfd/cpu-microblaze.c
165index 0c1d2b1aa69..a9abb9166cc 100644
166--- a/bfd/cpu-microblaze.c
167+++ b/bfd/cpu-microblaze.c
168@@ -23,7 +23,24 @@
169 #include "bfd.h"
170 #include "libbfd.h"
171
172-const bfd_arch_info_type bfd_microblaze_arch =
173+const bfd_arch_info_type bfd_microblaze_arch[] =
174+{
175+#if BFD_DEFAULT_TARGET_SIZE == 64
176+{
177+ 64, /* 32 bits in a word. */
178+ 64, /* 32 bits in an address. */
179+ 8, /* 8 bits in a byte. */
180+ bfd_arch_microblaze, /* Architecture. */
181+ 0, /* Machine number - 0 for now. */
182+ "microblaze", /* Architecture name. */
183+ "MicroBlaze", /* Printable name. */
184+ 3, /* Section align power. */
185+ false, /* Is this the default architecture ? */
186+ bfd_default_compatible, /* Architecture comparison function. */
187+ bfd_default_scan, /* String to architecture conversion. */
188+ bfd_arch_default_fill, /* Default fill. */
189+ &bfd_microblaze_arch[1] /* Next in list. */
190+},
191 {
192 32, /* Bits in a word. */
193 32, /* Bits in an address. */
194@@ -39,4 +56,38 @@ const bfd_arch_info_type bfd_microblaze_arch =
195 bfd_arch_default_fill, /* Default fill. */
196 NULL, /* Next in list. */
197 0 /* Maximum offset of a reloc from the start of an insn. */
198+}
199+#else
200+{
201+ 32, /* 32 bits in a word. */
202+ 32, /* 32 bits in an address. */
203+ 8, /* 8 bits in a byte. */
204+ bfd_arch_microblaze, /* Architecture. */
205+ 0, /* Machine number - 0 for now. */
206+ "microblaze", /* Architecture name. */
207+ "MicroBlaze", /* Printable name. */
208+ 3, /* Section align power. */
209+ true, /* Is this the default architecture ? */
210+ bfd_default_compatible, /* Architecture comparison function. */
211+ bfd_default_scan, /* String to architecture conversion. */
212+ bfd_arch_default_fill, /* Default fill. */
213+ &bfd_microblaze_arch[1] /* Next in list. */
214+},
215+{
216+ 64, /* 32 bits in a word. */
217+ 64, /* 32 bits in an address. */
218+ 8, /* 8 bits in a byte. */
219+ bfd_arch_microblaze, /* Architecture. */
220+ 0, /* Machine number - 0 for now. */
221+ "microblaze", /* Architecture name. */
222+ "MicroBlaze", /* Printable name. */
223+ 3, /* Section align power. */
224+ false, /* Is this the default architecture ? */
225+ bfd_default_compatible, /* Architecture comparison function. */
226+ bfd_default_scan, /* String to architecture conversion. */
227+ bfd_arch_default_fill, /* Default fill. */
228+ NULL, /* Next in list. */
229+ 0 /* Maximum offset of a reloc from the start of an insn. */
230+}
231+#endif
232 };
233diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
234index edde04bafe4..f20adb6fd73 100644
235--- a/bfd/elf32-microblaze.c
236+++ b/bfd/elf32-microblaze.c
237@@ -114,6 +114,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
238 0x0000ffff, /* Dest Mask. */
239 true), /* PC relative offset? */
240
241+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
242+ 0, /* Rightshift. */
243+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
244+ 16, /* Bitsize. */
245+ true, /* PC_relative. */
246+ 0, /* Bitpos. */
247+ complain_overflow_dont, /* Complain on overflow. */
248+ bfd_elf_generic_reloc,/* Special Function. */
249+ "R_MICROBLAZE_IMML_64", /* Name. */
250+ false, /* Partial Inplace. */
251+ 0, /* Source Mask. */
252+ 0x0000ffff, /* Dest Mask. */
253+ false), /* PC relative offset? */
254+
255 /* A 64 bit relocation. Table entry not really used. */
256 HOWTO (R_MICROBLAZE_64, /* Type. */
257 0, /* Rightshift. */
258@@ -278,6 +292,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
259 0x0000ffff, /* Dest Mask. */
260 true), /* PC relative offset? */
261
262+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
263+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
264+ 0, /* Rightshift. */
265+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
266+ 16, /* Bitsize. */
267+ true, /* PC_relative. */
268+ 0, /* Bitpos. */
269+ complain_overflow_dont, /* Complain on overflow. */
270+ bfd_elf_generic_reloc, /* Special Function. */
271+ "R_MICROBLAZE_GPC_64", /* Name. */
272+ false, /* Partial Inplace. */
273+ 0, /* Source Mask. */
274+ 0x0000ffff, /* Dest Mask. */
275+ true), /* PC relative offset? */
276+
277 /* A 64 bit GOT relocation. Table-entry not really used. */
278 HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
279 0, /* Rightshift. */
280@@ -617,9 +646,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
281 case BFD_RELOC_VTABLE_ENTRY:
282 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
283 break;
284+ case BFD_RELOC_MICROBLAZE_64:
285+ microblaze_reloc = R_MICROBLAZE_IMML_64;
286+ break;
287 case BFD_RELOC_MICROBLAZE_64_GOTPC:
288 microblaze_reloc = R_MICROBLAZE_GOTPC_64;
289 break;
290+ case BFD_RELOC_MICROBLAZE_64_GPC:
291+ microblaze_reloc = R_MICROBLAZE_GPC_64;
292+ break;
293 case BFD_RELOC_MICROBLAZE_64_GOT:
294 microblaze_reloc = R_MICROBLAZE_GOT_64;
295 break;
296@@ -1500,7 +1535,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
297 if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
298 {
299 relocation += addend;
300- if (r_type == R_MICROBLAZE_32)
301+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
302 bfd_put_32 (input_bfd, relocation, contents + offset);
303 else
304 {
305@@ -1970,6 +2005,28 @@ microblaze_elf_relax_section (bfd *abfd,
306 irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
307 }
308 break;
309+ case R_MICROBLAZE_IMML_64:
310+ {
311+ /* This was a PC-relative instruction that was
312+ completely resolved. */
313+ int sfix, efix;
314+ unsigned int val;
315+ bfd_vma target_address;
316+ target_address = irel->r_addend + irel->r_offset;
317+ sfix = calc_fixup (irel->r_offset, 0, sec);
318+ efix = calc_fixup (target_address, 0, sec);
319+
320+ /* Validate the in-band val. */
321+ val = bfd_get_32 (abfd, contents + irel->r_offset);
322+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
323+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
324+ }
325+ irel->r_addend -= (efix - sfix);
326+ /* Should use HOWTO. */
327+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
328+ irel->r_addend);
329+ }
330+ break;
331 case R_MICROBLAZE_NONE:
332 case R_MICROBLAZE_32_NONE:
333 {
334diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
335new file mode 100644
336index 00000000000..0faa8de73c8
337--- /dev/null
338+++ b/bfd/elf64-microblaze.c
339@@ -0,0 +1,3612 @@
340+/* Xilinx MicroBlaze-specific support for 32-bit ELF
341+
342+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
343+
344+ This file is part of BFD, the Binary File Descriptor library.
345+
346+ This program is free software; you can redistribute it and/or modify
347+ it under the terms of the GNU General Public License as published by
348+ the Free Software Foundation; either version 3 of the License, or
349+ (at your option) any later version.
350+
351+ This program is distributed in the hope that it will be useful,
352+ but WITHOUT ANY WARRANTY; without even the implied warranty of
353+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
354+ GNU General Public License for more details.
355+
356+ You should have received a copy of the GNU General Public License
357+ along with this program; if not, write to the
358+ Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
359+ Boston, MA 02110-1301, USA. */
360+
361+
362+#include "sysdep.h"
363+#include "bfd.h"
364+#include "bfdlink.h"
365+#include "libbfd.h"
366+#include "elf-bfd.h"
367+#include "elf/microblaze.h"
368+#include <assert.h>
369+
370+#define USE_RELA /* Only USE_REL is actually significant, but this is
371+ here are a reminder... */
372+#define INST_WORD_SIZE 4
373+
374+static int ro_small_data_pointer = 0;
375+static int rw_small_data_pointer = 0;
376+
377+static reloc_howto_type * microblaze_elf_howto_table [(int) R_MICROBLAZE_max];
378+
379+static reloc_howto_type microblaze_elf_howto_raw[] =
380+{
381+ /* This reloc does nothing. */
382+ HOWTO (R_MICROBLAZE_NONE, /* Type. */
383+ 0, /* Rightshift. */
384+ 0, /* Size. */
385+ 0, /* Bitsize. */
386+ false, /* PC_relative. */
387+ 0, /* Bitpos. */
388+ complain_overflow_dont, /* Complain on overflow. */
389+ NULL, /* Special Function. */
390+ "R_MICROBLAZE_NONE", /* Name. */
391+ false, /* Partial Inplace. */
392+ 0, /* Source Mask. */
393+ 0, /* Dest Mask. */
394+ false), /* PC relative offset? */
395+
396+ /* A standard 32 bit relocation. */
397+ HOWTO (R_MICROBLAZE_32, /* Type. */
398+ 0, /* Rightshift. */
399+ 4, /* Size. */
400+ 32, /* Bitsize. */
401+ false, /* PC_relative. */
402+ 0, /* Bitpos. */
403+ complain_overflow_bitfield, /* Complain on overflow. */
404+ bfd_elf_generic_reloc,/* Special Function. */
405+ "R_MICROBLAZE_32", /* Name. */
406+ false, /* Partial Inplace. */
407+ 0, /* Source Mask. */
408+ 0xffffffff, /* Dest Mask. */
409+ false), /* PC relative offset? */
410+
411+ /* A standard PCREL 32 bit relocation. */
412+ HOWTO (R_MICROBLAZE_32_PCREL,/* Type. */
413+ 0, /* Rightshift. */
414+ 4, /* Size. */
415+ 32, /* Bitsize. */
416+ true, /* PC_relative. */
417+ 0, /* Bitpos. */
418+ complain_overflow_bitfield, /* Complain on overflow. */
419+ bfd_elf_generic_reloc,/* Special Function. */
420+ "R_MICROBLAZE_32_PCREL", /* Name. */
421+ true, /* Partial Inplace. */
422+ 0, /* Source Mask. */
423+ 0xffffffff, /* Dest Mask. */
424+ true), /* PC relative offset? */
425+
426+ /* A 64 bit PCREL relocation. Table-entry not really used. */
427+ HOWTO (R_MICROBLAZE_64_PCREL,/* Type. */
428+ 0, /* Rightshift. */
429+ 4, /* Size. */
430+ 16, /* Bitsize. */
431+ true, /* PC_relative. */
432+ 0, /* Bitpos. */
433+ complain_overflow_dont, /* Complain on overflow. */
434+ bfd_elf_generic_reloc,/* Special Function. */
435+ "R_MICROBLAZE_64_PCREL", /* Name. */
436+ false, /* Partial Inplace. */
437+ 0, /* Source Mask. */
438+ 0x0000ffff, /* Dest Mask. */
439+ true), /* PC relative offset? */
440+
441+ /* The low half of a PCREL 32 bit relocation. */
442+ HOWTO (R_MICROBLAZE_32_PCREL_LO, /* Type. */
443+ 0, /* Rightshift. */
444+ 4, /* Size. */
445+ 16, /* Bitsize. */
446+ true, /* PC_relative. */
447+ 0, /* Bitpos. */
448+ complain_overflow_signed, /* Complain on overflow. */
449+ bfd_elf_generic_reloc, /* Special Function. */
450+ "R_MICROBLAZE_32_PCREL_LO", /* Name. */
451+ false, /* Partial Inplace. */
452+ 0, /* Source Mask. */
453+ 0x0000ffff, /* Dest Mask. */
454+ true), /* PC relative offset? */
455+
456+ HOWTO (R_MICROBLAZE_IMML_64, /* Type. */
457+ 0, /* Rightshift. */
458+ 4, /* Size (0 = byte, 1 = short, 2 = long). */
459+ 64, /* Bitsize. */
460+ true, /* PC_relative. */
461+ 0, /* Bitpos. */
462+ complain_overflow_dont, /* Complain on overflow. */
463+ bfd_elf_generic_reloc,/* Special Function. */
464+ "R_MICROBLAZE_IMML_64", /* Name. */
465+ false, /* Partial Inplace. */
466+ 0, /* Source Mask. */
467+ 0x0000ffff, /* Dest Mask. */
468+ false), /* PC relative offset? */
469+
470+ /* A 64 bit relocation. Table entry not really used. */
471+ HOWTO (R_MICROBLAZE_64, /* Type. */
472+ 0, /* Rightshift. */
473+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
474+ 16, /* 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_64", /* Name. */
480+ false, /* Partial Inplace. */
481+ 0, /* Source Mask. */
482+ 0x0000ffff, /* Dest Mask. */
483+ false), /* PC relative offset? */
484+
485+ /* The low half of a 32 bit relocation. */
486+ HOWTO (R_MICROBLAZE_32_LO, /* Type. */
487+ 0, /* Rightshift. */
488+ 4, /* Size. */
489+ 16, /* Bitsize. */
490+ false, /* PC_relative. */
491+ 0, /* Bitpos. */
492+ complain_overflow_signed, /* Complain on overflow. */
493+ bfd_elf_generic_reloc,/* Special Function. */
494+ "R_MICROBLAZE_32_LO", /* Name. */
495+ false, /* Partial Inplace. */
496+ 0, /* Source Mask. */
497+ 0x0000ffff, /* Dest Mask. */
498+ false), /* PC relative offset? */
499+
500+ /* Read-only small data section relocation. */
501+ HOWTO (R_MICROBLAZE_SRO32, /* Type. */
502+ 0, /* Rightshift. */
503+ 4, /* Size. */
504+ 16, /* Bitsize. */
505+ false, /* PC_relative. */
506+ 0, /* Bitpos. */
507+ complain_overflow_bitfield, /* Complain on overflow. */
508+ bfd_elf_generic_reloc,/* Special Function. */
509+ "R_MICROBLAZE_SRO32", /* Name. */
510+ false, /* Partial Inplace. */
511+ 0, /* Source Mask. */
512+ 0x0000ffff, /* Dest Mask. */
513+ false), /* PC relative offset? */
514+
515+ /* Read-write small data area relocation. */
516+ HOWTO (R_MICROBLAZE_SRW32, /* Type. */
517+ 0, /* Rightshift. */
518+ 4, /* Size. */
519+ 16, /* Bitsize. */
520+ false, /* PC_relative. */
521+ 0, /* Bitpos. */
522+ complain_overflow_bitfield, /* Complain on overflow. */
523+ bfd_elf_generic_reloc,/* Special Function. */
524+ "R_MICROBLAZE_SRW32", /* Name. */
525+ false, /* Partial Inplace. */
526+ 0, /* Source Mask. */
527+ 0x0000ffff, /* Dest Mask. */
528+ false), /* PC relative offset? */
529+
530+ /* This reloc does nothing. Used for relaxation. */
531+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
532+ 0, /* Rightshift. */
533+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
534+ 32, /* Bitsize. */
535+ true, /* PC_relative. */
536+ 0, /* Bitpos. */
537+ complain_overflow_bitfield, /* Complain on overflow. */
538+ NULL, /* Special Function. */
539+ "R_MICROBLAZE_32_NONE",/* Name. */
540+ false, /* Partial Inplace. */
541+ 0, /* Source Mask. */
542+ 0, /* Dest Mask. */
543+ false), /* PC relative offset? */
544+
545+ /* This reloc does nothing. Used for relaxation. */
546+ HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
547+ 0, /* Rightshift. */
548+ 0, /* Size. */
549+ 0, /* Bitsize. */
550+ true, /* PC_relative. */
551+ 0, /* Bitpos. */
552+ complain_overflow_dont, /* Complain on overflow. */
553+ NULL, /* Special Function. */
554+ "R_MICROBLAZE_64_NONE",/* Name. */
555+ false, /* Partial Inplace. */
556+ 0, /* Source Mask. */
557+ 0, /* Dest Mask. */
558+ false), /* PC relative offset? */
559+
560+ /* Symbol Op Symbol relocation. */
561+ HOWTO (R_MICROBLAZE_32_SYM_OP_SYM, /* Type. */
562+ 0, /* Rightshift. */
563+ 4, /* Size. */
564+ 32, /* Bitsize. */
565+ false, /* PC_relative. */
566+ 0, /* Bitpos. */
567+ complain_overflow_bitfield, /* Complain on overflow. */
568+ bfd_elf_generic_reloc,/* Special Function. */
569+ "R_MICROBLAZE_32_SYM_OP_SYM", /* Name. */
570+ false, /* Partial Inplace. */
571+ 0, /* Source Mask. */
572+ 0xffffffff, /* Dest Mask. */
573+ false), /* PC relative offset? */
574+
575+ /* GNU extension to record C++ vtable hierarchy. */
576+ HOWTO (R_MICROBLAZE_GNU_VTINHERIT, /* Type. */
577+ 0, /* Rightshift. */
578+ 4, /* Size. */
579+ 0, /* Bitsize. */
580+ false, /* PC_relative. */
581+ 0, /* Bitpos. */
582+ complain_overflow_dont,/* Complain on overflow. */
583+ NULL, /* Special Function. */
584+ "R_MICROBLAZE_GNU_VTINHERIT", /* Name. */
585+ false, /* Partial Inplace. */
586+ 0, /* Source Mask. */
587+ 0, /* Dest Mask. */
588+ false), /* PC relative offset? */
589+
590+ /* GNU extension to record C++ vtable member usage. */
591+ HOWTO (R_MICROBLAZE_GNU_VTENTRY, /* Type. */
592+ 0, /* Rightshift. */
593+ 4, /* Size. */
594+ 0, /* Bitsize. */
595+ false, /* PC_relative. */
596+ 0, /* Bitpos. */
597+ complain_overflow_dont,/* Complain on overflow. */
598+ _bfd_elf_rel_vtable_reloc_fn, /* Special Function. */
599+ "R_MICROBLAZE_GNU_VTENTRY", /* Name. */
600+ false, /* Partial Inplace. */
601+ 0, /* Source Mask. */
602+ 0, /* Dest Mask. */
603+ false), /* PC relative offset? */
604+
605+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
606+ HOWTO (R_MICROBLAZE_GOTPC_64, /* Type. */
607+ 0, /* Rightshift. */
608+ 4, /* Size. */
609+ 16, /* Bitsize. */
610+ true, /* PC_relative. */
611+ 0, /* Bitpos. */
612+ complain_overflow_dont, /* Complain on overflow. */
613+ bfd_elf_generic_reloc, /* Special Function. */
614+ "R_MICROBLAZE_GOTPC_64", /* Name. */
615+ false, /* Partial Inplace. */
616+ 0, /* Source Mask. */
617+ 0x0000ffff, /* Dest Mask. */
618+ true), /* PC relative offset? */
619+
620+ /* A 64 bit TEXTPCREL relocation. Table-entry not really used. */
621+ HOWTO (R_MICROBLAZE_TEXTPCREL_64, /* Type. */
622+ 0, /* Rightshift. */
623+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
624+ 16, /* Bitsize. */
625+ true, /* PC_relative. */
626+ 0, /* Bitpos. */
627+ complain_overflow_dont, /* Complain on overflow. */
628+ bfd_elf_generic_reloc, /* Special Function. */
629+ "R_MICROBLAZE_TEXTPCREL_64", /* Name. */
630+ false, /* Partial Inplace. */
631+ 0, /* Source Mask. */
632+ 0x0000ffff, /* Dest Mask. */
633+ true), /* PC relative offset? */
634+
635+ /* A 64 bit GOTPC relocation. Table-entry not really used. */
636+ HOWTO (R_MICROBLAZE_GPC_64, /* Type. */
637+ 0, /* Rightshift. */
638+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
639+ 16, /* Bitsize. */
640+ true, /* PC_relative. */
641+ 0, /* Bitpos. */
642+ complain_overflow_dont, /* Complain on overflow. */
643+ bfd_elf_generic_reloc, /* Special Function. */
644+ "R_MICROBLAZE_GPC_64", /* Name. */
645+ false, /* Partial Inplace. */
646+ 0, /* Source Mask. */
647+ 0x0000ffff, /* Dest Mask. */
648+ true), /* PC relative offset? */
649+
650+ /* A 64 bit GOT relocation. Table-entry not really used. */
651+ HOWTO (R_MICROBLAZE_GOT_64, /* Type. */
652+ 0, /* Rightshift. */
653+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
654+ 16, /* Bitsize. */
655+ false, /* PC_relative. */
656+ 0, /* Bitpos. */
657+ complain_overflow_dont, /* Complain on overflow. */
658+ bfd_elf_generic_reloc,/* Special Function. */
659+ "R_MICROBLAZE_GOT_64",/* Name. */
660+ false, /* Partial Inplace. */
661+ 0, /* Source Mask. */
662+ 0x0000ffff, /* Dest Mask. */
663+ false), /* PC relative offset? */
664+
665+ /* A 64 bit TEXTREL relocation. Table-entry not really used. */
666+ HOWTO (R_MICROBLAZE_TEXTREL_64, /* Type. */
667+ 0, /* Rightshift. */
668+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
669+ 16, /* Bitsize. */
670+ false, /* PC_relative. */
671+ 0, /* Bitpos. */
672+ complain_overflow_dont, /* Complain on overflow. */
673+ bfd_elf_generic_reloc,/* Special Function. */
674+ "R_MICROBLAZE_TEXTREL_64",/* Name. */
675+ false, /* Partial Inplace. */
676+ 0, /* Source Mask. */
677+ 0x0000ffff, /* Dest Mask. */
678+ false), /* PC relative offset? */
679+
680+ /* A 64 bit PLT relocation. Table-entry not really used. */
681+ HOWTO (R_MICROBLAZE_PLT_64, /* Type. */
682+ 0, /* Rightshift. */
683+ 4, /* Size. */
684+ 16, /* Bitsize. */
685+ true, /* PC_relative. */
686+ 0, /* Bitpos. */
687+ complain_overflow_dont, /* Complain on overflow. */
688+ bfd_elf_generic_reloc,/* Special Function. */
689+ "R_MICROBLAZE_PLT_64",/* Name. */
690+ false, /* Partial Inplace. */
691+ 0, /* Source Mask. */
692+ 0x0000ffff, /* Dest Mask. */
693+ true), /* PC relative offset? */
694+
695+ /* Table-entry not really used. */
696+ HOWTO (R_MICROBLAZE_REL, /* Type. */
697+ 0, /* Rightshift. */
698+ 4, /* Size. */
699+ 16, /* Bitsize. */
700+ true, /* PC_relative. */
701+ 0, /* Bitpos. */
702+ complain_overflow_dont, /* Complain on overflow. */
703+ bfd_elf_generic_reloc,/* Special Function. */
704+ "R_MICROBLAZE_REL", /* Name. */
705+ false, /* Partial Inplace. */
706+ 0, /* Source Mask. */
707+ 0x0000ffff, /* Dest Mask. */
708+ true), /* PC relative offset? */
709+
710+ /* Table-entry not really used. */
711+ HOWTO (R_MICROBLAZE_JUMP_SLOT,/* Type. */
712+ 0, /* Rightshift. */
713+ 4, /* Size. */
714+ 16, /* Bitsize. */
715+ true, /* PC_relative. */
716+ 0, /* Bitpos. */
717+ complain_overflow_dont, /* Complain on overflow. */
718+ bfd_elf_generic_reloc,/* Special Function. */
719+ "R_MICROBLAZE_JUMP_SLOT", /* Name. */
720+ false, /* Partial Inplace. */
721+ 0, /* Source Mask. */
722+ 0x0000ffff, /* Dest Mask. */
723+ true), /* PC relative offset? */
724+
725+ /* Table-entry not really used. */
726+ HOWTO (R_MICROBLAZE_GLOB_DAT,/* Type. */
727+ 0, /* Rightshift. */
728+ 4, /* Size. */
729+ 16, /* Bitsize. */
730+ true, /* PC_relative. */
731+ 0, /* Bitpos. */
732+ complain_overflow_dont, /* Complain on overflow. */
733+ bfd_elf_generic_reloc,/* Special Function. */
734+ "R_MICROBLAZE_GLOB_DAT", /* Name. */
735+ false, /* Partial Inplace. */
736+ 0, /* Source Mask. */
737+ 0x0000ffff, /* Dest Mask. */
738+ true), /* PC relative offset? */
739+
740+ /* A 64 bit GOT relative relocation. Table-entry not really used. */
741+ HOWTO (R_MICROBLAZE_GOTOFF_64, /* Type. */
742+ 0, /* Rightshift. */
743+ 4, /* Size. */
744+ 16, /* Bitsize. */
745+ false, /* PC_relative. */
746+ 0, /* Bitpos. */
747+ complain_overflow_dont, /* Complain on overflow. */
748+ bfd_elf_generic_reloc,/* Special Function. */
749+ "R_MICROBLAZE_GOTOFF_64", /* Name. */
750+ false, /* Partial Inplace. */
751+ 0, /* Source Mask. */
752+ 0x0000ffff, /* Dest Mask. */
753+ false), /* PC relative offset? */
754+
755+ /* A 32 bit GOT relative relocation. Table-entry not really used. */
756+ HOWTO (R_MICROBLAZE_GOTOFF_32, /* Type. */
757+ 0, /* Rightshift. */
758+ 4, /* Size. */
759+ 16, /* Bitsize. */
760+ false, /* PC_relative. */
761+ 0, /* Bitpos. */
762+ complain_overflow_dont, /* Complain on overflow. */
763+ bfd_elf_generic_reloc, /* Special Function. */
764+ "R_MICROBLAZE_GOTOFF_32", /* Name. */
765+ false, /* Partial Inplace. */
766+ 0, /* Source Mask. */
767+ 0x0000ffff, /* Dest Mask. */
768+ false), /* PC relative offset? */
769+
770+ /* COPY relocation. Table-entry not really used. */
771+ HOWTO (R_MICROBLAZE_COPY, /* Type. */
772+ 0, /* Rightshift. */
773+ 4, /* Size. */
774+ 16, /* Bitsize. */
775+ false, /* PC_relative. */
776+ 0, /* Bitpos. */
777+ complain_overflow_dont, /* Complain on overflow. */
778+ bfd_elf_generic_reloc,/* Special Function. */
779+ "R_MICROBLAZE_COPY", /* Name. */
780+ false, /* Partial Inplace. */
781+ 0, /* Source Mask. */
782+ 0x0000ffff, /* Dest Mask. */
783+ false), /* PC relative offset? */
784+
785+ /* Marker relocs for TLS. */
786+ HOWTO (R_MICROBLAZE_TLS,
787+ 0, /* rightshift */
788+ 2, /* size (0 = byte, 1 = short, 2 = long) */
789+ 32, /* bitsize */
790+ false, /* pc_relative */
791+ 0, /* bitpos */
792+ complain_overflow_dont, /* complain_on_overflow */
793+ bfd_elf_generic_reloc, /* special_function */
794+ "R_MICROBLAZE_TLS", /* name */
795+ false, /* partial_inplace */
796+ 0, /* src_mask */
797+ 0x0000ffff, /* dst_mask */
798+ false), /* pcrel_offset */
799+
800+ HOWTO (R_MICROBLAZE_TLSGD,
801+ 0, /* rightshift */
802+ 4, /* size */
803+ 32, /* bitsize */
804+ false, /* pc_relative */
805+ 0, /* bitpos */
806+ complain_overflow_dont, /* complain_on_overflow */
807+ bfd_elf_generic_reloc, /* special_function */
808+ "R_MICROBLAZE_TLSGD", /* name */
809+ false, /* partial_inplace */
810+ 0, /* src_mask */
811+ 0x0000ffff, /* dst_mask */
812+ false), /* pcrel_offset */
813+
814+ HOWTO (R_MICROBLAZE_TLSLD,
815+ 0, /* rightshift */
816+ 2, /* size (0 = byte, 1 = short, 2 = long) */
817+ 32, /* bitsize */
818+ false, /* pc_relative */
819+ 0, /* bitpos */
820+ complain_overflow_dont, /* complain_on_overflow */
821+ bfd_elf_generic_reloc, /* special_function */
822+ "R_MICROBLAZE_TLSLD", /* name */
823+ false, /* partial_inplace */
824+ 0, /* src_mask */
825+ 0x0000ffff, /* dst_mask */
826+ false), /* pcrel_offset */
827+
828+ /* Computes the load module index of the load module that contains the
829+ definition of its TLS sym. */
830+ HOWTO (R_MICROBLAZE_TLSDTPMOD32,
831+ 0, /* rightshift */
832+ 2, /* size (0 = byte, 1 = short, 2 = long) */
833+ 32, /* bitsize */
834+ false, /* pc_relative */
835+ 0, /* bitpos */
836+ complain_overflow_dont, /* complain_on_overflow */
837+ bfd_elf_generic_reloc, /* special_function */
838+ "R_MICROBLAZE_TLSDTPMOD32", /* name */
839+ false, /* partial_inplace */
840+ 0, /* src_mask */
841+ 0x0000ffff, /* dst_mask */
842+ false), /* pcrel_offset */
843+
844+ /* Computes a dtv-relative displacement, the difference between the value
845+ of sym+add and the base address of the thread-local storage block that
846+ contains the definition of sym, minus 0x8000. Used for initializing GOT */
847+ HOWTO (R_MICROBLAZE_TLSDTPREL32,
848+ 0, /* rightshift */
849+ 4, /* size */
850+ 32, /* bitsize */
851+ false, /* pc_relative */
852+ 0, /* bitpos */
853+ complain_overflow_dont, /* complain_on_overflow */
854+ bfd_elf_generic_reloc, /* special_function */
855+ "R_MICROBLAZE_TLSDTPREL32", /* name */
856+ false, /* partial_inplace */
857+ 0, /* src_mask */
858+ 0x0000ffff, /* dst_mask */
859+ false), /* pcrel_offset */
860+
861+ /* Computes a dtv-relative displacement, the difference between the value
862+ of sym+add and the base address of the thread-local storage block that
863+ contains the definition of sym, minus 0x8000. */
864+ HOWTO (R_MICROBLAZE_TLSDTPREL64,
865+ 0, /* rightshift */
866+ 4, /* size */
867+ 32, /* bitsize */
868+ false, /* pc_relative */
869+ 0, /* bitpos */
870+ complain_overflow_dont, /* complain_on_overflow */
871+ bfd_elf_generic_reloc, /* special_function */
872+ "R_MICROBLAZE_TLSDTPREL64", /* name */
873+ false, /* partial_inplace */
874+ 0, /* src_mask */
875+ 0x0000ffff, /* dst_mask */
876+ false), /* pcrel_offset */
877+
878+ /* Computes a tp-relative displacement, the difference between the value of
879+ sym+add and the value of the thread pointer (r13). */
880+ HOWTO (R_MICROBLAZE_TLSGOTTPREL32,
881+ 0, /* rightshift */
882+ 4, /* size */
883+ 32, /* bitsize */
884+ false, /* pc_relative */
885+ 0, /* bitpos */
886+ complain_overflow_dont, /* complain_on_overflow */
887+ bfd_elf_generic_reloc, /* special_function */
888+ "R_MICROBLAZE_TLSGOTTPREL32", /* name */
889+ false, /* partial_inplace */
890+ 0, /* src_mask */
891+ 0x0000ffff, /* dst_mask */
892+ false), /* pcrel_offset */
893+
894+ /* Computes a tp-relative displacement, the difference between the value of
895+ sym+add and the value of the thread pointer (r13). */
896+ HOWTO (R_MICROBLAZE_TLSTPREL32,
897+ 0, /* rightshift */
898+ 4, /* size */
899+ 32, /* bitsize */
900+ false, /* pc_relative */
901+ 0, /* bitpos */
902+ complain_overflow_dont, /* complain_on_overflow */
903+ bfd_elf_generic_reloc, /* special_function */
904+ "R_MICROBLAZE_TLSTPREL32", /* name */
905+ false, /* partial_inplace */
906+ 0, /* src_mask */
907+ 0x0000ffff, /* dst_mask */
908+ false), /* pcrel_offset */
909+
910+};
911+
912+#ifndef NUM_ELEM
913+#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
914+#endif
915+
916+/* Initialize the microblaze_elf_howto_table, so that linear accesses can be done. */
917+
918+static void
919+microblaze_elf_howto_init (void)
920+{
921+ unsigned int i;
922+
923+ for (i = NUM_ELEM (microblaze_elf_howto_raw); i--;)
924+ {
925+ unsigned int type;
926+
927+ type = microblaze_elf_howto_raw[i].type;
928+
929+ BFD_ASSERT (type < NUM_ELEM (microblaze_elf_howto_table));
930+
931+ microblaze_elf_howto_table [type] = & microblaze_elf_howto_raw [i];
932+ }
933+}
934+
935+static reloc_howto_type *
936+microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
937+ bfd_reloc_code_real_type code)
938+{
939+ enum elf_microblaze_reloc_type microblaze_reloc = R_MICROBLAZE_NONE;
940+
941+ switch (code)
942+ {
943+ case BFD_RELOC_NONE:
944+ microblaze_reloc = R_MICROBLAZE_NONE;
945+ break;
946+ case BFD_RELOC_MICROBLAZE_32_NONE:
947+ microblaze_reloc = R_MICROBLAZE_32_NONE;
948+ break;
949+ case BFD_RELOC_MICROBLAZE_64_NONE:
950+ microblaze_reloc = R_MICROBLAZE_64_NONE;
951+ break;
952+ case BFD_RELOC_32:
953+ microblaze_reloc = R_MICROBLAZE_32;
954+ break;
955+ /* RVA is treated the same as 32 */
956+ case BFD_RELOC_RVA:
957+ microblaze_reloc = R_MICROBLAZE_32;
958+ break;
959+ case BFD_RELOC_32_PCREL:
960+ microblaze_reloc = R_MICROBLAZE_32_PCREL;
961+ break;
962+ case BFD_RELOC_64_PCREL:
963+ microblaze_reloc = R_MICROBLAZE_64_PCREL;
964+ break;
965+ case BFD_RELOC_MICROBLAZE_32_LO_PCREL:
966+ microblaze_reloc = R_MICROBLAZE_32_PCREL_LO;
967+ break;
968+ case BFD_RELOC_64:
969+ microblaze_reloc = R_MICROBLAZE_64;
970+ break;
971+ case BFD_RELOC_MICROBLAZE_32_LO:
972+ microblaze_reloc = R_MICROBLAZE_32_LO;
973+ break;
974+ case BFD_RELOC_MICROBLAZE_32_ROSDA:
975+ microblaze_reloc = R_MICROBLAZE_SRO32;
976+ break;
977+ case BFD_RELOC_MICROBLAZE_32_RWSDA:
978+ microblaze_reloc = R_MICROBLAZE_SRW32;
979+ break;
980+ case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
981+ microblaze_reloc = R_MICROBLAZE_32_SYM_OP_SYM;
982+ break;
983+ case BFD_RELOC_VTABLE_INHERIT:
984+ microblaze_reloc = R_MICROBLAZE_GNU_VTINHERIT;
985+ break;
986+ case BFD_RELOC_VTABLE_ENTRY:
987+ microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
988+ break;
989+ case BFD_RELOC_MICROBLAZE_64:
990+ microblaze_reloc = R_MICROBLAZE_IMML_64;
991+ break;
992+ case BFD_RELOC_MICROBLAZE_64_GOTPC:
993+ microblaze_reloc = R_MICROBLAZE_GOTPC_64;
994+ break;
995+ case BFD_RELOC_MICROBLAZE_64_GPC:
996+ microblaze_reloc = R_MICROBLAZE_GPC_64;
997+ break;
998+ case BFD_RELOC_MICROBLAZE_64_GOT:
999+ microblaze_reloc = R_MICROBLAZE_GOT_64;
1000+ break;
1001+ case BFD_RELOC_MICROBLAZE_64_TEXTPCREL:
1002+ microblaze_reloc = R_MICROBLAZE_TEXTPCREL_64;
1003+ break;
1004+ case BFD_RELOC_MICROBLAZE_64_TEXTREL:
1005+ microblaze_reloc = R_MICROBLAZE_TEXTREL_64;
1006+ break;
1007+ case BFD_RELOC_MICROBLAZE_64_PLT:
1008+ microblaze_reloc = R_MICROBLAZE_PLT_64;
1009+ break;
1010+ case BFD_RELOC_MICROBLAZE_64_GOTOFF:
1011+ microblaze_reloc = R_MICROBLAZE_GOTOFF_64;
1012+ break;
1013+ case BFD_RELOC_MICROBLAZE_32_GOTOFF:
1014+ microblaze_reloc = R_MICROBLAZE_GOTOFF_32;
1015+ break;
1016+ case BFD_RELOC_MICROBLAZE_64_TLSGD:
1017+ microblaze_reloc = R_MICROBLAZE_TLSGD;
1018+ break;
1019+ case BFD_RELOC_MICROBLAZE_64_TLSLD:
1020+ microblaze_reloc = R_MICROBLAZE_TLSLD;
1021+ break;
1022+ case BFD_RELOC_MICROBLAZE_32_TLSDTPREL:
1023+ microblaze_reloc = R_MICROBLAZE_TLSDTPREL32;
1024+ break;
1025+ case BFD_RELOC_MICROBLAZE_64_TLSDTPREL:
1026+ microblaze_reloc = R_MICROBLAZE_TLSDTPREL64;
1027+ break;
1028+ case BFD_RELOC_MICROBLAZE_32_TLSDTPMOD:
1029+ microblaze_reloc = R_MICROBLAZE_TLSDTPMOD32;
1030+ break;
1031+ case BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL:
1032+ microblaze_reloc = R_MICROBLAZE_TLSGOTTPREL32;
1033+ break;
1034+ case BFD_RELOC_MICROBLAZE_64_TLSTPREL:
1035+ microblaze_reloc = R_MICROBLAZE_TLSTPREL32;
1036+ break;
1037+ case BFD_RELOC_MICROBLAZE_COPY:
1038+ microblaze_reloc = R_MICROBLAZE_COPY;
1039+ break;
1040+ default:
1041+ return (reloc_howto_type *) NULL;
1042+ }
1043+
1044+ if (!microblaze_elf_howto_table [R_MICROBLAZE_32])
1045+ /* Initialize howto table if needed. */
1046+ microblaze_elf_howto_init ();
1047+
1048+ return microblaze_elf_howto_table [(int) microblaze_reloc];
1049+};
1050+
1051+static reloc_howto_type *
1052+microblaze_elf_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
1053+ const char *r_name)
1054+{
1055+ unsigned int i;
1056+
1057+ for (i = 0; i < NUM_ELEM (microblaze_elf_howto_raw); i++)
1058+ if (microblaze_elf_howto_raw[i].name != NULL
1059+ && strcasecmp (microblaze_elf_howto_raw[i].name, r_name) == 0)
1060+ return &microblaze_elf_howto_raw[i];
1061+
1062+ return NULL;
1063+}
1064+
1065+/* Set the howto pointer for a RCE ELF reloc. */
1066+
1067+static bool
1068+microblaze_elf_info_to_howto (bfd * abfd,
1069+ arelent * cache_ptr,
1070+ Elf_Internal_Rela * dst)
1071+{
1072+ unsigned int r_type;
1073+
1074+ if (!microblaze_elf_howto_table [R_MICROBLAZE_32])
1075+ /* Initialize howto table if needed. */
1076+ microblaze_elf_howto_init ();
1077+
1078+ r_type = ELF64_R_TYPE (dst->r_info);
1079+ if (r_type >= R_MICROBLAZE_max)
1080+ {
1081+ /* xgettext:c-format */
1082+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
1083+ abfd, r_type);
1084+ bfd_set_error (bfd_error_bad_value);
1085+ return false;
1086+ }
1087+
1088+ cache_ptr->howto = microblaze_elf_howto_table [r_type];
1089+ return true;
1090+}
1091+
1092+/* Relax table contains information about instructions which can
1093+ be removed by relaxation -- replacing a long address with a
1094+ short address. */
1095+struct relax_table
1096+{
1097+ /* Address where bytes may be deleted. */
1098+ bfd_vma addr;
1099+
1100+ /* Number of bytes to be deleted. */
1101+ size_t size;
1102+};
1103+
1104+struct _microblaze_elf_section_data
1105+{
1106+ struct bfd_elf_section_data elf;
1107+ /* Count of used relaxation table entries. */
1108+ size_t relax_count;
1109+ /* Relaxation table. */
1110+ struct relax_table *relax;
1111+};
1112+
1113+#define microblaze_elf_section_data(sec) \
1114+ ((struct _microblaze_elf_section_data *) elf_section_data (sec))
1115+
1116+static bool
1117+microblaze_elf_new_section_hook (bfd *abfd, asection *sec)
1118+{
1119+ if (!sec->used_by_bfd)
1120+ {
1121+ struct _microblaze_elf_section_data *sdata;
1122+ size_t amt = sizeof (*sdata);
1123+
1124+ sdata = bfd_zalloc (abfd, amt);
1125+ if (sdata == NULL)
1126+ return false;
1127+ sec->used_by_bfd = sdata;
1128+ }
1129+
1130+ return _bfd_elf_new_section_hook (abfd, sec);
1131+}
1132+
1133+/* Microblaze ELF local labels start with 'L.' or '$L', not '.L'. */
1134+
1135+static bool
1136+microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
1137+{
1138+ if (name[0] == 'L' && name[1] == '.')
1139+ return true;
1140+
1141+ if (name[0] == '$' && name[1] == 'L')
1142+ return true;
1143+
1144+ /* With gcc, the labels go back to starting with '.', so we accept
1145+ the generic ELF local label syntax as well. */
1146+ return _bfd_elf_is_local_label_name (abfd, name);
1147+}
1148+
1149+/* ELF linker hash entry. */
1150+
1151+struct elf64_mb_link_hash_entry
1152+{
1153+ struct elf_link_hash_entry elf;
1154+
1155+ /* TLS Reference Types for the symbol; Updated by check_relocs */
1156+#define TLS_GD 1 /* GD reloc. */
1157+#define TLS_LD 2 /* LD reloc. */
1158+#define TLS_TPREL 4 /* TPREL reloc, => IE. */
1159+#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */
1160+#define TLS_TLS 16 /* Any TLS reloc. */
1161+ unsigned char tls_mask;
1162+
1163+};
1164+
1165+#define IS_TLS_GD(x) (x == (TLS_TLS | TLS_GD))
1166+#define IS_TLS_LD(x) (x == (TLS_TLS | TLS_LD))
1167+#define IS_TLS_DTPREL(x) (x == (TLS_TLS | TLS_DTPREL))
1168+#define IS_TLS_NONE(x) (x == 0)
1169+
1170+#define elf64_mb_hash_entry(ent) ((struct elf64_mb_link_hash_entry *)(ent))
1171+
1172+/* ELF linker hash table. */
1173+
1174+struct elf64_mb_link_hash_table
1175+{
1176+ struct elf_link_hash_table elf;
1177+
1178+ /* TLS Local Dynamic GOT Entry */
1179+ union {
1180+ bfd_signed_vma refcount;
1181+ bfd_vma offset;
1182+ } tlsld_got;
1183+};
1184+
1185+/* Nonzero if this section has TLS related relocations. */
1186+#define has_tls_reloc sec_flg0
1187+
1188+/* Get the ELF linker hash table from a link_info structure. */
1189+
1190+#define elf64_mb_hash_table(p) \
1191+ ((is_elf_hash_table ((p)->hash) \
1192+ && elf_hash_table_id (elf_hash_table (p)) == MICROBLAZE_ELF_DATA) \
1193+ ? (struct elf64_mb_link_hash_table *) (p)->hash : NULL)
1194+
1195+/* Create an entry in a microblaze ELF linker hash table. */
1196+
1197+static struct bfd_hash_entry *
1198+link_hash_newfunc (struct bfd_hash_entry *entry,
1199+ struct bfd_hash_table *table,
1200+ const char *string)
1201+{
1202+ /* Allocate the structure if it has not already been allocated by a
1203+ subclass. */
1204+ if (entry == NULL)
1205+ {
1206+ entry = bfd_hash_allocate (table,
1207+ sizeof (struct elf64_mb_link_hash_entry));
1208+ if (entry == NULL)
1209+ return entry;
1210+ }
1211+
1212+ /* Call the allocation method of the superclass. */
1213+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
1214+ if (entry != NULL)
1215+ {
1216+ struct elf64_mb_link_hash_entry *eh;
1217+
1218+ eh = (struct elf64_mb_link_hash_entry *) entry;
1219+ eh->tls_mask = 0;
1220+ }
1221+
1222+ return entry;
1223+}
1224+
1225+/* Create a mb ELF linker hash table. */
1226+
1227+static struct bfd_link_hash_table *
1228+microblaze_elf_link_hash_table_create (bfd *abfd)
1229+{
1230+ struct elf64_mb_link_hash_table *ret;
1231+ size_t amt = sizeof (struct elf64_mb_link_hash_table);
1232+
1233+ ret = (struct elf64_mb_link_hash_table *) bfd_zmalloc (amt);
1234+ if (ret == NULL)
1235+ return NULL;
1236+
1237+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
1238+ sizeof (struct elf64_mb_link_hash_entry),
1239+ MICROBLAZE_ELF_DATA))
1240+ {
1241+ free (ret);
1242+ return NULL;
1243+ }
1244+
1245+ return &ret->elf.root;
1246+}
1247+
1248+/* Set the values of the small data pointers. */
1249+
1250+static void
1251+microblaze_elf_final_sdp (struct bfd_link_info *info)
1252+{
1253+ struct bfd_link_hash_entry *h;
1254+
1255+ h = bfd_link_hash_lookup (info->hash, RO_SDA_ANCHOR_NAME, false, false, true);
1256+ if (h != (struct bfd_link_hash_entry *) NULL
1257+ && h->type == bfd_link_hash_defined)
1258+ ro_small_data_pointer = (h->u.def.value
1259+ + h->u.def.section->output_section->vma
1260+ + h->u.def.section->output_offset);
1261+
1262+ h = bfd_link_hash_lookup (info->hash, RW_SDA_ANCHOR_NAME, false, false, true);
1263+ if (h != (struct bfd_link_hash_entry *) NULL
1264+ && h->type == bfd_link_hash_defined)
1265+ rw_small_data_pointer = (h->u.def.value
1266+ + h->u.def.section->output_section->vma
1267+ + h->u.def.section->output_offset);
1268+}
1269+
1270+static bfd_vma
1271+dtprel_base (struct bfd_link_info *info)
1272+{
1273+ /* If tls_sec is NULL, we should have signalled an error already. */
1274+ if (elf_hash_table (info)->tls_sec == NULL)
1275+ return 0;
1276+ return elf_hash_table (info)->tls_sec->vma;
1277+}
1278+
1279+/* The size of the thread control block. */
1280+#define TCB_SIZE 8
1281+
1282+/* Output a simple dynamic relocation into SRELOC. */
1283+
1284+static void
1285+microblaze_elf_output_dynamic_relocation (bfd *output_bfd,
1286+ asection *sreloc,
1287+ unsigned long reloc_index,
1288+ unsigned long indx,
1289+ int r_type,
1290+ bfd_vma offset,
1291+ bfd_vma addend)
1292+{
1293+
1294+ Elf_Internal_Rela rel;
1295+
1296+ rel.r_info = ELF64_R_INFO (indx, r_type);
1297+ rel.r_offset = offset;
1298+ rel.r_addend = addend;
1299+
1300+ bfd_elf64_swap_reloca_out (output_bfd, &rel,
1301+ (sreloc->contents + reloc_index * sizeof (Elf64_External_Rela)));
1302+}
1303+
1304+/* This code is taken from elf64-m32r.c
1305+ There is some attempt to make this function usable for many architectures,
1306+ both USE_REL and USE_RELA ['twould be nice if such a critter existed],
1307+ if only to serve as a learning tool.
1308+
1309+ The RELOCATE_SECTION function is called by the new ELF backend linker
1310+ to handle the relocations for a section.
1311+
1312+ The relocs are always passed as Rela structures; if the section
1313+ actually uses Rel structures, the r_addend field will always be
1314+ zero.
1315+
1316+ This function is responsible for adjust the section contents as
1317+ necessary, and (if using Rela relocs and generating a
1318+ relocatable output file) adjusting the reloc addend as
1319+ necessary.
1320+
1321+ This function does not have to worry about setting the reloc
1322+ address or the reloc symbol index.
1323+
1324+ LOCAL_SYMS is a pointer to the swapped in local symbols.
1325+
1326+ LOCAL_SECTIONS is an array giving the section in the input file
1327+ corresponding to the st_shndx field of each local symbol.
1328+
1329+ The global hash table entry for the global symbols can be found
1330+ via elf_sym_hashes (input_bfd).
1331+
1332+ When generating relocatable output, this function must handle
1333+ STB_LOCAL/STT_SECTION symbols specially. The output symbol is
1334+ going to be the section symbol corresponding to the output
1335+ section, which means that the addend must be adjusted
1336+ accordingly. */
1337+
1338+static int
1339+microblaze_elf_relocate_section (bfd *output_bfd,
1340+ struct bfd_link_info *info,
1341+ bfd *input_bfd,
1342+ asection *input_section,
1343+ bfd_byte *contents,
1344+ Elf_Internal_Rela *relocs,
1345+ Elf_Internal_Sym *local_syms,
1346+ asection **local_sections)
1347+{
1348+ struct elf64_mb_link_hash_table *htab;
1349+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1350+ struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
1351+ Elf_Internal_Rela *rel, *relend;
1352+ int endian = (bfd_little_endian (output_bfd)) ? 0 : 2;
1353+ /* Assume success. */
1354+ bool ret = true;
1355+ asection *sreloc;
1356+ bfd_vma *local_got_offsets;
1357+ unsigned int tls_type;
1358+
1359+ if (!microblaze_elf_howto_table[R_MICROBLAZE_max-1])
1360+ microblaze_elf_howto_init ();
1361+
1362+ htab = elf64_mb_hash_table (info);
1363+ if (htab == NULL)
1364+ return false;
1365+
1366+ local_got_offsets = elf_local_got_offsets (input_bfd);
1367+
1368+ sreloc = elf_section_data (input_section)->sreloc;
1369+
1370+ rel = relocs;
1371+ relend = relocs + input_section->reloc_count;
1372+ for (; rel < relend; rel++)
1373+ {
1374+ int r_type;
1375+ reloc_howto_type *howto;
1376+ unsigned long r_symndx;
1377+ bfd_vma addend = rel->r_addend;
1378+ bfd_vma offset = rel->r_offset;
1379+ struct elf_link_hash_entry *h;
1380+ Elf_Internal_Sym *sym;
1381+ asection *sec;
1382+ const char *sym_name;
1383+ bfd_reloc_status_type r = bfd_reloc_ok;
1384+ const char *errmsg = NULL;
1385+ bool unresolved_reloc = false;
1386+
1387+ h = NULL;
1388+ r_type = ELF64_R_TYPE (rel->r_info);
1389+ tls_type = 0;
1390+
1391+ if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max)
1392+ {
1393+ /* xgettext:c-format */
1394+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
1395+ input_bfd, (int) r_type);
1396+ bfd_set_error (bfd_error_bad_value);
1397+ ret = false;
1398+ continue;
1399+ }
1400+
1401+ howto = microblaze_elf_howto_table[r_type];
1402+ r_symndx = ELF64_R_SYM (rel->r_info);
1403+
1404+ if (bfd_link_relocatable (info))
1405+ {
1406+ /* This is a relocatable link. We don't have to change
1407+ anything, unless the reloc is against a section symbol,
1408+ in which case we have to adjust according to where the
1409+ section symbol winds up in the output section. */
1410+ sec = NULL;
1411+ if (r_symndx >= symtab_hdr->sh_info)
1412+ /* External symbol. */
1413+ continue;
1414+
1415+ /* Local symbol. */
1416+ sym = local_syms + r_symndx;
1417+ sym_name = "<local symbol>";
1418+ /* STT_SECTION: symbol is associated with a section. */
1419+ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
1420+ /* Symbol isn't associated with a section. Nothing to do. */
1421+ continue;
1422+
1423+ sec = local_sections[r_symndx];
1424+ addend += sec->output_offset + sym->st_value;
1425+#ifndef USE_REL
1426+ /* This can't be done for USE_REL because it doesn't mean anything
1427+ and elf_link_input_bfd asserts this stays zero. */
1428+ /* rel->r_addend = addend; */
1429+#endif
1430+
1431+#ifndef USE_REL
1432+ /* Addends are stored with relocs. We're done. */
1433+ continue;
1434+#else /* USE_REL */
1435+ /* If partial_inplace, we need to store any additional addend
1436+ back in the section. */
1437+ if (!howto->partial_inplace)
1438+ continue;
1439+ /* ??? Here is a nice place to call a special_function like handler. */
1440+ r = _bfd_relocate_contents (howto, input_bfd, addend,
1441+ contents + offset);
1442+#endif /* USE_REL */
1443+ }
1444+ else
1445+ {
1446+ bfd_vma relocation;
1447+ bool resolved_to_zero;
1448+
1449+ /* This is a final link. */
1450+ sym = NULL;
1451+ sec = NULL;
1452+ unresolved_reloc = false;
1453+
1454+ if (r_symndx < symtab_hdr->sh_info)
1455+ {
1456+ /* Local symbol. */
1457+ sym = local_syms + r_symndx;
1458+ sec = local_sections[r_symndx];
1459+ if (sec == 0)
1460+ continue;
1461+ sym_name = "<local symbol>";
1462+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1463+ /* r_addend may have changed if the reference section was
1464+ a merge section. */
1465+ addend = rel->r_addend;
1466+ }
1467+ else
1468+ {
1469+ /* External symbol. */
1470+ bool warned ATTRIBUTE_UNUSED;
1471+ bool ignored ATTRIBUTE_UNUSED;
1472+
1473+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
1474+ r_symndx, symtab_hdr, sym_hashes,
1475+ h, sec, relocation,
1476+ unresolved_reloc, warned, ignored);
1477+ sym_name = h->root.root.string;
1478+ }
1479+
1480+ /* Sanity check the address. */
1481+ if (offset > bfd_get_section_limit (input_bfd, input_section))
1482+ {
1483+ r = bfd_reloc_outofrange;
1484+ goto check_reloc;
1485+ }
1486+
1487+ resolved_to_zero = (h != NULL
1488+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
1489+
1490+ switch ((int) r_type)
1491+ {
1492+ case (int) R_MICROBLAZE_SRO32 :
1493+ {
1494+ const char *name;
1495+
1496+ /* Only relocate if the symbol is defined. */
1497+ if (sec)
1498+ {
1499+ name = bfd_section_name (sec);
1500+
1501+ if (strcmp (name, ".sdata2") == 0
1502+ || strcmp (name, ".sbss2") == 0)
1503+ {
1504+ if (ro_small_data_pointer == 0)
1505+ microblaze_elf_final_sdp (info);
1506+ if (ro_small_data_pointer == 0)
1507+ {
1508+ ret = false;
1509+ r = bfd_reloc_undefined;
1510+ goto check_reloc;
1511+ }
1512+
1513+ /* At this point `relocation' contains the object's
1514+ address. */
1515+ relocation -= ro_small_data_pointer;
1516+ /* Now it contains the offset from _SDA2_BASE_. */
1517+ r = _bfd_final_link_relocate (howto, input_bfd,
1518+ input_section,
1519+ contents, offset,
1520+ relocation, addend);
1521+ }
1522+ else
1523+ {
1524+ _bfd_error_handler
1525+ /* xgettext:c-format */
1526+ (_("%pB: the target (%s) of an %s relocation"
1527+ " is in the wrong section (%pA)"),
1528+ input_bfd,
1529+ sym_name,
1530+ microblaze_elf_howto_table[(int) r_type]->name,
1531+ sec);
1532+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1533+ ret = false;
1534+ continue;
1535+ }
1536+ }
1537+ }
1538+ break;
1539+
1540+ case (int) R_MICROBLAZE_SRW32 :
1541+ {
1542+ const char *name;
1543+
1544+ /* Only relocate if the symbol is defined. */
1545+ if (sec)
1546+ {
1547+ name = bfd_section_name (sec);
1548+
1549+ if (strcmp (name, ".sdata") == 0
1550+ || strcmp (name, ".sbss") == 0)
1551+ {
1552+ if (rw_small_data_pointer == 0)
1553+ microblaze_elf_final_sdp (info);
1554+ if (rw_small_data_pointer == 0)
1555+ {
1556+ ret = false;
1557+ r = bfd_reloc_undefined;
1558+ goto check_reloc;
1559+ }
1560+
1561+ /* At this point `relocation' contains the object's
1562+ address. */
1563+ relocation -= rw_small_data_pointer;
1564+ /* Now it contains the offset from _SDA_BASE_. */
1565+ r = _bfd_final_link_relocate (howto, input_bfd,
1566+ input_section,
1567+ contents, offset,
1568+ relocation, addend);
1569+ }
1570+ else
1571+ {
1572+ _bfd_error_handler
1573+ /* xgettext:c-format */
1574+ (_("%pB: the target (%s) of an %s relocation"
1575+ " is in the wrong section (%pA)"),
1576+ input_bfd,
1577+ sym_name,
1578+ microblaze_elf_howto_table[(int) r_type]->name,
1579+ sec);
1580+ /*bfd_set_error (bfd_error_bad_value); ??? why? */
1581+ ret = false;
1582+ continue;
1583+ }
1584+ }
1585+ }
1586+ break;
1587+
1588+ case (int) R_MICROBLAZE_32_SYM_OP_SYM:
1589+ break; /* Do nothing. */
1590+
1591+ case (int) R_MICROBLAZE_GOTPC_64:
1592+ relocation = (htab->elf.sgotplt->output_section->vma
1593+ + htab->elf.sgotplt->output_offset);
1594+ relocation -= (input_section->output_section->vma
1595+ + input_section->output_offset
1596+ + offset + INST_WORD_SIZE);
1597+ relocation += addend;
1598+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1599+ contents + offset + endian);
1600+ bfd_put_16 (input_bfd, relocation & 0xffff,
1601+ contents + offset + endian + INST_WORD_SIZE);
1602+ break;
1603+
1604+ case (int) R_MICROBLAZE_TEXTPCREL_64:
1605+ relocation = input_section->output_section->vma;
1606+ relocation -= (input_section->output_section->vma
1607+ + input_section->output_offset
1608+ + offset + INST_WORD_SIZE);
1609+ relocation += addend;
1610+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1611+ contents + offset + endian);
1612+ bfd_put_16 (input_bfd, relocation & 0xffff,
1613+ contents + offset + endian + INST_WORD_SIZE);
1614+ break;
1615+
1616+ case (int) R_MICROBLAZE_PLT_64:
1617+ {
1618+ bfd_vma immediate;
1619+ if (htab->elf.splt != NULL && h != NULL
1620+ && h->plt.offset != (bfd_vma) -1)
1621+ {
1622+ relocation = (htab->elf.splt->output_section->vma
1623+ + htab->elf.splt->output_offset
1624+ + h->plt.offset);
1625+ unresolved_reloc = false;
1626+ immediate = relocation - (input_section->output_section->vma
1627+ + input_section->output_offset
1628+ + offset + INST_WORD_SIZE);
1629+ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
1630+ contents + offset + endian);
1631+ bfd_put_16 (input_bfd, immediate & 0xffff,
1632+ contents + offset + endian + INST_WORD_SIZE);
1633+ }
1634+ else
1635+ {
1636+ relocation -= (input_section->output_section->vma
1637+ + input_section->output_offset
1638+ + offset + INST_WORD_SIZE);
1639+ immediate = relocation;
1640+ bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff,
1641+ contents + offset + endian);
1642+ bfd_put_16 (input_bfd, immediate & 0xffff,
1643+ contents + offset + endian + INST_WORD_SIZE);
1644+ }
1645+ break;
1646+ }
1647+
1648+ case (int) R_MICROBLAZE_TLSGD:
1649+ tls_type = (TLS_TLS | TLS_GD);
1650+ goto dogot;
1651+ case (int) R_MICROBLAZE_TLSLD:
1652+ tls_type = (TLS_TLS | TLS_LD);
1653+ /* Fall through. */
1654+ dogot:
1655+ case (int) R_MICROBLAZE_GOT_64:
1656+ {
1657+ bfd_vma *offp;
1658+ bfd_vma off, off2;
1659+ unsigned long indx;
1660+ bfd_vma static_value;
1661+
1662+ bool need_relocs = false;
1663+ if (htab->elf.sgot == NULL)
1664+ abort ();
1665+
1666+ indx = 0;
1667+ offp = NULL;
1668+
1669+ /* 1. Identify GOT Offset;
1670+ 2. Compute Static Values
1671+ 3. Process Module Id, Process Offset
1672+ 4. Fixup Relocation with GOT offset value. */
1673+
1674+ /* 1. Determine GOT Offset to use : TLS_LD, global, local */
1675+ if (IS_TLS_LD (tls_type))
1676+ offp = &htab->tlsld_got.offset;
1677+ else if (h != NULL)
1678+ {
1679+ if (htab->elf.sgotplt != NULL
1680+ && h->got.offset != (bfd_vma) -1)
1681+ offp = &h->got.offset;
1682+ else
1683+ abort ();
1684+ }
1685+ else
1686+ {
1687+ if (local_got_offsets == NULL)
1688+ abort ();
1689+ offp = &local_got_offsets[r_symndx];
1690+ }
1691+
1692+ if (!offp)
1693+ abort ();
1694+
1695+ off = (*offp) & ~1;
1696+ off2 = off;
1697+
1698+ if (IS_TLS_LD(tls_type) || IS_TLS_GD(tls_type))
1699+ off2 = off + 4;
1700+
1701+ /* Symbol index to use for relocs */
1702+ if (h != NULL)
1703+ {
1704+ bool dyn =
1705+ elf_hash_table (info)->dynamic_sections_created;
1706+
1707+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
1708+ bfd_link_pic (info),
1709+ h)
1710+ && (!bfd_link_pic (info)
1711+ || !SYMBOL_REFERENCES_LOCAL (info, h)))
1712+ indx = h->dynindx;
1713+ }
1714+
1715+ /* Need to generate relocs ? */
1716+ if ((bfd_link_pic (info) || indx != 0)
1717+ && (h == NULL
1718+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1719+ && !resolved_to_zero)
1720+ || h->root.type != bfd_link_hash_undefweak))
1721+ need_relocs = true;
1722+
1723+ /* 2. Compute/Emit Static value of r-expression */
1724+ static_value = relocation + addend;
1725+
1726+ /* 3. Process module-id and offset */
1727+ if (! ((*offp) & 1) )
1728+ {
1729+ bfd_vma got_offset;
1730+
1731+ got_offset = (htab->elf.sgot->output_section->vma
1732+ + htab->elf.sgot->output_offset
1733+ + off);
1734+
1735+ /* Process module-id */
1736+ if (IS_TLS_LD(tls_type))
1737+ {
1738+ if (! bfd_link_pic (info))
1739+ bfd_put_32 (output_bfd, 1,
1740+ htab->elf.sgot->contents + off);
1741+ else
1742+ microblaze_elf_output_dynamic_relocation
1743+ (output_bfd,
1744+ htab->elf.srelgot,
1745+ htab->elf.srelgot->reloc_count++,
1746+ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
1747+ got_offset, 0);
1748+ }
1749+ else if (IS_TLS_GD(tls_type))
1750+ {
1751+ if (! need_relocs)
1752+ bfd_put_32 (output_bfd, 1,
1753+ htab->elf.sgot->contents + off);
1754+ else
1755+ microblaze_elf_output_dynamic_relocation
1756+ (output_bfd,
1757+ htab->elf.srelgot,
1758+ htab->elf.srelgot->reloc_count++,
1759+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
1760+ got_offset, indx ? 0 : static_value);
1761+ }
1762+
1763+ /* Process Offset */
1764+ if (htab->elf.srelgot == NULL)
1765+ abort ();
1766+
1767+ got_offset = (htab->elf.sgot->output_section->vma
1768+ + htab->elf.sgot->output_offset
1769+ + off2);
1770+ if (IS_TLS_LD(tls_type))
1771+ {
1772+ /* For LD, offset should be 0 */
1773+ *offp |= 1;
1774+ bfd_put_32 (output_bfd, 0,
1775+ htab->elf.sgot->contents + off2);
1776+ }
1777+ else if (IS_TLS_GD(tls_type))
1778+ {
1779+ *offp |= 1;
1780+ static_value -= dtprel_base(info);
1781+ if (need_relocs)
1782+ microblaze_elf_output_dynamic_relocation
1783+ (output_bfd,
1784+ htab->elf.srelgot,
1785+ htab->elf.srelgot->reloc_count++,
1786+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
1787+ got_offset, indx ? 0 : static_value);
1788+ else
1789+ bfd_put_32 (output_bfd, static_value,
1790+ htab->elf.sgot->contents + off2);
1791+ }
1792+ else
1793+ {
1794+ bfd_put_32 (output_bfd, static_value,
1795+ htab->elf.sgot->contents + off2);
1796+
1797+ /* Relocs for dyn symbols generated by
1798+ finish_dynamic_symbols */
1799+ if (bfd_link_pic (info) && h == NULL)
1800+ {
1801+ *offp |= 1;
1802+ microblaze_elf_output_dynamic_relocation
1803+ (output_bfd,
1804+ htab->elf.srelgot,
1805+ htab->elf.srelgot->reloc_count++,
1806+ /* symindex= */ indx, R_MICROBLAZE_REL,
1807+ got_offset, static_value);
1808+ }
1809+ }
1810+ }
1811+
1812+ /* 4. Fixup Relocation with GOT offset value
1813+ Compute relative address of GOT entry for applying
1814+ the current relocation */
1815+ relocation = htab->elf.sgot->output_section->vma
1816+ + htab->elf.sgot->output_offset
1817+ + off
1818+ - htab->elf.sgotplt->output_section->vma
1819+ - htab->elf.sgotplt->output_offset;
1820+
1821+ /* Apply Current Relocation */
1822+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1823+ contents + offset + endian);
1824+ bfd_put_16 (input_bfd, relocation & 0xffff,
1825+ contents + offset + endian + INST_WORD_SIZE);
1826+
1827+ unresolved_reloc = false;
1828+ break;
1829+ }
1830+
1831+ case (int) R_MICROBLAZE_GOTOFF_64:
1832+ {
1833+ bfd_vma immediate;
1834+ unsigned short lo, high;
1835+ relocation += addend;
1836+ relocation -= (htab->elf.sgotplt->output_section->vma
1837+ + htab->elf.sgotplt->output_offset);
1838+ /* Write this value into correct location. */
1839+ immediate = relocation;
1840+ lo = immediate & 0x0000ffff;
1841+ high = (immediate >> 16) & 0x0000ffff;
1842+ bfd_put_16 (input_bfd, high, contents + offset + endian);
1843+ bfd_put_16 (input_bfd, lo,
1844+ contents + offset + INST_WORD_SIZE + endian);
1845+ break;
1846+ }
1847+
1848+ case (int) R_MICROBLAZE_GOTOFF_32:
1849+ {
1850+ relocation += addend;
1851+ relocation -= (htab->elf.sgotplt->output_section->vma
1852+ + htab->elf.sgotplt->output_offset);
1853+ /* Write this value into correct location. */
1854+ bfd_put_32 (input_bfd, relocation, contents + offset);
1855+ break;
1856+ }
1857+
1858+ case (int) R_MICROBLAZE_TLSDTPREL64:
1859+ relocation += addend;
1860+ relocation -= dtprel_base(info);
1861+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1862+ contents + offset + endian);
1863+ bfd_put_16 (input_bfd, relocation & 0xffff,
1864+ contents + offset + endian + INST_WORD_SIZE);
1865+ break;
1866+ case (int) R_MICROBLAZE_TEXTREL_64:
1867+ case (int) R_MICROBLAZE_TEXTREL_32_LO:
1868+ case (int) R_MICROBLAZE_64_PCREL :
1869+ case (int) R_MICROBLAZE_64:
1870+ case (int) R_MICROBLAZE_32:
1871+ {
1872+ /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
1873+ from removed linkonce sections, or sections discarded by
1874+ a linker script. */
1875+ if (r_symndx == STN_UNDEF || (input_section->flags & SEC_ALLOC) == 0)
1876+ {
1877+ relocation += addend;
1878+ if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
1879+ bfd_put_32 (input_bfd, relocation, contents + offset);
1880+ else
1881+ {
1882+ if (r_type == R_MICROBLAZE_64_PCREL)
1883+ relocation -= (input_section->output_section->vma
1884+ + input_section->output_offset
1885+ + offset + INST_WORD_SIZE);
1886+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1887+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1888+ relocation -= input_section->output_section->vma;
1889+
1890+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1891+ bfd_put_16 (input_bfd, relocation & 0xffff,
1892+ contents + offset + endian);
1893+
1894+ else
1895+ {
1896+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
1897+ contents + offset + endian);
1898+ bfd_put_16 (input_bfd, relocation & 0xffff,
1899+ contents + offset + endian + INST_WORD_SIZE);
1900+ }
1901+ }
1902+ break;
1903+ }
1904+
1905+ if ((bfd_link_pic (info)
1906+ && (h == NULL
1907+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
1908+ && !resolved_to_zero)
1909+ || h->root.type != bfd_link_hash_undefweak)
1910+ && (!howto->pc_relative
1911+ || (h != NULL
1912+ && h->dynindx != -1
1913+ && (!info->symbolic
1914+ || !h->def_regular))))
1915+ || (!bfd_link_pic (info)
1916+ && h != NULL
1917+ && h->dynindx != -1
1918+ && !h->non_got_ref
1919+ && ((h->def_dynamic
1920+ && !h->def_regular)
1921+ || h->root.type == bfd_link_hash_undefweak
1922+ || h->root.type == bfd_link_hash_undefined)))
1923+ {
1924+ Elf_Internal_Rela outrel;
1925+ bfd_byte *loc;
1926+ bool skip;
1927+
1928+ /* When generating a shared object, these relocations
1929+ are copied into the output file to be resolved at run
1930+ time. */
1931+
1932+ BFD_ASSERT (sreloc != NULL);
1933+
1934+ skip = false;
1935+
1936+ outrel.r_offset =
1937+ _bfd_elf_section_offset (output_bfd, info, input_section,
1938+ rel->r_offset);
1939+ if (outrel.r_offset == (bfd_vma) -1)
1940+ skip = true;
1941+ else if (outrel.r_offset == (bfd_vma) -2)
1942+ skip = true;
1943+ outrel.r_offset += (input_section->output_section->vma
1944+ + input_section->output_offset);
1945+
1946+ if (skip)
1947+ memset (&outrel, 0, sizeof outrel);
1948+ /* h->dynindx may be -1 if the symbol was marked to
1949+ become local. */
1950+ else if (h != NULL
1951+ && ((! info->symbolic && h->dynindx != -1)
1952+ || !h->def_regular))
1953+ {
1954+ BFD_ASSERT (h->dynindx != -1);
1955+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
1956+ outrel.r_addend = addend;
1957+ }
1958+ else
1959+ {
1960+ if (r_type == R_MICROBLAZE_32)
1961+ {
1962+ outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
1963+ outrel.r_addend = relocation + addend;
1964+ }
1965+ else
1966+ {
1967+ BFD_FAIL ();
1968+ _bfd_error_handler
1969+ (_("%pB: probably compiled without -fPIC?"),
1970+ input_bfd);
1971+ bfd_set_error (bfd_error_bad_value);
1972+ return false;
1973+ }
1974+ }
1975+
1976+ loc = sreloc->contents;
1977+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
1978+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
1979+ break;
1980+ }
1981+ else
1982+ {
1983+ relocation += addend;
1984+ if (r_type == R_MICROBLAZE_32)
1985+ bfd_put_32 (input_bfd, relocation, contents + offset);
1986+ else
1987+ {
1988+ if (r_type == R_MICROBLAZE_64_PCREL)
1989+ relocation -= (input_section->output_section->vma
1990+ + input_section->output_offset
1991+ + offset + INST_WORD_SIZE);
1992+ else if (r_type == R_MICROBLAZE_TEXTREL_64
1993+ || r_type == R_MICROBLAZE_TEXTREL_32_LO)
1994+ relocation -= input_section->output_section->vma;
1995+
1996+ if (r_type == R_MICROBLAZE_TEXTREL_32_LO)
1997+ {
1998+ bfd_put_16 (input_bfd, relocation & 0xffff,
1999+ contents + offset + endian);
2000+ }
2001+ else
2002+ {
2003+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
2004+ contents + offset + endian);
2005+ bfd_put_16 (input_bfd, relocation & 0xffff,
2006+ contents + offset + endian
2007+ + INST_WORD_SIZE);
2008+ }
2009+ }
2010+ break;
2011+ }
2012+ }
2013+
2014+ default :
2015+ r = _bfd_final_link_relocate (howto, input_bfd, input_section,
2016+ contents, offset,
2017+ relocation, addend);
2018+ break;
2019+ }
2020+ }
2021+
2022+ check_reloc:
2023+
2024+ if (r != bfd_reloc_ok)
2025+ {
2026+ /* FIXME: This should be generic enough to go in a utility. */
2027+ const char *name;
2028+
2029+ if (h != NULL)
2030+ name = h->root.root.string;
2031+ else
2032+ {
2033+ name = (bfd_elf_string_from_elf_section
2034+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
2035+ if (name == NULL || *name == '\0')
2036+ name = bfd_section_name (sec);
2037+ }
2038+
2039+ if (errmsg != NULL)
2040+ goto common_error;
2041+
2042+ switch (r)
2043+ {
2044+ case bfd_reloc_overflow:
2045+ (*info->callbacks->reloc_overflow)
2046+ (info, (h ? &h->root : NULL), name, howto->name,
2047+ (bfd_vma) 0, input_bfd, input_section, offset);
2048+ break;
2049+
2050+ case bfd_reloc_undefined:
2051+ (*info->callbacks->undefined_symbol)
2052+ (info, name, input_bfd, input_section, offset, true);
2053+ break;
2054+
2055+ case bfd_reloc_outofrange:
2056+ errmsg = _("internal error: out of range error");
2057+ goto common_error;
2058+
2059+ case bfd_reloc_notsupported:
2060+ errmsg = _("internal error: unsupported relocation error");
2061+ goto common_error;
2062+
2063+ case bfd_reloc_dangerous:
2064+ errmsg = _("internal error: dangerous error");
2065+ goto common_error;
2066+
2067+ default:
2068+ errmsg = _("internal error: unknown error");
2069+ /* Fall through. */
2070+ common_error:
2071+ (*info->callbacks->warning) (info, errmsg, name, input_bfd,
2072+ input_section, offset);
2073+ break;
2074+ }
2075+ }
2076+ }
2077+
2078+ return ret;
2079+}
2080+
2081+/* Calculate fixup value for reference. */
2082+
2083+static size_t
2084+calc_fixup (bfd_vma start, bfd_vma size, asection *sec)
2085+{
2086+ bfd_vma end = start + size;
2087+ size_t i, fixup = 0;
2088+ struct _microblaze_elf_section_data *sdata;
2089+
2090+ if (sec == NULL || (sdata = microblaze_elf_section_data (sec)) == NULL)
2091+ return 0;
2092+
2093+ /* Look for addr in relax table, total fixup value. */
2094+ for (i = 0; i < sdata->relax_count; i++)
2095+ {
2096+ if (end <= sdata->relax[i].addr)
2097+ break;
2098+ if (end != start && start > sdata->relax[i].addr)
2099+ continue;
2100+ fixup += sdata->relax[i].size;
2101+ }
2102+ return fixup;
2103+}
2104+
2105+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
2106+ a 32-bit instruction. */
2107+static void
2108+microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
2109+{
2110+ unsigned long instr = bfd_get_32 (abfd, bfd_addr);
2111+ instr &= ~0x0000ffff;
2112+ instr |= (val & 0x0000ffff);
2113+ bfd_put_32 (abfd, instr, bfd_addr);
2114+}
2115+
2116+/* Read-modify-write into the bfd, an immediate value into appropriate fields of
2117+ two consecutive 32-bit instructions. */
2118+static void
2119+microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
2120+{
2121+ unsigned long instr_hi;
2122+ unsigned long instr_lo;
2123+
2124+ instr_hi = bfd_get_32 (abfd, bfd_addr);
2125+ instr_hi &= ~0x0000ffff;
2126+ instr_hi |= ((val >> 16) & 0x0000ffff);
2127+ bfd_put_32 (abfd, instr_hi, bfd_addr);
2128+
2129+ instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
2130+ instr_lo &= ~0x0000ffff;
2131+ instr_lo |= (val & 0x0000ffff);
2132+ bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE);
2133+}
2134+
2135+static bool
2136+microblaze_elf_relax_section (bfd *abfd,
2137+ asection *sec,
2138+ struct bfd_link_info *link_info,
2139+ bool *again)
2140+{
2141+ Elf_Internal_Shdr *symtab_hdr;
2142+ Elf_Internal_Rela *internal_relocs;
2143+ Elf_Internal_Rela *free_relocs = NULL;
2144+ Elf_Internal_Rela *irel, *irelend;
2145+ bfd_byte *contents = NULL;
2146+ bfd_byte *free_contents = NULL;
2147+ int rel_count;
2148+ unsigned int shndx;
2149+ size_t i, sym_index;
2150+ asection *o;
2151+ struct elf_link_hash_entry *sym_hash;
2152+ Elf_Internal_Sym *isymbuf, *isymend;
2153+ Elf_Internal_Sym *isym;
2154+ size_t symcount;
2155+ size_t offset;
2156+ bfd_vma src, dest;
2157+ struct _microblaze_elf_section_data *sdata;
2158+
2159+ /* We only do this once per section. We may be able to delete some code
2160+ by running multiple passes, but it is not worth it. */
2161+ *again = false;
2162+
2163+ /* Only do this for a text section. */
2164+ if (bfd_link_relocatable (link_info)
2165+ || (sec->flags & SEC_RELOC) == 0
2166+ || (sec->flags & SEC_CODE) == 0
2167+ || sec->reloc_count == 0
2168+ || (sdata = microblaze_elf_section_data (sec)) == NULL)
2169+ return true;
2170+
2171+ BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0));
2172+
2173+ /* If this is the first time we have been called for this section,
2174+ initialize the cooked size. */
2175+ if (sec->size == 0)
2176+ sec->size = sec->rawsize;
2177+
2178+ /* Get symbols for this section. */
2179+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
2180+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
2181+ symcount = symtab_hdr->sh_size / sizeof (Elf64_External_Sym);
2182+ if (isymbuf == NULL)
2183+ isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, symcount,
2184+ 0, NULL, NULL, NULL);
2185+ BFD_ASSERT (isymbuf != NULL);
2186+
2187+ internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
2188+ if (internal_relocs == NULL)
2189+ goto error_return;
2190+ if (! link_info->keep_memory)
2191+ free_relocs = internal_relocs;
2192+
2193+ sdata->relax_count = 0;
2194+ sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
2195+ * sizeof (*sdata->relax));
2196+ if (sdata->relax == NULL)
2197+ goto error_return;
2198+
2199+ irelend = internal_relocs + sec->reloc_count;
2200+ rel_count = 0;
2201+ for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
2202+ {
2203+ bfd_vma symval;
2204+ if ((ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
2205+ && (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64 )
2206+&& (ELF64_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_TEXTREL_64))
2207+ continue; /* Can't delete this reloc. */
2208+
2209+ /* Get the section contents. */
2210+ if (contents == NULL)
2211+ {
2212+ if (elf_section_data (sec)->this_hdr.contents != NULL)
2213+ contents = elf_section_data (sec)->this_hdr.contents;
2214+ else
2215+ {
2216+ contents = (bfd_byte *) bfd_malloc (sec->size);
2217+ if (contents == NULL)
2218+ goto error_return;
2219+ free_contents = contents;
2220+
2221+ if (!bfd_get_section_contents (abfd, sec, contents,
2222+ (file_ptr) 0, sec->size))
2223+ goto error_return;
2224+ elf_section_data (sec)->this_hdr.contents = contents;
2225+ }
2226+ }
2227+
2228+ /* Get the value of the symbol referred to by the reloc. */
2229+ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
2230+ {
2231+ /* A local symbol. */
2232+ asection *sym_sec;
2233+
2234+ isym = isymbuf + ELF64_R_SYM (irel->r_info);
2235+ if (isym->st_shndx == SHN_UNDEF)
2236+ sym_sec = bfd_und_section_ptr;
2237+ else if (isym->st_shndx == SHN_ABS)
2238+ sym_sec = bfd_abs_section_ptr;
2239+ else if (isym->st_shndx == SHN_COMMON)
2240+ sym_sec = bfd_com_section_ptr;
2241+ else
2242+ sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
2243+
2244+ symval = _bfd_elf_rela_local_sym (abfd, isym, &sym_sec, irel);
2245+ }
2246+ else
2247+ {
2248+ unsigned long indx;
2249+ struct elf_link_hash_entry *h;
2250+
2251+ indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info;
2252+ h = elf_sym_hashes (abfd)[indx];
2253+ BFD_ASSERT (h != NULL);
2254+
2255+ if (h->root.type != bfd_link_hash_defined
2256+ && h->root.type != bfd_link_hash_defweak)
2257+ /* This appears to be a reference to an undefined
2258+ symbol. Just ignore it--it will be caught by the
2259+ regular reloc processing. */
2260+ continue;
2261+
2262+ symval = (h->root.u.def.value
2263+ + h->root.u.def.section->output_section->vma
2264+ + h->root.u.def.section->output_offset);
2265+ }
2266+
2267+ /* If this is a PC-relative reloc, subtract the instr offset from
2268+ the symbol value. */
2269+ if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_64_PCREL)
2270+ {
2271+ symval = symval + irel->r_addend
2272+ - (irel->r_offset
2273+ + sec->output_section->vma
2274+ + sec->output_offset);
2275+ }
2276+ else if (ELF64_R_TYPE (irel->r_info) == (int) R_MICROBLAZE_TEXTREL_64)
2277+ {
2278+ symval = symval + irel->r_addend - (sec->output_section->vma);
2279+ }
2280+ else
2281+ symval += irel->r_addend;
2282+
2283+ if ((symval & 0xffff8000) == 0
2284+ || (symval & 0xffff8000) == 0xffff8000)
2285+ {
2286+ /* We can delete this instruction. */
2287+ sdata->relax[sdata->relax_count].addr = irel->r_offset;
2288+ sdata->relax[sdata->relax_count].size = INST_WORD_SIZE;
2289+ sdata->relax_count++;
2290+
2291+ /* Rewrite relocation type. */
2292+ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info))
2293+ {
2294+ case R_MICROBLAZE_64_PCREL:
2295+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2296+ (int) R_MICROBLAZE_32_PCREL_LO);
2297+ break;
2298+ case R_MICROBLAZE_64:
2299+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2300+ (int) R_MICROBLAZE_32_LO);
2301+ break;
2302+ case R_MICROBLAZE_TEXTREL_64:
2303+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
2304+ (int) R_MICROBLAZE_TEXTREL_32_LO);
2305+ break;
2306+ default:
2307+ /* Cannot happen. */
2308+ BFD_ASSERT (false);
2309+ }
2310+ }
2311+ } /* Loop through all relocations. */
2312+
2313+ /* Loop through the relocs again, and see if anything needs to change. */
2314+ if (sdata->relax_count > 0)
2315+ {
2316+ shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
2317+ rel_count = 0;
2318+ sdata->relax[sdata->relax_count].addr = sec->size;
2319+
2320+ for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
2321+ {
2322+ bfd_vma nraddr;
2323+
2324+ /* Get the new reloc address. */
2325+ nraddr = irel->r_offset - calc_fixup (irel->r_offset, 0, sec);
2326+ switch ((enum elf_microblaze_reloc_type) ELF64_R_TYPE (irel->r_info))
2327+ {
2328+ default:
2329+ break;
2330+ case R_MICROBLAZE_64_PCREL:
2331+ break;
2332+ case R_MICROBLAZE_64:
2333+ case R_MICROBLAZE_32_LO:
2334+ /* If this reloc is against a symbol defined in this
2335+ section, we must check the addend to see it will put the value in
2336+ range to be adjusted, and hence must be changed. */
2337+ if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
2338+ {
2339+ isym = isymbuf + ELF64_R_SYM (irel->r_info);
2340+ /* Only handle relocs against .text. */
2341+ if (isym->st_shndx == shndx
2342+ && ELF64_ST_TYPE (isym->st_info) == STT_SECTION)
2343+ irel->r_addend -= calc_fixup (irel->r_addend, 0, sec);
2344+ }
2345+ break;
2346+ case R_MICROBLAZE_IMML_64:
2347+ {
2348+ /* This was a PC-relative instruction that was
2349+ completely resolved. */
2350+ int sfix, efix;
2351+ unsigned int val;
2352+ bfd_vma target_address;
2353+ target_address = irel->r_addend + irel->r_offset;
2354+ sfix = calc_fixup (irel->r_offset, 0, sec);
2355+ efix = calc_fixup (target_address, 0, sec);
2356+
2357+ /* Validate the in-band val. */
2358+ val = bfd_get_32 (abfd, contents + irel->r_offset);
2359+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2360+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2361+ }
2362+ irel->r_addend -= (efix - sfix);
2363+ /* Should use HOWTO. */
2364+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
2365+ irel->r_addend);
2366+ }
2367+ break;
2368+ case R_MICROBLAZE_NONE:
2369+ case R_MICROBLAZE_32_NONE:
2370+ {
2371+ /* This was a PC-relative instruction that was
2372+ completely resolved. */
2373+ size_t sfix, efix;
2374+ unsigned int val;
2375+ bfd_vma target_address;
2376+ target_address = irel->r_addend + irel->r_offset;
2377+ sfix = calc_fixup (irel->r_offset, 0, sec);
2378+ efix = calc_fixup (target_address, 0, sec);
2379+
2380+ /* Validate the in-band val. */
2381+ val = bfd_get_32 (abfd, contents + irel->r_offset);
2382+ if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
2383+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
2384+ }
2385+ irel->r_addend -= (efix - sfix);
2386+ /* Should use HOWTO. */
2387+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
2388+ irel->r_addend);
2389+ }
2390+ break;
2391+ case R_MICROBLAZE_64_NONE:
2392+ {
2393+ /* This was a PC-relative 64-bit instruction that was
2394+ completely resolved. */
2395+ size_t sfix, efix;
2396+ bfd_vma target_address;
2397+ target_address = irel->r_addend + irel->r_offset + INST_WORD_SIZE;
2398+ sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
2399+ efix = calc_fixup (target_address, 0, sec);
2400+ irel->r_addend -= (efix - sfix);
2401+ microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
2402+ + INST_WORD_SIZE, irel->r_addend);
2403+ }
2404+ break;
2405+ }
2406+ irel->r_offset = nraddr;
2407+ } /* Change all relocs in this section. */
2408+
2409+ /* Look through all other sections. */
2410+ for (o = abfd->sections; o != NULL; o = o->next)
2411+ {
2412+ Elf_Internal_Rela *irelocs;
2413+ Elf_Internal_Rela *irelscan, *irelscanend;
2414+ bfd_byte *ocontents;
2415+
2416+ if (o == sec
2417+ || (o->flags & SEC_RELOC) == 0
2418+ || o->reloc_count == 0)
2419+ continue;
2420+
2421+ /* We always cache the relocs. Perhaps, if info->keep_memory is
2422+ false, we should free them, if we are permitted to. */
2423+
2424+ irelocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL, true);
2425+ if (irelocs == NULL)
2426+ goto error_return;
2427+
2428+ ocontents = NULL;
2429+ irelscanend = irelocs + o->reloc_count;
2430+ for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
2431+ {
2432+ if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
2433+ {
2434+ unsigned int val;
2435+
2436+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2437+
2438+ /* hax: We only do the following fixup for debug location lists. */
2439+ if (strcmp(".debug_loc", o->name))
2440+ continue;
2441+
2442+ /* This was a PC-relative instruction that was completely resolved. */
2443+ if (ocontents == NULL)
2444+ {
2445+ if (elf_section_data (o)->this_hdr.contents != NULL)
2446+ ocontents = elf_section_data (o)->this_hdr.contents;
2447+ else
2448+ {
2449+ /* We always cache the section contents.
2450+ Perhaps, if info->keep_memory is false, we
2451+ should free them, if we are permitted to. */
2452+
2453+ if (o->rawsize == 0)
2454+ o->rawsize = o->size;
2455+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2456+ if (ocontents == NULL)
2457+ goto error_return;
2458+ if (!bfd_get_section_contents (abfd, o, ocontents,
2459+ (file_ptr) 0,
2460+ o->rawsize))
2461+ goto error_return;
2462+ elf_section_data (o)->this_hdr.contents = ocontents;
2463+ }
2464+ }
2465+
2466+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
2467+ if (val != irelscan->r_addend) {
2468+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
2469+ }
2470+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
2471+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
2472+ irelscan->r_addend);
2473+ }
2474+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
2475+ {
2476+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2477+
2478+ /* Look at the reloc only if the value has been resolved. */
2479+ if (isym->st_shndx == shndx
2480+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2481+ {
2482+ if (ocontents == NULL)
2483+ {
2484+ if (elf_section_data (o)->this_hdr.contents != NULL)
2485+ ocontents = elf_section_data (o)->this_hdr.contents;
2486+ else
2487+ {
2488+ /* We always cache the section contents.
2489+ Perhaps, if info->keep_memory is false, we
2490+ should free them, if we are permitted to. */
2491+ if (o->rawsize == 0)
2492+ o->rawsize = o->size;
2493+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2494+ if (ocontents == NULL)
2495+ goto error_return;
2496+ if (!bfd_get_section_contents (abfd, o, ocontents,
2497+ (file_ptr) 0,
2498+ o->rawsize))
2499+ goto error_return;
2500+ elf_section_data (o)->this_hdr.contents = ocontents;
2501+ }
2502+
2503+ }
2504+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
2505+ }
2506+ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
2507+ {
2508+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2509+
2510+ /* Look at the reloc only if the value has been resolved. */
2511+ if (ocontents == NULL)
2512+ {
2513+ if (elf_section_data (o)->this_hdr.contents != NULL)
2514+ ocontents = elf_section_data (o)->this_hdr.contents;
2515+ else
2516+ {
2517+ /* We always cache the section contents.
2518+ Perhaps, if info->keep_memory is false, we
2519+ should free them, if we are permitted to. */
2520+
2521+ if (o->rawsize == 0)
2522+ o->rawsize = o->size;
2523+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2524+ if (ocontents == NULL)
2525+ goto error_return;
2526+ if (!bfd_get_section_contents (abfd, o, ocontents,
2527+ (file_ptr) 0,
2528+ o->rawsize))
2529+ goto error_return;
2530+ elf_section_data (o)->this_hdr.contents = ocontents;
2531+ }
2532+ }
2533+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
2534+ + isym->st_value,
2535+ 0,
2536+ sec);
2537+ }
2538+ }
2539+ else if ((ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_PCREL_LO)
2540+ || (ELF32_R_TYPE (irelscan->r_info)
2541+ == (int) R_MICROBLAZE_32_LO)
2542+ || (ELF32_R_TYPE (irelscan->r_info)
2543+ == (int) R_MICROBLAZE_TEXTREL_32_LO))
2544+ {
2545+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2546+
2547+ /* Look at the reloc only if the value has been resolved. */
2548+ if (isym->st_shndx == shndx
2549+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2550+ {
2551+ bfd_vma immediate;
2552+ bfd_vma target_address;
2553+
2554+ if (ocontents == NULL)
2555+ {
2556+ if (elf_section_data (o)->this_hdr.contents != NULL)
2557+ ocontents = elf_section_data (o)->this_hdr.contents;
2558+ else
2559+ {
2560+ /* We always cache the section contents.
2561+ Perhaps, if info->keep_memory is false, we
2562+ should free them, if we are permitted to. */
2563+ if (o->rawsize == 0)
2564+ o->rawsize = o->size;
2565+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2566+ if (ocontents == NULL)
2567+ goto error_return;
2568+ if (!bfd_get_section_contents (abfd, o, ocontents,
2569+ (file_ptr) 0,
2570+ o->rawsize))
2571+ goto error_return;
2572+ elf_section_data (o)->this_hdr.contents = ocontents;
2573+ }
2574+ }
2575+
2576+ unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
2577+ immediate = instr & 0x0000ffff;
2578+ target_address = immediate;
2579+ offset = calc_fixup (target_address, 0, sec);
2580+ immediate -= offset;
2581+ irelscan->r_addend -= offset;
2582+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
2583+ irelscan->r_addend);
2584+ }
2585+ }
2586+
2587+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64
2588+ || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64))
2589+ {
2590+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2591+
2592+ /* Look at the reloc only if the value has been resolved. */
2593+ if (isym->st_shndx == shndx
2594+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2595+ {
2596+ if (ocontents == NULL)
2597+ {
2598+ if (elf_section_data (o)->this_hdr.contents != NULL)
2599+ ocontents = elf_section_data (o)->this_hdr.contents;
2600+ else
2601+ {
2602+ /* We always cache the section contents.
2603+ Perhaps, if info->keep_memory is false, we
2604+ should free them, if we are permitted to. */
2605+
2606+ if (o->rawsize == 0)
2607+ o->rawsize = o->size;
2608+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2609+ if (ocontents == NULL)
2610+ goto error_return;
2611+ if (!bfd_get_section_contents (abfd, o, ocontents,
2612+ (file_ptr) 0,
2613+ o->rawsize))
2614+ goto error_return;
2615+ elf_section_data (o)->this_hdr.contents = ocontents;
2616+ }
2617+ }
2618+ offset = calc_fixup (irelscan->r_addend, 0, sec);
2619+ irelscan->r_addend -= offset;
2620+ }
2621+ }
2622+ else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
2623+ {
2624+ isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
2625+
2626+ /* Look at the reloc only if the value has been resolved. */
2627+ if (isym->st_shndx == shndx
2628+ && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
2629+ {
2630+ bfd_vma immediate;
2631+ bfd_vma target_address;
2632+
2633+ if (ocontents == NULL)
2634+ {
2635+ if (elf_section_data (o)->this_hdr.contents != NULL)
2636+ ocontents = elf_section_data (o)->this_hdr.contents;
2637+ else
2638+ {
2639+ /* We always cache the section contents.
2640+ Perhaps, if info->keep_memory is false, we
2641+ should free them, if we are permitted to. */
2642+ if (o->rawsize == 0)
2643+ o->rawsize = o->size;
2644+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
2645+ if (ocontents == NULL)
2646+ goto error_return;
2647+ if (!bfd_get_section_contents (abfd, o, ocontents,
2648+ (file_ptr) 0,
2649+ o->rawsize))
2650+ goto error_return;
2651+ elf_section_data (o)->this_hdr.contents = ocontents;
2652+ }
2653+ }
2654+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents
2655+ + irelscan->r_offset);
2656+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
2657+ + irelscan->r_offset
2658+ + INST_WORD_SIZE);
2659+ immediate = (instr_hi & 0x0000ffff) << 16;
2660+ immediate |= (instr_lo & 0x0000ffff);
2661+ target_address = immediate;
2662+ offset = calc_fixup (target_address, 0, sec);
2663+ immediate -= offset;
2664+ irelscan->r_addend -= offset;
2665+ microblaze_bfd_write_imm_value_64 (abfd, ocontents
2666+ + irelscan->r_offset, immediate);
2667+ }
2668+ }
2669+ }
2670+ }
2671+
2672+ /* Adjust the local symbols defined in this section. */
2673+ isymend = isymbuf + symtab_hdr->sh_info;
2674+ for (isym = isymbuf; isym < isymend; isym++)
2675+ {
2676+ if (isym->st_shndx == shndx)
2677+ {
2678+ isym->st_value -= calc_fixup (isym->st_value, 0, sec);
2679+ if (isym->st_size)
2680+ isym->st_size -= calc_fixup (isym->st_value, isym->st_size, sec);
2681+ }
2682+ }
2683+
2684+ /* Now adjust the global symbols defined in this section. */
2685+ isym = isymbuf + symtab_hdr->sh_info;
2686+ symcount = (symtab_hdr->sh_size / sizeof (Elf64_External_Sym)) - symtab_hdr->sh_info;
2687+ for (sym_index = 0; sym_index < symcount; sym_index++)
2688+ {
2689+ sym_hash = elf_sym_hashes (abfd)[sym_index];
2690+ if ((sym_hash->root.type == bfd_link_hash_defined
2691+ || sym_hash->root.type == bfd_link_hash_defweak)
2692+ && sym_hash->root.u.def.section == sec)
2693+ {
2694+ sym_hash->root.u.def.value -= calc_fixup (sym_hash->root.u.def.value,
2695+ 0, sec);
2696+ if (sym_hash->size)
2697+ sym_hash->size -= calc_fixup (sym_hash->root.u.def.value,
2698+ sym_hash->size, sec);
2699+ }
2700+ }
2701+
2702+ /* Physically move the code and change the cooked size. */
2703+ dest = sdata->relax[0].addr;
2704+ for (i = 0; i < sdata->relax_count; i++)
2705+ {
2706+ size_t len;
2707+ src = sdata->relax[i].addr + sdata->relax[i].size;
2708+ len = (sdata->relax[i+1].addr - sdata->relax[i].addr
2709+ - sdata->relax[i].size);
2710+
2711+ memmove (contents + dest, contents + src, len);
2712+ sec->size -= sdata->relax[i].size;
2713+ dest += len;
2714+ }
2715+
2716+ elf_section_data (sec)->relocs = internal_relocs;
2717+ free_relocs = NULL;
2718+
2719+ elf_section_data (sec)->this_hdr.contents = contents;
2720+ free_contents = NULL;
2721+
2722+ symtab_hdr->contents = (bfd_byte *) isymbuf;
2723+ }
2724+
2725+ free (free_relocs);
2726+ free_relocs = NULL;
2727+
2728+ if (free_contents != NULL)
2729+ {
2730+ if (!link_info->keep_memory)
2731+ free (free_contents);
2732+ else
2733+ /* Cache the section contents for elf_link_input_bfd. */
2734+ elf_section_data (sec)->this_hdr.contents = contents;
2735+ free_contents = NULL;
2736+ }
2737+
2738+ if (sdata->relax_count == 0)
2739+ {
2740+ *again = false;
2741+ free (sdata->relax);
2742+ sdata->relax = NULL;
2743+ }
2744+ else
2745+ *again = true;
2746+ return true;
2747+
2748+ error_return:
2749+ free (free_relocs);
2750+ free (free_contents);
2751+ free (sdata->relax);
2752+ sdata->relax = NULL;
2753+ sdata->relax_count = 0;
2754+ return false;
2755+}
2756+
2757+/* Return the section that should be marked against GC for a given
2758+ relocation. */
2759+
2760+static asection *
2761+microblaze_elf_gc_mark_hook (asection *sec,
2762+ struct bfd_link_info * info,
2763+ Elf_Internal_Rela * rel,
2764+ struct elf_link_hash_entry * h,
2765+ Elf_Internal_Sym * sym)
2766+{
2767+ if (h != NULL)
2768+ switch (ELF64_R_TYPE (rel->r_info))
2769+ {
2770+ case R_MICROBLAZE_GNU_VTINHERIT:
2771+ case R_MICROBLAZE_GNU_VTENTRY:
2772+ return NULL;
2773+ }
2774+
2775+ return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2776+}
2777+
2778+/* PIC support. */
2779+
2780+#define PLT_ENTRY_SIZE 16
2781+
2782+#define PLT_ENTRY_WORD_0 0xb0000000 /* "imm 0". */
2783+#define PLT_ENTRY_WORD_1 0xe9940000 /* "lwi r12,r20,0" - relocated to lwi r12,r20,func@GOT. */
2784+#define PLT_ENTRY_WORD_1_NOPIC 0xe9800000 /* "lwi r12,r0,0" - non-PIC object. */
2785+#define PLT_ENTRY_WORD_2 0x98186000 /* "brad r12". */
2786+#define PLT_ENTRY_WORD_3 0x80000000 /* "nop". */
2787+
2788+/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
2789+ shortcuts to them in our hash table. */
2790+
2791+static bool
2792+update_local_sym_info (bfd *abfd,
2793+ Elf_Internal_Shdr *symtab_hdr,
2794+ unsigned long r_symndx,
2795+ unsigned int tls_type)
2796+{
2797+ bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
2798+ unsigned char *local_got_tls_masks;
2799+
2800+ if (local_got_refcounts == NULL)
2801+ {
2802+ bfd_size_type size = symtab_hdr->sh_info;
2803+
2804+ size *= (sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks));
2805+ local_got_refcounts = bfd_zalloc (abfd, size);
2806+ if (local_got_refcounts == NULL)
2807+ return false;
2808+ elf_local_got_refcounts (abfd) = local_got_refcounts;
2809+ }
2810+
2811+ local_got_tls_masks =
2812+ (unsigned char *) (local_got_refcounts + symtab_hdr->sh_info);
2813+ local_got_tls_masks[r_symndx] |= tls_type;
2814+ local_got_refcounts[r_symndx] += 1;
2815+
2816+ return true;
2817+}
2818+/* Look through the relocs for a section during the first phase. */
2819+
2820+static bool
2821+microblaze_elf_check_relocs (bfd * abfd,
2822+ struct bfd_link_info * info,
2823+ asection * sec,
2824+ const Elf_Internal_Rela * relocs)
2825+{
2826+ Elf_Internal_Shdr * symtab_hdr;
2827+ struct elf_link_hash_entry ** sym_hashes;
2828+ struct elf_link_hash_entry ** sym_hashes_end;
2829+ const Elf_Internal_Rela * rel;
2830+ const Elf_Internal_Rela * rel_end;
2831+ struct elf64_mb_link_hash_table *htab;
2832+ asection *sreloc = NULL;
2833+
2834+ if (bfd_link_relocatable (info))
2835+ return true;
2836+
2837+ htab = elf64_mb_hash_table (info);
2838+ if (htab == NULL)
2839+ return false;
2840+
2841+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
2842+ sym_hashes = elf_sym_hashes (abfd);
2843+ sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf64_External_Sym);
2844+ if (!elf_bad_symtab (abfd))
2845+ sym_hashes_end -= symtab_hdr->sh_info;
2846+
2847+ rel_end = relocs + sec->reloc_count;
2848+
2849+ for (rel = relocs; rel < rel_end; rel++)
2850+ {
2851+ unsigned int r_type;
2852+ struct elf_link_hash_entry * h;
2853+ unsigned long r_symndx;
2854+ unsigned char tls_type = 0;
2855+
2856+ r_symndx = ELF64_R_SYM (rel->r_info);
2857+ r_type = ELF64_R_TYPE (rel->r_info);
2858+
2859+ if (r_symndx < symtab_hdr->sh_info)
2860+ h = NULL;
2861+ else
2862+ {
2863+ h = sym_hashes [r_symndx - symtab_hdr->sh_info];
2864+ while (h->root.type == bfd_link_hash_indirect
2865+ || h->root.type == bfd_link_hash_warning)
2866+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
2867+ }
2868+
2869+ switch (r_type)
2870+ {
2871+ /* This relocation describes the C++ object vtable hierarchy.
2872+ Reconstruct it for later use during GC. */
2873+ case R_MICROBLAZE_GNU_VTINHERIT:
2874+ if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
2875+ return false;
2876+ break;
2877+
2878+ /* This relocation describes which C++ vtable entries are actually
2879+ used. Record for later use during GC. */
2880+ case R_MICROBLAZE_GNU_VTENTRY:
2881+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
2882+ return false;
2883+ break;
2884+
2885+ /* This relocation requires .plt entry. */
2886+ case R_MICROBLAZE_PLT_64:
2887+ if (h != NULL)
2888+ {
2889+ h->needs_plt = 1;
2890+ h->plt.refcount += 1;
2891+ }
2892+ break;
2893+
2894+ /* This relocation requires .got entry. */
2895+ case R_MICROBLAZE_TLSGD:
2896+ tls_type |= (TLS_TLS | TLS_GD);
2897+ goto dogottls;
2898+ case R_MICROBLAZE_TLSLD:
2899+ tls_type |= (TLS_TLS | TLS_LD);
2900+ /* Fall through. */
2901+ dogottls:
2902+ sec->has_tls_reloc = 1;
2903+ /* Fall through. */
2904+ case R_MICROBLAZE_GOT_64:
2905+ if (htab->elf.sgot == NULL)
2906+ {
2907+ if (htab->elf.dynobj == NULL)
2908+ htab->elf.dynobj = abfd;
2909+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2910+ return false;
2911+ }
2912+ if (h != NULL)
2913+ {
2914+ h->got.refcount += 1;
2915+ elf64_mb_hash_entry (h)->tls_mask |= tls_type;
2916+ }
2917+ else
2918+ {
2919+ if (! update_local_sym_info(abfd, symtab_hdr, r_symndx, tls_type) )
2920+ return false;
2921+ }
2922+ break;
2923+
2924+ case R_MICROBLAZE_GOTOFF_64:
2925+ case R_MICROBLAZE_GOTOFF_32:
2926+ if (htab->elf.sgot == NULL)
2927+ {
2928+ if (htab->elf.dynobj == NULL)
2929+ htab->elf.dynobj = abfd;
2930+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
2931+ return false;
2932+ }
2933+ break;
2934+
2935+ case R_MICROBLAZE_64:
2936+ case R_MICROBLAZE_64_PCREL:
2937+ case R_MICROBLAZE_32:
2938+ {
2939+ if (h != NULL && !bfd_link_pic (info))
2940+ {
2941+ /* we may need a copy reloc. */
2942+ h->non_got_ref = 1;
2943+
2944+ /* we may also need a .plt entry. */
2945+ h->plt.refcount += 1;
2946+ if (ELF64_R_TYPE (rel->r_info) != R_MICROBLAZE_64_PCREL)
2947+ h->pointer_equality_needed = 1;
2948+ }
2949+
2950+
2951+ /* If we are creating a shared library, and this is a reloc
2952+ against a global symbol, or a non PC relative reloc
2953+ against a local symbol, then we need to copy the reloc
2954+ into the shared library. However, if we are linking with
2955+ -Bsymbolic, we do not need to copy a reloc against a
2956+ global symbol which is defined in an object we are
2957+ including in the link (i.e., DEF_REGULAR is set). At
2958+ this point we have not seen all the input files, so it is
2959+ possible that DEF_REGULAR is not set now but will be set
2960+ later (it is never cleared). In case of a weak definition,
2961+ DEF_REGULAR may be cleared later by a strong definition in
2962+ a shared library. We account for that possibility below by
2963+ storing information in the relocs_copied field of the hash
2964+ table entry. A similar situation occurs when creating
2965+ shared libraries and symbol visibility changes render the
2966+ symbol local.
2967+
2968+ If on the other hand, we are creating an executable, we
2969+ may need to keep relocations for symbols satisfied by a
2970+ dynamic library if we manage to avoid copy relocs for the
2971+ symbol. */
2972+
2973+ if ((bfd_link_pic (info)
2974+ && (sec->flags & SEC_ALLOC) != 0
2975+ && (r_type != R_MICROBLAZE_64_PCREL
2976+ || (h != NULL
2977+ && (! info->symbolic
2978+ || h->root.type == bfd_link_hash_defweak
2979+ || !h->def_regular))))
2980+ || (!bfd_link_pic (info)
2981+ && (sec->flags & SEC_ALLOC) != 0
2982+ && h != NULL
2983+ && (h->root.type == bfd_link_hash_defweak
2984+ || !h->def_regular)))
2985+ {
2986+ struct elf_dyn_relocs *p;
2987+ struct elf_dyn_relocs **head;
2988+
2989+ /* When creating a shared object, we must copy these
2990+ relocs into the output file. We create a reloc
2991+ section in dynobj and make room for the reloc. */
2992+
2993+ if (sreloc == NULL)
2994+ {
2995+ bfd *dynobj;
2996+
2997+ if (htab->elf.dynobj == NULL)
2998+ htab->elf.dynobj = abfd;
2999+ dynobj = htab->elf.dynobj;
3000+
3001+ sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj,
3002+ 2, abfd, 1);
3003+ if (sreloc == NULL)
3004+ return false;
3005+ }
3006+
3007+ /* If this is a global symbol, we count the number of
3008+ relocations we need for this symbol. */
3009+ if (h != NULL)
3010+ head = &h->dyn_relocs;
3011+ else
3012+ {
3013+ /* Track dynamic relocs needed for local syms too.
3014+ We really need local syms available to do this
3015+ easily. Oh well. */
3016+
3017+ asection *s;
3018+ Elf_Internal_Sym *isym;
3019+ void *vpp;
3020+
3021+ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
3022+ abfd, r_symndx);
3023+ if (isym == NULL)
3024+ return false;
3025+
3026+ s = bfd_section_from_elf_index (abfd, isym->st_shndx);
3027+ if (s == NULL)
3028+ return false;
3029+
3030+ vpp = &elf_section_data (s)->local_dynrel;
3031+ head = (struct elf_dyn_relocs **) vpp;
3032+ }
3033+
3034+ p = *head;
3035+ if (p == NULL || p->sec != sec)
3036+ {
3037+ size_t amt = sizeof *p;
3038+ p = ((struct elf_dyn_relocs *)
3039+ bfd_alloc (htab->elf.dynobj, amt));
3040+ if (p == NULL)
3041+ return false;
3042+ p->next = *head;
3043+ *head = p;
3044+ p->sec = sec;
3045+ p->count = 0;
3046+ p->pc_count = 0;
3047+ }
3048+
3049+ p->count += 1;
3050+ if (r_type == R_MICROBLAZE_64_PCREL)
3051+ p->pc_count += 1;
3052+ }
3053+ }
3054+ break;
3055+ }
3056+ }
3057+
3058+ return true;
3059+}
3060+
3061+/* Copy the extra info we tack onto an elf_link_hash_entry. */
3062+
3063+static void
3064+microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
3065+ struct elf_link_hash_entry *dir,
3066+ struct elf_link_hash_entry *ind)
3067+{
3068+ struct elf64_mb_link_hash_entry *edir, *eind;
3069+
3070+ edir = (struct elf64_mb_link_hash_entry *) dir;
3071+ eind = (struct elf64_mb_link_hash_entry *) ind;
3072+
3073+ edir->tls_mask |= eind->tls_mask;
3074+
3075+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
3076+}
3077+
3078+static bool
3079+microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
3080+ struct elf_link_hash_entry *h)
3081+{
3082+ struct elf64_mb_link_hash_table *htab;
3083+ asection *s, *srel;
3084+ unsigned int power_of_two;
3085+
3086+ htab = elf64_mb_hash_table (info);
3087+ if (htab == NULL)
3088+ return false;
3089+
3090+ /* If this is a function, put it in the procedure linkage table. We
3091+ will fill in the contents of the procedure linkage table later,
3092+ when we know the address of the .got section. */
3093+ if (h->type == STT_FUNC
3094+ || h->needs_plt)
3095+ {
3096+ if (h->plt.refcount <= 0
3097+ || SYMBOL_CALLS_LOCAL (info, h)
3098+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
3099+ && h->root.type == bfd_link_hash_undefweak))
3100+ {
3101+ /* This case can occur if we saw a PLT reloc in an input
3102+ file, but the symbol was never referred to by a dynamic
3103+ object, or if all references were garbage collected. In
3104+ such a case, we don't actually need to build a procedure
3105+ linkage table, and we can just do a PC32 reloc instead. */
3106+ h->plt.offset = (bfd_vma) -1;
3107+ h->needs_plt = 0;
3108+ }
3109+
3110+ return true;
3111+ }
3112+ else
3113+ /* It's possible that we incorrectly decided a .plt reloc was
3114+ needed for an R_MICROBLAZE_64_PCREL reloc to a non-function sym in
3115+ check_relocs. We can't decide accurately between function and
3116+ non-function syms in check-relocs; Objects loaded later in
3117+ the link may change h->type. So fix it now. */
3118+ h->plt.offset = (bfd_vma) -1;
3119+
3120+ /* If this is a weak symbol, and there is a real definition, the
3121+ processor independent code will have arranged for us to see the
3122+ real definition first, and we can just use the same value. */
3123+ if (h->is_weakalias)
3124+ {
3125+ struct elf_link_hash_entry *def = weakdef (h);
3126+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
3127+ h->root.u.def.section = def->root.u.def.section;
3128+ h->root.u.def.value = def->root.u.def.value;
3129+ return true;
3130+ }
3131+
3132+ /* This is a reference to a symbol defined by a dynamic object which
3133+ is not a function. */
3134+
3135+ /* If we are creating a shared library, we must presume that the
3136+ only references to the symbol are via the global offset table.
3137+ For such cases we need not do anything here; the relocations will
3138+ be handled correctly by relocate_section. */
3139+ if (bfd_link_pic (info))
3140+ return true;
3141+
3142+ /* If there are no references to this symbol that do not use the
3143+ GOT, we don't need to generate a copy reloc. */
3144+ if (!h->non_got_ref)
3145+ return true;
3146+
3147+ /* If -z nocopyreloc was given, we won't generate them either. */
3148+ if (info->nocopyreloc)
3149+ {
3150+ h->non_got_ref = 0;
3151+ return true;
3152+ }
3153+
3154+ /* If we don't find any dynamic relocs in read-only sections, then
3155+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
3156+ if (!_bfd_elf_readonly_dynrelocs (h))
3157+ {
3158+ h->non_got_ref = 0;
3159+ return true;
3160+ }
3161+
3162+ /* We must allocate the symbol in our .dynbss section, which will
3163+ become part of the .bss section of the executable. There will be
3164+ an entry for this symbol in the .dynsym section. The dynamic
3165+ object will contain position independent code, so all references
3166+ from the dynamic object to this symbol will go through the global
3167+ offset table. The dynamic linker will use the .dynsym entry to
3168+ determine the address it must put in the global offset table, so
3169+ both the dynamic object and the regular object will refer to the
3170+ same memory location for the variable. */
3171+
3172+ /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
3173+ to copy the initial value out of the dynamic object and into the
3174+ runtime process image. */
3175+ if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
3176+ {
3177+ s = htab->elf.sdynrelro;
3178+ srel = htab->elf.sreldynrelro;
3179+ }
3180+ else
3181+ {
3182+ s = htab->elf.sdynbss;
3183+ srel = htab->elf.srelbss;
3184+ }
3185+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
3186+ {
3187+ srel->size += sizeof (Elf64_External_Rela);
3188+ h->needs_copy = 1;
3189+ }
3190+
3191+ /* We need to figure out the alignment required for this symbol. I
3192+ have no idea how ELF linkers handle this. */
3193+ power_of_two = bfd_log2 (h->size);
3194+ if (power_of_two > 3)
3195+ power_of_two = 3;
3196+
3197+ /* Apply the required alignment. */
3198+ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
3199+ if (power_of_two > s->alignment_power)
3200+ {
3201+ if (!bfd_set_section_alignment (s, power_of_two))
3202+ return false;
3203+ }
3204+
3205+ /* Define the symbol as being at this point in the section. */
3206+ h->root.u.def.section = s;
3207+ h->root.u.def.value = s->size;
3208+
3209+ /* Increment the section size to make room for the symbol. */
3210+ s->size += h->size;
3211+ return true;
3212+}
3213+
3214+/* Allocate space in .plt, .got and associated reloc sections for
3215+ dynamic relocs. */
3216+
3217+static bool
3218+allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
3219+{
3220+ struct bfd_link_info *info;
3221+ struct elf64_mb_link_hash_table *htab;
3222+ struct elf64_mb_link_hash_entry *eh;
3223+ struct elf_dyn_relocs *p;
3224+
3225+ if (h->root.type == bfd_link_hash_indirect)
3226+ return true;
3227+
3228+ info = (struct bfd_link_info *) dat;
3229+ htab = elf64_mb_hash_table (info);
3230+ if (htab == NULL)
3231+ return false;
3232+
3233+ if (htab->elf.dynamic_sections_created
3234+ && h->plt.refcount > 0)
3235+ {
3236+ /* Make sure this symbol is output as a dynamic symbol.
3237+ Undefined weak syms won't yet be marked as dynamic. */
3238+ if (h->dynindx == -1
3239+ && !h->forced_local)
3240+ {
3241+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3242+ return false;
3243+ }
3244+
3245+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
3246+ {
3247+ asection *s = htab->elf.splt;
3248+
3249+ /* The first entry in .plt is reserved. */
3250+ if (s->size == 0)
3251+ s->size = PLT_ENTRY_SIZE;
3252+
3253+ h->plt.offset = s->size;
3254+
3255+ /* If this symbol is not defined in a regular file, and we are
3256+ not generating a shared library, then set the symbol to this
3257+ location in the .plt. This is required to make function
3258+ pointers compare as equal between the normal executable and
3259+ the shared library. */
3260+ if (! bfd_link_pic (info)
3261+ && !h->def_regular)
3262+ {
3263+ h->root.u.def.section = s;
3264+ h->root.u.def.value = h->plt.offset;
3265+ }
3266+
3267+ /* Make room for this entry. */
3268+ s->size += PLT_ENTRY_SIZE;
3269+
3270+ /* We also need to make an entry in the .got.plt section, which
3271+ will be placed in the .got section by the linker script. */
3272+ htab->elf.sgotplt->size += 4;
3273+
3274+ /* We also need to make an entry in the .rel.plt section. */
3275+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
3276+ }
3277+ else
3278+ {
3279+ h->plt.offset = (bfd_vma) -1;
3280+ h->needs_plt = 0;
3281+ }
3282+ }
3283+ else
3284+ {
3285+ h->plt.offset = (bfd_vma) -1;
3286+ h->needs_plt = 0;
3287+ }
3288+
3289+ eh = (struct elf64_mb_link_hash_entry *) h;
3290+ if (h->got.refcount > 0)
3291+ {
3292+ unsigned int need;
3293+ asection *s;
3294+
3295+ /* Make sure this symbol is output as a dynamic symbol.
3296+ Undefined weak syms won't yet be marked as dynamic. */
3297+ if (h->dynindx == -1
3298+ && !h->forced_local)
3299+ {
3300+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3301+ return false;
3302+ }
3303+
3304+ need = 0;
3305+ if ((eh->tls_mask & TLS_TLS) != 0)
3306+ {
3307+ /* Handle TLS Symbol */
3308+ if ((eh->tls_mask & TLS_LD) != 0)
3309+ {
3310+ if (!eh->elf.def_dynamic)
3311+ /* We'll just use htab->tlsld_got.offset. This should
3312+ always be the case. It's a little odd if we have
3313+ a local dynamic reloc against a non-local symbol. */
3314+ htab->tlsld_got.refcount += 1;
3315+ else
3316+ need += 8;
3317+ }
3318+ if ((eh->tls_mask & TLS_GD) != 0)
3319+ need += 8;
3320+ }
3321+ else
3322+ {
3323+ /* Regular (non-TLS) symbol */
3324+ need += 4;
3325+ }
3326+ if (need == 0)
3327+ {
3328+ h->got.offset = (bfd_vma) -1;
3329+ }
3330+ else
3331+ {
3332+ s = htab->elf.sgot;
3333+ h->got.offset = s->size;
3334+ s->size += need;
3335+ htab->elf.srelgot->size += need * (sizeof (Elf64_External_Rela) / 4);
3336+ }
3337+ }
3338+ else
3339+ h->got.offset = (bfd_vma) -1;
3340+
3341+ if (h->dyn_relocs == NULL)
3342+ return true;
3343+
3344+ /* In the shared -Bsymbolic case, discard space allocated for
3345+ dynamic pc-relative relocs against symbols which turn out to be
3346+ defined in regular objects. For the normal shared case, discard
3347+ space for pc-relative relocs that have become local due to symbol
3348+ visibility changes. */
3349+
3350+ if (bfd_link_pic (info))
3351+ {
3352+ if (h->def_regular
3353+ && (h->forced_local
3354+ || info->symbolic))
3355+ {
3356+ struct elf_dyn_relocs **pp;
3357+
3358+ for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
3359+ {
3360+ p->count -= p->pc_count;
3361+ p->pc_count = 0;
3362+ if (p->count == 0)
3363+ *pp = p->next;
3364+ else
3365+ pp = &p->next;
3366+ }
3367+ }
3368+ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
3369+ h->dyn_relocs = NULL;
3370+ }
3371+ else
3372+ {
3373+ /* For the non-shared case, discard space for relocs against
3374+ symbols which turn out to need copy relocs or are not
3375+ dynamic. */
3376+
3377+ if (!h->non_got_ref
3378+ && ((h->def_dynamic
3379+ && !h->def_regular)
3380+ || (htab->elf.dynamic_sections_created
3381+ && (h->root.type == bfd_link_hash_undefweak
3382+ || h->root.type == bfd_link_hash_undefined))))
3383+ {
3384+ /* Make sure this symbol is output as a dynamic symbol.
3385+ Undefined weak syms won't yet be marked as dynamic. */
3386+ if (h->dynindx == -1
3387+ && !h->forced_local)
3388+ {
3389+ if (! bfd_elf_link_record_dynamic_symbol (info, h))
3390+ return false;
3391+ }
3392+
3393+ /* If that succeeded, we know we'll be keeping all the
3394+ relocs. */
3395+ if (h->dynindx != -1)
3396+ goto keep;
3397+ }
3398+
3399+ h->dyn_relocs = NULL;
3400+
3401+ keep: ;
3402+ }
3403+
3404+ /* Finally, allocate space. */
3405+ for (p = h->dyn_relocs; p != NULL; p = p->next)
3406+ {
3407+ asection *sreloc = elf_section_data (p->sec)->sreloc;
3408+ sreloc->size += p->count * sizeof (Elf64_External_Rela);
3409+ }
3410+
3411+ return true;
3412+}
3413+
3414+/* Set the sizes of the dynamic sections. */
3415+
3416+static bool
3417+microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
3418+ struct bfd_link_info *info)
3419+{
3420+ struct elf64_mb_link_hash_table *htab;
3421+ bfd *dynobj;
3422+ asection *s;
3423+ bfd *ibfd;
3424+
3425+ htab = elf64_mb_hash_table (info);
3426+ if (htab == NULL)
3427+ return false;
3428+
3429+ dynobj = htab->elf.dynobj;
3430+ BFD_ASSERT (dynobj != NULL);
3431+
3432+ /* Set up .got offsets for local syms, and space for local dynamic
3433+ relocs. */
3434+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
3435+ {
3436+ bfd_signed_vma *local_got;
3437+ bfd_signed_vma *end_local_got;
3438+ bfd_size_type locsymcount;
3439+ Elf_Internal_Shdr *symtab_hdr;
3440+ unsigned char *lgot_masks;
3441+ asection *srel;
3442+
3443+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
3444+ continue;
3445+
3446+ for (s = ibfd->sections; s != NULL; s = s->next)
3447+ {
3448+ struct elf_dyn_relocs *p;
3449+
3450+ for (p = ((struct elf_dyn_relocs *)
3451+ elf_section_data (s)->local_dynrel);
3452+ p != NULL;
3453+ p = p->next)
3454+ {
3455+ if (!bfd_is_abs_section (p->sec)
3456+ && bfd_is_abs_section (p->sec->output_section))
3457+ {
3458+ /* Input section has been discarded, either because
3459+ it is a copy of a linkonce section or due to
3460+ linker script /DISCARD/, so we'll be discarding
3461+ the relocs too. */
3462+ }
3463+ else if (p->count != 0)
3464+ {
3465+ srel = elf_section_data (p->sec)->sreloc;
3466+ srel->size += p->count * sizeof (Elf64_External_Rela);
3467+ if ((p->sec->output_section->flags & SEC_READONLY) != 0)
3468+ info->flags |= DF_TEXTREL;
3469+ }
3470+ }
3471+ }
3472+
3473+ local_got = elf_local_got_refcounts (ibfd);
3474+ if (!local_got)
3475+ continue;
3476+
3477+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
3478+ locsymcount = symtab_hdr->sh_info;
3479+ end_local_got = local_got + locsymcount;
3480+ lgot_masks = (unsigned char *) end_local_got;
3481+ s = htab->elf.sgot;
3482+ srel = htab->elf.srelgot;
3483+
3484+ for (; local_got < end_local_got; ++local_got, ++lgot_masks)
3485+ {
3486+ if (*local_got > 0)
3487+ {
3488+ unsigned int need = 0;
3489+ if ((*lgot_masks & TLS_TLS) != 0)
3490+ {
3491+ if ((*lgot_masks & TLS_GD) != 0)
3492+ need += 8;
3493+ if ((*lgot_masks & TLS_LD) != 0)
3494+ htab->tlsld_got.refcount += 1;
3495+ }
3496+ else
3497+ need += 4;
3498+
3499+ if (need == 0)
3500+ {
3501+ *local_got = (bfd_vma) -1;
3502+ }
3503+ else
3504+ {
3505+ *local_got = s->size;
3506+ s->size += need;
3507+ if (bfd_link_pic (info))
3508+ srel->size += need * (sizeof (Elf64_External_Rela) / 4);
3509+ }
3510+ }
3511+ else
3512+ *local_got = (bfd_vma) -1;
3513+ }
3514+ }
3515+
3516+ /* Allocate global sym .plt and .got entries, and space for global
3517+ sym dynamic relocs. */
3518+ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
3519+
3520+ if (htab->tlsld_got.refcount > 0)
3521+ {
3522+ htab->tlsld_got.offset = htab->elf.sgot->size;
3523+ htab->elf.sgot->size += 8;
3524+ if (bfd_link_pic (info))
3525+ htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
3526+ }
3527+ else
3528+ htab->tlsld_got.offset = (bfd_vma) -1;
3529+
3530+ if (elf_hash_table (info)->dynamic_sections_created)
3531+ {
3532+ /* Make space for the trailing nop in .plt. */
3533+ if (htab->elf.splt->size > 0)
3534+ htab->elf.splt->size += 4;
3535+ }
3536+
3537+ /* The check_relocs and adjust_dynamic_symbol entry points have
3538+ determined the sizes of the various dynamic sections. Allocate
3539+ memory for them. */
3540+ for (s = dynobj->sections; s != NULL; s = s->next)
3541+ {
3542+ const char *name;
3543+ bool strip = false;
3544+
3545+ if ((s->flags & SEC_LINKER_CREATED) == 0)
3546+ continue;
3547+
3548+ /* It's OK to base decisions on the section name, because none
3549+ of the dynobj section names depend upon the input files. */
3550+ name = bfd_section_name (s);
3551+
3552+ if (startswith (name, ".rela"))
3553+ {
3554+ if (s->size == 0)
3555+ {
3556+ /* If we don't need this section, strip it from the
3557+ output file. This is to handle .rela.bss and
3558+ .rela.plt. We must create it in
3559+ create_dynamic_sections, because it must be created
3560+ before the linker maps input sections to output
3561+ sections. The linker does that before
3562+ adjust_dynamic_symbol is called, and it is that
3563+ function which decides whether anything needs to go
3564+ into these sections. */
3565+ strip = true;
3566+ }
3567+ else
3568+ {
3569+ /* We use the reloc_count field as a counter if we need
3570+ to copy relocs into the output file. */
3571+ s->reloc_count = 0;
3572+ }
3573+ }
3574+ else if (s != htab->elf.splt
3575+ && s != htab->elf.sgot
3576+ && s != htab->elf.sgotplt
3577+ && s != htab->elf.sdynbss
3578+ && s != htab->elf.sdynrelro)
3579+ {
3580+ /* It's not one of our sections, so don't allocate space. */
3581+ continue;
3582+ }
3583+
3584+ if (strip)
3585+ {
3586+ s->flags |= SEC_EXCLUDE;
3587+ continue;
3588+ }
3589+
3590+ /* Allocate memory for the section contents. */
3591+ /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
3592+ Unused entries should be reclaimed before the section's contents
3593+ are written out, but at the moment this does not happen. Thus in
3594+ order to prevent writing out garbage, we initialise the section's
3595+ contents to zero. */
3596+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
3597+ if (s->contents == NULL && s->size != 0)
3598+ return false;
3599+ }
3600+
3601+ /* ??? Force DF_BIND_NOW? */
3602+ info->flags |= DF_BIND_NOW;
3603+ return _bfd_elf_add_dynamic_tags (output_bfd, info, true);
3604+}
3605+
3606+/* Finish up dynamic symbol handling. We set the contents of various
3607+ dynamic sections here. */
3608+
3609+static bool
3610+microblaze_elf_finish_dynamic_symbol (bfd *output_bfd,
3611+ struct bfd_link_info *info,
3612+ struct elf_link_hash_entry *h,
3613+ Elf_Internal_Sym *sym)
3614+{
3615+ struct elf64_mb_link_hash_table *htab;
3616+ struct elf64_mb_link_hash_entry *eh = elf64_mb_hash_entry(h);
3617+
3618+ htab = elf64_mb_hash_table (info);
3619+ if (htab == NULL)
3620+ return false;
3621+
3622+ if (h->plt.offset != (bfd_vma) -1)
3623+ {
3624+ asection *splt;
3625+ asection *srela;
3626+ asection *sgotplt;
3627+ Elf_Internal_Rela rela;
3628+ bfd_byte *loc;
3629+ bfd_vma plt_index;
3630+ bfd_vma got_offset;
3631+ bfd_vma got_addr;
3632+
3633+ /* This symbol has an entry in the procedure linkage table. Set
3634+ it up. */
3635+ BFD_ASSERT (h->dynindx != -1);
3636+
3637+ splt = htab->elf.splt;
3638+ srela = htab->elf.srelplt;
3639+ sgotplt = htab->elf.sgotplt;
3640+ BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL);
3641+
3642+ plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */
3643+ got_offset = (plt_index + 3) * 4; /* 3 reserved ??? */
3644+ got_addr = got_offset;
3645+
3646+ /* For non-PIC objects we need absolute address of the GOT entry. */
3647+ if (!bfd_link_pic (info))
3648+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset;
3649+
3650+ /* Fill in the entry in the procedure linkage table. */
3651+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
3652+ splt->contents + h->plt.offset);
3653+ if (bfd_link_pic (info))
3654+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff),
3655+ splt->contents + h->plt.offset + 4);
3656+ else
3657+ bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1_NOPIC + (got_addr & 0xffff),
3658+ splt->contents + h->plt.offset + 4);
3659+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_2,
3660+ splt->contents + h->plt.offset + 8);
3661+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD_3,
3662+ splt->contents + h->plt.offset + 12);
3663+
3664+ /* Any additions to the .got section??? */
3665+ /* bfd_put_32 (output_bfd,
3666+ splt->output_section->vma + splt->output_offset + h->plt.offset + 4,
3667+ sgotplt->contents + got_offset); */
3668+
3669+ /* Fill in the entry in the .rela.plt section. */
3670+ rela.r_offset = (sgotplt->output_section->vma
3671+ + sgotplt->output_offset
3672+ + got_offset);
3673+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_JUMP_SLOT);
3674+ rela.r_addend = 0;
3675+ loc = srela->contents;
3676+ loc += plt_index * sizeof (Elf64_External_Rela);
3677+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
3678+
3679+ if (!h->def_regular)
3680+ {
3681+ /* Mark the symbol as undefined, rather than as defined in
3682+ the .plt section. Zero the value. */
3683+ sym->st_shndx = SHN_UNDEF;
3684+ sym->st_value = 0;
3685+ }
3686+ }
3687+
3688+ /* h->got.refcount to be checked ? */
3689+ if (h->got.offset != (bfd_vma) -1 &&
3690+ ! ((h->got.offset & 1) ||
3691+ IS_TLS_LD(eh->tls_mask) || IS_TLS_GD(eh->tls_mask)))
3692+ {
3693+ asection *sgot;
3694+ asection *srela;
3695+ bfd_vma offset;
3696+
3697+ /* This symbol has an entry in the global offset table. Set it
3698+ up. */
3699+
3700+ sgot = htab->elf.sgot;
3701+ srela = htab->elf.srelgot;
3702+ BFD_ASSERT (sgot != NULL && srela != NULL);
3703+
3704+ offset = (sgot->output_section->vma + sgot->output_offset
3705+ + (h->got.offset &~ (bfd_vma) 1));
3706+
3707+ /* If this is a -Bsymbolic link, and the symbol is defined
3708+ locally, we just want to emit a RELATIVE reloc. Likewise if
3709+ the symbol was forced to be local because of a version file.
3710+ The entry in the global offset table will already have been
3711+ initialized in the relocate_section function. */
3712+ if (bfd_link_pic (info)
3713+ && ((info->symbolic && h->def_regular)
3714+ || h->dynindx == -1))
3715+ {
3716+ asection *sec = h->root.u.def.section;
3717+ bfd_vma value;
3718+
3719+ value = h->root.u.def.value;
3720+ if (sec->output_section != NULL)
3721+ /* PR 21180: If the output section is NULL, then the symbol is no
3722+ longer needed, and in theory the GOT entry is redundant. But
3723+ it is too late to change our minds now... */
3724+ value += sec->output_section->vma + sec->output_offset;
3725+
3726+ microblaze_elf_output_dynamic_relocation (output_bfd,
3727+ srela, srela->reloc_count++,
3728+ /* symindex= */ 0,
3729+ R_MICROBLAZE_REL, offset,
3730+ value);
3731+ }
3732+ else
3733+ {
3734+ microblaze_elf_output_dynamic_relocation (output_bfd,
3735+ srela, srela->reloc_count++,
3736+ h->dynindx,
3737+ R_MICROBLAZE_GLOB_DAT,
3738+ offset, 0);
3739+ }
3740+
3741+ bfd_put_32 (output_bfd, (bfd_vma) 0,
3742+ sgot->contents + (h->got.offset &~ (bfd_vma) 1));
3743+ }
3744+
3745+ if (h->needs_copy)
3746+ {
3747+ asection *s;
3748+ Elf_Internal_Rela rela;
3749+ bfd_byte *loc;
3750+
3751+ /* This symbols needs a copy reloc. Set it up. */
3752+
3753+ BFD_ASSERT (h->dynindx != -1);
3754+
3755+ rela.r_offset = (h->root.u.def.value
3756+ + h->root.u.def.section->output_section->vma
3757+ + h->root.u.def.section->output_offset);
3758+ rela.r_info = ELF64_R_INFO (h->dynindx, R_MICROBLAZE_COPY);
3759+ rela.r_addend = 0;
3760+ if (h->root.u.def.section == htab->elf.sdynrelro)
3761+ s = htab->elf.sreldynrelro;
3762+ else
3763+ s = htab->elf.srelbss;
3764+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
3765+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
3766+ }
3767+
3768+ /* Mark some specially defined symbols as absolute. */
3769+ if (h == htab->elf.hdynamic
3770+ || h == htab->elf.hgot
3771+ || h == htab->elf.hplt)
3772+ sym->st_shndx = SHN_ABS;
3773+
3774+ return true;
3775+}
3776+
3777+
3778+/* Finish up the dynamic sections. */
3779+
3780+static bool
3781+microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
3782+ struct bfd_link_info *info)
3783+{
3784+ bfd *dynobj;
3785+ asection *sdyn, *sgot;
3786+ struct elf64_mb_link_hash_table *htab;
3787+
3788+ htab = elf64_mb_hash_table (info);
3789+ if (htab == NULL)
3790+ return false;
3791+
3792+ dynobj = htab->elf.dynobj;
3793+
3794+ sdyn = bfd_get_linker_section (dynobj, ".dynamic");
3795+
3796+ if (htab->elf.dynamic_sections_created)
3797+ {
3798+ asection *splt;
3799+ Elf64_External_Dyn *dyncon, *dynconend;
3800+
3801+ dyncon = (Elf64_External_Dyn *) sdyn->contents;
3802+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size);
3803+ for (; dyncon < dynconend; dyncon++)
3804+ {
3805+ Elf_Internal_Dyn dyn;
3806+ asection *s;
3807+ bool size;
3808+
3809+ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
3810+
3811+ switch (dyn.d_tag)
3812+ {
3813+ case DT_PLTGOT:
3814+ s = htab->elf.sgotplt;
3815+ size = false;
3816+ break;
3817+
3818+ case DT_PLTRELSZ:
3819+ s = htab->elf.srelplt;
3820+ size = true;
3821+ break;
3822+
3823+ case DT_JMPREL:
3824+ s = htab->elf.srelplt;
3825+ size = false;
3826+ break;
3827+
3828+ default:
3829+ continue;
3830+ }
3831+
3832+ if (s == NULL)
3833+ dyn.d_un.d_val = 0;
3834+ else
3835+ {
3836+ if (!size)
3837+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
3838+ else
3839+ dyn.d_un.d_val = s->size;
3840+ }
3841+ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
3842+ }
3843+
3844+ splt = htab->elf.splt;
3845+ BFD_ASSERT (splt != NULL && sdyn != NULL);
3846+
3847+ /* Clear the first entry in the procedure linkage table,
3848+ and put a nop in the last four bytes. */
3849+ if (splt->size > 0)
3850+ {
3851+ memset (splt->contents, 0, PLT_ENTRY_SIZE);
3852+ bfd_put_32 (output_bfd, (bfd_vma) 0x80000000 /* nop. */,
3853+ splt->contents + splt->size - 4);
3854+
3855+ if (splt->output_section != bfd_abs_section_ptr)
3856+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
3857+ }
3858+ }
3859+
3860+ /* Set the first entry in the global offset table to the address of
3861+ the dynamic section. */
3862+ sgot = htab->elf.sgotplt;
3863+ if (sgot && sgot->size > 0)
3864+ {
3865+ if (sdyn == NULL)
3866+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
3867+ else
3868+ bfd_put_32 (output_bfd,
3869+ sdyn->output_section->vma + sdyn->output_offset,
3870+ sgot->contents);
3871+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
3872+ }
3873+
3874+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
3875+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
3876+
3877+ return true;
3878+}
3879+
3880+/* Hook called by the linker routine which adds symbols from an object
3881+ file. We use it to put .comm items in .sbss, and not .bss. */
3882+
3883+static bool
3884+microblaze_elf_add_symbol_hook (bfd *abfd,
3885+ struct bfd_link_info *info,
3886+ Elf_Internal_Sym *sym,
3887+ const char **namep ATTRIBUTE_UNUSED,
3888+ flagword *flagsp ATTRIBUTE_UNUSED,
3889+ asection **secp,
3890+ bfd_vma *valp)
3891+{
3892+ if (sym->st_shndx == SHN_COMMON
3893+ && !bfd_link_relocatable (info)
3894+ && sym->st_size <= elf_gp_size (abfd))
3895+ {
3896+ /* Common symbols less than or equal to -G nn bytes are automatically
3897+ put into .sbss. */
3898+ *secp = bfd_make_section_old_way (abfd, ".sbss");
3899+ if (*secp == NULL
3900+ || !bfd_set_section_flags (*secp, SEC_IS_COMMON | SEC_SMALL_DATA))
3901+ return false;
3902+
3903+ *valp = sym->st_size;
3904+ }
3905+
3906+ return true;
3907+}
3908+
3909+#define TARGET_LITTLE_SYM microblaze_elf64_le_vec
3910+#define TARGET_LITTLE_NAME "elf64-microblazeel"
3911+
3912+#define TARGET_BIG_SYM microblaze_elf64_vec
3913+#define TARGET_BIG_NAME "elf64-microblaze"
3914+
3915+#define ELF_ARCH bfd_arch_microblaze
3916+#define ELF_TARGET_ID MICROBLAZE_ELF_DATA
3917+#define ELF_MACHINE_CODE EM_MICROBLAZE
3918+#define ELF_MACHINE_ALT1 EM_MICROBLAZE_OLD
3919+#define ELF_MAXPAGESIZE 0x1000
3920+#define elf_info_to_howto microblaze_elf_info_to_howto
3921+#define elf_info_to_howto_rel NULL
3922+
3923+#define bfd_elf64_bfd_reloc_type_lookup microblaze_elf_reloc_type_lookup
3924+#define bfd_elf64_bfd_is_local_label_name microblaze_elf_is_local_label_name
3925+#define bfd_elf64_new_section_hook microblaze_elf_new_section_hook
3926+#define elf_backend_relocate_section microblaze_elf_relocate_section
3927+#define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
3928+#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
3929+#define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
3930+
3931+#define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
3932+#define elf_backend_check_relocs microblaze_elf_check_relocs
3933+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
3934+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
3935+#define elf_backend_can_gc_sections 1
3936+#define elf_backend_can_refcount 1
3937+#define elf_backend_want_got_plt 1
3938+#define elf_backend_plt_readonly 1
3939+#define elf_backend_got_header_size 12
3940+#define elf_backend_want_dynrelro 1
3941+#define elf_backend_rela_normal 1
3942+#define elf_backend_dtrel_excludes_plt 1
3943+
3944+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
3945+#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
3946+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
3947+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
3948+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
3949+#define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
3950+
3951+#include "elf64-target.h"
3952diff --git a/bfd/libbfd.h b/bfd/libbfd.h
3953index ea2507d1879..e74c051e781 100644
3954--- a/bfd/libbfd.h
3955+++ b/bfd/libbfd.h
3956@@ -2991,7 +2991,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
3957 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
3958 "BFD_RELOC_MICROBLAZE_32_NONE",
3959 "BFD_RELOC_MICROBLAZE_64_NONE",
3960+ "BFD_RELOC_MICROBLAZE_64",
3961 "BFD_RELOC_MICROBLAZE_64_GOTPC",
3962+ "BFD_RELOC_MICROBLAZE_64_GPC",
3963 "BFD_RELOC_MICROBLAZE_64_GOT",
3964 "BFD_RELOC_MICROBLAZE_64_PLT",
3965 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
3966diff --git a/bfd/reloc.c b/bfd/reloc.c
3967index 5ac8a8536a7..0f99df91299 100644
3968--- a/bfd/reloc.c
3969+++ b/bfd/reloc.c
3970@@ -6875,12 +6875,24 @@ ENUMDOC
3971 done here - only used for relaxing
3972 ENUM
3973 BFD_RELOC_MICROBLAZE_64_NONE
3974+ENUMDOC
3975+ This is a 32 bit reloc that stores the 32 bit pc relative
3976+ value in two words (with an imml instruction). No relocation is
3977+ done here - only used for relaxing
3978+ENUM
3979+ BFD_RELOC_MICROBLAZE_64
3980 ENUMDOC
3981 This is a 64 bit reloc that stores the 32 bit pc relative
3982 value in two words (with an imm instruction). No relocation is
3983 done here - only used for relaxing
3984 ENUM
3985 BFD_RELOC_MICROBLAZE_64_GOTPC
3986+ENUMDOC
3987+ This is a 64 bit reloc that stores the 32 bit pc relative
3988+ value in two words (with an imml instruction). No relocation is
3989+ done here - only used for relaxing
3990+ENUM
3991+ BFD_RELOC_MICROBLAZE_64_GPC
3992 ENUMDOC
3993 This is a 64 bit reloc that stores the 32 bit pc relative
3994 value in two words (with an imm instruction). The relocation is
3995diff --git a/bfd/targets.c b/bfd/targets.c
3996index 3284bb88aa8..6e93cb2f995 100644
3997--- a/bfd/targets.c
3998+++ b/bfd/targets.c
3999@@ -791,6 +791,8 @@ extern const bfd_target mep_elf32_le_vec;
4000 extern const bfd_target metag_elf32_vec;
4001 extern const bfd_target microblaze_elf32_vec;
4002 extern const bfd_target microblaze_elf32_le_vec;
4003+extern const bfd_target microblaze_elf64_vec;
4004+extern const bfd_target microblaze_elf64_le_vec;
4005 extern const bfd_target mips_ecoff_be_vec;
4006 extern const bfd_target mips_ecoff_le_vec;
4007 extern const bfd_target mips_ecoff_bele_vec;
4008@@ -1153,6 +1155,10 @@ static const bfd_target * const _bfd_target_vector[] =
4009
4010 &metag_elf32_vec,
4011
4012+#ifdef BFD64
4013+ &microblaze_elf64_vec,
4014+ &microblaze_elf64_le_vec,
4015+#endif
4016 &microblaze_elf32_vec,
4017
4018 &mips_ecoff_be_vec,
4019diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
4020index 086f8704156..a6f12dda54a 100644
4021--- a/gas/config/tc-microblaze.c
4022+++ b/gas/config/tc-microblaze.c
4023@@ -35,10 +35,13 @@
4024 #define streq(a,b) (strcmp (a, b) == 0)
4025 #endif
4026
4027+static int microblaze_arch_size = 0;
4028+
4029 #define OPTION_EB (OPTION_MD_BASE + 0)
4030 #define OPTION_EL (OPTION_MD_BASE + 1)
4031 #define OPTION_LITTLE (OPTION_MD_BASE + 2)
4032 #define OPTION_BIG (OPTION_MD_BASE + 3)
4033+#define OPTION_M64 (OPTION_MD_BASE + 4)
4034
4035 void microblaze_generate_symbol (char *sym);
4036 static bool check_spl_reg (unsigned *);
4037@@ -91,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
4038 #define TLSTPREL_OFFSET 16
4039 #define TEXT_OFFSET 17
4040 #define TEXT_PC_OFFSET 18
4041+#define DEFINED_64_OFFSET 19
4042
4043 /* Initialize the relax table. */
4044 const relax_typeS md_relax_table[] =
4045@@ -113,7 +117,9 @@ const relax_typeS md_relax_table[] =
4046 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */
4047 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */
4048 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
4049- { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
4050+ { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
4051+// { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
4052+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */
4053 };
4054
4055 static htab_t opcode_hash_control; /* Opcode mnemonics. */
4056@@ -393,7 +399,8 @@ const pseudo_typeS md_pseudo_table[] =
4057 {"data32", cons, 4}, /* Same as word. */
4058 {"ent", s_func, 0}, /* Treat ent as function entry point. */
4059 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
4060- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
4061+ {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
4062+ {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
4063 {"weakext", microblaze_s_weakext, 0},
4064 {"rodata", microblaze_s_rdata, 0},
4065 {"sdata2", microblaze_s_rdata, 1},
4066@@ -402,6 +409,7 @@ const pseudo_typeS md_pseudo_table[] =
4067 {"sbss", microblaze_s_bss, 1},
4068 {"text", microblaze_s_text, 0},
4069 {"word", cons, 4},
4070+ {"dword", cons, 8},
4071 {"frame", s_ignore, 0},
4072 {"mask", s_ignore, 0}, /* Emitted by gcc. */
4073 {NULL, NULL, 0}
4074@@ -773,6 +781,74 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
4075 return new_pointer;
4076 }
4077
4078+ static char *
4079+parse_imml (char * s, expressionS * e, long min, long max)
4080+{
4081+ char *new_pointer;
4082+ char *atp;
4083+ int itype, ilen;
4084+
4085+ ilen = 0;
4086+
4087+ /* Find the start of "@GOT" or "@PLT" suffix (if any) */
4088+ for (atp = s; *atp != '@'; atp++)
4089+ if (is_end_of_line[(unsigned char) *atp])
4090+ break;
4091+
4092+ if (*atp == '@')
4093+ {
4094+ itype = match_imm (atp + 1, &ilen);
4095+ if (itype != 0)
4096+ {
4097+ *atp = 0;
4098+ e->X_md = itype;
4099+ }
4100+ else
4101+ {
4102+ atp = NULL;
4103+ e->X_md = 0;
4104+ ilen = 0;
4105+ }
4106+ *atp = 0;
4107+ }
4108+ else
4109+ {
4110+ atp = NULL;
4111+ e->X_md = 0;
4112+ }
4113+
4114+ if (atp && !GOT_symbol)
4115+ {
4116+ GOT_symbol = symbol_find_or_make (GOT_SYMBOL_NAME);
4117+ }
4118+
4119+ new_pointer = parse_exp (s, e);
4120+
4121+ if (!GOT_symbol && ! strncmp (s, GOT_SYMBOL_NAME, 20))
4122+ {
4123+ GOT_symbol = symbol_find_or_make (GOT_SYMBOL_NAME);
4124+ }
4125+
4126+ if (e->X_op == O_absent)
4127+ ; /* An error message has already been emitted. */
4128+ else if ((e->X_op != O_constant && e->X_op != O_symbol) )
4129+ as_fatal (_("operand must be a constant or a label"));
4130+ else if ((e->X_op == O_constant) && ((long) e->X_add_number < min
4131+ || (long) e->X_add_number > max))
4132+ {
4133+ as_fatal (_("operand must be absolute in range %ld..%ld, not %ld"),
4134+ min, max, (long) e->X_add_number);
4135+ }
4136+
4137+ if (atp)
4138+ {
4139+ *atp = '@'; /* restore back (needed?) */
4140+ if (new_pointer >= atp)
4141+ new_pointer += ilen + 1; /* sizeof (imm_suffix) + 1 for '@' */
4142+ }
4143+ return new_pointer;
4144+}
4145+
4146 static char *
4147 check_got (int * got_type, int * got_len)
4148 {
4149@@ -827,7 +903,7 @@ check_got (int * got_type, int * got_len)
4150 extern bfd_reloc_code_real_type
4151 parse_cons_expression_microblaze (expressionS *exp, int size)
4152 {
4153- if (size == 4)
4154+ if (size == 4 || (microblaze_arch_size == 64 && size == 8))
4155 {
4156 /* Handle @GOTOFF et.al. */
4157 char *save, *gotfree_copy;
4158@@ -859,6 +935,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size)
4159
4160 static const char * str_microblaze_ro_anchor = "RO";
4161 static const char * str_microblaze_rw_anchor = "RW";
4162+static const char * str_microblaze_64 = "64";
4163
4164 static bool
4165 check_spl_reg (unsigned * reg)
4166@@ -920,6 +997,7 @@ md_assemble (char * str)
4167 unsigned int immed = 0, immed2 = 0, temp;
4168 expressionS exp;
4169 char name[20];
4170+ long immedl;
4171
4172 /* Drop leading whitespace. */
4173 while (ISSPACE (* str))
4174@@ -1106,6 +1184,33 @@ md_assemble (char * str)
4175 inst |= (immed << IMM_LOW) & IMM_MASK;
4176 }
4177 }
4178+#if 0 //revisit
4179+ else if (streq (name, "lli") || streq (name, "sli"))
4180+ {
4181+ temp = immed & 0xFFFFFFFFFFFF8000;
4182+ if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
4183+ {
4184+ /* Needs an immediate inst. */
4185+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4186+ if (opcode1 == NULL)
4187+ {
4188+ as_bad (_("unknown opcode \"%s\""), "imml");
4189+ return;
4190+ }
4191+
4192+ inst1 = opcode1->bit_sequence;
4193+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4194+ output[0] = INST_BYTE0 (inst1);
4195+ output[1] = INST_BYTE1 (inst1);
4196+ output[2] = INST_BYTE2 (inst1);
4197+ output[3] = INST_BYTE3 (inst1);
4198+ output = frag_more (isize);
4199+ }
4200+ inst |= (reg1 << RD_LOW) & RD_MASK;
4201+ inst |= (reg2 << RA_LOW) & RA_MASK;
4202+ inst |= (immed << IMM_LOW) & IMM_MASK;
4203+ }
4204+#endif
4205 else
4206 {
4207 temp = immed & 0xFFFF8000;
4208@@ -1135,7 +1240,7 @@ md_assemble (char * str)
4209 }
4210 break;
4211
4212- case INST_TYPE_RD_R1_IMM5:
4213+ case INST_TYPE_RD_R1_IMMS:
4214 if (strcmp (op_end, ""))
4215 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
4216 else
4217@@ -1169,16 +1274,22 @@ md_assemble (char * str)
4218 immed = exp.X_add_number;
4219 }
4220
4221- if (immed != (immed % 32))
4222+ if ((immed != (immed % 32)) &&
4223+ (opcode->instr == bslli || opcode->instr == bsrai || opcode->instr == bsrli))
4224 {
4225 as_warn (_("Shift value > 32. using <value %% 32>"));
4226 immed = immed % 32;
4227 }
4228+ else if (immed != (immed % 64))
4229+ {
4230+ as_warn (_("Shift value > 64. using <value %% 64>"));
4231+ immed = immed % 64;
4232+ }
4233 inst |= (reg1 << RD_LOW) & RD_MASK;
4234 inst |= (reg2 << RA_LOW) & RA_MASK;
4235- inst |= (immed << IMM_LOW) & IMM5_MASK;
4236+ inst |= (immed << IMM_LOW) & IMM6_MASK;
4237 break;
4238- case INST_TYPE_RD_R1_IMM5_IMM5:
4239+ case INST_TYPE_RD_R1_IMMW_IMMS:
4240 if (strcmp (op_end, ""))
4241 op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
4242 else
4243@@ -1202,7 +1313,7 @@ md_assemble (char * str)
4244
4245 /* Width immediate value. */
4246 if (strcmp (op_end, ""))
4247- op_end = parse_imm (op_end + 1, &exp, MIN_IMM_WIDTH, MAX_IMM_WIDTH);
4248+ op_end = parse_imm (op_end + 1, &exp, MIN_IMM, MAX_IMM);
4249 else
4250 as_fatal (_("Error in statement syntax"));
4251 if (exp.X_op != O_constant)
4252@@ -1214,6 +1325,8 @@ md_assemble (char * str)
4253 immed = exp.X_add_number;
4254 if (opcode->instr == bsefi && immed > 31)
4255 as_fatal (_("Width value must be less than 32"));
4256+ else if (opcode->instr == bslefi && immed > 63)
4257+ as_fatal (_("Width value must be less than 64"));
4258
4259 /* Shift immediate value. */
4260 if (strcmp (op_end, ""))
4261@@ -1221,32 +1334,40 @@ md_assemble (char * str)
4262 else
4263 as_fatal (_("Error in statement syntax"));
4264 if (exp.X_op != O_constant)
4265- {
4266+ {
4267 as_warn (_("Symbol used as immediate shift value for bit field instruction"));
4268 immed2 = 0;
4269 }
4270 else
4271- {
4272+ {
4273 output = frag_more (isize);
4274 immed2 = exp.X_add_number;
4275- }
4276- if (immed2 != (immed2 % 32))
4277- {
4278- as_warn (_("Shift value greater than 32. using <value %% 32>"));
4279+ }
4280+ if ((immed2 != (immed2 % 32)) && (opcode->instr == bsefi || opcode->instr == bsifi))
4281+ {
4282+
4283+ as_warn (_("Shift value greater than 32. using <value %% 32>"));
4284 immed2 = immed2 % 32;
4285 }
4286+ else if (immed2 != (immed2 % 64))
4287+ {
4288+ as_warn (_("Shift value greater than 64. using <value %% 64>"));
4289+ immed2 = immed2 % 64;
4290+ }
4291
4292 /* Check combined value. */
4293- if (immed + immed2 > 32)
4294+ if ((immed + immed2 > 32) && (opcode->instr == bsefi || opcode->instr == bsifi))
4295 as_fatal (_("Width value + shift value must not be greater than 32"));
4296
4297+ else if (immed + immed2 > 64)
4298+ as_fatal (_("Width value + shift value must not be greater than 64"));
4299 inst |= (reg1 << RD_LOW) & RD_MASK;
4300 inst |= (reg2 << RA_LOW) & RA_MASK;
4301- if (opcode->instr == bsefi)
4302- inst |= (immed & IMM5_MASK) << IMM_WIDTH_LOW; /* bsefi */
4303+ if (opcode->instr == bsefi || opcode->instr == bslefi)
4304+ inst |= (immed & IMM6_MASK) << IMM_WIDTH_LOW; /* bsefi or bslefi */
4305 else
4306- inst |= ((immed + immed2 - 1) & IMM5_MASK) << IMM_WIDTH_LOW; /* bsifi */
4307- inst |= (immed2 << IMM_LOW) & IMM5_MASK;
4308+ inst |= ((immed + immed2 - 1) & IMM6_MASK) << IMM_WIDTH_LOW; /* bsifi or bslifi */
4309+ inst |= (immed2 << IMM_LOW) & IMM6_MASK;
4310 break;
4311 case INST_TYPE_R1_R2:
4312 if (strcmp (op_end, ""))
4313@@ -1820,6 +1941,143 @@ md_assemble (char * str)
4314 }
4315 inst |= (immed << IMM_MBAR);
4316 break;
4317+ /* For 64-bit instructions */
4318+ case INST_TYPE_RD_R1_IMML:
4319+ if (strcmp (op_end, ""))
4320+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
4321+ else
4322+ {
4323+ as_fatal (_("Error in statement syntax"));
4324+ reg1 = 0;
4325+ }
4326+ if (strcmp (op_end, ""))
4327+ op_end = parse_reg (op_end + 1, &reg2); /* Get r1. */
4328+ else
4329+ {
4330+ as_fatal (_("Error in statement syntax"));
4331+ reg2 = 0;
4332+ }
4333+ if (strcmp (op_end, ""))
4334+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
4335+ else
4336+ as_fatal (_("Error in statement syntax"));
4337+
4338+ /* Check for spl registers. */
4339+ if (check_spl_reg (& reg1))
4340+ as_fatal (_("Cannot use special register with this instruction"));
4341+ if (check_spl_reg (& reg2))
4342+ as_fatal (_("Cannot use special register with this instruction"));
4343+
4344+ if (exp.X_op != O_constant)
4345+ {
4346+ char *opc = NULL;
4347+ //char *opc = str_microblaze_64;
4348+ relax_substateT subtype;
4349+
4350+ if (exp.X_md != 0)
4351+ subtype = get_imm_otype(exp.X_md);
4352+ else
4353+ subtype = opcode->inst_offset_type;
4354+
4355+ output = frag_var (rs_machine_dependent,
4356+ isize * 2, /* maxm of 2 words. */
4357+ isize * 2, /* minm of 2 words. */
4358+ subtype, /* PC-relative or not. */
4359+ exp.X_add_symbol,
4360+ exp.X_add_number,
4361+ (char *) opc);
4362+ immedl = 0L;
4363+ }
4364+ else
4365+ {
4366+ output = frag_more (isize);
4367+ immedl = exp.X_add_number;
4368+
4369+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4370+ if (opcode1 == NULL)
4371+ {
4372+ as_bad (_("unknown opcode \"%s\""), "imml");
4373+ return;
4374+ }
4375+
4376+ inst1 = opcode1->bit_sequence;
4377+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4378+ output[0] = INST_BYTE0 (inst1);
4379+ output[1] = INST_BYTE1 (inst1);
4380+ output[2] = INST_BYTE2 (inst1);
4381+ output[3] = INST_BYTE3 (inst1);
4382+ output = frag_more (isize);
4383+ }
4384+
4385+ inst |= (reg1 << RD_LOW) & RD_MASK;
4386+ inst |= (reg2 << RA_LOW) & RA_MASK;
4387+ inst |= (immedl << IMM_LOW) & IMM_MASK;
4388+ break;
4389+
4390+ case INST_TYPE_R1_IMML:
4391+ if (strcmp (op_end, ""))
4392+ op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
4393+ else
4394+ {
4395+ as_fatal (_("Error in statement syntax"));
4396+ reg1 = 0;
4397+ }
4398+ if (strcmp (op_end, ""))
4399+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
4400+ else
4401+ as_fatal (_("Error in statement syntax"));
4402+
4403+ /* Check for spl registers. */
4404+ if (check_spl_reg (&reg1))
4405+ as_fatal (_("Cannot use special register with this instruction"));
4406+
4407+ if (exp.X_op != O_constant)
4408+ {
4409+ //char *opc = NULL;
4410+ char *opc = str_microblaze_64;
4411+ relax_substateT subtype;
4412+
4413+ if (exp.X_md != 0)
4414+ subtype = get_imm_otype(exp.X_md);
4415+ else
4416+ subtype = opcode->inst_offset_type;
4417+
4418+ output = frag_var (rs_machine_dependent,
4419+ isize * 2, /* maxm of 2 words. */
4420+ isize * 2, /* minm of 2 words. */
4421+ subtype, /* PC-relative or not. */
4422+ exp.X_add_symbol,
4423+ exp.X_add_number,
4424+ (char *) opc);
4425+ immedl = 0L;
4426+ }
4427+ else
4428+ {
4429+ output = frag_more (isize);
4430+ immedl = exp.X_add_number;
4431+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4432+ if (opcode1 == NULL)
4433+ {
4434+ as_bad (_("unknown opcode \"%s\""), "imml");
4435+ return;
4436+ }
4437+
4438+ inst1 = opcode1->bit_sequence;
4439+ inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4440+ output[0] = INST_BYTE0 (inst1);
4441+ output[1] = INST_BYTE1 (inst1);
4442+ output[2] = INST_BYTE2 (inst1);
4443+ output[3] = INST_BYTE3 (inst1);
4444+ output = frag_more (isize);
4445+ }
4446+
4447+ inst |= (reg1 << RA_LOW) & RA_MASK;
4448+ inst |= (immedl << IMM_LOW) & IMM_MASK;
4449+ break;
4450+
4451+ case INST_TYPE_IMML:
4452+ as_fatal (_("An IMML instruction should not be present in the .s file"));
4453+ break;
4454
4455 default:
4456 as_fatal (_("unimplemented opcode \"%s\""), name);
4457@@ -1927,6 +2185,7 @@ struct option md_longopts[] =
4458 {"EL", no_argument, NULL, OPTION_EL},
4459 {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
4460 {"mbig-endian", no_argument, NULL, OPTION_BIG},
4461+ {"m64", no_argument, NULL, OPTION_M64},
4462 { NULL, no_argument, NULL, 0}
4463 };
4464
4465@@ -1971,13 +2230,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
4466 fragP->fr_fix += INST_WORD_SIZE * 2;
4467 fragP->fr_var = 0;
4468 break;
4469+ case DEFINED_64_OFFSET:
4470+ if (fragP->fr_symbol == GOT_symbol)
4471+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
4472+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
4473+ else
4474+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
4475+ fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
4476+ fragP->fr_fix += INST_WORD_SIZE * 2;
4477+ fragP->fr_var = 0;
4478+ break;
4479 case DEFINED_ABS_SEGMENT:
4480 if (fragP->fr_symbol == GOT_symbol)
4481 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
4482 fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
4483 else
4484 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
4485- fragP->fr_offset, false, BFD_RELOC_64);
4486+ fragP->fr_offset, true, BFD_RELOC_64);
4487 fragP->fr_fix += INST_WORD_SIZE * 2;
4488 fragP->fr_var = 0;
4489 break;
4490@@ -2198,23 +2467,38 @@ md_apply_fix (fixS * fixP,
4491 case BFD_RELOC_64_PCREL:
4492 case BFD_RELOC_64:
4493 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
4494+ case BFD_RELOC_MICROBLAZE_64:
4495 /* Add an imm instruction. First save the current instruction. */
4496 for (i = 0; i < INST_WORD_SIZE; i++)
4497 buf[i + INST_WORD_SIZE] = buf[i];
4498+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4499+ {
4500+ /* Generate the imm instruction. */
4501+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4502+ if (opcode1 == NULL)
4503+ {
4504+ as_bad (_("unknown opcode \"%s\""), "imml");
4505+ return;
4506+ }
4507
4508- /* Generate the imm instruction. */
4509- opcode1
4510- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4511- if (opcode1 == NULL)
4512- {
4513- as_bad (_("unknown opcode \"%s\""), "imm");
4514- return;
4515- }
4516-
4517- inst1 = opcode1->bit_sequence;
4518- if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4519- inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
4520-
4521+ inst1 = opcode1->bit_sequence;
4522+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4523+ inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
4524+ }
4525+ else
4526+ {
4527+ /* Generate the imm instruction. */
4528+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4529+ if (opcode1 == NULL)
4530+ {
4531+ as_bad (_("unknown opcode \"%s\""), "imm");
4532+ return;
4533+ }
4534+
4535+ inst1 = opcode1->bit_sequence;
4536+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
4537+ inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
4538+ }
4539 buf[0] = INST_BYTE0 (inst1);
4540 buf[1] = INST_BYTE1 (inst1);
4541 buf[2] = INST_BYTE2 (inst1);
4542@@ -2243,6 +2527,7 @@ md_apply_fix (fixS * fixP,
4543 /* Fall through. */
4544
4545 case BFD_RELOC_MICROBLAZE_64_GOTPC:
4546+ case BFD_RELOC_MICROBLAZE_64_GPC:
4547 case BFD_RELOC_MICROBLAZE_64_GOT:
4548 case BFD_RELOC_MICROBLAZE_64_PLT:
4549 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
4550@@ -2250,13 +2535,17 @@ md_apply_fix (fixS * fixP,
4551 /* Add an imm instruction. First save the current instruction. */
4552 for (i = 0; i < INST_WORD_SIZE; i++)
4553 buf[i + INST_WORD_SIZE] = buf[i];
4554-
4555 /* Generate the imm instruction. */
4556- opcode1
4557- = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4558+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
4559+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
4560+ else
4561+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
4562 if (opcode1 == NULL)
4563 {
4564- as_bad (_("unknown opcode \"%s\""), "imm");
4565+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
4566+ as_bad (_("unknown opcode \"%s\""), "imml");
4567+ else
4568+ as_bad (_("unknown opcode \"%s\""), "imm");
4569 return;
4570 }
4571
4572@@ -2280,6 +2569,8 @@ md_apply_fix (fixS * fixP,
4573 moves code around due to relaxing. */
4574 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
4575 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
4576+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4577+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
4578 else if (fixP->fx_r_type == BFD_RELOC_32)
4579 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
4580 else
4581@@ -2323,6 +2614,32 @@ md_estimate_size_before_relax (fragS * fragP,
4582 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
4583 abort ();
4584 }
4585+ else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type
4586+ && !S_IS_WEAK (fragP->fr_symbol))
4587+ {
4588+ if (fragP->fr_opcode != NULL) {
4589+ if(streq (fragP->fr_opcode, str_microblaze_64))
4590+ {
4591+ /* Used as an absolute value. */
4592+ fragP->fr_subtype = DEFINED_64_OFFSET;
4593+ /* Variable part does not change. */
4594+ fragP->fr_var = INST_WORD_SIZE;
4595+ }
4596+ else
4597+ {
4598+ fragP->fr_subtype = DEFINED_PC_OFFSET;
4599+ /* Don't know now whether we need an imm instruction. */
4600+ fragP->fr_var = INST_WORD_SIZE;
4601+ }
4602+ }
4603+ else
4604+ {
4605+ fragP->fr_subtype = DEFINED_PC_OFFSET;
4606+ /* Don't know now whether we need an imm instruction. */
4607+ fragP->fr_var = INST_WORD_SIZE;
4608+ }
4609+ }
4610+ #if 0
4611 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
4612 !S_IS_WEAK (fragP->fr_symbol))
4613 {
4614@@ -2330,6 +2647,7 @@ md_estimate_size_before_relax (fragS * fragP,
4615 /* Don't know now whether we need an imm instruction. */
4616 fragP->fr_var = INST_WORD_SIZE;
4617 }
4618+#endif
4619 else if (S_IS_DEFINED (fragP->fr_symbol)
4620 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
4621 {
4622@@ -2432,6 +2750,7 @@ md_estimate_size_before_relax (fragS * fragP,
4623 case TLSLD_OFFSET:
4624 case TLSTPREL_OFFSET:
4625 case TLSDTPREL_OFFSET:
4626+ case DEFINED_64_OFFSET:
4627 fragP->fr_var = INST_WORD_SIZE*2;
4628 break;
4629 case DEFINED_RO_SEGMENT:
4630@@ -2485,7 +2804,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
4631 else
4632 {
4633 /* The case where we are going to resolve things... */
4634- if (fixp->fx_r_type == BFD_RELOC_64_PCREL)
4635+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
4636 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
4637 else
4638 return fixp->fx_where + fixp->fx_frag->fr_address;
4639@@ -2518,6 +2837,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
4640 case BFD_RELOC_MICROBLAZE_32_RWSDA:
4641 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
4642 case BFD_RELOC_MICROBLAZE_64_GOTPC:
4643+ case BFD_RELOC_MICROBLAZE_64_GPC:
4644+ case BFD_RELOC_MICROBLAZE_64:
4645 case BFD_RELOC_MICROBLAZE_64_GOT:
4646 case BFD_RELOC_MICROBLAZE_64_PLT:
4647 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
4648@@ -2578,6 +2899,18 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
4649 return rel;
4650 }
4651
4652+/* Called by TARGET_FORMAT. */
4653+const char *
4654+microblaze_target_format (void)
4655+{
4656+
4657+ if (microblaze_arch_size == 64)
4658+ return "elf64-microblazeel";
4659+ else
4660+ return target_big_endian ? "elf32-microblaze" : "elf32-microblazeel";
4661+}
4662+
4663+
4664 int
4665 md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4666 {
4667@@ -2591,6 +2924,10 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
4668 case OPTION_LITTLE:
4669 target_big_endian = 0;
4670 break;
4671+ case OPTION_M64:
4672+ //if (arg != NULL && strcmp (arg, "64") == 0)
4673+ microblaze_arch_size = 64;
4674+ break;
4675 default:
4676 return 0;
4677 }
4678@@ -2606,6 +2943,7 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
4679 fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
4680 fprintf (stream, " -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
4681 fprintf (stream, " -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
4682+ fprintf (stream, " -%-23s%s\n", "m64", N_("generate 64-bit elf"));
4683 }
4684
4685
4686@@ -2643,7 +2981,10 @@ cons_fix_new_microblaze (fragS * frag,
4687 r = BFD_RELOC_32;
4688 break;
4689 case 8:
4690- r = BFD_RELOC_64;
4691+ if (microblaze_arch_size == 64)
4692+ r = BFD_RELOC_32;
4693+ else
4694+ r = BFD_RELOC_64;
4695 break;
4696 default:
4697 as_bad (_("unsupported BFD relocation size %u"), size);
4698diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
4699index 36f56725c46..5a97b460212 100644
4700--- a/gas/config/tc-microblaze.h
4701+++ b/gas/config/tc-microblaze.h
4702@@ -81,7 +81,9 @@ extern const struct relax_type md_relax_table[];
4703
4704 #ifdef OBJ_ELF
4705
4706-#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
4707+#define TARGET_FORMAT microblaze_target_format()
4708+extern const char *microblaze_target_format (void);
4709+//#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
4710
4711 #define ELF_TC_SPECIAL_SECTIONS \
4712 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
4713diff --git a/include/elf/common.h b/include/elf/common.h
4714index e4bc53e35b4..1ad565adf7a 100644
4715--- a/include/elf/common.h
4716+++ b/include/elf/common.h
4717@@ -360,6 +360,7 @@
4718 #define EM_U16_U8CORE 260 /* LAPIS nX-U16/U8 */
4719 #define EM_TACHYUM 261 /* Tachyum */
4720 #define EM_56800EF 262 /* NXP 56800EF Digital Signal Controller (DSC) */
4721+#define EM_MB_64 263 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
4722
4723 /* If it is necessary to assign new unofficial EM_* values, please pick large
4724 random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
4725diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
4726index a2e1ce4580f..79799b86a49 100644
4727--- a/include/elf/microblaze.h
4728+++ b/include/elf/microblaze.h
4729@@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
4730 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */
4731 RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */
4732 RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33)
4733+ RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34)
4734+ RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */
4735
4736 END_RELOC_NUMBERS (R_MICROBLAZE_max)
4737
4738diff --git a/ld/Makefile.am b/ld/Makefile.am
4739index d31021c13e2..bd1a2e5a625 100644
4740--- a/ld/Makefile.am
4741+++ b/ld/Makefile.am
4742@@ -418,6 +418,8 @@ ALL_64_EMULATION_SOURCES = \
4743 eelf32ltsmipn32.c \
4744 eelf32ltsmipn32_fbsd.c \
4745 eelf32mipswindiss.c \
4746+ eelf64microblazeel.c \
4747+ eelf64microblaze.c \
4748 eelf64_aix.c \
4749 eelf64_ia64.c \
4750 eelf64_ia64_fbsd.c \
4751@@ -906,6 +908,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4752 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4753 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4754 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
4755+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Pc@am__quote@
4756+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Pc@am__quote@
4757 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Pc@am__quote@
4758 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4759 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Pc@am__quote@
4760diff --git a/ld/Makefile.in b/ld/Makefile.in
4761index ee0c98f65b0..f4b7ee0623e 100644
4762--- a/ld/Makefile.in
4763+++ b/ld/Makefile.in
4764@@ -914,6 +914,8 @@ ALL_64_EMULATION_SOURCES = \
4765 eelf32ltsmipn32.c \
4766 eelf32ltsmipn32_fbsd.c \
4767 eelf32mipswindiss.c \
4768+ eelf64microblazeel.c \
4769+ eelf64microblaze.c \
4770 eelf64_aix.c \
4771 eelf64_ia64.c \
4772 eelf64_ia64_fbsd.c \
4773@@ -1407,6 +1409,8 @@ distclean-compile:
4774 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Po@am__quote@
4775 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Po@am__quote@
4776 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Po@am__quote@
4777+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Po@am__quote@
4778+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Po@am__quote@
4779 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Po@am__quote@
4780 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Po@am__quote@
4781 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Po@am__quote@
4782@@ -2572,6 +2576,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
4783 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32.Pc@am__quote@
4784 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ltsmipn32_fbsd.Pc@am__quote@
4785 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Pc@am__quote@
4786+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblazeel.Pc@am__quote@
4787+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64microblaze.Pc@am__quote@
4788 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_aix.Pc@am__quote@
4789 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64.Pc@am__quote@
4790 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64_ia64_fbsd.Pc@am__quote@
4791diff --git a/ld/configure.tgt b/ld/configure.tgt
4792index 2bae9099b6a..80ffbcf23b3 100644
4793--- a/ld/configure.tgt
4794+++ b/ld/configure.tgt
4795@@ -515,6 +515,9 @@ microblaze*-linux*) targ_emul="elf32mb_linux"
4796 microblazeel*) targ_emul=elf32microblazeel
4797 targ_extra_emuls=elf32microblaze
4798 ;;
4799+microblazeel64*) targ_emul=elf64microblazeel
4800+ targ_extra_emuls=elf64microblaze
4801+ ;;
4802 microblaze*) targ_emul=elf32microblaze
4803 targ_extra_emuls=elf32microblazeel
4804 ;;
4805diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
4806new file mode 100644
4807index 00000000000..9c7b0eb7080
4808--- /dev/null
4809+++ b/ld/emulparams/elf64microblaze.sh
4810@@ -0,0 +1,23 @@
4811+SCRIPT_NAME=elfmicroblaze
4812+OUTPUT_FORMAT="elf64-microblazeel"
4813+#BIG_OUTPUT_FORMAT="elf64-microblaze"
4814+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
4815+#TEXT_START_ADDR=0
4816+NONPAGED_TEXT_START_ADDR=0x28
4817+ALIGNMENT=4
4818+MAXPAGESIZE=4
4819+ARCH=microblaze
4820+EMBEDDED=yes
4821+
4822+NOP=0x80000000
4823+
4824+# Hmmm, there's got to be a better way. This sets the stack to the
4825+# top of the simulator memory (2^19 bytes).
4826+#PAGE_SIZE=0x1000
4827+#DATA_ADDR=0x10000
4828+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
4829+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4830+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4831+
4832+TEMPLATE_NAME=elf32
4833+#GENERATE_SHLIB_SCRIPT=yes
4834diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
4835new file mode 100644
4836index 00000000000..9c7b0eb7080
4837--- /dev/null
4838+++ b/ld/emulparams/elf64microblazeel.sh
4839@@ -0,0 +1,23 @@
4840+SCRIPT_NAME=elfmicroblaze
4841+OUTPUT_FORMAT="elf64-microblazeel"
4842+#BIG_OUTPUT_FORMAT="elf64-microblaze"
4843+LITTLE_OUTPUT_FORMAT="elf64-microblazeel"
4844+#TEXT_START_ADDR=0
4845+NONPAGED_TEXT_START_ADDR=0x28
4846+ALIGNMENT=4
4847+MAXPAGESIZE=4
4848+ARCH=microblaze
4849+EMBEDDED=yes
4850+
4851+NOP=0x80000000
4852+
4853+# Hmmm, there's got to be a better way. This sets the stack to the
4854+# top of the simulator memory (2^19 bytes).
4855+#PAGE_SIZE=0x1000
4856+#DATA_ADDR=0x10000
4857+#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }'
4858+#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
4859+#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
4860+
4861+TEMPLATE_NAME=elf32
4862+#GENERATE_SHLIB_SCRIPT=yes
4863diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
4864index f57b98fc9f7..921adce04ea 100644
4865--- a/opcodes/microblaze-dis.c
4866+++ b/opcodes/microblaze-dis.c
4867@@ -33,6 +33,7 @@
4868 #define get_field_r1(buf, instr) get_field (buf, instr, RA_MASK, RA_LOW)
4869 #define get_field_r2(buf, instr) get_field (buf, instr, RB_MASK, RB_LOW)
4870 #define get_int_field_imm(instr) ((instr & IMM_MASK) >> IMM_LOW)
4871+#define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
4872 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
4873
4874 #define NUM_STRBUFS 3
4875@@ -73,11 +74,19 @@ get_field_imm (struct string_buf *buf, long instr)
4876 }
4877
4878 static char *
4879-get_field_imm5 (struct string_buf *buf, long instr)
4880+get_field_imml (struct string_buf *buf, long instr)
4881+{
4882+ char *p = strbuf (buf);
4883+ sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
4884+ return p;
4885+}
4886+
4887+static char *
4888+get_field_imms (struct string_buf *buf, long instr)
4889 {
4890 char *p = strbuf (buf);
4891
4892- sprintf (p, "%d", (short)((instr & IMM5_MASK) >> IMM_LOW));
4893+ sprintf (p, "%d", (short)((instr & IMM6_MASK) >> IMM_LOW));
4894 return p;
4895 }
4896
4897@@ -91,14 +100,14 @@ get_field_imm5_mbar (struct string_buf *buf, long instr)
4898 }
4899
4900 static char *
4901-get_field_imm5width (struct string_buf *buf, long instr)
4902+get_field_immw (struct string_buf *buf, long instr)
4903 {
4904 char *p = strbuf (buf);
4905
4906 if (instr & 0x00004000)
4907- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
4908+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW))); /* bsefi */
4909 else
4910- sprintf (p, "%d", (short)(((instr & IMM5_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM5_MASK) >> IMM_LOW) + 1)); /* bsifi */
4911+ sprintf (p, "%d", (short)(((instr & IMM6_WIDTH_MASK) >> IMM_WIDTH_LOW) - ((instr & IMM6_MASK) >> IMM_LOW) + 1)); /* bsifi */
4912 return p;
4913 }
4914
4915@@ -308,9 +317,14 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4916 }
4917 }
4918 break;
4919- case INST_TYPE_RD_R1_IMM5:
4920+ case INST_TYPE_RD_R1_IMML:
4921 print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4922- get_field_r1 (&buf, inst), get_field_imm5 (&buf, inst));
4923+ get_field_r1 (&buf, inst), get_field_imm (&buf, inst));
4924+ /* TODO: Also print symbol */
4925+ break;
4926+ case INST_TYPE_RD_R1_IMMS:
4927+ print_func (stream, "\t%s, %s, %s", get_field_rd (&buf, inst),
4928+ get_field_r1(&buf, inst), get_field_imms (&buf, inst));
4929 break;
4930 case INST_TYPE_RD_RFSL:
4931 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4932@@ -417,6 +431,10 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4933 case INST_TYPE_RD_R2:
4934 print_func (stream, "\t%s, %s", get_field_rd (&buf, inst),
4935 get_field_r2 (&buf, inst));
4936+ break;
4937+ case INST_TYPE_IMML:
4938+ print_func (stream, "\t%s", get_field_imml (&buf, inst));
4939+ /* TODO: Also print symbol */
4940 break;
4941 case INST_TYPE_R2:
4942 print_func (stream, "\t%s", get_field_r2 (&buf, inst));
4943@@ -440,8 +458,8 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
4944 case INST_TYPE_NONE:
4945 break;
4946 /* For bit field insns. */
4947- case INST_TYPE_RD_R1_IMM5_IMM5:
4948- 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));
4949+ case INST_TYPE_RD_R1_IMMW_IMMS:
4950+ 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));
4951 break;
4952 /* For tuqula instruction */
4953 case INST_TYPE_RD:
4954diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
4955index 825c639a41e..ab90240d88a 100644
4956--- a/opcodes/microblaze-opc.h
4957+++ b/opcodes/microblaze-opc.h
4958@@ -40,7 +40,7 @@
4959 #define INST_TYPE_RD_SPECIAL 11
4960 #define INST_TYPE_R1 12
4961 /* New instn type for barrel shift imms. */
4962-#define INST_TYPE_RD_R1_IMM5 13
4963+#define INST_TYPE_RD_R1_IMMS 13
4964 #define INST_TYPE_RD_RFSL 14
4965 #define INST_TYPE_R1_RFSL 15
4966
4967@@ -60,7 +60,13 @@
4968 #define INST_TYPE_IMM5 20
4969
4970 /* For bsefi and bsifi */
4971-#define INST_TYPE_RD_R1_IMM5_IMM5 21
4972+#define INST_TYPE_RD_R1_IMMW_IMMS 21
4973+
4974+/* For 64-bit instructions */
4975+#define INST_TYPE_IMML 22
4976+#define INST_TYPE_RD_R1_IMML 23
4977+#define INST_TYPE_R1_IMML 24
4978+#define INST_TYPE_RD_R1_IMMW_IMMS 21
4979
4980 #define INST_TYPE_NONE 25
4981
4982@@ -91,13 +97,14 @@
4983 #define OPCODE_MASK_H24 0xFC1F07FF /* High 6, bits 20-16 and low 11 bits. */
4984 #define OPCODE_MASK_H124 0xFFFF07FF /* High 16, and low 11 bits. */
4985 #define OPCODE_MASK_H1234 0xFFFFFFFF /* All 32 bits. */
4986-#define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
4987-#define OPCODE_MASK_H3B 0xFC00C600 /* High 6 bits and bits 16, 17, 21, 22. */
4988+#define OPCODE_MASK_H3 0xFC000700 /* High 6 bits and bits 21, 22, 23. */
4989+#define OPCODE_MASK_H3B 0xFC00E600 /* High 6 bits and bits 16, 17, 18, 21, 22. */
4990 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
4991-#define OPCODE_MASK_H32B 0xFC00C000 /* High 6 bits and bit 16, 17. */
4992+#define OPCODE_MASK_H32B 0xFC00E000 /* High 6 bits and bit 16, 17, 18. */
4993 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
4994 #define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
4995 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
4996+#define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
4997
4998 /* New Mask for msrset, msrclr insns. */
4999 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
5000@@ -107,7 +114,7 @@
5001 #define DELAY_SLOT 1
5002 #define NO_DELAY_SLOT 0
5003
5004-#define MAX_OPCODES 301
5005+#define MAX_OPCODES 412
5006
5007 const struct op_code_struct
5008 {
5009@@ -125,6 +132,7 @@ const struct op_code_struct
5010 /* More info about output format here. */
5011 } microblaze_opcodes[MAX_OPCODES] =
5012 {
5013+ /* 32-bit instructions */
5014 {"add", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000000, OPCODE_MASK_H4, add, arithmetic_inst },
5015 {"rsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000000, OPCODE_MASK_H4, rsub, arithmetic_inst },
5016 {"addc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000000, OPCODE_MASK_H4, addc, arithmetic_inst },
5017@@ -161,11 +169,11 @@ const struct op_code_struct
5018 {"ncget", INST_TYPE_RD_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C006000, OPCODE_MASK_H32, ncget, anyware_inst },
5019 {"ncput", INST_TYPE_R1_RFSL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x6C00E000, OPCODE_MASK_H32, ncput, anyware_inst },
5020 {"muli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x60000000, OPCODE_MASK_H, muli, mult_inst },
5021- {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
5022- {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
5023- {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
5024- {"bsefi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64004000, OPCODE_MASK_H32B, bsefi, barrel_shift_inst },
5025- {"bsifi", INST_TYPE_RD_R1_IMM5_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64008000, OPCODE_MASK_H32B, bsifi, barrel_shift_inst },
5026+ {"bslli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3B, bslli, barrel_shift_inst },
5027+ {"bsrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3B, bsrai, barrel_shift_inst },
5028+ {"bsrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3B, bsrli, barrel_shift_inst },
5029+ {"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 },
5030+ {"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 },
5031 {"or", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
5032 {"and", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
5033 {"xor", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
5034@@ -425,6 +433,129 @@ const struct op_code_struct
5035 {"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. */
5036 {"swapb", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4, swapb, arithmetic_inst },
5037 {"swaph", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4, swaph, arithmetic_inst },
5038+
5039+ /* 64-bit instructions */
5040+ {"addl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x00000100, OPCODE_MASK_H4, addl, arithmetic_inst },
5041+ {"rsubl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x04000100, OPCODE_MASK_H4, rsubl, arithmetic_inst },
5042+ {"addlc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x08000100, OPCODE_MASK_H4, addlc, arithmetic_inst },
5043+ {"rsublc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x0C000100, OPCODE_MASK_H4, rsublc, arithmetic_inst },
5044+ {"addlk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x10000100, OPCODE_MASK_H4, addlk, arithmetic_inst },
5045+ {"rsublk", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000100, OPCODE_MASK_H4, rsublk, arithmetic_inst },
5046+ {"addlkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x18000100, OPCODE_MASK_H4, addlkc, arithmetic_inst },
5047+ {"rsublkc", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x1C000100, OPCODE_MASK_H4, rsublkc, arithmetic_inst },
5048+ {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
5049+ {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
5050+ {"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 */
5051+ {"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 */
5052+ {"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 */
5053+ {"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 */
5054+ {"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 */
5055+ {"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 */
5056+ {"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 */
5057+ {"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 */
5058+ {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
5059+ {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
5060+ {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
5061+ {"bslrl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000100, OPCODE_MASK_H3, bslrl, barrel_shift_inst },
5062+ {"bsllli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002400, OPCODE_MASK_H3B, bsllli, barrel_shift_inst },
5063+ {"bslrai", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002200, OPCODE_MASK_H3B, bslrai, barrel_shift_inst },
5064+ {"bslrli", INST_TYPE_RD_R1_IMMS, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64002000, OPCODE_MASK_H3B, bslrli, barrel_shift_inst },
5065+ {"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 },
5066+ {"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 },
5067+ {"orl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000100, OPCODE_MASK_H4, orl, logical_inst },
5068+ {"andl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000100, OPCODE_MASK_H4, andl, logical_inst },
5069+ {"xorl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000100, OPCODE_MASK_H4, xorl, logical_inst },
5070+ {"andnl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000100, OPCODE_MASK_H4, andnl, logical_inst },
5071+ {"pcmplbf", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000500, OPCODE_MASK_H4, pcmplbf, logical_inst },
5072+ {"pcmpleq", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000500, OPCODE_MASK_H4, pcmpleq, logical_inst },
5073+ {"pcmplne", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000500, OPCODE_MASK_H4, pcmplne, logical_inst },
5074+ {"srla", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000101, OPCODE_MASK_H34, srla, logical_inst },
5075+ {"srlc", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000121, OPCODE_MASK_H34, srlc, logical_inst },
5076+ {"srll", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000141, OPCODE_MASK_H34, srll, logical_inst },
5077+ {"sextl8", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000160, OPCODE_MASK_H34, sextl8, logical_inst },
5078+ {"sextl16", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000161, OPCODE_MASK_H34, sextl16, logical_inst },
5079+ {"sextl32", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000162, OPCODE_MASK_H34, sextl32, logical_inst },
5080+ {"brea", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98010000, OPCODE_MASK_H124, brea, branch_inst },
5081+ {"bread", INST_TYPE_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98110000, OPCODE_MASK_H124, bread, branch_inst },
5082+ {"breald", INST_TYPE_RD_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98150000, OPCODE_MASK_H24, breald, branch_inst },
5083+ {"beaeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000000, OPCODE_MASK_H14, beaeq, branch_inst },
5084+ {"bealeq", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D000100, OPCODE_MASK_H14, bealeq, branch_inst },
5085+ {"beaeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000000, OPCODE_MASK_H14, beaeqd, branch_inst },
5086+ {"bealeqd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F000100, OPCODE_MASK_H14, bealeqd, branch_inst },
5087+ {"beane", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200000, OPCODE_MASK_H14, beane, branch_inst },
5088+ {"bealne", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D200100, OPCODE_MASK_H14, bealne, branch_inst },
5089+ {"beaned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200000, OPCODE_MASK_H14, beaned, branch_inst },
5090+ {"bealned", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F200100, OPCODE_MASK_H14, bealned, branch_inst },
5091+ {"bealt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400000, OPCODE_MASK_H14, bealt, branch_inst },
5092+ {"beallt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D400100, OPCODE_MASK_H14, beallt, branch_inst },
5093+ {"bealtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400000, OPCODE_MASK_H14, bealtd, branch_inst },
5094+ {"bealltd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F400100, OPCODE_MASK_H14, bealltd, branch_inst },
5095+ {"beale", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600000, OPCODE_MASK_H14, beale, branch_inst },
5096+ {"bealle", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D600100, OPCODE_MASK_H14, bealle, branch_inst },
5097+ {"bealed", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600000, OPCODE_MASK_H14, bealed, branch_inst },
5098+ {"bealled", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F600100, OPCODE_MASK_H14, bealled, branch_inst },
5099+ {"beagt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800000, OPCODE_MASK_H14, beagt, branch_inst },
5100+ {"bealgt", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9D800100, OPCODE_MASK_H14, bealgt, branch_inst },
5101+ {"beagtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800000, OPCODE_MASK_H14, beagtd, branch_inst },
5102+ {"bealgtd", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9F800100, OPCODE_MASK_H14, bealgtd, branch_inst },
5103+ {"beage", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00000, OPCODE_MASK_H14, beage, branch_inst },
5104+ {"bealge", INST_TYPE_R1_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9DA00100, OPCODE_MASK_H14, bealge, branch_inst },
5105+ {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
5106+ {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
5107+ {"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 */
5108+ {"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 */
5109+ {"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 */
5110+ {"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 */
5111+ {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
5112+ {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
5113+ {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
5114+ {"brealid", INST_TYPE_RD_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8150000, OPCODE_MASK_H2, brealid, branch_inst },
5115+ {"beaeqi", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD000000, OPCODE_MASK_H1, beaeqi, branch_inst },
5116+ {"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 */
5117+ {"beaeqid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF000000, OPCODE_MASK_H1, beaeqid, branch_inst },
5118+ {"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 */
5119+ {"beanei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD200000, OPCODE_MASK_H1, beanei, branch_inst },
5120+ {"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 */
5121+ {"beaneid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF200000, OPCODE_MASK_H1, beaneid, branch_inst },
5122+ {"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 */
5123+ {"bealti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD400000, OPCODE_MASK_H1, bealti, branch_inst },
5124+ {"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 */
5125+ {"bealtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF400000, OPCODE_MASK_H1, bealtid, branch_inst },
5126+ {"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 */
5127+ {"bealei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD600000, OPCODE_MASK_H1, bealei, branch_inst },
5128+ {"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 */
5129+ {"bealeid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF600000, OPCODE_MASK_H1, bealeid, branch_inst },
5130+ {"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 */
5131+ {"beagti", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBD800000, OPCODE_MASK_H1, beagti, branch_inst },
5132+ {"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 */
5133+ {"beagtid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBF800000, OPCODE_MASK_H1, beagtid, branch_inst },
5134+ {"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 */
5135+ {"beagei", INST_TYPE_R1_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBDA00000, OPCODE_MASK_H1, beagei, branch_inst },
5136+ {"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 */
5137+ {"beageid", INST_TYPE_R1_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBFA00000, OPCODE_MASK_H1, beageid, branch_inst },
5138+ {"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 */
5139+ {"ll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000100, OPCODE_MASK_H4, ll, memory_load_inst },
5140+ {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst },
5141+ {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst },
5142+ {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst },
5143+ {"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 */
5144+ {"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 */
5145+ {"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 */
5146+ {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst },
5147+ {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst },
5148+ {"dmul", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000500, OPCODE_MASK_H4, dmul, arithmetic_inst },
5149+ {"ddiv", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000580, OPCODE_MASK_H4, ddiv, arithmetic_inst },
5150+ {"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 },
5151+ {"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 },
5152+ {"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 },
5153+ {"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 },
5154+ {"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 },
5155+ {"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 },
5156+ {"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 },
5157+ {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
5158+ {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
5159+ {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
5160+
5161 {"", 0, 0, 0, 0, 0, 0, 0, 0},
5162 };
5163
5164@@ -445,8 +576,17 @@ char pvr_register_prefix[] = "rpvr";
5165 #define MIN_IMM5 ((int) 0x00000000)
5166 #define MAX_IMM5 ((int) 0x0000001f)
5167
5168+#define MIN_IMM6 ((int) 0x00000000)
5169+#define MAX_IMM6 ((int) 0x0000003f)
5170+
5171 #define MIN_IMM_WIDTH ((int) 0x00000001)
5172 #define MAX_IMM_WIDTH ((int) 0x00000020)
5173
5174+#define MIN_IMM6_WIDTH ((int) 0x00000001)
5175+#define MAX_IMM6_WIDTH ((int) 0x00000040)
5176+
5177+#define MIN_IMML ((long) 0xffffff8000000000L)
5178+#define MAX_IMML ((long) 0x0000007fffffffffL)
5179+
5180 #endif /* MICROBLAZE_OPC */
5181
5182diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
5183index aa3401610d9..b242ea73c7b 100644
5184--- a/opcodes/microblaze-opcm.h
5185+++ b/opcodes/microblaze-opcm.h
5186@@ -25,6 +25,7 @@
5187
5188 enum microblaze_instr
5189 {
5190+ /* 32-bit instructions */
5191 add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
5192 addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul,
5193 mulh, mulhu, mulhsu,swapb,swaph,
5194@@ -39,8 +40,8 @@ enum microblaze_instr
5195 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
5196 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
5197 bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx,
5198- sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi,
5199- sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5200+ sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli,
5201+ sbi, shi, swi, sli, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv,
5202 fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt,
5203 /* 'fsqrt' is a glibc:math.h symbol. */
5204 fint, microblaze_fsqrt,
5205@@ -59,6 +60,18 @@ enum microblaze_instr
5206 aputd, taputd, caputd, tcaputd, naputd, tnaputd, ncaputd, tncaputd,
5207 eagetd, teagetd, ecagetd, tecagetd, neagetd, tneagetd, necagetd, tnecagetd,
5208 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
5209+
5210+ /* 64-bit instructions */
5211+ addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
5212+ bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
5213+ andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
5214+ brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
5215+ bealned, bealt, beallt, bealtd, bealltd, beale, bealle, bealed, bealled, beagt,
5216+ bealgt, beagtd, bealgtd, beage, bealge, beaged, bealged, breai, breaid, brealid,
5217+ beaeqi, beaeqid, beanei, beaneid, bealti, bealtid, bealei, bealeid, beagti,
5218+ beagtid, beagei, beageid, imml, ll, llr, sl, slr,
5219+ dadd, drsub, dmul, ddiv, dcmp_lt, dcmp_eq, dcmp_le, dcmp_gt, dcmp_ne, dcmp_ge,
5220+ dcmp_un, dbl, dlong, dsqrt,
5221 invalid_inst
5222 };
5223
5224@@ -136,15 +149,18 @@ enum microblaze_instr_type
5225 #define RA_MASK 0x001F0000
5226 #define RB_MASK 0x0000F800
5227 #define IMM_MASK 0x0000FFFF
5228+#define IMML_MASK 0x00FFFFFF
5229
5230-/* Imm mask for barrel shifts. */
5231+/* Imm masks for barrel shifts. */
5232 #define IMM5_MASK 0x0000001F
5233+#define IMM6_MASK 0x0000003F
5234
5235 /* Imm mask for mbar. */
5236 #define IMM5_MBAR_MASK 0x03E00000
5237
5238-/* Imm mask for extract/insert width. */
5239+/* Imm masks for extract/insert width. */
5240 #define IMM5_WIDTH_MASK 0x000007C0
5241+#define IMM6_WIDTH_MASK 0x00000FC0
5242
5243 /* FSL imm mask for get, put instructions. */
5244 #define RFSL_MASK 0x000000F
5245--
52462.37.1 (Apple Git-137.1)
5247
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
deleted file mode 100644
index 01aff144..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0013-Patch-Microblaze-negl-instruction-is-overriding-rsub.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 667611ec2dfb22bf13d5c6af65ea62e9c13a68de Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 11 Sep 2018 13:48:33 +0530
4Subject: [PATCH 13/34] [Patch,Microblaze] : negl instruction is overriding
5 rsubl,fixed it by changing the instruction order...
6
7---
8 opcodes/microblaze-opc.h | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-)
10
11diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
12index ab90240d88a..5e45df995de 100644
13--- a/opcodes/microblaze-opc.h
14+++ b/opcodes/microblaze-opc.h
15@@ -275,9 +275,7 @@ const struct op_code_struct
16 {"la", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* la translates to addik. */
17 {"tuqula",INST_TYPE_RD, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x3000002A, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* tuqula rd translates to addik rd, r0, 42. */
18 {"not", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xA800FFFF, OPCODE_MASK_H34, invalid_inst, logical_inst }, /* not translates to xori rd,ra,-1. */
19- {"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. */
20 {"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. */
21- {"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. */
22 {"lmi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst },
23 {"smi", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst },
24 {"msrset",INST_TYPE_RD_IMM15, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x94100000, OPCODE_MASK_H23N, msrset, special_inst },
25@@ -555,6 +553,8 @@ const struct op_code_struct
26 {"dbl", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000680, OPCODE_MASK_H4, dbl, arithmetic_inst },
27 {"dlong", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000700, OPCODE_MASK_H4, dlong, arithmetic_inst },
28 {"dsqrt", INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000780, OPCODE_MASK_H4, dsqrt, arithmetic_inst },
29+ {"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. */
30+ {"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. */
31
32 {"", 0, 0, 0, 0, 0, 0, 0, 0},
33 };
34--
352.37.1 (Apple Git-137.1)
36
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch
deleted file mode 100644
index 404081e0..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch
+++ /dev/null
@@ -1,349 +0,0 @@
1From 4e94c1683a806ac46f3a0d54bfe8f7247d5f0cbd Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 11 Sep 2018 17:30:17 +0530
4Subject: [PATCH 14/34] 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---
13 bfd/bfd-in2.h | 9 +++-
14 bfd/libbfd.h | 4 +-
15 bfd/reloc.c | 26 ++++++-----
16 gas/config/tc-microblaze.c | 90 ++++++++++++++++----------------------
17 4 files changed, 61 insertions(+), 68 deletions(-)
18
19diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
20index 6cf701abf10..14e228c9c0e 100644
21--- a/bfd/bfd-in2.h
22+++ b/bfd/bfd-in2.h
23@@ -5387,13 +5387,18 @@ done here - only used for relaxing */
24 /* This is a 64 bit reloc that stores the 32 bit pc relative
25 value in two words (with an imm instruction). No relocation is
26 done here - only used for relaxing */
27- BFD_RELOC_MICROBLAZE_64_NONE,
28+ BFD_RELOC_MICROBLAZE_64_PCREL,
29
30-/* This is a 64 bit reloc that stores the 32 bit pc relative
31+/* This is a 64 bit reloc that stores the 32 bit relative
32 * +value in two words (with an imml instruction). No relocation is
33 * +done here - only used for relaxing */
34 BFD_RELOC_MICROBLAZE_64,
35
36+/* This is a 64 bit reloc that stores the 32 bit pc relative
37+ * +value in two words (with an imm instruction). No relocation is
38+ * +done here - only used for relaxing */
39+ BFD_RELOC_MICROBLAZE_64_NONE,
40+
41 /* This is a 64 bit reloc that stores the 32 bit pc relative
42 value in two words (with an imm instruction). The relocation is
43 PC-relative GOT offset */
44diff --git a/bfd/libbfd.h b/bfd/libbfd.h
45index e74c051e781..20086ba608b 100644
46--- a/bfd/libbfd.h
47+++ b/bfd/libbfd.h
48@@ -2991,14 +2991,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
49 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
50 "BFD_RELOC_MICROBLAZE_32_NONE",
51 "BFD_RELOC_MICROBLAZE_64_NONE",
52- "BFD_RELOC_MICROBLAZE_64",
53 "BFD_RELOC_MICROBLAZE_64_GOTPC",
54- "BFD_RELOC_MICROBLAZE_64_GPC",
55 "BFD_RELOC_MICROBLAZE_64_GOT",
56 "BFD_RELOC_MICROBLAZE_64_PLT",
57 "BFD_RELOC_MICROBLAZE_64_GOTOFF",
58 "BFD_RELOC_MICROBLAZE_32_GOTOFF",
59 "BFD_RELOC_MICROBLAZE_COPY",
60+ "BFD_RELOC_MICROBLAZE_64",
61+ "BFD_RELOC_MICROBLAZE_64_PCREL",
62 "BFD_RELOC_MICROBLAZE_64_TLS",
63 "BFD_RELOC_MICROBLAZE_64_TLSGD",
64 "BFD_RELOC_MICROBLAZE_64_TLSLD",
65diff --git a/bfd/reloc.c b/bfd/reloc.c
66index 0f99df91299..6165ff3adf1 100644
67--- a/bfd/reloc.c
68+++ b/bfd/reloc.c
69@@ -6875,24 +6875,12 @@ ENUMDOC
70 done here - only used for relaxing
71 ENUM
72 BFD_RELOC_MICROBLAZE_64_NONE
73-ENUMDOC
74- This is a 32 bit reloc that stores the 32 bit pc relative
75- value in two words (with an imml instruction). No relocation is
76- done here - only used for relaxing
77-ENUM
78- BFD_RELOC_MICROBLAZE_64
79 ENUMDOC
80 This is a 64 bit reloc that stores the 32 bit pc relative
81 value in two words (with an imm instruction). No relocation is
82 done here - only used for relaxing
83 ENUM
84 BFD_RELOC_MICROBLAZE_64_GOTPC
85-ENUMDOC
86- This is a 64 bit reloc that stores the 32 bit pc relative
87- value in two words (with an imml instruction). No relocation is
88- done here - only used for relaxing
89-ENUM
90- BFD_RELOC_MICROBLAZE_64_GPC
91 ENUMDOC
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@@ -6978,6 +6966,20 @@ ENUMDOC
95 value in two words (with an imm instruction). The relocation is
96 relative offset from start of TEXT.
97
98+ This is a 64 bit reloc that stores 64-bit thread pointer relative offset
99+ to two words (uses imml instruction).
100+ENUM
101+BFD_RELOC_MICROBLAZE_64,
102+ENUMDOC
103+ This is a 64 bit reloc that stores the 64 bit pc relative
104+ value in two words (with an imml instruction). No relocation is
105+ done here - only used for relaxing
106+ENUM
107+BFD_RELOC_MICROBLAZE_64_PCREL,
108+ENUMDOC
109+ This is a 32 bit reloc that stores the 32 bit pc relative
110+ value in two words (with an imml instruction). No relocation is
111+ done here - only used for relaxing
112 ENUM
113 BFD_RELOC_AARCH64_RELOC_START
114 ENUMDOC
115diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
116index a6f12dda54a..9d4dbc12ab3 100644
117--- a/gas/config/tc-microblaze.c
118+++ b/gas/config/tc-microblaze.c
119@@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
120 #define TEXT_OFFSET 17
121 #define TEXT_PC_OFFSET 18
122 #define DEFINED_64_OFFSET 19
123+#define DEFINED_64_PC_OFFSET 20
124
125 /* Initialize the relax table. */
126 const relax_typeS md_relax_table[] =
127@@ -119,7 +120,8 @@ const relax_typeS md_relax_table[] =
128 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */
129 { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */
130 // { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */
131- { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */
132+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */
133+ { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */
134 };
135
136 static htab_t opcode_hash_control; /* Opcode mnemonics. */
137@@ -1184,33 +1186,6 @@ md_assemble (char * str)
138 inst |= (immed << IMM_LOW) & IMM_MASK;
139 }
140 }
141-#if 0 //revisit
142- else if (streq (name, "lli") || streq (name, "sli"))
143- {
144- temp = immed & 0xFFFFFFFFFFFF8000;
145- if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000))
146- {
147- /* Needs an immediate inst. */
148- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
149- if (opcode1 == NULL)
150- {
151- as_bad (_("unknown opcode \"%s\""), "imml");
152- return;
153- }
154-
155- inst1 = opcode1->bit_sequence;
156- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & 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- }
163- inst |= (reg1 << RD_LOW) & RD_MASK;
164- inst |= (reg2 << RA_LOW) & RA_MASK;
165- inst |= (immed << IMM_LOW) & IMM_MASK;
166- }
167-#endif
168 else
169 {
170 temp = immed & 0xFFFF8000;
171@@ -1970,8 +1945,8 @@ md_assemble (char * str)
172
173 if (exp.X_op != O_constant)
174 {
175- char *opc = NULL;
176- //char *opc = str_microblaze_64;
177+ //char *opc = NULL;
178+ char *opc = str_microblaze_64;
179 relax_substateT subtype;
180
181 if (exp.X_md != 0)
182@@ -2230,13 +2205,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
183 fragP->fr_fix += INST_WORD_SIZE * 2;
184 fragP->fr_var = 0;
185 break;
186+ case DEFINED_64_PC_OFFSET:
187+ fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
188+ fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_PCREL);
189+ fragP->fr_fix += INST_WORD_SIZE * 2;
190+ fragP->fr_var = 0;
191+ break;
192 case DEFINED_64_OFFSET:
193 if (fragP->fr_symbol == GOT_symbol)
194 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
195- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC);
196+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64_GPC);
197 else
198 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol,
199- fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64);
200+ fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64);
201 fragP->fr_fix += INST_WORD_SIZE * 2;
202 fragP->fr_var = 0;
203 break;
204@@ -2246,7 +2227,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
205 fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC);
206 else
207 fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol,
208- fragP->fr_offset, true, BFD_RELOC_64);
209+ fragP->fr_offset, false, BFD_RELOC_64);
210 fragP->fr_fix += INST_WORD_SIZE * 2;
211 fragP->fr_var = 0;
212 break;
213@@ -2464,14 +2445,17 @@ md_apply_fix (fixS * fixP,
214 }
215 }
216 break;
217+
218 case BFD_RELOC_64_PCREL:
219 case BFD_RELOC_64:
220 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
221 case BFD_RELOC_MICROBLAZE_64:
222+ case BFD_RELOC_MICROBLAZE_64_PCREL:
223 /* Add an imm instruction. First save the current instruction. */
224 for (i = 0; i < INST_WORD_SIZE; i++)
225 buf[i + INST_WORD_SIZE] = buf[i];
226- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
227+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
228+ || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
229 {
230 /* Generate the imm instruction. */
231 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
232@@ -2484,6 +2468,10 @@ md_apply_fix (fixS * fixP,
233 inst1 = opcode1->bit_sequence;
234 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
235 inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
236+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
237+ fixP->fx_r_type = BFD_RELOC_64;
238+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
239+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
240 }
241 else
242 {
243@@ -2494,7 +2482,7 @@ md_apply_fix (fixS * fixP,
244 as_bad (_("unknown opcode \"%s\""), "imm");
245 return;
246 }
247-
248+
249 inst1 = opcode1->bit_sequence;
250 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
251 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
252@@ -2542,7 +2530,7 @@ md_apply_fix (fixS * fixP,
253 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
254 if (opcode1 == NULL)
255 {
256- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
257+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
258 as_bad (_("unknown opcode \"%s\""), "imml");
259 else
260 as_bad (_("unknown opcode \"%s\""), "imm");
261@@ -2569,8 +2557,6 @@ md_apply_fix (fixS * fixP,
262 moves code around due to relaxing. */
263 if (fixP->fx_r_type == BFD_RELOC_64_PCREL)
264 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
265- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
266- fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
267 else if (fixP->fx_r_type == BFD_RELOC_32)
268 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
269 else
270@@ -2621,33 +2607,24 @@ md_estimate_size_before_relax (fragS * fragP,
271 if(streq (fragP->fr_opcode, str_microblaze_64))
272 {
273 /* Used as an absolute value. */
274- fragP->fr_subtype = DEFINED_64_OFFSET;
275+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
276 /* Variable part does not change. */
277- fragP->fr_var = INST_WORD_SIZE;
278+ fragP->fr_var = INST_WORD_SIZE*2;
279 }
280 else
281 {
282 fragP->fr_subtype = DEFINED_PC_OFFSET;
283- /* Don't know now whether we need an imm instruction. */
284+ /* Don't know now whether we need an imm instruction. */
285 fragP->fr_var = INST_WORD_SIZE;
286 }
287 }
288 else
289 {
290 fragP->fr_subtype = DEFINED_PC_OFFSET;
291- /* Don't know now whether we need an imm instruction. */
292+ /* Don't know now whether we need an imm instruction. */
293 fragP->fr_var = INST_WORD_SIZE;
294 }
295 }
296- #if 0
297- else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type &&
298- !S_IS_WEAK (fragP->fr_symbol))
299- {
300- fragP->fr_subtype = DEFINED_PC_OFFSET;
301- /* Don't know now whether we need an imm instruction. */
302- fragP->fr_var = INST_WORD_SIZE;
303- }
304-#endif
305 else if (S_IS_DEFINED (fragP->fr_symbol)
306 && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0))
307 {
308@@ -2677,6 +2654,13 @@ md_estimate_size_before_relax (fragS * fragP,
309 /* Variable part does not change. */
310 fragP->fr_var = INST_WORD_SIZE*2;
311 }
312+ else if (streq (fragP->fr_opcode, str_microblaze_64))
313+ {
314+ /* Used as an absolute value. */
315+ fragP->fr_subtype = DEFINED_64_OFFSET;
316+ /* Variable part does not change. */
317+ fragP->fr_var = INST_WORD_SIZE;
318+ }
319 else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor))
320 {
321 /* It is accessed using the small data read only anchor. */
322@@ -2751,6 +2735,7 @@ md_estimate_size_before_relax (fragS * fragP,
323 case TLSTPREL_OFFSET:
324 case TLSDTPREL_OFFSET:
325 case DEFINED_64_OFFSET:
326+ case DEFINED_64_PC_OFFSET:
327 fragP->fr_var = INST_WORD_SIZE*2;
328 break;
329 case DEFINED_RO_SEGMENT:
330@@ -2804,7 +2789,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED)
331 else
332 {
333 /* The case where we are going to resolve things... */
334- if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64)
335+ if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
336 return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE;
337 else
338 return fixp->fx_where + fixp->fx_frag->fr_address;
339@@ -2839,6 +2824,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
340 case BFD_RELOC_MICROBLAZE_64_GOTPC:
341 case BFD_RELOC_MICROBLAZE_64_GPC:
342 case BFD_RELOC_MICROBLAZE_64:
343+ case BFD_RELOC_MICROBLAZE_64_PCREL:
344 case BFD_RELOC_MICROBLAZE_64_GOT:
345 case BFD_RELOC_MICROBLAZE_64_PLT:
346 case BFD_RELOC_MICROBLAZE_64_GOTOFF:
347--
3482.37.1 (Apple Git-137.1)
349
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch
deleted file mode 100644
index e93e3476..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch
+++ /dev/null
@@ -1,361 +0,0 @@
1From da36307dff05dff1eebd44aec56f9bdc196ad632 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 15/34] -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---
14 bfd/elf64-microblaze.c | 48 ++++++++++--
15 gas/config/tc-microblaze.c | 155 ++++++++++++++++++++++++++-----------
16 gas/tc.h | 2 +-
17 3 files changed, 152 insertions(+), 53 deletions(-)
18
19diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
20index 0faa8de73c8..951bb36506d 100644
21--- a/bfd/elf64-microblaze.c
22+++ b/bfd/elf64-microblaze.c
23@@ -1552,6 +1552,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
24 bfd_put_16 (input_bfd, relocation & 0xffff,
25 contents + offset + endian);
26
27+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
28+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
29+ {
30+ insn &= ~0x00ffffff;
31+ insn |= (relocation >> 16) & 0xffffff;
32+ bfd_put_32 (input_bfd, insn,
33+ contents + offset + endian);
34+ }
35 else
36 {
37 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
38@@ -1659,6 +1667,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
39 bfd_put_16 (input_bfd, relocation & 0xffff,
40 contents + offset + endian);
41 }
42+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
43+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
44+ {
45+ insn &= ~0x00ffffff;
46+ insn |= (relocation >> 16) & 0xffffff;
47+ bfd_put_32 (input_bfd, insn,
48+ contents + offset + endian);
49+ }
50 else
51 {
52 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
53@@ -1769,9 +1785,19 @@ static void
54 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
55 {
56 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
57- instr &= ~0x0000ffff;
58- instr |= (val & 0x0000ffff);
59- bfd_put_32 (abfd, instr, bfd_addr);
60+
61+ if (instr == 0xb2000000 || instr == 0xb2ffffff)
62+ {
63+ instr &= ~0x00ffffff;
64+ instr |= (val & 0xffffff);
65+ bfd_put_32 (abfd, instr, bfd_addr);
66+ }
67+ else
68+ {
69+ instr &= ~0x0000ffff;
70+ instr |= (val & 0x0000ffff);
71+ bfd_put_32 (abfd, instr, bfd_addr);
72+ }
73 }
74
75 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
76@@ -1783,10 +1809,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
77 unsigned long instr_lo;
78
79 instr_hi = bfd_get_32 (abfd, bfd_addr);
80- instr_hi &= ~0x0000ffff;
81- instr_hi |= ((val >> 16) & 0x0000ffff);
82- bfd_put_32 (abfd, instr_hi, bfd_addr);
83-
84+ if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff)
85+ {
86+ instr_hi &= ~0x00ffffff;
87+ instr_hi |= (val >> 16) & 0xffffff;
88+ bfd_put_32 (abfd, instr_hi,bfd_addr);
89+ }
90+ else
91+ {
92+ instr_hi &= ~0x0000ffff;
93+ instr_hi |= ((val >> 16) & 0x0000ffff);
94+ bfd_put_32 (abfd, instr_hi, bfd_addr);
95+ }
96 instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
97 instr_lo &= ~0x0000ffff;
98 instr_lo |= (val & 0x0000ffff);
99diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
100index 9d4dbc12ab3..a0e97231a41 100644
101--- a/gas/config/tc-microblaze.c
102+++ b/gas/config/tc-microblaze.c
103@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
104 Integer arg to pass to the function. */
105 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
106 and then in the read.c table. */
107-const pseudo_typeS md_pseudo_table[] =
108+pseudo_typeS md_pseudo_table[] =
109 {
110 {"lcomm", microblaze_s_lcomm, 1},
111 {"data", microblaze_s_data, 0},
112@@ -401,7 +401,7 @@ const pseudo_typeS md_pseudo_table[] =
113 {"data32", cons, 4}, /* Same as word. */
114 {"ent", s_func, 0}, /* Treat ent as function entry point. */
115 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
116- {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
117+ {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
118 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
119 {"weakext", microblaze_s_weakext, 0},
120 {"rodata", microblaze_s_rdata, 0},
121@@ -996,7 +996,7 @@ md_assemble (char * str)
122 unsigned reg2;
123 unsigned reg3;
124 unsigned isize;
125- unsigned int immed = 0, immed2 = 0, temp;
126+ unsigned long immed = 0, immed2 = 0, temp;
127 expressionS exp;
128 char name[20];
129 long immedl;
130@@ -1118,8 +1118,9 @@ md_assemble (char * str)
131 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
132 else if (streq (name, "smi"))
133 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
134-
135- if (reg2 == REG_ROSDP)
136+ if(streq (name, "lli") || streq (name, "sli"))
137+ opc = str_microblaze_64;
138+ else if (reg2 == REG_ROSDP)
139 opc = str_microblaze_ro_anchor;
140 else if (reg2 == REG_RWSDP)
141 opc = str_microblaze_rw_anchor;
142@@ -1186,33 +1187,57 @@ md_assemble (char * str)
143 inst |= (immed << IMM_LOW) & IMM_MASK;
144 }
145 }
146- else
147- {
148- temp = immed & 0xFFFF8000;
149- if ((temp != 0) && (temp != 0xFFFF8000))
150- {
151+ else if (streq (name, "lli") || streq (name, "sli"))
152+ {
153+ temp = immed & 0xFFFFFF8000;
154+ if (temp != 0 && temp != 0xFFFFFF8000)
155+ {
156 /* Needs an immediate inst. */
157 opcode1
158 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
159- "imm");
160+ "imml");
161 if (opcode1 == NULL)
162 {
163- as_bad (_("unknown opcode \"%s\""), "imm");
164+ as_bad (_("unknown opcode \"%s\""), "imml");
165 return;
166 }
167-
168 inst1 = opcode1->bit_sequence;
169- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
170+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
171 output[0] = INST_BYTE0 (inst1);
172 output[1] = INST_BYTE1 (inst1);
173 output[2] = INST_BYTE2 (inst1);
174 output[3] = INST_BYTE3 (inst1);
175 output = frag_more (isize);
176- }
177- inst |= (reg1 << RD_LOW) & RD_MASK;
178- inst |= (reg2 << RA_LOW) & RA_MASK;
179- inst |= (immed << IMM_LOW) & IMM_MASK;
180- }
181+ }
182+ inst |= (reg1 << RD_LOW) & RD_MASK;
183+ inst |= (reg2 << RA_LOW) & RA_MASK;
184+ inst |= (immed << IMM_LOW) & IMM_MASK;
185+ }
186+ else
187+ {
188+ temp = immed & 0xFFFF8000;
189+ if ((temp != 0) && (temp != 0xFFFF8000))
190+ {
191+ /* Needs an immediate inst. */
192+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
193+ if (opcode1 == NULL)
194+ {
195+ as_bad (_("unknown opcode \"%s\""), "imm");
196+ return;
197+ }
198+
199+ inst1 = opcode1->bit_sequence;
200+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
201+ output[0] = INST_BYTE0 (inst1);
202+ output[1] = INST_BYTE1 (inst1);
203+ output[2] = INST_BYTE2 (inst1);
204+ output[3] = INST_BYTE3 (inst1);
205+ output = frag_more (isize);
206+ }
207+ inst |= (reg1 << RD_LOW) & RD_MASK;
208+ inst |= (reg2 << RA_LOW) & RA_MASK;
209+ inst |= (immed << IMM_LOW) & IMM_MASK;
210+ }
211 break;
212
213 case INST_TYPE_RD_R1_IMMS:
214@@ -1842,12 +1867,20 @@ md_assemble (char * str)
215 case INST_TYPE_IMM:
216 if (streq (name, "imm"))
217 as_fatal (_("An IMM instruction should not be present in the .s file"));
218-
219- op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
220+ if (microblaze_arch_size == 64)
221+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
222+ else
223+ op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
224
225 if (exp.X_op != O_constant)
226 {
227- char *opc = NULL;
228+ char *opc;
229+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
230+ streq (name, "breaid") ||
231+ streq (name, "brai") || streq (name, "braid")))
232+ opc = str_microblaze_64;
233+ else
234+ opc = NULL;
235 relax_substateT subtype;
236
237 if (exp.X_md != 0)
238@@ -1870,29 +1903,53 @@ md_assemble (char * str)
239 immed = exp.X_add_number;
240 }
241
242-
243- temp = immed & 0xFFFF8000;
244- if ((temp != 0) && (temp != 0xFFFF8000))
245- {
246- /* Needs an immediate inst. */
247- opcode1
248- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
249- "imm");
250- if (opcode1 == NULL)
251- {
252- as_bad (_("unknown opcode \"%s\""), "imm");
253- return;
254+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
255+ streq (name, "breaid") ||
256+ streq (name, "brai") || streq (name, "braid")))
257+ {
258+ temp = immed & 0xFFFFFF8000;
259+ if (temp != 0)
260+ {
261+ /* Needs an immediate inst. */
262+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
263+ if (opcode1 == NULL)
264+ {
265+ as_bad (_("unknown opcode \"%s\""), "imml");
266+ return;
267+ }
268+ inst1 = opcode1->bit_sequence;
269+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
270+ output[0] = INST_BYTE0 (inst1);
271+ output[1] = INST_BYTE1 (inst1);
272+ output[2] = INST_BYTE2 (inst1);
273+ output[3] = INST_BYTE3 (inst1);
274+ output = frag_more (isize);
275 }
276+ inst |= (immed << IMM_LOW) & IMM_MASK;
277+ }
278+ else
279+ {
280+ temp = immed & 0xFFFF8000;
281+ if ((temp != 0) && (temp != 0xFFFF8000))
282+ {
283+ /* Needs an immediate inst. */
284+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
285+ if (opcode1 == NULL)
286+ {
287+ as_bad (_("unknown opcode \"%s\""), "imm");
288+ return;
289+ }
290
291- inst1 = opcode1->bit_sequence;
292- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
293- output[0] = INST_BYTE0 (inst1);
294- output[1] = INST_BYTE1 (inst1);
295- output[2] = INST_BYTE2 (inst1);
296- output[3] = INST_BYTE3 (inst1);
297- output = frag_more (isize);
298- }
299- inst |= (immed << IMM_LOW) & IMM_MASK;
300+ inst1 = opcode1->bit_sequence;
301+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
302+ output[0] = INST_BYTE0 (inst1);
303+ output[1] = INST_BYTE1 (inst1);
304+ output[2] = INST_BYTE2 (inst1);
305+ output[3] = INST_BYTE3 (inst1);
306+ output = frag_more (isize);
307+ }
308+ inst |= (immed << IMM_LOW) & IMM_MASK;
309+ }
310 break;
311
312 case INST_TYPE_NONE:
313@@ -2467,7 +2524,7 @@ md_apply_fix (fixS * fixP,
314
315 inst1 = opcode1->bit_sequence;
316 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
317- inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
318+ inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
319 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
320 fixP->fx_r_type = BFD_RELOC_64;
321 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
322@@ -2636,7 +2693,14 @@ md_estimate_size_before_relax (fragS * fragP,
323 }
324 else
325 {
326- fragP->fr_subtype = UNDEFINED_PC_OFFSET;
327+ if (fragP->fr_opcode != NULL) {
328+ if (streq (fragP->fr_opcode, str_microblaze_64))
329+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
330+ else
331+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
332+ }
333+ else
334+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
335 fragP->fr_var = INST_WORD_SIZE*2;
336 }
337 break;
338@@ -2913,6 +2977,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
339 case OPTION_M64:
340 //if (arg != NULL && strcmp (arg, "64") == 0)
341 microblaze_arch_size = 64;
342+ md_pseudo_table[7].poc_val = 8;
343 break;
344 default:
345 return 0;
346diff --git a/gas/tc.h b/gas/tc.h
347index 4a740f9bdd9..bb9a935a353 100644
348--- a/gas/tc.h
349+++ b/gas/tc.h
350@@ -22,7 +22,7 @@
351 /* In theory (mine, at least!) the machine dependent part of the assembler
352 should only have to include one file. This one. -- JF */
353
354-extern const pseudo_typeS md_pseudo_table[];
355+extern pseudo_typeS md_pseudo_table[];
356
357 const char * md_atof (int, char *, int *);
358 int md_parse_option (int, const char *);
359--
3602.37.1 (Apple Git-137.1)
361
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0016-Fixing-the-branch-related-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0016-Fixing-the-branch-related-issues.patch
deleted file mode 100644
index f3a7267d..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0016-Fixing-the-branch-related-issues.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 3a46bc21f52c7b5ccbd408eeecd7145b856f6b1d Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Sun, 30 Sep 2018 17:06:58 +0530
4Subject: [PATCH 16/34] Fixing the branch related issues
5
6Conflicts:
7 bfd/elf64-microblaze.c
8---
9 bfd/elf64-microblaze.c | 3 +++
10 1 file changed, 3 insertions(+)
11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index 951bb36506d..6d698383404 100644
14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c
16@@ -2559,6 +2559,9 @@ microblaze_elf_check_relocs (bfd * abfd,
17 while (h->root.type == bfd_link_hash_indirect
18 || h->root.type == bfd_link_hash_warning)
19 h = (struct elf_link_hash_entry *) h->root.u.i.link;
20+ /* PR15323, ref flags aren't set for references in the same
21+ object. */
22+ h->root.non_ir_ref_regular = 1;
23 }
24
25 switch (r_type)
26--
272.37.1 (Apple Git-137.1)
28
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch
deleted file mode 100644
index 4c0496c3..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch
+++ /dev/null
@@ -1,227 +0,0 @@
1From a6003437722a8f04c1e31435eb7f9101c50cc292 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 17/34] - 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---
17 bfd/bfd-in2.h | 5 +++
18 bfd/elf64-microblaze.c | 12 +++----
19 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
20 opcodes/microblaze-dis.c | 2 +-
21 4 files changed, 78 insertions(+), 15 deletions(-)
22
23diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
24index 14e228c9c0e..d4b5006902c 100644
25--- a/bfd/bfd-in2.h
26+++ b/bfd/bfd-in2.h
27@@ -5394,6 +5394,11 @@ done here - only used for relaxing */
28 * +done here - only used for relaxing */
29 BFD_RELOC_MICROBLAZE_64,
30
31+/* This is a 64 bit reloc that stores the 32 bit relative
32+ * +value in two words (with an imml instruction). No relocation is
33+ * +done here - only used for relaxing */
34+ BFD_RELOC_MICROBLAZE_EA64,
35+
36 /* This is a 64 bit reloc that stores the 32 bit pc relative
37 * +value in two words (with an imm instruction). No relocation is
38 * +done here - only used for relaxing */
39diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
40index 6d698383404..f16b544b1fc 100644
41--- a/bfd/elf64-microblaze.c
42+++ b/bfd/elf64-microblaze.c
43@@ -118,14 +118,14 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
44 0, /* Rightshift. */
45 4, /* Size (0 = byte, 1 = short, 2 = long). */
46 64, /* Bitsize. */
47- true, /* PC_relative. */
48+ false, /* PC_relative. */
49 0, /* Bitpos. */
50 complain_overflow_dont, /* Complain on overflow. */
51 bfd_elf_generic_reloc,/* Special Function. */
52 "R_MICROBLAZE_IMML_64", /* Name. */
53 false, /* Partial Inplace. */
54 0, /* Source Mask. */
55- 0x0000ffff, /* Dest Mask. */
56+ 0xffffffffffffff, /* Dest Mask. */
57 false), /* PC relative offset? */
58
59 /* A 64 bit relocation. Table entry not really used. */
60@@ -613,9 +613,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
61 case BFD_RELOC_32:
62 microblaze_reloc = R_MICROBLAZE_32;
63 break;
64- /* RVA is treated the same as 32 */
65+ /* RVA is treated the same as 64 */
66 case BFD_RELOC_RVA:
67- microblaze_reloc = R_MICROBLAZE_32;
68+ microblaze_reloc = R_MICROBLAZE_IMML_64;
69 break;
70 case BFD_RELOC_32_PCREL:
71 microblaze_reloc = R_MICROBLAZE_32_PCREL;
72@@ -647,7 +647,7 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
73 case BFD_RELOC_VTABLE_ENTRY:
74 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
75 break;
76- case BFD_RELOC_MICROBLAZE_64:
77+ case BFD_RELOC_MICROBLAZE_EA64:
78 microblaze_reloc = R_MICROBLAZE_IMML_64;
79 break;
80 case BFD_RELOC_MICROBLAZE_64_GOTPC:
81@@ -2050,7 +2050,7 @@ microblaze_elf_relax_section (bfd *abfd,
82 efix = calc_fixup (target_address, 0, sec);
83
84 /* Validate the in-band val. */
85- val = bfd_get_32 (abfd, contents + irel->r_offset);
86+ val = bfd_get_64 (abfd, contents + irel->r_offset);
87 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
88 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
89 }
90diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
91index a0e97231a41..d3de049e9c0 100644
92--- a/gas/config/tc-microblaze.c
93+++ b/gas/config/tc-microblaze.c
94@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] =
95 {"ent", s_func, 0}, /* Treat ent as function entry point. */
96 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
97 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
98- {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
99 {"weakext", microblaze_s_weakext, 0},
100 {"rodata", microblaze_s_rdata, 0},
101 {"sdata2", microblaze_s_rdata, 1},
102@@ -2483,18 +2482,74 @@ md_apply_fix (fixS * fixP,
103 case BFD_RELOC_RVA:
104 case BFD_RELOC_32_PCREL:
105 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
106+ /* Don't do anything if the symbol is not defined. */
107+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
108+ {
109+ if ((fixP->fx_r_type == BFD_RELOC_RVA) && (microblaze_arch_size == 64))
110+ {
111+ if (target_big_endian)
112+ {
113+ buf[0] |= ((val >> 56) & 0xff);
114+ buf[1] |= ((val >> 48) & 0xff);
115+ buf[2] |= ((val >> 40) & 0xff);
116+ buf[3] |= ((val >> 32) & 0xff);
117+ buf[4] |= ((val >> 24) & 0xff);
118+ buf[5] |= ((val >> 16) & 0xff);
119+ buf[6] |= ((val >> 8) & 0xff);
120+ buf[7] |= (val & 0xff);
121+ }
122+ else
123+ {
124+ buf[7] |= ((val >> 56) & 0xff);
125+ buf[6] |= ((val >> 48) & 0xff);
126+ buf[5] |= ((val >> 40) & 0xff);
127+ buf[4] |= ((val >> 32) & 0xff);
128+ buf[3] |= ((val >> 24) & 0xff);
129+ buf[2] |= ((val >> 16) & 0xff);
130+ buf[1] |= ((val >> 8) & 0xff);
131+ buf[0] |= (val & 0xff);
132+ }
133+ }
134+ else {
135+ if (target_big_endian)
136+ {
137+ buf[0] |= ((val >> 24) & 0xff);
138+ buf[1] |= ((val >> 16) & 0xff);
139+ buf[2] |= ((val >> 8) & 0xff);
140+ buf[3] |= (val & 0xff);
141+ }
142+ else
143+ {
144+ buf[3] |= ((val >> 24) & 0xff);
145+ buf[2] |= ((val >> 16) & 0xff);
146+ buf[1] |= ((val >> 8) & 0xff);
147+ buf[0] |= (val & 0xff);
148+ }
149+ }
150+ }
151+ break;
152+
153+ case BFD_RELOC_MICROBLAZE_EA64:
154 /* Don't do anything if the symbol is not defined. */
155 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
156 {
157 if (target_big_endian)
158 {
159- buf[0] |= ((val >> 24) & 0xff);
160- buf[1] |= ((val >> 16) & 0xff);
161- buf[2] |= ((val >> 8) & 0xff);
162- buf[3] |= (val & 0xff);
163+ buf[0] |= ((val >> 56) & 0xff);
164+ buf[1] |= ((val >> 48) & 0xff);
165+ buf[2] |= ((val >> 40) & 0xff);
166+ buf[3] |= ((val >> 32) & 0xff);
167+ buf[4] |= ((val >> 24) & 0xff);
168+ buf[5] |= ((val >> 16) & 0xff);
169+ buf[6] |= ((val >> 8) & 0xff);
170+ buf[7] |= (val & 0xff);
171 }
172 else
173 {
174+ buf[7] |= ((val >> 56) & 0xff);
175+ buf[6] |= ((val >> 48) & 0xff);
176+ buf[5] |= ((val >> 40) & 0xff);
177+ buf[4] |= ((val >> 32) & 0xff);
178 buf[3] |= ((val >> 24) & 0xff);
179 buf[2] |= ((val >> 16) & 0xff);
180 buf[1] |= ((val >> 8) & 0xff);
181@@ -2616,6 +2671,8 @@ md_apply_fix (fixS * fixP,
182 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
183 else if (fixP->fx_r_type == BFD_RELOC_32)
184 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
185+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64)
186+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64;
187 else
188 fixP->fx_r_type = BFD_RELOC_NONE;
189 fixP->fx_addsy = section_symbol (absolute_section);
190@@ -2887,6 +2944,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
191 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
192 case BFD_RELOC_MICROBLAZE_64_GOTPC:
193 case BFD_RELOC_MICROBLAZE_64_GPC:
194+ case BFD_RELOC_MICROBLAZE_EA64:
195 case BFD_RELOC_MICROBLAZE_64:
196 case BFD_RELOC_MICROBLAZE_64_PCREL:
197 case BFD_RELOC_MICROBLAZE_64_GOT:
198@@ -3032,10 +3090,10 @@ cons_fix_new_microblaze (fragS * frag,
199 r = BFD_RELOC_32;
200 break;
201 case 8:
202- if (microblaze_arch_size == 64)
203+ /*if (microblaze_arch_size == 64)
204 r = BFD_RELOC_32;
205- else
206- r = BFD_RELOC_64;
207+ else*/
208+ r = BFD_RELOC_MICROBLAZE_EA64;
209 break;
210 default:
211 as_bad (_("unsupported BFD relocation size %u"), size);
212diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
213index 921adce04ea..d837ebb38e2 100644
214--- a/opcodes/microblaze-dis.c
215+++ b/opcodes/microblaze-dis.c
216@@ -77,7 +77,7 @@ static char *
217 get_field_imml (struct string_buf *buf, long instr)
218 {
219 char *p = strbuf (buf);
220- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
221+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
222 return p;
223 }
224
225--
2262.37.1 (Apple Git-137.1)
227
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0018-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
deleted file mode 100644
index 6a70dbfb..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0018-Patch-MicroBlaze-Adding-new-relocation-to-support-64.patch
+++ /dev/null
@@ -1,167 +0,0 @@
1From 6209a572f4ec70608564fa7aa0270d640aa421f0 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Tue, 2 Nov 2021 17:28:24 +0530
4Subject: [PATCH 18/34] [Patch,MicroBlaze : Adding new relocation to support
5 64bit rodata.
6
7---
8 bfd/elf64-microblaze.c | 11 +++++++--
9 gas/config/tc-microblaze.c | 49 ++++++++++++++++++++++++++++++++++----
10 2 files changed, 54 insertions(+), 6 deletions(-)
11
12diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
13index f16b544b1fc..355e9131987 100644
14--- a/bfd/elf64-microblaze.c
15+++ b/bfd/elf64-microblaze.c
16@@ -1529,6 +1529,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
17 case (int) R_MICROBLAZE_64_PCREL :
18 case (int) R_MICROBLAZE_64:
19 case (int) R_MICROBLAZE_32:
20+ case (int) R_MICROBLAZE_IMML_64:
21 {
22 /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols
23 from removed linkonce sections, or sections discarded by
24@@ -1538,6 +1539,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
25 relocation += addend;
26 if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64)
27 bfd_put_32 (input_bfd, relocation, contents + offset);
28+ else if (r_type == R_MICROBLAZE_IMML_64)
29+ bfd_put_64 (input_bfd, relocation, contents + offset);
30 else
31 {
32 if (r_type == R_MICROBLAZE_64_PCREL)
33@@ -1626,7 +1629,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
34 }
35 else
36 {
37- if (r_type == R_MICROBLAZE_32)
38+ if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64)
39 {
40 outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL);
41 outrel.r_addend = relocation + addend;
42@@ -1652,6 +1655,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
43 relocation += addend;
44 if (r_type == R_MICROBLAZE_32)
45 bfd_put_32 (input_bfd, relocation, contents + offset);
46+ else if (r_type == R_MICROBLAZE_IMML_64)
47+ bfd_put_64 (input_bfd, relocation, contents + offset + endian);
48 else
49 {
50 if (r_type == R_MICROBLAZE_64_PCREL)
51@@ -2166,7 +2171,8 @@ microblaze_elf_relax_section (bfd *abfd,
52 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
53 irelscan->r_addend);
54 }
55- if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
56+ if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
57+ || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
58 {
59 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
60
61@@ -2633,6 +2639,7 @@ microblaze_elf_check_relocs (bfd * abfd,
62 case R_MICROBLAZE_64:
63 case R_MICROBLAZE_64_PCREL:
64 case R_MICROBLAZE_32:
65+ case R_MICROBLAZE_IMML_64:
66 {
67 if (h != NULL && !bfd_link_pic (info))
68 {
69diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
70index d3de049e9c0..76ce516d8aa 100644
71--- a/gas/config/tc-microblaze.c
72+++ b/gas/config/tc-microblaze.c
73@@ -1119,6 +1119,13 @@ md_assemble (char * str)
74 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
75 if(streq (name, "lli") || streq (name, "sli"))
76 opc = str_microblaze_64;
77+ else if ((microblaze_arch_size == 64) && ((streq (name, "lbui")
78+ || streq (name, "lhui") || streq (name, "lwi") || streq (name, "sbi")
79+ || streq (name, "shi") || streq (name, "swi"))))
80+ {
81+ opc = str_microblaze_64;
82+ subtype = opcode->inst_offset_type;
83+ }
84 else if (reg2 == REG_ROSDP)
85 opc = str_microblaze_ro_anchor;
86 else if (reg2 == REG_RWSDP)
87@@ -1186,7 +1193,10 @@ md_assemble (char * str)
88 inst |= (immed << IMM_LOW) & IMM_MASK;
89 }
90 }
91- else if (streq (name, "lli") || streq (name, "sli"))
92+ else if (streq (name, "lli") || streq (name, "sli") || ((microblaze_arch_size == 64)
93+ && ((streq (name, "lbui")) || streq (name, "lhui")
94+ || streq (name, "lwi") || streq (name, "sbi")
95+ || streq (name, "shi") || streq (name, "swi"))))
96 {
97 temp = immed & 0xFFFFFF8000;
98 if (temp != 0 && temp != 0xFFFFFF8000)
99@@ -1802,6 +1812,11 @@ md_assemble (char * str)
100
101 if (exp.X_md != 0)
102 subtype = get_imm_otype(exp.X_md);
103+ else if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
104+ {
105+ opc = str_microblaze_64;
106+ subtype = opcode->inst_offset_type;
107+ }
108 else
109 subtype = opcode->inst_offset_type;
110
111@@ -1819,6 +1834,31 @@ md_assemble (char * str)
112 output = frag_more (isize);
113 immed = exp.X_add_number;
114 }
115+ if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
116+ {
117+ temp = immed & 0xFFFFFF8000;
118+ if (temp != 0 && temp != 0xFFFFFF8000)
119+ {
120+ /* Needs an immediate inst. */
121+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
122+ if (opcode1 == NULL)
123+ {
124+ as_bad (_("unknown opcode \"%s\""), "imml");
125+ return;
126+ }
127+ inst1 = opcode1->bit_sequence;
128+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
129+ output[0] = INST_BYTE0 (inst1);
130+ output[1] = INST_BYTE1 (inst1);
131+ output[2] = INST_BYTE2 (inst1);
132+ output[3] = INST_BYTE3 (inst1);
133+ output = frag_more (isize);
134+ }
135+ inst |= (reg1 << RD_LOW) & RD_MASK;
136+ inst |= (immed << IMM_LOW) & IMM_MASK;
137+ }
138+ else
139+ {
140
141 temp = immed & 0xFFFF8000;
142 if ((temp != 0) && (temp != 0xFFFF8000))
143@@ -1844,6 +1884,7 @@ md_assemble (char * str)
144
145 inst |= (reg1 << RD_LOW) & RD_MASK;
146 inst |= (immed << IMM_LOW) & IMM_MASK;
147+ }
148 break;
149
150 case INST_TYPE_R2:
151@@ -3090,10 +3131,10 @@ cons_fix_new_microblaze (fragS * frag,
152 r = BFD_RELOC_32;
153 break;
154 case 8:
155- /*if (microblaze_arch_size == 64)
156- r = BFD_RELOC_32;
157- else*/
158+ if (microblaze_arch_size == 64)
159 r = BFD_RELOC_MICROBLAZE_EA64;
160+ else
161+ r = BFD_RELOC_64;
162 break;
163 default:
164 as_bad (_("unsupported BFD relocation size %u"), size);
165--
1662.37.1 (Apple Git-137.1)
167
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0019-fixing-the-.bss-relocation-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0019-fixing-the-.bss-relocation-issue.patch
deleted file mode 100644
index 5826f0a3..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0019-fixing-the-.bss-relocation-issue.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From 35e89c09636e2ce2f5eafcf62941d15ece79a172 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 24 Oct 2018 12:34:37 +0530
4Subject: [PATCH 19/34] fixing the .bss relocation issue
5
6Conflicts:
7 bfd/elf64-microblaze.c
8
9Conflicts:
10 bfd/elf64-microblaze.c
11---
12 bfd/elf64-microblaze.c | 41 +++++++++++++++++++++++++++++------------
13 1 file changed, 29 insertions(+), 12 deletions(-)
14
15diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
16index 355e9131987..eb7f9138884 100644
17--- a/bfd/elf64-microblaze.c
18+++ b/bfd/elf64-microblaze.c
19@@ -1555,14 +1555,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
20 bfd_put_16 (input_bfd, relocation & 0xffff,
21 contents + offset + endian);
22
23- unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
24- if (insn == 0xb2000000 || insn == 0xb2ffffff)
25- {
26- insn &= ~0x00ffffff;
27- insn |= (relocation >> 16) & 0xffffff;
28- bfd_put_32 (input_bfd, insn,
29- contents + offset + endian);
30- }
31+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
32+ if ((insn & 0xff000000) == 0xb2000000)
33+ {
34+ insn &= ~0x00ffffff;
35+ insn |= (relocation >> 16) & 0xffffff;
36+ bfd_put_32 (input_bfd, insn,
37+ contents + offset + endian);
38+ }
39 else
40 {
41 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
42@@ -1673,7 +1673,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
43 contents + offset + endian);
44 }
45 unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
46- if (insn == 0xb2000000 || insn == 0xb2ffffff)
47+ if ((insn & 0xff000000) == 0xb2000000)
48 {
49 insn &= ~0x00ffffff;
50 insn |= (relocation >> 16) & 0xffffff;
51@@ -1791,7 +1791,7 @@ microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
52 {
53 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
54
55- if (instr == 0xb2000000 || instr == 0xb2ffffff)
56+ if ((instr & 0xff000000) == 0xb2000000)
57 {
58 instr &= ~0x00ffffff;
59 instr |= (val & 0xffffff);
60@@ -1814,7 +1814,7 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
61 unsigned long instr_lo;
62
63 instr_hi = bfd_get_32 (abfd, bfd_addr);
64- if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff)
65+ if ((instr_hi & 0xff000000) == 0xb2000000)
66 {
67 instr_hi &= ~0x00ffffff;
68 instr_hi |= (val >> 16) & 0xffffff;
69@@ -2294,6 +2294,8 @@ microblaze_elf_relax_section (bfd *abfd,
70 if (isym->st_shndx == shndx
71 && (ELF64_ST_TYPE (isym->st_info) == STT_SECTION))
72 {
73+ bfd_vma immediate;
74+
75 if (ocontents == NULL)
76 {
77 if (elf_section_data (o)->this_hdr.contents != NULL)
78@@ -2316,8 +2318,20 @@ microblaze_elf_relax_section (bfd *abfd,
79 elf_section_data (o)->this_hdr.contents = ocontents;
80 }
81 }
82+ unsigned long instr_hi = bfd_get_32 (abfd, ocontents
83+ + irelscan->r_offset);
84+ unsigned long instr_lo = bfd_get_32 (abfd, ocontents
85+ + irelscan->r_offset
86+ + INST_WORD_SIZE);
87+ if ((instr_hi & 0xff000000) == 0xb2000000)
88+ immediate = (instr_hi & 0x00ffffff) << 24;
89+ else
90+ immediate = (instr_hi & 0x0000ffff) << 16;
91+ immediate |= (instr_lo & 0x0000ffff);
92 offset = calc_fixup (irelscan->r_addend, 0, sec);
93+ immediate -= offset;
94 irelscan->r_addend -= offset;
95+
96 }
97 }
98 else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
99@@ -2357,7 +2371,10 @@ microblaze_elf_relax_section (bfd *abfd,
100 unsigned long instr_lo = bfd_get_32 (abfd, ocontents
101 + irelscan->r_offset
102 + INST_WORD_SIZE);
103- immediate = (instr_hi & 0x0000ffff) << 16;
104+ if ((instr_hi & 0xff000000) == 0xb2000000)
105+ immediate = (instr_hi & 0x00ffffff) << 24;
106+ else
107+ immediate = (instr_hi & 0x0000ffff) << 16;
108 immediate |= (instr_lo & 0x0000ffff);
109 target_address = immediate;
110 offset = calc_fixup (target_address, 0, sec);
111--
1122.37.1 (Apple Git-137.1)
113
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
deleted file mode 100644
index 21fab2de..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0020-Fixed-the-bug-in-the-R_MICROBLAZE_64_NONE-relocation.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From 6c6490ed5a5c5c00d1b18a1f446280689bb572d1 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Wed, 28 Nov 2018 14:00:29 +0530
4Subject: [PATCH 20/34] Fixed the bug in the R_MICROBLAZE_64_NONE relocation.
5 It was adjusting only lower 16bits.
6
7Conflicts:
8 bfd/elf64-microblaze.c
9---
10 bfd/elf32-microblaze.c | 4 ++--
11 bfd/elf64-microblaze.c | 4 ++--
12 2 files changed, 4 insertions(+), 4 deletions(-)
13
14diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
15index f20adb6fd73..88ac730582b 100644
16--- a/bfd/elf32-microblaze.c
17+++ b/bfd/elf32-microblaze.c
18@@ -2060,8 +2060,8 @@ microblaze_elf_relax_section (bfd *abfd,
19 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
20 efix = calc_fixup (target_address, 0, sec);
21 irel->r_addend -= (efix - sfix);
22- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
23- + INST_WORD_SIZE, irel->r_addend);
24+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
25+ irel->r_addend);
26 }
27 break;
28 }
29diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
30index eb7f9138884..03fe9eba53a 100644
31--- a/bfd/elf64-microblaze.c
32+++ b/bfd/elf64-microblaze.c
33@@ -2098,8 +2098,8 @@ microblaze_elf_relax_section (bfd *abfd,
34 sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, 0, sec);
35 efix = calc_fixup (target_address, 0, sec);
36 irel->r_addend -= (efix - sfix);
37- microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset
38- + INST_WORD_SIZE, irel->r_addend);
39+ microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset,
40+ irel->r_addend);
41 }
42 break;
43 }
44--
452.37.1 (Apple Git-137.1)
46
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0021-Revert-ld-Remove-unused-expression-state.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0021-Revert-ld-Remove-unused-expression-state.patch
deleted file mode 100644
index ab7f2077..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0021-Revert-ld-Remove-unused-expression-state.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From 6238123cdc680941f3b3a253cca5be06d5c81492 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 27 Feb 2019 15:12:32 +0530
4Subject: [PATCH 21/34] 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---
17 ld/ldexp.c | 8 +++++---
18 ld/ldexp.h | 1 +
19 2 files changed, 6 insertions(+), 3 deletions(-)
20
21diff --git a/ld/ldexp.c b/ld/ldexp.c
22index d4d8706968d..b7f4361129f 100644
23--- a/ld/ldexp.c
24+++ b/ld/ldexp.c
25@@ -1380,6 +1380,7 @@ static etree_type *
26 exp_assop (const char *dst,
27 etree_type *src,
28 enum node_tree_enum class,
29+ bool defsym,
30 bool hidden)
31 {
32 etree_type *n;
33@@ -1391,6 +1392,7 @@ exp_assop (const char *dst,
34 n->assign.type.node_class = class;
35 n->assign.src = src;
36 n->assign.dst = dst;
37+ n->assign.defsym = defsym;
38 n->assign.hidden = hidden;
39 return n;
40 }
41@@ -1400,7 +1402,7 @@ exp_assop (const char *dst,
42 etree_type *
43 exp_assign (const char *dst, etree_type *src, bool hidden)
44 {
45- return exp_assop (dst, src, etree_assign, hidden);
46+ return exp_assop (dst, src, etree_assign, false, hidden);
47 }
48
49 /* Handle --defsym command-line option. */
50@@ -1408,7 +1410,7 @@ exp_assign (const char *dst, etree_type *src, bool hidden)
51 etree_type *
52 exp_defsym (const char *dst, etree_type *src)
53 {
54- return exp_assop (dst, src, etree_assign, false);
55+ return exp_assop (dst, src, etree_assign, true, false);
56 }
57
58 /* Handle PROVIDE. */
59@@ -1416,7 +1418,7 @@ exp_defsym (const char *dst, etree_type *src)
60 etree_type *
61 exp_provide (const char *dst, etree_type *src, bool hidden)
62 {
63- return exp_assop (dst, src, etree_provide, hidden);
64+ return exp_assop (dst, src, etree_provide, false, hidden);
65 }
66
67 /* Handle ASSERT. */
68diff --git a/ld/ldexp.h b/ld/ldexp.h
69index ed6fb8be715..e838b736306 100644
70--- a/ld/ldexp.h
71+++ b/ld/ldexp.h
72@@ -66,6 +66,7 @@ typedef union etree_union {
73 node_type type;
74 const char *dst;
75 union etree_union *src;
76+ bool defsym;
77 bool hidden;
78 } assign;
79 struct {
80--
812.37.1 (Apple Git-137.1)
82
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-long-long-long-mingw-toolchain-issue.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-long-long-long-mingw-toolchain-issue.patch
deleted file mode 100644
index bfb68360..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0022-fixing-the-long-long-long-mingw-toolchain-issue.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 24269bd086efcd37f702b92fd25dfe45faa7dfb6 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Thu, 29 Nov 2018 17:59:25 +0530
4Subject: [PATCH 22/34] fixing the long & long long mingw toolchain issue
5
6---
7 gas/config/tc-microblaze.c | 10 +++++-----
8 opcodes/microblaze-opc.h | 4 ++--
9 2 files changed, 7 insertions(+), 7 deletions(-)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 76ce516d8aa..a1fb6ccbd44 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -783,7 +783,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
16 }
17
18 static char *
19-parse_imml (char * s, expressionS * e, long min, long max)
20+parse_imml (char * s, expressionS * e, long long min, long long max)
21 {
22 char *new_pointer;
23 char *atp;
24@@ -834,11 +834,11 @@ parse_imml (char * s, expressionS * e, long min, long max)
25 ; /* An error message has already been emitted. */
26 else if ((e->X_op != O_constant && e->X_op != O_symbol) )
27 as_fatal (_("operand must be a constant or a label"));
28- else if ((e->X_op == O_constant) && ((long) e->X_add_number < min
29- || (long) e->X_add_number > max))
30+ else if ((e->X_op == O_constant) && ((long long) e->X_add_number < min
31+ || (long long) e->X_add_number > max))
32 {
33- as_fatal (_("operand must be absolute in range %ld..%ld, not %ld"),
34- min, max, (long) e->X_add_number);
35+ as_fatal (_("operand must be absolute in range %lld..%lld, not %lld"),
36+ min, max, (long long) e->X_add_number);
37 }
38
39 if (atp)
40diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
41index 5e45df995de..6b25d12dace 100644
42--- a/opcodes/microblaze-opc.h
43+++ b/opcodes/microblaze-opc.h
44@@ -585,8 +585,8 @@ char pvr_register_prefix[] = "rpvr";
45 #define MIN_IMM6_WIDTH ((int) 0x00000001)
46 #define MAX_IMM6_WIDTH ((int) 0x00000040)
47
48-#define MIN_IMML ((long) 0xffffff8000000000L)
49-#define MAX_IMML ((long) 0x0000007fffffffffL)
50+#define MIN_IMML ((long long) 0xffffff8000000000L)
51+#define MAX_IMML ((long long) 0x0000007fffffffffL)
52
53 #endif /* MICROBLAZE_OPC */
54
55--
562.37.1 (Apple Git-137.1)
57
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-support-to-new-arithmetic-single-register-inst.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-support-to-new-arithmetic-single-register-inst.patch
deleted file mode 100644
index 0b8c83cd..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0023-Added-support-to-new-arithmetic-single-register-inst.patch
+++ /dev/null
@@ -1,369 +0,0 @@
1From 3c197b12c4b680a230e8350ecd9a523be804fe3c Mon Sep 17 00:00:00 2001
2From: Nagaraju <nmekala@xilinx.com>
3Date: Fri, 23 Aug 2019 16:18:43 +0530
4Subject: [PATCH 23/34] 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---
19 gas/config/tc-microblaze.c | 147 ++++++++++++++++++++++++++++++++++++-
20 opcodes/microblaze-dis.c | 11 +++
21 opcodes/microblaze-opc.h | 43 ++++++++++-
22 opcodes/microblaze-opcm.h | 5 +-
23 4 files changed, 200 insertions(+), 6 deletions(-)
24
25diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
26index a1fb6ccbd44..27544b60ea3 100644
27--- a/gas/config/tc-microblaze.c
28+++ b/gas/config/tc-microblaze.c
29@@ -423,12 +423,33 @@ void
30 md_begin (void)
31 {
32 const struct op_code_struct * opcode;
33+ const char *prev_name = "";
34
35 opcode_hash_control = str_htab_create ();
36
37 /* Insert unique names into hash table. */
38- for (opcode = microblaze_opcodes; opcode->name; opcode ++)
39- str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
40+ for (opcode = (struct microblaze_opcodes *)microblaze_opcodes; opcode->name; opcode ++)
41+ {
42+ if (strcmp (prev_name, opcode->name))
43+ {
44+ prev_name = (char *) opcode->name;
45+ str_hash_insert (opcode_hash_control, opcode->name, opcode, 0);
46+ }
47+ }
48+}
49+
50+static int
51+is_reg (char * s)
52+{
53+ int is_reg = 0;
54+ /* Strip leading whitespace. */
55+ while (ISSPACE (* s))
56+ ++ s;
57+ if (TOLOWER (s[0]) == 'r')
58+ {
59+ is_reg =1;
60+ }
61+ return is_reg;
62 }
63
64 /* Try to parse a reg name. */
65@@ -986,6 +1007,7 @@ md_assemble (char * str)
66 {
67 char * op_start;
68 char * op_end;
69+ char * temp_op_end;
70 struct op_code_struct * opcode, *opcode1;
71 char * output = NULL;
72 int nlen = 0;
73@@ -996,9 +1018,10 @@ md_assemble (char * str)
74 unsigned reg3;
75 unsigned isize;
76 unsigned long immed = 0, immed2 = 0, temp;
77- expressionS exp;
78+ expressionS exp,exp1;
79 char name[20];
80 long immedl;
81+ int reg=0;
82
83 /* Drop leading whitespace. */
84 while (ISSPACE (* str))
85@@ -1029,7 +1052,78 @@ md_assemble (char * str)
86 as_bad (_("unknown opcode \"%s\""), name);
87 return;
88 }
89-
90+
91+ if ((microblaze_arch_size == 64) && (streq (name, "addli") || streq (name, "addlic") ||
92+ streq (name, "addlik") || streq (name, "addlikc") || streq (name, "rsubli")
93+ || streq (name, "rsublic") || streq (name, "rsublik") || streq (name, "rsublikc")
94+ || streq (name, "andli") || streq (name, "andnli") || streq (name, "orli")
95+ || streq (name, "xorli")))
96+ {
97+ temp_op_end = op_end;
98+ if (strcmp (temp_op_end, ""))
99+ temp_op_end = parse_reg (temp_op_end + 1, &reg1); /* Get rd. */
100+ if (strcmp (temp_op_end, ""))
101+ reg = is_reg (temp_op_end + 1);
102+ if (reg)
103+ {
104+
105+ opcode->inst_type=INST_TYPE_RD_R1_IMML;
106+ opcode->inst_offset_type = OPCODE_MASK_H;
107+ if (streq (name, "addli"))
108+ opcode->bit_sequence = ADDLI_MASK;
109+ else if (streq (name, "addlic"))
110+ opcode->bit_sequence = ADDLIC_MASK;
111+ else if (streq (name, "addlik"))
112+ opcode->bit_sequence = ADDLIK_MASK;
113+ else if (streq (name, "addlikc"))
114+ opcode->bit_sequence = ADDLIKC_MASK;
115+ else if (streq (name, "rsubli"))
116+ opcode->bit_sequence = RSUBLI_MASK;
117+ else if (streq (name, "rsublic"))
118+ opcode->bit_sequence = RSUBLIC_MASK;
119+ else if (streq (name, "rsublik"))
120+ opcode->bit_sequence = RSUBLIK_MASK;
121+ else if (streq (name, "rsublikc"))
122+ opcode->bit_sequence = RSUBLIKC_MASK;
123+ else if (streq (name, "andli"))
124+ opcode->bit_sequence = ANDLI_MASK;
125+ else if (streq (name, "andnli"))
126+ opcode->bit_sequence = ANDLNI_MASK;
127+ else if (streq (name, "orli"))
128+ opcode->bit_sequence = ORLI_MASK;
129+ else if (streq (name, "xorli"))
130+ opcode->bit_sequence = XORLI_MASK;
131+ }
132+ else
133+ {
134+ opcode->inst_type=INST_TYPE_RD_IMML;
135+ opcode->inst_offset_type = OPCODE_MASK_LIMM;
136+ if (streq (name, "addli"))
137+ opcode->bit_sequence = ADDLI_ONE_REG_MASK;
138+ else if (streq (name, "addlic"))
139+ opcode->bit_sequence = ADDLIC_ONE_REG_MASK;
140+ else if (streq (name, "addlik"))
141+ opcode->bit_sequence = ADDLIK_ONE_REG_MASK;
142+ else if (streq (name, "addlikc"))
143+ opcode->bit_sequence = ADDLIKC_ONE_REG_MASK;
144+ else if (streq (name, "rsubli"))
145+ opcode->bit_sequence = RSUBLI_ONE_REG_MASK;
146+ else if (streq (name, "rsublic"))
147+ opcode->bit_sequence = RSUBLIC_ONE_REG_MASK;
148+ else if (streq (name, "rsublik"))
149+ opcode->bit_sequence = RSUBLIK_ONE_REG_MASK;
150+ else if (streq (name, "rsublikc"))
151+ opcode->bit_sequence = RSUBLIKC_ONE_REG_MASK;
152+ else if (streq (name, "andli"))
153+ opcode->bit_sequence = ANDLI_ONE_REG_MASK;
154+ else if (streq (name, "andnli"))
155+ opcode->bit_sequence = ANDLNI_ONE_REG_MASK;
156+ else if (streq (name, "orli"))
157+ opcode->bit_sequence = ORLI_ONE_REG_MASK;
158+ else if (streq (name, "xorli"))
159+ opcode->bit_sequence = XORLI_ONE_REG_MASK;
160+ }
161+ }
162 inst = opcode->bit_sequence;
163 isize = 4;
164
165@@ -1486,6 +1580,51 @@ md_assemble (char * str)
166 inst |= (immed << IMM_LOW) & IMM15_MASK;
167 break;
168
169+ case INST_TYPE_RD_IMML:
170+ if (strcmp (op_end, ""))
171+ op_end = parse_reg (op_end + 1, &reg1); /* Get rd. */
172+ else
173+ {
174+ as_fatal (_("Error in statement syntax"));
175+ reg1 = 0;
176+ }
177+
178+ if (strcmp (op_end, ""))
179+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
180+ else
181+ as_fatal (_("Error in statement syntax"));
182+
183+ /* Check for spl registers. */
184+ if (check_spl_reg (&reg1))
185+ as_fatal (_("Cannot use special register with this instruction"));
186+ if (exp.X_op != O_constant)
187+ {
188+ char *opc = NULL;
189+ relax_substateT subtype;
190+
191+ if (exp.X_md != 0)
192+ subtype = get_imm_otype(exp.X_md);
193+ else
194+ subtype = opcode->inst_offset_type;
195+
196+ output = frag_var (rs_machine_dependent,
197+ isize * 2,
198+ isize * 2,
199+ subtype,
200+ exp.X_add_symbol,
201+ exp.X_add_number,
202+ (char *) opc);
203+ immedl = 0L;
204+ }
205+ else
206+ {
207+ output = frag_more (isize);
208+ immed = exp.X_add_number;
209+ }
210+ inst |= (reg1 << RD_LOW) & RD_MASK;
211+ inst |= (immed << IMM_LOW) & IMM16_MASK;
212+ break;
213+
214 case INST_TYPE_R1_RFSL:
215 if (strcmp (op_end, ""))
216 op_end = parse_reg (op_end + 1, &reg1); /* Get r1. */
217diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
218index d837ebb38e2..b5a78dcfe09 100644
219--- a/opcodes/microblaze-dis.c
220+++ b/opcodes/microblaze-dis.c
221@@ -130,6 +130,14 @@ get_field_imm15 (struct string_buf *buf, long instr)
222 return p;
223 }
224
225+get_field_imm16 (struct string_buf *buf, long instr)
226+{
227+ char *p = strbuf (buf);
228+
229+ sprintf (p, "%d", (short)((instr & IMM16_MASK) >> IMM_LOW));
230+ return p;
231+}
232+
233 static char *
234 get_field_special (struct string_buf *buf, long instr,
235 const struct op_code_struct *op)
236@@ -457,6 +465,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
237 /* For mbar 16 or sleep insn. */
238 case INST_TYPE_NONE:
239 break;
240+ case INST_TYPE_RD_IMML:
241+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
242+ break;
243 /* For bit field insns. */
244 case INST_TYPE_RD_R1_IMMW_IMMS:
245 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));
246diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
247index 6b25d12dace..82da7f1179a 100644
248--- a/opcodes/microblaze-opc.h
249+++ b/opcodes/microblaze-opc.h
250@@ -69,6 +69,7 @@
251 #define INST_TYPE_RD_R1_IMMW_IMMS 21
252
253 #define INST_TYPE_NONE 25
254+#define INST_TYPE_RD_IMML 26
255
256
257
258@@ -84,6 +85,7 @@
259 #define IMMVAL_MASK_MFS 0x0000
260
261 #define OPCODE_MASK_H 0xFC000000 /* High 6 bits only. */
262+#define OPCODE_MASK_LIMM 0xFC1F0000 /* High 6 bits and 12-16 bits */
263 #define OPCODE_MASK_H1 0xFFE00000 /* High 11 bits. */
264 #define OPCODE_MASK_H2 0xFC1F0000 /* High 6 and bits 20-16. */
265 #define OPCODE_MASK_H12 0xFFFF0000 /* High 16. */
266@@ -106,6 +108,33 @@
267 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
268 #define OPCODE_MASK_H8 0xFF000000 /* High 8 bits only. */
269
270+/*Defines to identify 64-bit single reg instructions */
271+#define ADDLI_ONE_REG_MASK 0x68000000
272+#define ADDLIC_ONE_REG_MASK 0x68020000
273+#define ADDLIK_ONE_REG_MASK 0x68040000
274+#define ADDLIKC_ONE_REG_MASK 0x68060000
275+#define RSUBLI_ONE_REG_MASK 0x68010000
276+#define RSUBLIC_ONE_REG_MASK 0x68030000
277+#define RSUBLIK_ONE_REG_MASK 0x68050000
278+#define RSUBLIKC_ONE_REG_MASK 0x68070000
279+#define ORLI_ONE_REG_MASK 0x68100000
280+#define ANDLI_ONE_REG_MASK 0x68110000
281+#define XORLI_ONE_REG_MASK 0x68120000
282+#define ANDLNI_ONE_REG_MASK 0x68130000
283+#define ADDLI_MASK 0x20000000
284+#define ADDLIC_MASK 0x28000000
285+#define ADDLIK_MASK 0x30000000
286+#define ADDLIKC_MASK 0x38000000
287+#define RSUBLI_MASK 0x24000000
288+#define RSUBLIC_MASK 0x2C000000
289+#define RSUBLIK_MASK 0x34000000
290+#define RSUBLIKC_MASK 0x3C000000
291+#define ANDLI_MASK 0xA4000000
292+#define ANDLNI_MASK 0xAC000000
293+#define ORLI_MASK 0xA0000000
294+#define XORLI_MASK 0xA8000000
295+
296+
297 /* New Mask for msrset, msrclr insns. */
298 #define OPCODE_MASK_H23N 0xFC1F8000 /* High 6 and bits 11 - 16. */
299 /* Mask for mbar insn. */
300@@ -114,7 +143,7 @@
301 #define DELAY_SLOT 1
302 #define NO_DELAY_SLOT 0
303
304-#define MAX_OPCODES 412
305+#define MAX_OPCODES 424
306
307 const struct op_code_struct
308 {
309@@ -444,13 +473,21 @@ const struct op_code_struct
310 {"cmpl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000101, OPCODE_MASK_H4, cmpl, arithmetic_inst },
311 {"cmplu", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x14000103, OPCODE_MASK_H4, cmplu, arithmetic_inst },
312 {"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 */
313+ {"addli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68000000, OPCODE_MASK_LIMM, addli, arithmetic_inst },
314 {"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 */
315+ {"rsubli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68010000, OPCODE_MASK_LIMM, rsubli, arithmetic_inst },
316 {"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 */
317+ {"addlic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68020000, OPCODE_MASK_LIMM, addlic, arithmetic_inst },
318 {"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 */
319+ {"rsublic", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68030000, OPCODE_MASK_LIMM, rsublic, arithmetic_inst },
320 {"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 */
321+ {"addlik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68040000, OPCODE_MASK_LIMM, addlik, arithmetic_inst },
322 {"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 */
323+ {"rsublik", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68050000, OPCODE_MASK_LIMM, rsublik, arithmetic_inst },
324 {"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 */
325+ {"addlikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68060000, OPCODE_MASK_LIMM, addlikc, arithmetic_inst },
326 {"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 */
327+ {"rsublikc", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68070000, OPCODE_MASK_LIMM, rsublikc, arithmetic_inst },
328 {"mull", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x40000100, OPCODE_MASK_H4, mull, mult_inst },
329 {"bslll", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000500, OPCODE_MASK_H3, bslll, barrel_shift_inst },
330 {"bslra", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x44000300, OPCODE_MASK_H3, bslra, barrel_shift_inst },
331@@ -501,9 +538,13 @@ const struct op_code_struct
332 {"beaged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00000, OPCODE_MASK_H14, beaged, branch_inst },
333 {"bealged", INST_TYPE_R1_R2, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x9FA00100, OPCODE_MASK_H14, bealged, branch_inst },
334 {"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 */
335+ {"orli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68100000, OPCODE_MASK_LIMM, orli, arithmetic_inst },
336 {"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 */
337+ {"andli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68110000, OPCODE_MASK_LIMM, andli, arithmetic_inst },
338 {"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 */
339+ {"xorli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68120000, OPCODE_MASK_LIMM, xorli, arithmetic_inst },
340 {"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 */
341+ {"andnli", INST_TYPE_RD_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL,0x68130000, OPCODE_MASK_LIMM, andnli, arithmetic_inst },
342 {"imml", INST_TYPE_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB2000000, OPCODE_MASK_H8, imml, immediate_inst },
343 {"breai", INST_TYPE_IMM, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8010000, OPCODE_MASK_H12, breai, branch_inst },
344 {"breaid", INST_TYPE_IMM, INST_PC_OFFSET, DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8110000, OPCODE_MASK_H12, breaid, branch_inst },
345diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
346index b242ea73c7b..5c44a5ff0ac 100644
347--- a/opcodes/microblaze-opcm.h
348+++ b/opcodes/microblaze-opcm.h
349@@ -62,7 +62,9 @@ enum microblaze_instr
350 eaputd, teaputd, ecaputd, tecaputd, neaputd, tneaputd, necaputd, tnecaputd,
351
352 /* 64-bit instructions */
353- addl, rsubl, addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
354+ addl, addli, addlic, addlik, addlikc, rsubl, rsubli, rsublic, rsublik, rsublikc,
355+ addlc, rsublc, addlk, rsublk, addlkc, rsublkc, cmpl, cmplu, mull,
356+ andli, andnli, orli, xorli,
357 bslll, bslra, bslrl, bsllli, bslrai, bslrli, bslefi, bslifi, orl, andl, xorl,
358 andnl, pcmplbf, pcmpleq, pcmplne, srla, srlc, srll, sextl8, sextl16, sextl32,
359 brea, bread, breald, beaeq, bealeq, beaeqd, bealeqd, beane, bealne, beaned,
360@@ -167,5 +169,6 @@ enum microblaze_instr_type
361
362 /* Imm mask for msrset, msrclr instructions. */
363 #define IMM15_MASK 0x00007FFF
364+#define IMM16_MASK 0x0000FFFF
365
366 #endif /* MICROBLAZE-OPCM */
367--
3682.37.1 (Apple Git-137.1)
369
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
deleted file mode 100644
index 6d0df558..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch
+++ /dev/null
@@ -1,545 +0,0 @@
1From ec5bfe546213b2cb7fe2a51f9f9571597b2c5aa9 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 26 Aug 2019 15:29:42 +0530
4Subject: [PATCH 24/34] [Patch,MicroBlaze] : double imml generation for 64 bit
5 values.
6
7Conflicts:
8 gas/config/tc-microblaze.c
9---
10 gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++-------
11 opcodes/microblaze-opc.h | 4 +-
12 2 files changed, 262 insertions(+), 63 deletions(-)
13
14diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
15index 27544b60ea3..4c455ff02b8 100644
16--- a/gas/config/tc-microblaze.c
17+++ b/gas/config/tc-microblaze.c
18@@ -1008,7 +1008,7 @@ md_assemble (char * str)
19 char * op_start;
20 char * op_end;
21 char * temp_op_end;
22- struct op_code_struct * opcode, *opcode1;
23+ struct op_code_struct * opcode, *opcode1, *opcode2;
24 char * output = NULL;
25 int nlen = 0;
26 int i;
27@@ -1192,7 +1192,12 @@ md_assemble (char * str)
28 reg2 = 0;
29 }
30 if (strcmp (op_end, ""))
31+ {
32+ if(microblaze_arch_size == 64)
33+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
34+ else
35 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
36+ }
37 else
38 as_fatal (_("Error in statement syntax"));
39
40@@ -1292,26 +1297,51 @@ md_assemble (char * str)
41 || streq (name, "lwi") || streq (name, "sbi")
42 || streq (name, "shi") || streq (name, "swi"))))
43 {
44- temp = immed & 0xFFFFFF8000;
45- if (temp != 0 && temp != 0xFFFFFF8000)
46+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
47+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
48 {
49 /* Needs an immediate inst. */
50- opcode1
51- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
52- "imml");
53- if (opcode1 == NULL)
54+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
55+ {
56+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
57+ if (opcode1 == NULL)
58 {
59 as_bad (_("unknown opcode \"%s\""), "imml");
60 return;
61 }
62 inst1 = opcode1->bit_sequence;
63- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
64+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
65 output[0] = INST_BYTE0 (inst1);
66 output[1] = INST_BYTE1 (inst1);
67 output[2] = INST_BYTE2 (inst1);
68 output[3] = INST_BYTE3 (inst1);
69 output = frag_more (isize);
70 }
71+ else
72+ {
73+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
74+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
75+ if (opcode1 == NULL || opcode2 == NULL)
76+ {
77+ as_bad (_("unknown opcode \"%s\""), "imml");
78+ return;
79+ }
80+ inst1 = opcode2->bit_sequence;
81+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
82+ output[0] = INST_BYTE0 (inst1);
83+ output[1] = INST_BYTE1 (inst1);
84+ output[2] = INST_BYTE2 (inst1);
85+ output[3] = INST_BYTE3 (inst1);
86+ output = frag_more (isize);
87+ inst1 = opcode1->bit_sequence;
88+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
89+ output[0] = INST_BYTE0 (inst1);
90+ output[1] = INST_BYTE1 (inst1);
91+ output[2] = INST_BYTE2 (inst1);
92+ output[3] = INST_BYTE3 (inst1);
93+ output = frag_more (isize);
94+ }
95+ }
96 inst |= (reg1 << RD_LOW) & RD_MASK;
97 inst |= (reg2 << RA_LOW) & RA_MASK;
98 inst |= (immed << IMM_LOW) & IMM_MASK;
99@@ -1328,8 +1358,7 @@ md_assemble (char * str)
100 as_bad (_("unknown opcode \"%s\""), "imm");
101 return;
102 }
103-
104- inst1 = opcode1->bit_sequence;
105+ inst1 = opcode1->bit_sequence;
106 inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
107 output[0] = INST_BYTE0 (inst1);
108 output[1] = INST_BYTE1 (inst1);
109@@ -1570,7 +1599,7 @@ md_assemble (char * str)
110 as_fatal (_("Cannot use special register with this instruction"));
111
112 if (exp.X_op != O_constant)
113- as_fatal (_("Symbol used as immediate value for msrset/msrclr instructions"));
114+ as_fatal (_("Symbol used as immediate value for arithmetic long instructions"));
115 else
116 {
117 output = frag_more (isize);
118@@ -1904,6 +1933,7 @@ md_assemble (char * str)
119 temp = immed & 0xFFFF8000;
120 if ((temp != 0) && (temp != 0xFFFF8000))
121 {
122+
123 /* Needs an immediate inst. */
124 opcode1
125 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
126@@ -1936,7 +1966,12 @@ md_assemble (char * str)
127 reg1 = 0;
128 }
129 if (strcmp (op_end, ""))
130+ {
131+ if(microblaze_arch_size == 64)
132+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
133+ else
134 op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
135+ }
136 else
137 as_fatal (_("Error in statement syntax"));
138
139@@ -1975,30 +2010,55 @@ md_assemble (char * str)
140 }
141 if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai"))
142 {
143- temp = immed & 0xFFFFFF8000;
144- if (temp != 0 && temp != 0xFFFFFF8000)
145+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
146+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000)
147 {
148 /* Needs an immediate inst. */
149- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
150+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
151+ {
152+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
153 if (opcode1 == NULL)
154 {
155 as_bad (_("unknown opcode \"%s\""), "imml");
156 return;
157 }
158 inst1 = opcode1->bit_sequence;
159- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
160+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
161 output[0] = INST_BYTE0 (inst1);
162 output[1] = INST_BYTE1 (inst1);
163 output[2] = INST_BYTE2 (inst1);
164 output[3] = INST_BYTE3 (inst1);
165 output = frag_more (isize);
166 }
167+ else {
168+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
169+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
170+ if (opcode1 == NULL || opcode2 == NULL)
171+ {
172+ as_bad (_("unknown opcode \"%s\""), "imml");
173+ return;
174+ }
175+ inst1 = opcode2->bit_sequence;
176+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
177+ output[0] = INST_BYTE0 (inst1);
178+ output[1] = INST_BYTE1 (inst1);
179+ output[2] = INST_BYTE2 (inst1);
180+ output[3] = INST_BYTE3 (inst1);
181+ output = frag_more (isize);
182+ inst1 = opcode1->bit_sequence;
183+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
184+ output[0] = INST_BYTE0 (inst1);
185+ output[1] = INST_BYTE1 (inst1);
186+ output[2] = INST_BYTE2 (inst1);
187+ output[3] = INST_BYTE3 (inst1);
188+ output = frag_more (isize);
189+ }
190+ }
191 inst |= (reg1 << RD_LOW) & RD_MASK;
192 inst |= (immed << IMM_LOW) & IMM_MASK;
193 }
194 else
195 {
196-
197 temp = immed & 0xFFFF8000;
198 if ((temp != 0) && (temp != 0xFFFF8000))
199 {
200@@ -2086,24 +2146,50 @@ md_assemble (char * str)
201 streq (name, "breaid") ||
202 streq (name, "brai") || streq (name, "braid")))
203 {
204- temp = immed & 0xFFFFFF8000;
205+ temp = immed & 0xFFFFFFFFFFFF8000;
206 if (temp != 0)
207 {
208 /* Needs an immediate inst. */
209- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
210+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
211+ {
212+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
213 if (opcode1 == NULL)
214 {
215 as_bad (_("unknown opcode \"%s\""), "imml");
216 return;
217 }
218 inst1 = opcode1->bit_sequence;
219- inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
220+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
221 output[0] = INST_BYTE0 (inst1);
222 output[1] = INST_BYTE1 (inst1);
223 output[2] = INST_BYTE2 (inst1);
224 output[3] = INST_BYTE3 (inst1);
225 output = frag_more (isize);
226 }
227+ else {
228+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
229+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
230+ if (opcode1 == NULL || opcode2 == NULL)
231+ {
232+ as_bad (_("unknown opcode \"%s\""), "imml");
233+ return;
234+ }
235+ inst1 = opcode2->bit_sequence;
236+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
237+ output[0] = INST_BYTE0 (inst1);
238+ output[1] = INST_BYTE1 (inst1);
239+ output[2] = INST_BYTE2 (inst1);
240+ output[3] = INST_BYTE3 (inst1);
241+ output = frag_more (isize);
242+ inst1 = opcode1->bit_sequence;
243+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & 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+ }
250+ }
251 inst |= (immed << IMM_LOW) & IMM_MASK;
252 }
253 else
254@@ -2203,21 +2289,45 @@ md_assemble (char * str)
255 {
256 output = frag_more (isize);
257 immedl = exp.X_add_number;
258-
259- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
260- if (opcode1 == NULL)
261- {
262- as_bad (_("unknown opcode \"%s\""), "imml");
263- return;
264- }
265-
266- inst1 = opcode1->bit_sequence;
267- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
268- output[0] = INST_BYTE0 (inst1);
269- output[1] = INST_BYTE1 (inst1);
270- output[2] = INST_BYTE2 (inst1);
271- output[3] = INST_BYTE3 (inst1);
272- output = frag_more (isize);
273+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
274+ {
275+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
276+ if (opcode1 == NULL)
277+ {
278+ as_bad (_("unknown opcode \"%s\""), "imml");
279+ return;
280+ }
281+ inst1 = opcode1->bit_sequence;
282+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
283+ output[0] = INST_BYTE0 (inst1);
284+ output[1] = INST_BYTE1 (inst1);
285+ output[2] = INST_BYTE2 (inst1);
286+ output[3] = INST_BYTE3 (inst1);
287+ output = frag_more (isize);
288+ }
289+ else {
290+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
291+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
292+ if (opcode2 == NULL || opcode1 == NULL)
293+ {
294+ as_bad (_("unknown opcode \"%s\""), "imml");
295+ return;
296+ }
297+ inst1 = opcode2->bit_sequence;
298+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
299+ output[0] = INST_BYTE0 (inst1);
300+ output[1] = INST_BYTE1 (inst1);
301+ output[2] = INST_BYTE2 (inst1);
302+ output[3] = INST_BYTE3 (inst1);
303+ output = frag_more (isize);
304+ inst1 = opcode1->bit_sequence;
305+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
306+ output[0] = INST_BYTE0 (inst1);
307+ output[1] = INST_BYTE1 (inst1);
308+ output[2] = INST_BYTE2 (inst1);
309+ output[3] = INST_BYTE3 (inst1);
310+ output = frag_more (isize);
311+ }
312 }
313
314 inst |= (reg1 << RD_LOW) & RD_MASK;
315@@ -2266,21 +2376,46 @@ md_assemble (char * str)
316 {
317 output = frag_more (isize);
318 immedl = exp.X_add_number;
319- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
320- if (opcode1 == NULL)
321- {
322- as_bad (_("unknown opcode \"%s\""), "imml");
323- return;
324- }
325-
326+ if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887)
327+ {
328+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
329+ if (opcode1 == NULL)
330+ {
331+ as_bad (_("unknown opcode \"%s\""), "imml");
332+ return;
333+ }
334+ inst1 = opcode1->bit_sequence;
335+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
336+ output[0] = INST_BYTE0 (inst1);
337+ output[1] = INST_BYTE1 (inst1);
338+ output[2] = INST_BYTE2 (inst1);
339+ output[3] = INST_BYTE3 (inst1);
340+ output = frag_more (isize);
341+ }
342+ else {
343+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
344+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
345+ if (opcode2 == NULL || opcode1 == NULL)
346+ {
347+ as_bad (_("unknown opcode \"%s\""), "imml");
348+ return;
349+ }
350+ inst1 = opcode2->bit_sequence;
351+ inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
352+ output[0] = INST_BYTE0 (inst1);
353+ output[1] = INST_BYTE1 (inst1);
354+ output[2] = INST_BYTE2 (inst1);
355+ output[3] = INST_BYTE3 (inst1);
356+ output = frag_more (isize);
357 inst1 = opcode1->bit_sequence;
358- inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
359+ inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
360 output[0] = INST_BYTE0 (inst1);
361 output[1] = INST_BYTE1 (inst1);
362 output[2] = INST_BYTE2 (inst1);
363 output[3] = INST_BYTE3 (inst1);
364 output = frag_more (isize);
365 }
366+ }
367
368 inst |= (reg1 << RA_LOW) & RA_MASK;
369 inst |= (immedl << IMM_LOW) & IMM_MASK;
370@@ -2560,8 +2695,8 @@ md_apply_fix (fixS * fixP,
371 /* Note: use offsetT because it is signed, valueT is unsigned. */
372 offsetT val = (offsetT) * valp;
373 int i;
374- struct op_code_struct * opcode1;
375- unsigned long inst1;
376+ struct op_code_struct * opcode1, * opcode2;
377+ unsigned long inst1,inst2;
378
379 symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
380
381@@ -2743,30 +2878,75 @@ md_apply_fix (fixS * fixP,
382 case BFD_RELOC_MICROBLAZE_64_TEXTREL:
383 case BFD_RELOC_MICROBLAZE_64:
384 case BFD_RELOC_MICROBLAZE_64_PCREL:
385- /* Add an imm instruction. First save the current instruction. */
386- for (i = 0; i < INST_WORD_SIZE; i++)
387- buf[i + INST_WORD_SIZE] = buf[i];
388 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64
389 || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
390 {
391 /* Generate the imm instruction. */
392- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
393+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
394+ {
395+ /* Add an imm instruction. First save the current instruction. */
396+ for (i = 0; i < INST_WORD_SIZE; i++)
397+ buf[i + INST_WORD_SIZE] = buf[i];
398+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
399 if (opcode1 == NULL)
400- {
401- as_bad (_("unknown opcode \"%s\""), "imml");
402- return;
403- }
404+ {
405+ as_bad (_("unknown opcode \"%s\""), "imml");
406+ return;
407+ }
408
409 inst1 = opcode1->bit_sequence;
410 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
411- inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
412+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
413 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
414- fixP->fx_r_type = BFD_RELOC_64;
415+ fixP->fx_r_type = BFD_RELOC_64;
416 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
417- fixP->fx_r_type = BFD_RELOC_64_PCREL;
418+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
419+ buf[0] = INST_BYTE0 (inst1);
420+ buf[1] = INST_BYTE1 (inst1);
421+ buf[2] = INST_BYTE2 (inst1);
422+ buf[3] = INST_BYTE3 (inst1);
423+ }
424+ else {
425+ /* Add an imm instruction. First save the current instruction. */
426+ for (i = 0; i < INST_WORD_SIZE; i++)
427+ buf[i + INST_WORD_SIZE + 4] = buf[i];
428+
429+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
430+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
431+ if (opcode1 == NULL || opcode2 ==NULL)
432+ {
433+ as_bad (_("unknown opcode \"%s\""), "imml");
434+ return;
435+ }
436+ inst1 = opcode2->bit_sequence;
437+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
438+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 40) & IMML_MASK;
439+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
440+ fixP->fx_r_type = BFD_RELOC_64;
441+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
442+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
443+ inst2 = opcode1->bit_sequence;
444+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
445+ inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
446+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
447+ fixP->fx_r_type = BFD_RELOC_64;
448+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
449+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
450+ buf[0] = INST_BYTE0 (inst1);
451+ buf[1] = INST_BYTE1 (inst1);
452+ buf[2] = INST_BYTE2 (inst1);
453+ buf[3] = INST_BYTE3 (inst1);
454+ buf[4] = INST_BYTE0 (inst2);
455+ buf[5] = INST_BYTE1 (inst2);
456+ buf[6] = INST_BYTE2 (inst2);
457+ buf[7] = INST_BYTE3 (inst2);
458+ }
459 }
460 else
461 {
462+ /* Add an imm instruction. First save the current instruction. */
463+ for (i = 0; i < INST_WORD_SIZE; i++)
464+ buf[i + INST_WORD_SIZE] = buf[i];
465 /* Generate the imm instruction. */
466 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
467 if (opcode1 == NULL)
468@@ -2778,12 +2958,11 @@ md_apply_fix (fixS * fixP,
469 inst1 = opcode1->bit_sequence;
470 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
471 inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK;
472- }
473 buf[0] = INST_BYTE0 (inst1);
474 buf[1] = INST_BYTE1 (inst1);
475 buf[2] = INST_BYTE2 (inst1);
476 buf[3] = INST_BYTE3 (inst1);
477-
478+ }
479 /* Add the value only if the symbol is defined. */
480 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
481 {
482@@ -2816,21 +2995,41 @@ md_apply_fix (fixS * fixP,
483 for (i = 0; i < INST_WORD_SIZE; i++)
484 buf[i + INST_WORD_SIZE] = buf[i];
485 /* Generate the imm instruction. */
486- if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
487- opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
488+ if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) {
489+ if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887)
490+ {
491+ for (i = 0; i < INST_WORD_SIZE; i++)
492+ buf[i + INST_WORD_SIZE] = buf[i];
493+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
494+ }
495+ else {
496+ for (i = 0; i < INST_WORD_SIZE; i++)
497+ buf[i + INST_WORD_SIZE + 4] = buf[i];
498+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
499+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
500+ inst2 = opcode2->bit_sequence;
501+
502+ /* We can fixup call to a defined non-global address
503+ * within the same section only. */
504+ buf[4] = INST_BYTE0 (inst2);
505+ buf[5] = INST_BYTE1 (inst2);
506+ buf[6] = INST_BYTE2 (inst2);
507+ buf[7] = INST_BYTE3 (inst2);
508+ }
509+ }
510 else
511 opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
512 if (opcode1 == NULL)
513 {
514+ for (i = 0; i < INST_WORD_SIZE; i++)
515+ buf[i + INST_WORD_SIZE] = buf[i];
516 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC)
517 as_bad (_("unknown opcode \"%s\""), "imml");
518 else
519 as_bad (_("unknown opcode \"%s\""), "imm");
520 return;
521 }
522-
523 inst1 = opcode1->bit_sequence;
524-
525 /* We can fixup call to a defined non-global address
526 within the same section only. */
527 buf[0] = INST_BYTE0 (inst1);
528diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
529index 82da7f1179a..e65f4b58233 100644
530--- a/opcodes/microblaze-opc.h
531+++ b/opcodes/microblaze-opc.h
532@@ -626,8 +626,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.37.1 (Apple Git-137.1)
545
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
deleted file mode 100644
index 74fcea81..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0025-Fixed-bug-in-generation-of-IMML-instruction-for-the.patch
+++ /dev/null
@@ -1,86 +0,0 @@
1From 0ba14f999b266406e7e86fc0e7311ebb275e7b97 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 3 Nov 2021 12:13:32 +0530
4Subject: [PATCH 25/34] Fixed bug in generation of IMML instruction for the
5
6new MB-64 instructions with single register.
7---
8 gas/config/tc-microblaze.c | 50 +++++++++++++++++++++++++++++++++++---
9 1 file changed, 47 insertions(+), 3 deletions(-)
10
11diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
12index 4c455ff02b8..bccaafe296c 100644
13--- a/gas/config/tc-microblaze.c
14+++ b/gas/config/tc-microblaze.c
15@@ -1643,12 +1643,56 @@ md_assemble (char * str)
16 exp.X_add_symbol,
17 exp.X_add_number,
18 (char *) opc);
19- immedl = 0L;
20+ immed = 0L;
21 }
22 else
23 {
24 output = frag_more (isize);
25 immed = exp.X_add_number;
26+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
27+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
28+ {
29+ /* Needs an immediate inst. */
30+ if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
31+ {
32+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
33+ if (opcode1 == NULL)
34+ {
35+ as_bad (_("unknown opcode \"%s\""), "imml");
36+ return;
37+ }
38+ inst1 = opcode1->bit_sequence;
39+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
40+ output[0] = INST_BYTE0 (inst1);
41+ output[1] = INST_BYTE1 (inst1);
42+ output[2] = INST_BYTE2 (inst1);
43+ output[3] = INST_BYTE3 (inst1);
44+ output = frag_more (isize);
45+ }
46+ else {
47+ opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
48+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
49+ if (opcode1 == NULL || opcode2 == NULL)
50+ {
51+ as_bad (_("unknown opcode \"%s\""), "imml");
52+ return;
53+ }
54+ inst1 = opcode2->bit_sequence;
55+ inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK;
56+ output[0] = INST_BYTE0 (inst1);
57+ output[1] = INST_BYTE1 (inst1);
58+ output[2] = INST_BYTE2 (inst1);
59+ output[3] = INST_BYTE3 (inst1);
60+ output = frag_more (isize);
61+ inst1 = opcode1->bit_sequence;
62+ inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK;
63+ output[0] = INST_BYTE0 (inst1);
64+ output[1] = INST_BYTE1 (inst1);
65+ output[2] = INST_BYTE2 (inst1);
66+ output[3] = INST_BYTE3 (inst1);
67+ output = frag_more (isize);
68+ }
69+ }
70 }
71 inst |= (reg1 << RD_LOW) & RD_MASK;
72 inst |= (immed << IMM_LOW) & IMM16_MASK;
73@@ -2146,8 +2190,8 @@ md_assemble (char * str)
74 streq (name, "breaid") ||
75 streq (name, "brai") || streq (name, "braid")))
76 {
77- temp = immed & 0xFFFFFFFFFFFF8000;
78- if (temp != 0)
79+ temp = ((long long)immed) & 0xFFFFFFFFFFFF8000;
80+ if (temp != 0 && temp != 0xFFFFFFFFFFFF8000 && temp != 0x8000)
81 {
82 /* Needs an immediate inst. */
83 if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887)
84--
852.37.1 (Apple Git-137.1)
86
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
deleted file mode 100644
index 8058c6a6..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0026-Patch-MicroBlaze-m64-This-patch-will-remove-imml-0-a.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 6e92cc2429ec37ced6cc70596ad7c6217d25e806 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Thu, 16 Apr 2020 18:08:58 +0530
4Subject: [PATCH 26/34] [Patch,MicroBlaze m64] : This patch will remove imml 0
5 and imml -1 instructions when the offset is less than 16 bit for Type A
6 branch EA instructions.
7
8---
9 gas/config/tc-microblaze.c | 6 ++----
10 1 file changed, 2 insertions(+), 4 deletions(-)
11
12diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
13index bccaafe296c..85509011f8c 100644
14--- a/gas/config/tc-microblaze.c
15+++ b/gas/config/tc-microblaze.c
16@@ -2158,9 +2158,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@@ -2923,7 +2921,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.37.1 (Apple Git-137.1)
38
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
deleted file mode 100644
index 50819300..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0027-Patch-MicroBlaze-improper-address-mapping-of-PROVIDE.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 7f4c17e26065d8194a2512f2982c245afa0e7e40 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Wed, 17 Jun 2020 21:20:26 +0530
4Subject: [PATCH 27/34] [Patch,MicroBlaze] : improper address mapping of
5 PROVIDE directive symbols[DTOR_END] are causing runtime loops and we don't
6 need to override PROVIDE symbols if symbols are defined in libraries and
7 linker so I am disabling override for PROVIDE symbols.
8
9---
10 ld/ldlang.c | 12 +++++++++---
11 1 file changed, 9 insertions(+), 3 deletions(-)
12
13diff --git a/ld/ldlang.c b/ld/ldlang.c
14index f12c09633a7..4a71abc7cbc 100644
15--- a/ld/ldlang.c
16+++ b/ld/ldlang.c
17@@ -3692,10 +3692,16 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
18 plugin_insert = NULL;
19 #endif
20 break;
21+ /* This is from a --defsym on the command line. */
22 case lang_assignment_statement_enum:
23- if (s->assignment_statement.exp->type.node_class != etree_assert)
24- exp_fold_tree_no_dot (s->assignment_statement.exp);
25- break;
26+ if (s->assignment_statement.exp->type.node_class != etree_assert)
27+ {
28+ if(!(s->assignment_statement.exp->assign.defsym) && (s->assignment_statement.exp->type.node_class == etree_provide))
29+ ;
30+ else
31+ exp_fold_tree_no_dot (s->assignment_statement.exp);
32+ }
33+ break;
34 default:
35 break;
36 }
37--
382.37.1 (Apple Git-137.1)
39
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch
deleted file mode 100644
index c7c4f1d1..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0028-Patch-microblaze-Changing-the-long-to-long-long-as-i.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 3e308d91912ade69f914383fd9c13f934da37be4 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilinx.com>
3Date: Tue, 20 Apr 2021 21:22:06 +0530
4Subject: [PATCH 28/34] [Patch, microblaze]:Changing the long to long long as
5 in Windows long is 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---
12 gas/config/tc-microblaze.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
16index 85509011f8c..31677446114 100644
17--- a/gas/config/tc-microblaze.c
18+++ b/gas/config/tc-microblaze.c
19@@ -1017,7 +1017,7 @@ md_assemble (char * str)
20 unsigned reg2;
21 unsigned reg3;
22 unsigned isize;
23- unsigned long immed = 0, immed2 = 0, temp;
24+ unsigned long long immed = 0, immed2 = 0, temp;
25 expressionS exp,exp1;
26 char name[20];
27 long immedl;
28--
292.37.1 (Apple Git-137.1)
30
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0029-gas-revert-moving-of-md_pseudo_table-from-const.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0029-gas-revert-moving-of-md_pseudo_table-from-const.patch
deleted file mode 100644
index 205f04fe..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0029-gas-revert-moving-of-md_pseudo_table-from-const.patch
+++ /dev/null
@@ -1,83 +0,0 @@
1From 24d43f5ce8746c653de7de3fad46915755ba789d Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 21:57:13 +0530
4Subject: [PATCH 29/34] gas: revert moving of md_pseudo_table from const
5
6The base system expect md_pseudo_table to be constant, Changing the
7definition will break other architectures when compiled with a
8unified source code.
9
10Patch reverts the change away from const, and implements a newer
11dynamic handler that passes the correct argument value based on word
12size.
13
14Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
15---
16 gas/config/tc-microblaze.c | 16 +++++++++++++---
17 gas/tc.h | 2 +-
18 2 files changed, 14 insertions(+), 4 deletions(-)
19
20diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
21index 31677446114..6b398ab5605 100644
22--- a/gas/config/tc-microblaze.c
23+++ b/gas/config/tc-microblaze.c
24@@ -385,6 +385,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@@ -392,7 +403,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
43 Integer arg to pass to the function. */
44 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
45 and then in the read.c table. */
46-pseudo_typeS md_pseudo_table[] =
47+const pseudo_typeS md_pseudo_table[] =
48 {
49 {"lcomm", microblaze_s_lcomm, 1},
50 {"data", microblaze_s_data, 0},
51@@ -401,7 +412,7 @@ pseudo_typeS md_pseudo_table[] =
52 {"data32", cons, 4}, /* Same as word. */
53 {"ent", s_func, 0}, /* Treat ent as function entry point. */
54 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
55- {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
56+ {"gpword", microblaze_s_gpword, 0}, /* gpword label => store resolved label address in data section. */
57 {"weakext", microblaze_s_weakext, 0},
58 {"rodata", microblaze_s_rdata, 0},
59 {"sdata2", microblaze_s_rdata, 1},
60@@ -3456,7 +3467,6 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
61 case OPTION_M64:
62 //if (arg != NULL && strcmp (arg, "64") == 0)
63 microblaze_arch_size = 64;
64- md_pseudo_table[7].poc_val = 8;
65 break;
66 default:
67 return 0;
68diff --git a/gas/tc.h b/gas/tc.h
69index bb9a935a353..4a740f9bdd9 100644
70--- a/gas/tc.h
71+++ b/gas/tc.h
72@@ -22,7 +22,7 @@
73 /* In theory (mine, at least!) the machine dependent part of the assembler
74 should only have to include one file. This one. -- JF */
75
76-extern pseudo_typeS md_pseudo_table[];
77+extern const pseudo_typeS md_pseudo_table[];
78
79 const char * md_atof (int, char *, int *);
80 int md_parse_option (int, const char *);
81--
822.37.1 (Apple Git-137.1)
83
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0030-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0030-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
deleted file mode 100644
index bfb65224..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0030-ld-emulparams-elf64microblaze-Fix-emulation-generati.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From 62107ba949fe70e5ae0573147d82cbb52bd1fc08 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 8 Nov 2021 22:01:23 +0530
4Subject: [PATCH 30/34] ld/emulparams/elf64microblaze: Fix emulation generation
5
6Compilation fails when building ld-new with:
7
8ldemul.o:(.data.rel+0x820): undefined reference to `ld_elf64microblazeel_emulation'
9ldemul.o:(.data.rel+0x828): undefined reference to `ld_elf64microblaze_emulation'
10
11The error appears to be that the elf64 files were referencing the elf32 emulation.
12
13Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
14---
15 ld/emulparams/elf64microblaze.sh | 2 +-
16 ld/emulparams/elf64microblazeel.sh | 2 +-
17 2 files changed, 2 insertions(+), 2 deletions(-)
18
19diff --git a/ld/emulparams/elf64microblaze.sh b/ld/emulparams/elf64microblaze.sh
20index 9c7b0eb7080..7b4c7c411bd 100644
21--- a/ld/emulparams/elf64microblaze.sh
22+++ b/ld/emulparams/elf64microblaze.sh
23@@ -19,5 +19,5 @@ NOP=0x80000000
24 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
25 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
26
27-TEMPLATE_NAME=elf32
28+TEMPLATE_NAME=elf
29 #GENERATE_SHLIB_SCRIPT=yes
30diff --git a/ld/emulparams/elf64microblazeel.sh b/ld/emulparams/elf64microblazeel.sh
31index 9c7b0eb7080..7b4c7c411bd 100644
32--- a/ld/emulparams/elf64microblazeel.sh
33+++ b/ld/emulparams/elf64microblazeel.sh
34@@ -19,5 +19,5 @@ NOP=0x80000000
35 #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@}
36 #OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);'
37
38-TEMPLATE_NAME=elf32
39+TEMPLATE_NAME=elf
40 #GENERATE_SHLIB_SCRIPT=yes
41--
422.37.1 (Apple Git-137.1)
43
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch
deleted file mode 100644
index cb31c0d7..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0031-Patch-MicroBlaze-Invalid-data-offsets-pointer-after-.patch
+++ /dev/null
@@ -1,142 +0,0 @@
1From 7bddfaf3ad574aa738ab903f63a345ebde134f9e Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:04:07 +0530
4Subject: [PATCH 31/34] [Patch,MicroBlaze] : Invalid data offsets (pointer)
5 after relaxation. Proposed patch from community member (dednev@rambler.ru)
6 against 2021.1 [CR-1115232]
7
8---
9 bfd/elf32-microblaze.c | 18 ++++++++++++++++++
10 bfd/elf64-microblaze.c | 17 +++++++++++++++++
11 2 files changed, 35 insertions(+)
12
13diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
14index 88ac730582b..588367ebcbb 100644
15--- a/bfd/elf32-microblaze.c
16+++ b/bfd/elf32-microblaze.c
17@@ -2095,6 +2095,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@@ -2136,6 +2139,9 @@ microblaze_elf_relax_section (bfd *abfd,
28 }
29 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
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@@ -2168,6 +2174,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@@ -2205,6 +2214,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@@ -2251,6 +2263,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@@ -2285,6 +2300,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. */
77diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
78index 03fe9eba53a..76aec43ec7a 100644
79--- a/bfd/elf64-microblaze.c
80+++ b/bfd/elf64-microblaze.c
81@@ -2132,6 +2132,8 @@ microblaze_elf_relax_section (bfd *abfd,
82 if (1 && ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
83 {
84 unsigned int val;
85+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
86+ continue;
87
88 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
89
90@@ -2174,6 +2176,9 @@ microblaze_elf_relax_section (bfd *abfd,
91 if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32
92 || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64)
93 {
94+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
95+ continue;
96+
97 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
98
99 /* Look at the reloc only if the value has been resolved. */
100@@ -2206,6 +2211,9 @@ microblaze_elf_relax_section (bfd *abfd,
101 }
102 else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_SYM_OP_SYM)
103 {
104+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
105+ continue;
106+
107 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
108
109 /* Look at the reloc only if the value has been resolved. */
110@@ -2243,6 +2251,9 @@ microblaze_elf_relax_section (bfd *abfd,
111 || (ELF32_R_TYPE (irelscan->r_info)
112 == (int) R_MICROBLAZE_TEXTREL_32_LO))
113 {
114+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
115+ continue;
116+
117 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
118
119 /* Look at the reloc only if the value has been resolved. */
120@@ -2288,6 +2299,9 @@ microblaze_elf_relax_section (bfd *abfd,
121 if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64
122 || (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_TEXTREL_64))
123 {
124+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
125+ continue;
126+
127 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
128
129 /* Look at the reloc only if the value has been resolved. */
130@@ -2336,6 +2350,9 @@ microblaze_elf_relax_section (bfd *abfd,
131 }
132 else if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_PCREL)
133 {
134+ if (ELF64_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info)
135+ continue;
136+
137 isym = isymbuf + ELF64_R_SYM (irelscan->r_info);
138
139 /* Look at the reloc only if the value has been resolved. */
140--
1412.37.1 (Apple Git-137.1)
142
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0032-Patch-MicroBlaze-Double-free-with-ld-no-keep-memory.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0032-Patch-MicroBlaze-Double-free-with-ld-no-keep-memory.patch
deleted file mode 100644
index e9556bf5..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0032-Patch-MicroBlaze-Double-free-with-ld-no-keep-memory.patch
+++ /dev/null
@@ -1,195 +0,0 @@
1From 70268d8d38851d06bd66f9c7cc85865f2f3c0e48 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Mon, 24 Jan 2022 16:59:19 +0530
4Subject: [PATCH 32/34] [Patch,MicroBlaze] : Double free with ld
5 --no-keep-memory. Proposed patches from the community member
6 (dednev@rambler.ru) for 2021.1. [CR-1115233]
7
8Conflicts:
9 bfd/elf32-microblaze.c
10 bfd/elf64-microblaze.c
11---
12 bfd/elf32-microblaze.c | 40 ++++++++++++++++++++++------------------
13 bfd/elf64-microblaze.c | 38 ++++++++++++++++++++------------------
14 2 files changed, 42 insertions(+), 36 deletions(-)
15
16diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
17index 588367ebcbb..28589db662f 100644
18--- a/bfd/elf32-microblaze.c
19+++ b/bfd/elf32-microblaze.c
20@@ -1800,10 +1800,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@@ -1847,8 +1845,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@@ -1876,7 +1872,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@@ -2396,25 +2391,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@@ -2428,8 +2424,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;
105diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
106index 76aec43ec7a..77872cef1ab 100644
107--- a/bfd/elf64-microblaze.c
108+++ b/bfd/elf64-microblaze.c
109@@ -1840,10 +1840,8 @@ microblaze_elf_relax_section (bfd *abfd,
110 {
111 Elf_Internal_Shdr *symtab_hdr;
112 Elf_Internal_Rela *internal_relocs;
113- Elf_Internal_Rela *free_relocs = NULL;
114 Elf_Internal_Rela *irel, *irelend;
115 bfd_byte *contents = NULL;
116- bfd_byte *free_contents = NULL;
117 int rel_count;
118 unsigned int shndx;
119 size_t i, sym_index;
120@@ -1887,8 +1885,6 @@ microblaze_elf_relax_section (bfd *abfd,
121 internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL, link_info->keep_memory);
122 if (internal_relocs == NULL)
123 goto error_return;
124- if (! link_info->keep_memory)
125- free_relocs = internal_relocs;
126
127 sdata->relax_count = 0;
128 sdata->relax = (struct relax_table *) bfd_malloc ((sec->reloc_count + 1)
129@@ -1916,8 +1912,6 @@ microblaze_elf_relax_section (bfd *abfd,
130 contents = (bfd_byte *) bfd_malloc (sec->size);
131 if (contents == NULL)
132 goto error_return;
133- free_contents = contents;
134-
135 if (!bfd_get_section_contents (abfd, sec, contents,
136 (file_ptr) 0, sec->size))
137 goto error_return;
138@@ -2449,25 +2443,26 @@ microblaze_elf_relax_section (bfd *abfd,
139 }
140
141 elf_section_data (sec)->relocs = internal_relocs;
142- free_relocs = NULL;
143
144 elf_section_data (sec)->this_hdr.contents = contents;
145- free_contents = NULL;
146
147 symtab_hdr->contents = (bfd_byte *) isymbuf;
148 }
149
150- free (free_relocs);
151- free_relocs = NULL;
152+ if (internal_relocs != NULL
153+ && elf_section_data (sec)->relocs != internal_relocs)
154+ free (internal_relocs);
155
156- if (free_contents != NULL)
157+ if (contents != NULL
158+ && elf_section_data (sec)->this_hdr.contents != contents)
159 {
160- if (!link_info->keep_memory)
161- free (free_contents);
162+ if (! link_info->keep_memory)
163+ free (contents);
164 else
165- /* Cache the section contents for elf_link_input_bfd. */
166- elf_section_data (sec)->this_hdr.contents = contents;
167- free_contents = NULL;
168+ {
169+ /* Cache the section contents for elf_link_input_bfd. */
170+ elf_section_data (sec)->this_hdr.contents = contents;
171+ }
172 }
173
174 if (sdata->relax_count == 0)
175@@ -2481,8 +2476,15 @@ microblaze_elf_relax_section (bfd *abfd,
176 return true;
177
178 error_return:
179- free (free_relocs);
180- free (free_contents);
181+ if (isymbuf != NULL
182+ && symtab_hdr->contents != (unsigned char *) isymbuf)
183+ free (isymbuf);
184+ if (internal_relocs != NULL
185+ && elf_section_data (sec)->relocs != internal_relocs)
186+ free (internal_relocs);
187+ if (contents != NULL
188+ && elf_section_data (sec)->this_hdr.contents != contents)
189+ free (contents);
190 free (sdata->relax);
191 sdata->relax = NULL;
192 sdata->relax_count = 0;
193--
1942.37.1 (Apple Git-137.1)
195
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Patch-MB-MB-binutils-Upstream-port-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0033-Patch-MB-MB-binutils-Upstream-port-issues.patch
deleted file mode 100644
index f70ca3f2..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0033-Patch-MB-MB-binutils-Upstream-port-issues.patch
+++ /dev/null
@@ -1,536 +0,0 @@
1From 5b79b9fe7da091664680b86e3b09bc4b926e2e61 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sun, 28 Nov 2021 17:17:15 +0530
4Subject: [PATCH 33/34] [Patch,MB]: MB binutils Upstream port issues.
5
6It's resolving the seg faults with ADDLIK
7Conflicts:
8 bfd/elf64-microblaze.c
9---
10 bfd/elf64-microblaze.c | 248 ++++++++++++++++++++++++++++---------
11 gas/config/tc-microblaze.c | 2 +-
12 opcodes/microblaze-dis.c | 12 +-
13 opcodes/microblaze-opc.h | 2 +-
14 4 files changed, 197 insertions(+), 67 deletions(-)
15
16diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
17index 77872cef1ab..119d266f95a 100644
18--- a/bfd/elf64-microblaze.c
19+++ b/bfd/elf64-microblaze.c
20@@ -807,12 +807,35 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
21 return _bfd_elf_is_local_label_name (abfd, name);
22 }
23
24+/* The microblaze linker (like many others) needs to keep track of
25+ the number of relocs that it decides to copy as dynamic relocs in
26+ check_relocs for each symbol. This is so that it can later discard
27+ them if they are found to be unnecessary. We store the information
28+ in a field extending the regular ELF linker hash table. */
29+
30+struct elf64_mb_dyn_relocs
31+{
32+ struct elf64_mb_dyn_relocs *next;
33+
34+ /* The input section of the reloc. */
35+ asection *sec;
36+
37+ /* Total number of relocs copied for the input section. */
38+ bfd_size_type count;
39+
40+ /* Number of pc-relative relocs copied for the input section. */
41+ bfd_size_type pc_count;
42+};
43+
44 /* ELF linker hash entry. */
45
46 struct elf64_mb_link_hash_entry
47 {
48 struct elf_link_hash_entry elf;
49
50+ /* Track dynamic relocs copied for this symbol. */
51+ struct elf64_mb_dyn_relocs *dyn_relocs;
52+
53 /* TLS Reference Types for the symbol; Updated by check_relocs */
54 #define TLS_GD 1 /* GD reloc. */
55 #define TLS_LD 2 /* LD reloc. */
56@@ -836,6 +859,18 @@ struct elf64_mb_link_hash_table
57 {
58 struct elf_link_hash_table elf;
59
60+ /* Short-cuts to get to dynamic linker sections. */
61+ asection *sgot;
62+ asection *sgotplt;
63+ asection *srelgot;
64+ asection *splt;
65+ asection *srelplt;
66+ asection *sdynbss;
67+ asection *srelbss;
68+
69+ /* Small local sym to section mapping cache. */
70+ struct sym_cache sym_sec;
71+
72 /* TLS Local Dynamic GOT Entry */
73 union {
74 bfd_signed_vma refcount;
75@@ -1376,8 +1411,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
76 /* Need to generate relocs ? */
77 if ((bfd_link_pic (info) || indx != 0)
78 && (h == NULL
79- || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
80- && !resolved_to_zero)
81+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
82 || h->root.type != bfd_link_hash_undefweak))
83 need_relocs = true;
84
85@@ -1564,13 +1598,11 @@ microblaze_elf_relocate_section (bfd *output_bfd,
86 contents + offset + endian);
87 }
88 else
89- {
90- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
91- contents + offset + endian);
92- bfd_put_16 (input_bfd, relocation & 0xffff,
93- contents + offset + endian + INST_WORD_SIZE);
94+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
95+ contents + offset + endian);
96+ bfd_put_16 (input_bfd, relocation & 0xffff,
97+ contents + offset + endian + INST_WORD_SIZE);
98 }
99- }
100 break;
101 }
102
103@@ -1660,9 +1692,16 @@ microblaze_elf_relocate_section (bfd *output_bfd,
104 else
105 {
106 if (r_type == R_MICROBLAZE_64_PCREL)
107+ {
108+ if (!input_section->output_section->vma &&
109+ !input_section->output_offset && !offset)
110+ relocation -= (input_section->output_section->vma
111+ + input_section->output_offset
112+ + offset);
113+ else
114 relocation -= (input_section->output_section->vma
115- + input_section->output_offset
116- + offset + INST_WORD_SIZE);
117+ + input_section->output_offset + offset + INST_WORD_SIZE);
118+ }
119 else if (r_type == R_MICROBLAZE_TEXTREL_64
120 || r_type == R_MICROBLAZE_TEXTREL_32_LO)
121 relocation -= input_section->output_section->vma;
122@@ -1681,14 +1720,11 @@ microblaze_elf_relocate_section (bfd *output_bfd,
123 contents + offset + endian);
124 }
125 else
126- {
127- bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
128- contents + offset + endian);
129- bfd_put_16 (input_bfd, relocation & 0xffff,
130- contents + offset + endian
131- + INST_WORD_SIZE);
132- }
133- }
134+ bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
135+ contents + offset + endian);
136+ bfd_put_16 (input_bfd, relocation & 0xffff,
137+ contents + offset + endian + INST_WORD_SIZE);
138+ }
139 break;
140 }
141 }
142@@ -1759,6 +1795,21 @@ microblaze_elf_relocate_section (bfd *output_bfd,
143
144 return ret;
145 }
146+
147+/* Merge backend specific data from an object file to the output
148+ object file when linking.
149+
150+ Note: We only use this hook to catch endian mismatches. */
151+static bool
152+microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
153+{
154+ /* Check if we have the same endianess. */
155+ if (! _bfd_generic_verify_endian_match (ibfd, obfd))
156+ return false;
157+
158+ return true;
159+}
160+
161
162 /* Calculate fixup value for reference. */
163
164@@ -2512,6 +2563,17 @@ microblaze_elf_gc_mark_hook (asection *sec,
165 return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
166 }
167
168+/* Update the got entry reference counts for the section being removed. */
169+
170+static bool
171+microblaze_elf_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED,
172+ struct bfd_link_info * info ATTRIBUTE_UNUSED,
173+ asection * sec ATTRIBUTE_UNUSED,
174+ const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
175+{
176+ return true;
177+}
178+
179 /* PIC support. */
180
181 #define PLT_ENTRY_SIZE 16
182@@ -2718,14 +2780,14 @@ microblaze_elf_check_relocs (bfd * abfd,
183 && (! info->symbolic
184 || h->root.type == bfd_link_hash_defweak
185 || !h->def_regular))))
186- || (!bfd_link_pic (info)
187- && (sec->flags & SEC_ALLOC) != 0
188- && h != NULL
189- && (h->root.type == bfd_link_hash_defweak
190- || !h->def_regular)))
191- {
192- struct elf_dyn_relocs *p;
193- struct elf_dyn_relocs **head;
194+ || (!bfd_link_pic (info)
195+ && (sec->flags & SEC_ALLOC) != 0
196+ && h != NULL
197+ && (h->root.type == bfd_link_hash_defweak
198+ || !h->def_regular)))
199+ {
200+ struct elf64_mb_dyn_relocs *p;
201+ struct elf64_mb_dyn_relocs **head;
202
203 /* When creating a shared object, we must copy these
204 relocs into the output file. We create a reloc
205@@ -2769,14 +2831,14 @@ microblaze_elf_check_relocs (bfd * abfd,
206 return false;
207
208 vpp = &elf_section_data (s)->local_dynrel;
209- head = (struct elf_dyn_relocs **) vpp;
210+ head = (struct elf64_mb_dyn_relocs **) vpp;
211 }
212
213 p = *head;
214 if (p == NULL || p->sec != sec)
215 {
216 size_t amt = sizeof *p;
217- p = ((struct elf_dyn_relocs *)
218+ p = ((struct elf64_mb_dyn_relocs *)
219 bfd_alloc (htab->elf.dynobj, amt));
220 if (p == NULL)
221 return false;
222@@ -2799,6 +2861,34 @@ microblaze_elf_check_relocs (bfd * abfd,
223 return true;
224 }
225
226+static bool
227+microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
228+{
229+ struct elf64_mb_link_hash_table *htab;
230+
231+ htab = elf64_mb_hash_table (info);
232+ if (htab == NULL)
233+ return false;
234+
235+ if (!htab->sgot && !_bfd_elf_create_got_section (dynobj, info))
236+ return false;
237+
238+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
239+ return false;
240+
241+ htab->splt = bfd_get_linker_section (dynobj, ".plt");
242+ htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
243+ htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
244+ if (!bfd_link_pic (info))
245+ htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
246+
247+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
248+ || (!bfd_link_pic (info) && !htab->srelbss))
249+ abort ();
250+
251+ return true;
252+}
253+
254 /* Copy the extra info we tack onto an elf_link_hash_entry. */
255
256 static void
257@@ -2811,6 +2901,40 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
258 edir = (struct elf64_mb_link_hash_entry *) dir;
259 eind = (struct elf64_mb_link_hash_entry *) ind;
260
261+ if (eind->dyn_relocs != NULL)
262+ {
263+ if (edir->dyn_relocs != NULL)
264+ {
265+ struct elf64_mb_dyn_relocs **pp;
266+ struct elf64_mb_dyn_relocs *p;
267+
268+ if (ind->root.type == bfd_link_hash_indirect)
269+ abort ();
270+
271+ /* Add reloc counts against the weak sym to the strong sym
272+ list. Merge any entries against the same section. */
273+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
274+ {
275+ struct elf64_mb_dyn_relocs *q;
276+
277+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
278+ if (q->sec == p->sec)
279+ {
280+ q->pc_count += p->pc_count;
281+ q->count += p->count;
282+ *pp = p->next;
283+ break;
284+ }
285+ if (q == NULL)
286+ pp = &p->next;
287+ }
288+ *pp = edir->dyn_relocs;
289+ }
290+
291+ edir->dyn_relocs = eind->dyn_relocs;
292+ eind->dyn_relocs = NULL;
293+ }
294+
295 edir->tls_mask |= eind->tls_mask;
296
297 _bfd_elf_link_hash_copy_indirect (info, dir, ind);
298@@ -2821,8 +2945,12 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
299 struct elf_link_hash_entry *h)
300 {
301 struct elf64_mb_link_hash_table *htab;
302+ struct elf64_mb_link_hash_entry * eh;
303+ struct elf64_mb_dyn_relocs *p;
304+ asection *sdynbss;
305 asection *s, *srel;
306 unsigned int power_of_two;
307+ bfd *dynobj;
308
309 htab = elf64_mb_hash_table (info);
310 if (htab == NULL)
311@@ -2892,9 +3020,17 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
312 return true;
313 }
314
315- /* If we don't find any dynamic relocs in read-only sections, then
316+ eh = (struct elf64_mb_link_hash_entry *) h;
317+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
318+ {
319+ s = p->sec->output_section;
320+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
321+ break;
322+ }
323+
324+ /* If we didn't find any dynamic relocs in read-only sections, then
325 we'll be keeping the dynamic relocs and avoiding the copy reloc. */
326- if (!_bfd_elf_readonly_dynrelocs (h))
327+ if (p == NULL)
328 {
329 h->non_got_ref = 0;
330 return true;
331@@ -2913,19 +3049,11 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
332 /* We must generate a R_MICROBLAZE_COPY reloc to tell the dynamic linker
333 to copy the initial value out of the dynamic object and into the
334 runtime process image. */
335- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
336- {
337- s = htab->elf.sdynrelro;
338- srel = htab->elf.sreldynrelro;
339- }
340- else
341- {
342- s = htab->elf.sdynbss;
343- srel = htab->elf.srelbss;
344- }
345+ dynobj = elf_hash_table (info)->dynobj;
346+ BFD_ASSERT (dynobj != NULL);
347 if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
348 {
349- srel->size += sizeof (Elf64_External_Rela);
350+ htab->srelbss->size += sizeof (Elf64_External_Rela);
351 h->needs_copy = 1;
352 }
353
354@@ -2935,11 +3063,12 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
355 if (power_of_two > 3)
356 power_of_two = 3;
357
358+ sdynbss = htab->sdynbss;
359 /* Apply the required alignment. */
360- s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
361- if (power_of_two > s->alignment_power)
362+ sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
363+ if (power_of_two > sdynbss->alignment_power)
364 {
365- if (!bfd_set_section_alignment (s, power_of_two))
366+ if (! bfd_set_section_alignment (sdynbss, power_of_two))
367 return false;
368 }
369
370@@ -2961,7 +3090,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
371 struct bfd_link_info *info;
372 struct elf64_mb_link_hash_table *htab;
373 struct elf64_mb_link_hash_entry *eh;
374- struct elf_dyn_relocs *p;
375+ struct elf64_mb_dyn_relocs *p;
376
377 if (h->root.type == bfd_link_hash_indirect)
378 return true;
379@@ -3013,7 +3142,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
380 htab->elf.sgotplt->size += 4;
381
382 /* We also need to make an entry in the .rel.plt section. */
383- htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
384+ htab->elf.srelplt->size += sizeof (Elf64_External_Rela);
385 }
386 else
387 {
388@@ -3079,7 +3208,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
389 else
390 h->got.offset = (bfd_vma) -1;
391
392- if (h->dyn_relocs == NULL)
393+ if (eh->dyn_relocs == NULL)
394 return true;
395
396 /* In the shared -Bsymbolic case, discard space allocated for
397@@ -3094,9 +3223,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
398 && (h->forced_local
399 || info->symbolic))
400 {
401- struct elf_dyn_relocs **pp;
402+ struct elf64_mb_dyn_relocs **pp;
403
404- for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
405+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
406 {
407 p->count -= p->pc_count;
408 p->pc_count = 0;
409@@ -3188,7 +3317,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
410 {
411 struct elf_dyn_relocs *p;
412
413- for (p = ((struct elf_dyn_relocs *)
414+ for (p = ((struct elf64_mb_dyn_relocs *)
415 elf_section_data (s)->local_dynrel);
416 p != NULL;
417 p = p->next)
418@@ -3666,13 +3795,14 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
419 #define bfd_elf64_new_section_hook microblaze_elf_new_section_hook
420 #define elf_backend_relocate_section microblaze_elf_relocate_section
421 #define bfd_elf64_bfd_relax_section microblaze_elf_relax_section
422-#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match
423+#define bfd_elf64_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data
424 #define bfd_elf64_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup
425
426 #define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook
427-#define elf_backend_check_relocs microblaze_elf_check_relocs
428-#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
429-#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
430+#define elf_backend_gc_sweep_hook microblaze_elf_gc_sweep_hook
431+#define elf_backend_check_relocs microblaze_elf_check_relocs
432+#define elf_backend_copy_indirect_symbol microblaze_elf_copy_indirect_symbol
433+#define bfd_elf64_bfd_link_hash_table_create microblaze_elf_link_hash_table_create
434 #define elf_backend_can_gc_sections 1
435 #define elf_backend_can_refcount 1
436 #define elf_backend_want_got_plt 1
437@@ -3682,11 +3812,11 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
438 #define elf_backend_rela_normal 1
439 #define elf_backend_dtrel_excludes_plt 1
440
441-#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
442-#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
443-#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
444-#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
445-#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
446+#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
447+#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections
448+#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
449+#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
450+#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
451 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
452
453 #include "elf64-target.h"
454diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
455index 6b398ab5605..c4a3817bf19 100644
456--- a/gas/config/tc-microblaze.c
457+++ b/gas/config/tc-microblaze.c
458@@ -433,7 +433,7 @@ const pseudo_typeS md_pseudo_table[] =
459 void
460 md_begin (void)
461 {
462- const struct op_code_struct * opcode;
463+ struct op_code_struct * opcode;
464 const char *prev_name = "";
465
466 opcode_hash_control = str_htab_create ();
467diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
468index b5a78dcfe09..b76a5935a34 100644
469--- a/opcodes/microblaze-dis.c
470+++ b/opcodes/microblaze-dis.c
471@@ -140,7 +140,7 @@ get_field_imm16 (struct string_buf *buf, long instr)
472
473 static char *
474 get_field_special (struct string_buf *buf, long instr,
475- const struct op_code_struct *op)
476+ struct op_code_struct *op)
477 {
478 char *p = strbuf (buf);
479 char *spr;
480@@ -213,11 +213,11 @@ get_field_special (struct string_buf *buf, long instr,
481 static unsigned long
482 read_insn_microblaze (bfd_vma memaddr,
483 struct disassemble_info *info,
484- const struct op_code_struct **opr)
485+ struct op_code_struct **opr)
486 {
487 unsigned char ibytes[4];
488 int status;
489- const struct op_code_struct *op;
490+ struct op_code_struct *op;
491 unsigned long inst;
492
493 status = info->read_memory_func (memaddr, ibytes, 4, info);
494@@ -253,7 +253,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
495 fprintf_ftype print_func = info->fprintf_func;
496 void *stream = info->stream;
497 unsigned long inst, prev_inst;
498- const struct op_code_struct *op, *pop;
499+ struct op_code_struct *op, *pop;
500 int immval = 0;
501 bool immfound = false;
502 static bfd_vma prev_insn_addr = -1; /* Init the prev insn addr. */
503@@ -497,7 +497,7 @@ get_insn_microblaze (long inst,
504 enum microblaze_instr_type *insn_type,
505 short *delay_slots)
506 {
507- const struct op_code_struct *op;
508+ struct op_code_struct *op;
509 *isunsignedimm = false;
510
511 /* Just a linear search of the table. */
512@@ -539,7 +539,7 @@ microblaze_get_target_address (long inst, bool immfound, int immval,
513 bool *targetvalid,
514 bool *unconditionalbranch)
515 {
516- const struct op_code_struct *op;
517+ struct op_code_struct *op;
518 long targetaddr = 0;
519
520 *unconditionalbranch = false;
521diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
522index e65f4b58233..4a415495113 100644
523--- a/opcodes/microblaze-opc.h
524+++ b/opcodes/microblaze-opc.h
525@@ -145,7 +145,7 @@
526
527 #define MAX_OPCODES 424
528
529-const struct op_code_struct
530+struct op_code_struct
531 {
532 const char * name;
533 short inst_type; /* Registers and immediate values involved. */
534--
5352.37.1 (Apple Git-137.1)
536
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Patch-MicroBlaze-By-default-the-linker-will-generate.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0034-Patch-MicroBlaze-By-default-the-linker-will-generate.patch
deleted file mode 100644
index 4428823f..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0034-Patch-MicroBlaze-By-default-the-linker-will-generate.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 652c69cca5a9da92369378674707cdc59988bcc3 Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Fri, 28 Oct 2022 13:57:48 +0530
4Subject: [PATCH 34/34] [Patch,MicroBlaze] : By default the linker will
5 generate warnings if it is creating an executable stack or a segment with
6 all three of read, write and execute permissions. These settings are not
7 appropriate for all targets
8
9---
10 ld/configure.tgt | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/ld/configure.tgt b/ld/configure.tgt
14index 80ffbcf23b3..198cd0f71e4 100644
15--- a/ld/configure.tgt
16+++ b/ld/configure.tgt
17@@ -55,6 +55,7 @@ if test "${ac_default_ld_warn_rwx_segments}" = unset; then
18 cris-*-* | crisv32-*-* | \
19 hppa*-*-* | \
20 mips*-*-* | \
21+ microblaze*-*-* | \
22 sparc*-*-*)
23 ac_default_ld_warn_rwx_segments=0
24 ;;
25--
262.37.1 (Apple Git-137.1)
27
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-for-objdump-issue-for-mb32-el.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-for-objdump-issue-for-mb32-el.patch
deleted file mode 100644
index b63d368a..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0035-Fix-for-objdump-issue-for-mb32-el.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From f070f81107d4b1e497207c1668f079dabb0b4417 Mon Sep 17 00:00:00 2001
2From: Aayush Misra <aayushm@amd.com>
3Date: Mon, 24 Jul 2023 21:49:14 +0530
4Subject: [PATCH 35/36] Fix for objdump issue for mb32-el
5
6---
7 opcodes/microblaze-dis.c | 7 ++++---
8 1 file changed, 4 insertions(+), 3 deletions(-)
9
10diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
11index b76a5935a34..237a6081377 100644
12--- a/opcodes/microblaze-dis.c
13+++ b/opcodes/microblaze-dis.c
14@@ -36,7 +36,7 @@
15 #define get_int_field_imml(instr) ((instr & IMML_MASK) >> IMM_LOW)
16 #define get_int_field_r1(instr) ((instr & RA_MASK) >> RA_LOW)
17
18-#define NUM_STRBUFS 3
19+#define NUM_STRBUFS 4
20 #define STRBUF_SIZE 25
21
22 struct string_buf
23@@ -466,8 +466,9 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
24 case INST_TYPE_NONE:
25 break;
26 case INST_TYPE_RD_IMML:
27- print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
28- break;
29+ if(info->insn_type != dis_noninsn)
30+ print_func (stream, "\t%s, %s", get_field_rd (&buf, inst), get_field_imm16 (&buf, inst));
31+ break;
32 /* For bit field insns. */
33 case INST_TYPE_RD_R1_IMMW_IMMS:
34 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));
35--
362.34.1
37
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-for-missing-instructions-in-dump.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-for-missing-instructions-in-dump.patch
deleted file mode 100644
index e48dfe84..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0036-Fix-for-missing-instructions-in-dump.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 834cc7ca420d3fb783fb813b336e76960eb5b28e Mon Sep 17 00:00:00 2001
2From: Aayush Misra <aayushm@amd.com>
3Date: Thu, 28 Mar 2024 16:33:40 +0530
4Subject: [PATCH 36/36] Fix for missing instructions in dump
5
6---
7 opcodes/microblaze-dis.c | 4 ++--
8 1 file changed, 2 insertions(+), 2 deletions(-)
9
10diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
11index 237a6081377..a83e00e282b 100644
12--- a/opcodes/microblaze-dis.c
13+++ b/opcodes/microblaze-dis.c
14@@ -266,7 +266,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
15
16 inst = read_insn_microblaze (memaddr, info, &op);
17 if (inst == 0)
18- return -1;
19+ return 4;
20
21 if (prev_insn_vma == curr_insn_vma)
22 {
23@@ -274,7 +274,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info)
24 {
25 prev_inst = read_insn_microblaze (prev_insn_addr, info, &pop);
26 if (prev_inst == 0)
27- return -1;
28+ return 4;
29 if (pop->instr == imm)
30 {
31 immval = (get_int_field_imm (prev_inst) << 16) & 0xffff0000;
32--
332.34.1
34
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc
new file mode 100644
index 00000000..0dbbecad
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc
@@ -0,0 +1,114 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4
5PV = "12.2.0"
6
7# BINV should be incremented to a revision after a minor gcc release
8
9BINV = "12.2.0"
10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
12
13DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
15
16LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
17
18LIC_FILES_CHKSUM = "\
19 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
20 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
21 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
24"
25# from git
26#RELEASE ?= "7092b7aea122a91824d048aeb23834cf1d19b1a1"
27#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]}"
29
30# from snapshot
31#RELEASE ?= "12.1.0-RC-20220429"
32#SOURCEDIR ?= "gcc-${RELEASE}"
33#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
34
35# official release
36RELEASE ?= "${PV}"
37BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
38SOURCEDIR ?= "gcc-${PV}"
39
40SRC_URI = "${BASEURI} \
41 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
42 file://0002-gcc-poison-system-directories.patch \
43 file://0003-64-bit-multilib-hack.patch \
44 file://0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch \
45 file://0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
46 file://0006-cpp-honor-sysroot.patch \
47 file://0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
48 file://0008-libtool.patch \
49 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 \
51 file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
52 file://0013-Ensure-target-gcc-headers-can-be-included.patch \
53 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 \
55 file://0016-handle-sysroot-support-for-nativesdk-gcc.patch \
56 file://0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
57 file://0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
58 file://0019-Re-introduce-spe-commandline-options.patch \
59 file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
60 file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
61 file://0023-libatomic-Do-not-enforce-march-on-aarch64.patch \
62 file://0024-Fix-install-path-of-linux64.h.patch \
63 file://0026-rust-recursion-limit.patch \
64 file://prefix-map-realpath.patch \
65 file://hardcoded-paths.patch \
66"
67SRC_URI[sha256sum] = "e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff"
68
69S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
70B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
71
72# Language Overrides
73FORTRAN = ""
74JAVA = ""
75
76SSP ?= "--disable-libssp"
77SSP:mingw32 = "--enable-libssp"
78
79EXTRA_OECONF_BASE = "\
80 ${SSP} \
81 --enable-libitm \
82 --enable-lto \
83 --disable-bootstrap \
84 --with-system-zlib \
85 ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
86 --enable-linker-build-id \
87 --with-ppl=no \
88 --with-cloog=no \
89 --enable-checking=release \
90 --enable-cheaders=c_global \
91 --without-isl \
92"
93
94EXTRA_OECONF_INITIAL = "\
95 --disable-libgomp \
96 --disable-libitm \
97 --disable-libquadmath \
98 --with-system-zlib \
99 --disable-lto \
100 --disable-plugin \
101 --enable-linker-build-id \
102 --enable-decimal-float=no \
103 --without-isl \
104 --disable-libssp \
105"
106
107EXTRA_OECONF_PATHS = "\
108 --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
109 --with-sysroot=/not/exist \
110 --with-build-sysroot=${STAGING_DIR_TARGET} \
111"
112
113# Is a binutils 2.26 issue, not gcc
114CVE_CHECK_IGNORE += "CVE-2021-37322"
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-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch
index 1099a0e8..f8985752 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0001-LOCAL-Testsuite-builtins-tests-require-fpic.patch
@@ -2,6 +2,8 @@ From 376b0ee790231a99fe50b50e20070c104bbba0d8 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/53] LOCAL]: Testsuite - builtins tests require fpic
5Upstream-Status: Pending
6
5 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 7 Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
6 8
7Conflicts: 9Conflicts:
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-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch
index 061dfc86..5302b942 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-12/0002-LOCAL-Quick-fail-g-.dg-opt-memcpy1.C.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 02/53] [LOCAL]: Quick fail g++.dg/opt/memcpy1.C This
6 for microblaze. This speeds up the testsuite without removing it from the 6 for microblaze. This speeds up the testsuite without removing it from the
7 FAIL reports. 7 FAIL reports.
8 8
9Upstream-Status: Pending
10
9Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 11Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10--- 12---
11 gcc/testsuite/g++.dg/opt/memcpy1.C | 4 ++++ 13 gcc/testsuite/g++.dg/opt/memcpy1.C | 4 ++++
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-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch
index 1b5d428e..89fe0ff6 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-12/0003-LOCAL-For-dejagnu-static-testing-on-qemu-suppress-wa.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 03/53] [LOCAL]: For dejagnu static testing on qemu, suppress
6 with method used by powerpc. Dynamic linking and using a qemu binary which 6 with 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
9Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
10--- 12---
11 gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 4 ---- 13 gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp | 4 ----
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-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch
index 8db33100..39c9c17e 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-12/0004-Patch-testsuite-Add-MicroBlaze-to-target-supports-fo.patch
@@ -13,6 +13,8 @@ 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
16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 18Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
17--- 19---
18 gcc/testsuite/lib/target-supports.exp | 1 + 20 gcc/testsuite/lib/target-supports.exp | 1 +
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-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch
index 0fb32850..d127a03e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0005-Patch-testsuite-Update-MicroBlaze-strings-test.patch
@@ -11,6 +11,8 @@ 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
14Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
15--- 17---
16 gcc/testsuite/gcc.target/microblaze/others/strings1.c | 4 ++++ 18 gcc/testsuite/gcc.target/microblaze/others/strings1.c | 4 ++++
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-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch
index a82f11cc..3c412471 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-12/0006-Patch-testsuite-Allow-MicroBlaze-.weakext-pattern-in.patch
@@ -13,6 +13,8 @@ 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
16Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 18Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
17 19
18Conflicts: 20Conflicts:
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-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch
index 736f5cd1..89d3b75a 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-12/0007-Patch-testsuite-Add-MicroBlaze-to-check_profiling_av.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 07/53] [Patch, testsuite]: Add MicroBlaze to
6 check_profiling_available inline with other archs setting 6 check_profiling_available inline with other archs setting
7 profiling_available_saved to 0 7 profiling_available_saved to 0
8 8
9Upstream-Status: Pending
10
9Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
10--- 12---
11 gcc/testsuite/lib/target-supports.exp | 1 + 13 gcc/testsuite/lib/target-supports.exp | 1 +
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-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch
index 451070c0..21747726 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0008-Patch-microblaze-Fix-atomic-side-effects.patch
@@ -7,6 +7,8 @@ Subject: [PATCH 08/53] [Patch, microblaze]: Fix atomic side effects. In
7 generated assembly code with undefined side effects after invocation of the 7 generated assembly code with undefined side effects after invocation of the
8 atomic. 8 atomic.
9 9
10Upstream-Status: Pending
11
10Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> 12Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 13Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12 14
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-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch
index c7efbb07..97f35569 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-12/0009-Patch-microblaze-Fix-atomic-boolean-return-value.patch
@@ -5,6 +5,8 @@ Subject: [PATCH 09/53] [Patch, microblaze]: Fix atomic boolean return value.
5 In atomic_compare_and_swapsi, fix boolean return value. Previously, it 5 In atomic_compare_and_swapsi, fix boolean return value. Previously, it
6 contained zero if successful and non-zero if unsuccessful. 6 contained zero if successful and non-zero if unsuccessful.
7 7
8Upstream-Status: Pending
9
8Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> 10Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com>
9Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
10--- 12---
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-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch
index 1bffafa9..62bb02a9 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-12/0010-Patch-microblaze-Fix-the-Microblaze-crash-with-msmal.patch
@@ -9,6 +9,8 @@ Subject: [PATCH 10/53] [Patch, microblaze]: Fix the Microblaze crash with
9 have subreg register due to this compiler was crashing. Changed the logic to 9 have subreg register due to this compiler was crashing. Changed the logic to
10 avoid sub_reg call 10 avoid sub_reg call
11 11
12Upstream-Status: Pending
13
12Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> 14Signed-off-by:Nagaraju Mekala <nmekala@xilix.com>
13 15
14Conflicts: 16Conflicts:
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-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch
index 1bd73b8a..09ebfca6 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-12/0011-Patch-microblaze-Added-ashrsi3_with_size_opt.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 11/53] [Patch, microblaze]: Added ashrsi3_with_size_opt Added
6 optimization is used. lshrsi3_with_size_opt is being removed as it has 6 optimization is used. lshrsi3_with_size_opt is being removed as it has
7 conflicts with unsigned int variables 7 conflicts with unsigned int variables
8 8
9Upstream-Status: Pending
10
9Signed-off-by:Nagaraju Mekala <nmekala@xilix.com> 11Signed-off-by:Nagaraju Mekala <nmekala@xilix.com>
10--- 12---
11 gcc/config/microblaze/microblaze.md | 21 +++++++++++++++++++++ 13 gcc/config/microblaze/microblaze.md | 21 +++++++++++++++++++++
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-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch
index f40fff9a..c26d46d4 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-12/0012-Patch-microblaze-Use-bralid-for-profiler-calls.patch
@@ -2,6 +2,8 @@ From 12d7e086376916ef61e2c48639671fd0f7c8fbbf 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/53] [Patch, microblaze]: Use bralid for profiler calls
5Upstream-Status: Pending
6
5 Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> 7 Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
6 8
7--- 9---
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch
index 5c927264..8739e6ea 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0013-Patch-microblaze-Removed-moddi3-routinue.patch
@@ -4,6 +4,8 @@ Date: Thu, 12 Jan 2017 17:36:16 +0530
4Subject: [PATCH 13/53] [Patch, microblaze]: Removed moddi3 routinue Using the 4Subject: [PATCH 13/53] [Patch, microblaze]: Removed moddi3 routinue Using the
5 default moddi3 function as the existing implementation has many bugs 5 default moddi3 function as the existing implementation has many bugs
6 6
7Upstream-Status: Pending
8
7Signed-off-by:Nagaraju <nmekala@xilix.com> 9Signed-off-by:Nagaraju <nmekala@xilix.com>
8 10
9Conflicts: 11Conflicts:
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-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch
index f8bcabe3..472c543c 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-12/0014-Patch-microblaze-Add-INIT_PRIORITY-support-Added.patch
@@ -10,6 +10,10 @@ 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
13--- 17---
14 gcc/config/microblaze/microblaze.cc | 53 +++++++++++++++++++++++++++++ 18 gcc/config/microblaze/microblaze.cc | 53 +++++++++++++++++++++++++++++
15 1 file changed, 53 insertions(+) 19 1 file changed, 53 insertions(+)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch
index 0f7d356f..7ce5ebc0 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0015-Patch-microblaze-Add-optimized-lshrsi3.patch
@@ -17,6 +17,8 @@ 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
20Signed-off-by:Nagaraju <nmekala@xilix.com> 22Signed-off-by:Nagaraju <nmekala@xilix.com>
21Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> 23Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
22--- 24---
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch
index 19ae324d..dc645c30 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0016-Patch-microblaze-Add-cbranchsi4_reg.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 16/53] [Patch, microblaze]: Add cbranchsi4_reg This patch
6 instruction has no immediate values.For the immediate values the xor 6 instruction has no immediate values.For the immediate values the xor
7 instruction is generated 7 instruction is generated
8 8
9Upstream-Status: Pending
10
9Signed-off-by: Nagaraju Mekala <nmekala@xilix.com> 11Signed-off-by: Nagaraju Mekala <nmekala@xilix.com>
10Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com> 12Signed-off-by: Ajit Agarwal <ajitkum@xilinx.com>
11 13
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-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch
index e3a98a08..b0d33516 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-12/0017-Patch-microblaze-Inline-Expansion-of-fsqrt-builtin.patch
@@ -22,6 +22,8 @@ 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
25Signed-off-by:Ajit Agarwal ajitkum@xilinx.com 27Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
26 Nagaraju Mekala nmekala@xilinx.com 28 Nagaraju Mekala nmekala@xilinx.com
27--- 29---
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-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch
index 831b8f22..94235be6 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-12/0018-PATCH-microblaze.md-Improve-adddi3-and-subdi3-insn-d.patch
@@ -17,6 +17,8 @@ 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
20Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> 22Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
21--- 23---
22 gcc/config/microblaze/microblaze.md | 13 ++++++------- 24 gcc/config/microblaze/microblaze.md | 13 ++++++-------
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-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch
index ab3fa535..e955938e 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0019-Patch-microblaze-Update-ashlsi3-movsf-patterns.patch
@@ -24,6 +24,10 @@ 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
27--- 31---
28 gcc/config/microblaze/microblaze.cc | 2 +- 32 gcc/config/microblaze/microblaze.cc | 2 +-
29 gcc/config/microblaze/microblaze.md | 10 ++++++++-- 33 gcc/config/microblaze/microblaze.md | 10 ++++++++--
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-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch
index 67eb0893..2d384b78 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-12/0020-Patch-microblaze-8-stage-pipeline-for-microblaze.patch
@@ -6,6 +6,10 @@ Subject: [PATCH 20/53] [Patch, microblaze]: 8-stage pipeline for microblaze
6 pipeline reduces the latencies of float & integer division drastically 6 pipeline reduces the 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
9--- 13---
10 gcc/config/microblaze/microblaze.cc | 11 ++++ 14 gcc/config/microblaze/microblaze.cc | 11 ++++
11 gcc/config/microblaze/microblaze.h | 3 +- 15 gcc/config/microblaze/microblaze.h | 3 +-
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-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch
index 96fe4f73..1b8d924c 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-12/0021-PATCH-21-53-Patch-microblaze-Correct-the-const-high-.patch
@@ -9,6 +9,10 @@ Subject: [PATCH 21/53] [PATCH 21/53] [Patch, microblaze]: Correct the const
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
12--- 16---
13 gcc/config/microblaze/microblaze.cc | 6 ++++-- 17 gcc/config/microblaze/microblaze.cc | 6 ++++--
14 gcc/testsuite/gcc.target/microblaze/others/long.c | 9 +++++++++ 18 gcc/testsuite/gcc.target/microblaze/others/long.c | 9 +++++++++
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-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch
index 332db5d3..a5917947 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-12/0022-Fix-microblaze-Fix-internal-compiler-error-with-msma.patch
@@ -9,6 +9,10 @@ Subject: [PATCH 22/53] [Fix, microblaze]: Fix internal compiler error with
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
12--- 16---
13 gcc/config/microblaze/microblaze.cc | 2 +- 17 gcc/config/microblaze/microblaze.cc | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-) 18 1 file changed, 1 insertion(+), 1 deletion(-)
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-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch
index 47e13fa6..ae05e791 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-12/0023-patch-microblaze-Fix-the-calculation-of-high-word-in.patch
@@ -14,6 +14,10 @@ Subject: [PATCH 23/53] [patch,microblaze]: Fix the calculation of high word in
14 14
15 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 15 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
16 Ajit Agarwal <ajitkum@xilinx.com> 16 Ajit Agarwal <ajitkum@xilinx.com>
17Upstream-Status: Pending
18
19Signed-off-by: Mark Hatle <mark.hatle@amd.com>
20
17--- 21---
18 gcc/config/microblaze/microblaze.cc | 3 --- 22 gcc/config/microblaze/microblaze.cc | 3 ---
19 1 file changed, 3 deletions(-) 23 1 file changed, 3 deletions(-)
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-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch
index 8ed5ae83..444c9397 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-12/0024-Patch-MicroBlaze-this-patch-has-1.Fixed-the-bug-in.patch
@@ -5,6 +5,10 @@ Subject: [PATCH 24/53] [Patch,MicroBlaze] : this patch has 1.Fixed the bug in
5 version calculation. 2.Add new bitfield instructions. 5 version calculation. 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
8--- 12---
9 gcc/config/microblaze/microblaze.cc | 154 ++++++++++++++-------------- 13 gcc/config/microblaze/microblaze.cc | 154 ++++++++++++++--------------
10 gcc/config/microblaze/microblaze.h | 2 + 14 gcc/config/microblaze/microblaze.h | 2 +
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-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch
index 109e0686..2800dee7 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-12/0025-Fixing-the-issue-with-the-builtin_alloc.patch
@@ -6,6 +6,10 @@ Subject: [PATCH 25/53] Fixing the issue with the builtin_alloc. register r18
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
9--- 13---
10 gcc/config/microblaze/microblaze.md | 8 ++++---- 14 gcc/config/microblaze/microblaze.md | 8 ++++----
11 1 file changed, 4 insertions(+), 4 deletions(-) 15 1 file changed, 4 insertions(+), 4 deletions(-)
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-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch
index 4f101b96..a1e4fb36 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-12/0026-Patch-Microblaze-Removed-fsqrt-generation-for-double.patch
@@ -4,6 +4,10 @@ Date: Mon, 4 Jun 2018 10:10:18 +0530
4Subject: [PATCH 26/53] [Patch,Microblaze] : Removed fsqrt generation for 4Subject: [PATCH 26/53] [Patch,Microblaze] : Removed fsqrt generation for
5 double values. 5 double values.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.md | 14 -------------- 12 gcc/config/microblaze/microblaze.md | 14 --------------
9 1 file changed, 14 deletions(-) 13 1 file changed, 14 deletions(-)
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-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch
index 2e7106d6..a9222e54 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-12/0027-Patch-MicroBlaze-Intial-commit-of-64-bit-Microblaze.patch
@@ -5,6 +5,10 @@ Subject: [PATCH 27/53] [Patch,MicroBlaze]: 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
8--- 12---
9 gcc/config/microblaze/constraints.md | 6 + 13 gcc/config/microblaze/constraints.md | 6 +
10 gcc/config/microblaze/microblaze-protos.h | 1 + 14 gcc/config/microblaze/microblaze-protos.h | 1 +
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-12/0028-Intial-commit-for-64bit-MB-sources.patch
index 1ffa79cb..c36e246a 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0028-Intial-commit-for-64bit-MB-sources.patch
@@ -4,6 +4,10 @@ Date: Tue, 13 Sep 2022 14:38:48 +0530
4Subject: [PATCH 28/53] Intial commit for 64bit-MB sources. Need to cleanup 4Subject: [PATCH 28/53] Intial commit for 64bit-MB sources. Need to cleanup
5 the code later. 5 the code later.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/constraints.md | 2 +- 12 gcc/config/microblaze/constraints.md | 2 +-
9 gcc/config/microblaze/microblaze-c.cc | 6 + 13 gcc/config/microblaze/microblaze-c.cc | 6 +
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-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch
index 26cdfca2..0a275c0b 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-12/0029-Patch-MicroBlaze-re-arrangement-of-the-compare-branc.patch
@@ -4,6 +4,10 @@ Date: Tue, 13 Sep 2022 14:45:15 +0530
4Subject: [PATCH 29/53] [Patch,MicroBlaze] : re-arrangement of the compare 4Subject: [PATCH 29/53] [Patch,MicroBlaze] : re-arrangement of the compare
5 branches 5 branches
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.cc | 28 ++---- 12 gcc/config/microblaze/microblaze.cc | 28 ++----
9 gcc/config/microblaze/microblaze.md | 141 +++++++++++++--------------- 13 gcc/config/microblaze/microblaze.md | 141 +++++++++++++---------------
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-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch
index 83d047cb..bda4e7da 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-12/0030-Patch-Microblaze-previous-commit-broke-the-handling-.patch
@@ -4,6 +4,10 @@ Date: Wed, 8 Aug 2018 17:37:26 +0530
4Subject: [PATCH 30/53] [Patch,Microblaze] : previous commit broke the 4Subject: [PATCH 30/53] [Patch,Microblaze] : previous commit broke the
5 handling of SI Branch compare for Microblaze 32-bit.. 5 handling of SI Branch compare for Microblaze 32-bit..
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.md | 4 ++-- 12 gcc/config/microblaze/microblaze.md | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
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-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch
index c230049c..a9a7a03d 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-12/0031-Patch-Microblaze-Support-of-multilibs-with-m64.patch
@@ -7,6 +7,10 @@ Conflicts:
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
10--- 14---
11 gcc/config/microblaze/microblaze-c.cc | 1 + 15 gcc/config/microblaze/microblaze-c.cc | 1 +
12 gcc/config/microblaze/t-microblaze | 15 ++++++--------- 16 gcc/config/microblaze/t-microblaze | 15 ++++++---------
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch
index 36a20450..cb62c5a7 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0032-Patch-MicroBlaze-Fixed-issues-like.patch
@@ -4,6 +4,10 @@ Date: Tue, 13 Sep 2022 15:24:25 +0530
4Subject: [PATCH 32/53] [Patch,MicroBlaze]: Fixed issues like: 1 Interrupt 4Subject: [PATCH 32/53] [Patch,MicroBlaze]: Fixed issues like: 1 Interrupt
5 alignment issue 2 Sign extension issue 5 alignment issue 2 Sign extension issue
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.cc | 16 ++++++++++------ 12 gcc/config/microblaze/microblaze.cc | 16 ++++++++++------
9 gcc/config/microblaze/microblaze.md | 2 +- 13 gcc/config/microblaze/microblaze.md | 2 +-
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch
index 9c9e4dd2..9760695c 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0033-Patch-MicroBlaze.patch
@@ -7,6 +7,10 @@ Subject: [PATCH 33/53] [Patch,MicroBlaze]: fixed below issues: - Floating
7 7
8 Conflicts: 8 Conflicts:
9 gcc/config/microblaze/microblaze.md 9 gcc/config/microblaze/microblaze.md
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
10--- 14---
11 gcc/config/microblaze/microblaze.cc | 12 +++- 15 gcc/config/microblaze/microblaze.cc | 12 +++-
12 gcc/config/microblaze/microblaze.h | 7 +++ 16 gcc/config/microblaze/microblaze.h | 7 +++
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch
index 7bd3001d..3f07dfa1 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0034-Added-double-arith-instructions.patch
@@ -4,6 +4,10 @@ Date: Tue, 9 Oct 2018 10:07:08 +0530
4Subject: [PATCH 34/53] -Added double arith instructions -Fixed prologue stack 4Subject: [PATCH 34/53] -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
7--- 11---
8 gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++---- 12 gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++----
9 gcc/config/microblaze/t-microblaze | 7 +++ 13 gcc/config/microblaze/t-microblaze | 7 +++
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-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch
index 89018aae..3ff6a2d0 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-12/0035-Fixed-the-issue-in-the-delay-slot-with-swap-instruct.patch
@@ -4,6 +4,10 @@ Date: Fri, 12 Oct 2018 16:07:36 +0530
4Subject: [PATCH 35/53] Fixed the issue in the delay slot with swap 4Subject: [PATCH 35/53] 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
7--- 11---
8 gcc/config/microblaze/microblaze.md | 6 ++++++ 12 gcc/config/microblaze/microblaze.md | 6 ++++++
9 1 file changed, 6 insertions(+) 13 1 file changed, 6 insertions(+)
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-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch
index 0c27d69f..90ddf3eb 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-12/0036-Fixed-the-load-store-issue-with-the-32bit-arith-libr.patch
@@ -4,6 +4,10 @@ Date: Sat, 13 Oct 2018 21:12:43 +0530
4Subject: [PATCH 36/53] Fixed the load store issue with the 32bit arith 4Subject: [PATCH 36/53] 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
7--- 11---
8 libgcc/config/microblaze/divsi3.S | 25 ++++++++++++++++++++++++- 12 libgcc/config/microblaze/divsi3.S | 25 ++++++++++++++++++++++++-
9 libgcc/config/microblaze/modsi3.S | 26 +++++++++++++++++++++++++- 13 libgcc/config/microblaze/modsi3.S | 26 +++++++++++++++++++++++++-
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-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch
index 2eab03ec..191c7627 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-12/0037-extending-the-Dwarf-support-to-64bit-Microblaze.patch
@@ -3,6 +3,10 @@ From: 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/53] extending the Dwarf support to 64bit Microblaze
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 gcc/config/microblaze/microblaze.h | 2 +- 11 gcc/config/microblaze/microblaze.h | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-) 12 1 file changed, 1 insertion(+), 1 deletion(-)
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-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch
index 4d6be758..8697be58 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-12/0038-fixing-the-typo-errors-in-umodsi3-file.patch
@@ -3,6 +3,10 @@ From: 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/53] fixing the typo errors in umodsi3 file
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 libgcc/config/microblaze/umodsi3.S | 6 +++--- 11 libgcc/config/microblaze/umodsi3.S | 6 +++---
8 1 file changed, 3 insertions(+), 3 deletions(-) 12 1 file changed, 3 insertions(+), 3 deletions(-)
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-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch
index 1a5a0ef7..032cab4d 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-12/0039-fixing-the-32bit-LTO-related-issue9-1014024.patch
@@ -3,6 +3,10 @@ From: 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/53] fixing the 32bit LTO related issue9(1014024)
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 gcc/config/microblaze/microblaze.h | 24 ++++++++++++++---------- 11 gcc/config/microblaze/microblaze.h | 24 ++++++++++++++----------
8 1 file changed, 14 insertions(+), 10 deletions(-) 12 1 file changed, 14 insertions(+), 10 deletions(-)
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-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch
index 7c6f9008..1ed53957 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-12/0040-Fixed-the-missing-stack-adjustment-in-prologue-of-mo.patch
@@ -4,6 +4,10 @@ Date: Fri, 19 Oct 2018 14:26:25 +0530
4Subject: [PATCH 40/53] Fixed the missing stack adjustment in prologue of 4Subject: [PATCH 40/53] 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
7--- 11---
8 libgcc/config/microblaze/modsi3.S | 1 + 12 libgcc/config/microblaze/modsi3.S | 1 +
9 1 file changed, 1 insertion(+) 13 1 file changed, 1 insertion(+)
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-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch
index 9cec7be9..e6335e8e 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-12/0041-Patch-Microblaze-corrected-SPN-for-dlong-instruction.patch
@@ -4,6 +4,10 @@ Date: Wed, 24 Oct 2018 18:31:04 +0530
4Subject: [PATCH 41/53] [Patch,Microblaze] : corrected SPN for dlong 4Subject: [PATCH 41/53] [Patch,Microblaze] : corrected SPN for dlong
5 instruction mapping. 5 instruction mapping.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.md | 4 ++-- 12 gcc/config/microblaze/microblaze.md | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
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-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch
index 8836d0e7..f4013b9e 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-12/0042-fixing-the-long-long-long-mingw-toolchain-issue.patch
@@ -3,6 +3,10 @@ From: 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/53] fixing the long & long long mingw toolchain issue
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 gcc/config/microblaze/constraints.md | 2 +- 11 gcc/config/microblaze/constraints.md | 2 +-
8 gcc/config/microblaze/microblaze.md | 8 ++++---- 12 gcc/config/microblaze/microblaze.md | 8 ++++----
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-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch
index c8caff29..7f3c8373 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-12/0043-Fix-the-MB-64-bug-of-handling-QI-objects.patch
@@ -3,6 +3,10 @@ From: 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/53] Fix the MB-64 bug of handling QI objects
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 gcc/config/microblaze/microblaze.md | 14 +++++++------- 11 gcc/config/microblaze/microblaze.md | 14 +++++++-------
8 1 file changed, 7 insertions(+), 7 deletions(-) 12 1 file changed, 7 insertions(+), 7 deletions(-)
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-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch
index e0d7df3d..14eb812a 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-12/0044-Patch-Microblaze-We-will-check-the-possibility-of-pe.patch
@@ -4,6 +4,10 @@ Date: Fri, 29 Mar 2019 12:08:39 +0530
4Subject: [PATCH 44/53] [Patch,Microblaze] : We will check the possibility of 4Subject: [PATCH 44/53] [Patch,Microblaze] : We will check the possibility of
5 peephole2 optimization,if we can then we will fix the compiler issue. 5 peephole2 optimization,if we can then we will fix the compiler issue.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/microblaze.md | 63 +++++++++++++++++------------ 12 gcc/config/microblaze/microblaze.md | 63 +++++++++++++++++------------
9 1 file changed, 38 insertions(+), 25 deletions(-) 13 1 file changed, 38 insertions(+), 25 deletions(-)
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-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch
index 770d0f70..54135b0f 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-12/0045-Patch-MicroBlaze-fixed-typos-in-mul-div-and-mod-asse.patch
@@ -4,6 +4,10 @@ Date: Wed, 17 Apr 2019 12:36:16 +0530
4Subject: [PATCH 45/53] [Patch,MicroBlaze]: fixed typos in mul,div and mod 4Subject: [PATCH 45/53] [Patch,MicroBlaze]: fixed typos in mul,div and mod
5 assembly files. 5 assembly files.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 libgcc/config/microblaze/divsi3.S | 47 ++++++++++++++++++++---- 12 libgcc/config/microblaze/divsi3.S | 47 ++++++++++++++++++++----
9 libgcc/config/microblaze/modsi3.S | 40 ++++++++++++++++++--- 13 libgcc/config/microblaze/modsi3.S | 40 ++++++++++++++++++---
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-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch
index 29a7b4eb..def10321 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-12/0046-Patch-microblaze-MB-64-removal-of-barrel-shift-instr.patch
@@ -8,6 +8,10 @@ Subject: [PATCH 46/53] [Patch, microblaze]: MB-64 removal of barrel-shift
8 enabled. Similarly to double instructions as well. 8 enabled. Similarly to double instructions as well.
9 9
10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com> 10 Signed-off-by :Nagaraju Mekala <nmekala@xilix.com>
11Upstream-Status: Pending
12
13Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14
11--- 15---
12 gcc/config/microblaze/microblaze.cc | 2 +- 16 gcc/config/microblaze/microblaze.cc | 2 +-
13 gcc/config/microblaze/microblaze.md | 269 ++++++++++++++++++++++++++-- 17 gcc/config/microblaze/microblaze.md | 269 ++++++++++++++++++++++++++--
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-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch
index 774fad5a..318abe7b 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-12/0047-Added-new-MB-64-single-register-arithmetic-instructi.patch
@@ -3,6 +3,10 @@ From: 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/53] Added new MB-64 single register arithmetic instructions
5 5
6Upstream-Status: Pending
7
8Signed-off-by: Mark Hatle <mark.hatle@amd.com>
9
6--- 10---
7 gcc/config/microblaze/microblaze.md | 56 +++++++++++++++++++++++++++++ 11 gcc/config/microblaze/microblaze.md | 56 +++++++++++++++++++++++++++++
8 1 file changed, 56 insertions(+) 12 1 file changed, 56 insertions(+)
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-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch
index a442bf0f..09514a7d 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-12/0048-Patch-MicroBlaze-Added-support-for-64-bit-Immediate-.patch
@@ -4,6 +4,10 @@ Date: Mon, 26 Aug 2019 15:55:22 +0530
4Subject: [PATCH 48/53] [Patch,MicroBlaze] : Added support for 64 bit Immediate 4Subject: [PATCH 48/53] [Patch,MicroBlaze] : Added support for 64 bit Immediate
5 values. 5 values.
6 6
7Upstream-Status: Pending
8
9Signed-off-by: Mark Hatle <mark.hatle@amd.com>
10
7--- 11---
8 gcc/config/microblaze/constraints.md | 4 ++-- 12 gcc/config/microblaze/constraints.md | 4 ++--
9 gcc/config/microblaze/microblaze.md | 3 +-- 13 gcc/config/microblaze/microblaze.md | 3 +--
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-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch
index 5732000d..6258e799 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-12/0049-Patch-microblaze-Fix-Compiler-crash-with-freg-struct.patch
@@ -7,6 +7,10 @@ Subject: [PATCH 49/53] [Patch, microblaze]: Fix Compiler crash with
7 With this patch all other modes are handled properly 7 With this patch all other modes are 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
10--- 14---
11 gcc/config/microblaze/microblaze.cc | 11 ++++++++++- 15 gcc/config/microblaze/microblaze.cc | 11 ++++++++++-
12 gcc/config/microblaze/microblaze.h | 19 ------------------- 16 gcc/config/microblaze/microblaze.h | 19 -------------------
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-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch
index ed48daf7..8d99c93d 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-12/0050-Patch-microblaze-Add-TARGET_OPTION_OPTIMIZATION-and-.patch
@@ -9,6 +9,8 @@ Added TARGET_OPTION_OPTIMIZATIONS and Turn off ivopts by default.
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
12Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com> 14Signed-off-by: Nagaraju Mekala <nmekala@xilinx.com>
13 Mahesh Bodapati <mbodapat@xilinx.com> 15 Mahesh Bodapati <mbodapat@xilinx.com>
14Conflicts: 16Conflicts:
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-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch
index b9575eac..64069e3c 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-12/0051-Patch-microblaze-Reducing-Stack-space-for-arguments.patch
@@ -9,6 +9,10 @@ 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
12--- 16---
13 gcc/config/microblaze/microblaze-protos.h | 1 + 17 gcc/config/microblaze/microblaze-protos.h | 1 +
14 gcc/config/microblaze/microblaze.cc | 130 ++++++++++++++++++++++ 18 gcc/config/microblaze/microblaze.cc | 130 ++++++++++++++++++++++
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch
index d504a092..63feff79 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0052-Patch-MicroBlaze.patch
@@ -8,6 +8,10 @@ Subject: [PATCH 52/53] [Patch,MicroBlaze] : If we use break_handler
8 break_handler attribute. signed-off-by : Mahesh Bodapati 8 break_handler attribute. signed-off-by : Mahesh Bodapati
9 <mbodapat@xilinx.com> 9 <mbodapat@xilinx.com>
10 10
11Upstream-Status: Pending
12
13Signed-off-by: Mark Hatle <mark.hatle@amd.com>
14
11--- 15---
12 gcc/config/microblaze/microblaze.cc | 13 +++++-------- 16 gcc/config/microblaze/microblaze.cc | 13 +++++--------
13 1 file changed, 5 insertions(+), 8 deletions(-) 17 1 file changed, 5 insertions(+), 8 deletions(-)
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-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch
index 6b3f4ddd..1552a5e9 100644
--- a/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12/0053-patch-microblaze64-Add-Zero_extended-instructions.patch
@@ -9,6 +9,8 @@ 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
12 Signed-off-by: Nagaraju Mekala<nmekala@xilinx.com> 14 Signed-off-by: Nagaraju Mekala<nmekala@xilinx.com>
13 Mahesh Bodapati<mbodapat@xilinx.com> 15 Mahesh Bodapati<mbodapat@xilinx.com>
14--- 16---
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc
new file mode 100644
index 00000000..5ac82b1b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,118 @@
1SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3DESCRIPTION = "The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system."
4SECTION = "devel"
5LICENSE = "GPL"
6
7NATIVEDEPS = ""
8
9CVE_PRODUCT = "gcc"
10
11inherit autotools gettext texinfo
12
13BPN = "gcc"
14COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
15
16python extract_stashed_builddir () {
17 src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
18 dest = d.getVar("B")
19 oe.path.copyhardlinktree(src, dest)
20 staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
21}
22
23def get_gcc_float_setting(bb, d):
24 if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
25 return "--with-float=hard"
26 if d.getVar('TARGET_FPU') in [ 'soft' ]:
27 return "--with-float=soft"
28 if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
29 return "--enable-e500_double"
30 return ""
31
32get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
33
34def get_gcc_x86_64_arch_setting(bb, d):
35 import re
36 march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
37 if march:
38 return "--with-arch=%s " % march.group(1)
39 # The earliest supported x86-64 CPU
40 return "--with-arch=core2"
41
42get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
43
44def get_gcc_mips_plt_setting(bb, d):
45 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
46 return "--with-mips-plt"
47 return ""
48
49def get_gcc_ppc_plt_settings(bb, d):
50 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
51 return "--enable-secureplt"
52 return ""
53
54def get_gcc_multiarch_setting(bb, d):
55 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
56 multiarch_options = {
57 "i586": "--enable-targets=all",
58 "i686": "--enable-targets=all",
59 "powerpc": "--enable-targets=powerpc64",
60 "powerpc64le": "--enable-targets=powerpcle",
61 "mips": "--enable-targets=all",
62 "sparc": "--enable-targets=all",
63 }
64
65 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
66 if target_arch in multiarch_options :
67 return multiarch_options[target_arch]
68 return ""
69
70# this is used by the multilib setup of gcc
71def get_tune_parameters(tune, d):
72 availtunes = d.getVar('AVAILTUNES')
73 if tune not in availtunes.split():
74 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
75
76 localdata = bb.data.createCopy(d)
77 override = ':tune-' + tune
78 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
79
80 retdict = {}
81 retdict['tune'] = tune
82 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
83 retdict['features'] = localdata.getVar('TUNE_FEATURES')
84 # BASELIB is used by the multilib code to change library paths
85 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
86 retdict['arch'] = localdata.getVar('TUNE_ARCH')
87 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
88 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
89 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
90 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
91 return retdict
92
93get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
94
95DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
96
97MIRRORS =+ "\
98 ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
99"
100#
101# Set some default values
102#
103gcclibdir = "${libdir}/gcc"
104BINV = "${PV}"
105#S = "${WORKDIR}/gcc-${PV}"
106S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
107
108B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
109
110target_includedir ?= "${includedir}"
111target_libdir ?= "${libdir}"
112target_base_libdir ?= "${base_libdir}"
113target_prefix ?= "${prefix}"
114
115# We need to ensure that for the shared work directory, the do_patch signatures match
116# The real WORKDIR location isn't a dependency for the shared workdir.
117src_patches[vardepsexclude] = "WORKDIR"
118should_apply[vardepsexclude] += "PN"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 00000000..e4cdb73f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,123 @@
1require gcc-multilib-config.inc
2require gcc-shared-source.inc
3#
4# Build the list of lanaguages to build.
5#
6# These can be overridden by the version specific .inc file.
7
8# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
9FORTRAN ?= ",f77"
10LANGUAGES ?= "c,c++${FORTRAN}"
11
12EXTRA_OECONF_BASE ?= ""
13EXTRA_OECONF_PATHS ?= ""
14
15GCCMULTILIB ?= "--disable-multilib"
16GCCTHREADS ?= "posix"
17
18GCCPIE ??= ""
19
20SYMVERS_CONF ?= "--enable-symvers=gnu"
21
22EXTRA_OECONF = "\
23 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
24 --with-gnu-ld \
25 --enable-shared \
26 --enable-languages=${LANGUAGES} \
27 --enable-threads=${GCCTHREADS} \
28 ${GCCMULTILIB} \
29 ${GCCPIE} \
30 --enable-c99 \
31 --enable-long-long \
32 ${SYMVERS_CONF} \
33 --enable-libstdcxx-pch \
34 --program-prefix=${TARGET_PREFIX} \
35 --without-local-prefix \
36 --disable-install-libiberty \
37 ${EXTRA_OECONF_BASE} \
38 ${EXTRA_OECONF_GCC_FLOAT} \
39 ${EXTRA_OECONF_PATHS} \
40 ${@get_gcc_mips_plt_setting(bb, d)} \
41 ${@get_gcc_ppc_plt_settings(bb, d)} \
42 ${@get_gcc_multiarch_setting(bb, d)} \
43 --enable-standard-branch-protection \
44"
45
46# glibc version is a minimum controlling whether features are enabled.
47# Doesn't need to track glibc exactly
48EXTRA_OECONF:append:libc-glibc = " --with-glibc-version=2.28 "
49
50# Set this here since GCC configure won't auto-detect and enable
51# initfini-arry when cross compiling.
52EXTRA_OECONF:append = " --enable-initfini-array"
53
54export gcc_cv_collect2_libs = 'none required'
55# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
56# in the config.log files (which might not get generated until do_compile
57# hence being missed by the insane do_configure check).
58
59EXTRA_OECONF:append:linux = " --enable-__cxa_atexit"
60
61EXTRA_OECONF:append:mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
62EXTRA_OECONF:append:mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
63EXTRA_OECONF:append:mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
64EXTRA_OECONF:append:mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
65EXTRA_OECONF:append:mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
66EXTRA_OECONF:append:mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
67EXTRA_OECONF:append:mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
68EXTRA_OECONF:append:mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
69
70EXTRA_OECONF_GCC_FLOAT ??= ""
71CPPFLAGS = ""
72
73SYSTEMHEADERS = "${target_includedir}"
74SYSTEMLIBS = "${target_base_libdir}/"
75SYSTEMLIBS1 = "${target_libdir}/"
76
77do_configure:prepend () {
78 # teach gcc to find correct target includedir when checking libc ssp support
79 mkdir -p ${B}/gcc
80 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
81 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
82 cat >>${B}/gcc/defaults.h.new <<_EOF
83#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
84#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
85#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
86#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
87#endif /* ! GCC_DEFAULTS_H */
88_EOF
89 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
90}
91
92do_configure () {
93 # Setup these vars for cross building only
94 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
95 # gcc build stuff when the build is producing a cross compiler - i.e.
96 # when the 'current' target is the 'host' system, and the host is not
97 # the target (because the build is actually making a cross compiler!)
98 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
99 export CC_FOR_TARGET="${CC}"
100 export GCC_FOR_TARGET="${CC}"
101 export CXX_FOR_TARGET="${CXX}"
102 export AS_FOR_TARGET="${HOST_PREFIX}as"
103 export LD_FOR_TARGET="${HOST_PREFIX}ld"
104 export NM_FOR_TARGET="${HOST_PREFIX}nm"
105 export AR_FOR_TARGET="${HOST_PREFIX}ar"
106 export GFORTRAN_FOR_TARGET="gfortran"
107 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
108 fi
109 export CC_FOR_BUILD="${BUILD_CC}"
110 export CXX_FOR_BUILD="${BUILD_CXX}"
111 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
112 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
113 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
114 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
115 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
116 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
117 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
118 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
119
120
121 oe_runconf
122}
123
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc
new file mode 100644
index 00000000..ec87b462
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,187 @@
1inherit cross-canadian
2
3SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5
6DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
7
8GCCMULTILIB = "--enable-multilib"
9
10require gcc-configure-common.inc
11
12EXTRA_OECONF += "--with-plugin-ld=ld"
13EXTRA_OECONF_PATHS = "\
14 --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
15 --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
16 --with-sysroot=/not/exist \
17 --with-build-sysroot=${STAGING_DIR_TARGET} \
18"
19# We have to point gcc at a sysroot but we don't need to rebuild if this changes
20# e.g. we switch between different machines with different tunes.
21EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
22TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
23get_gcc_float_setting[vardepvalue] = ""
24
25#
26# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
27# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
28#
29export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
30export AS_FOR_TARGET = "${TARGET_PREFIX}as"
31export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
32export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
33export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
34export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc"
35export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
36export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
37export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
38export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
39export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
40export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
41export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
42
43#
44# We need to override this and make sure the compiler can find staging
45#
46export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
47
48do_configure () {
49 if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
50 mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
51 fi
52 export CC_FOR_BUILD="${BUILD_CC}"
53 export CXX_FOR_BUILD="${BUILD_CXX}"
54 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
55 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
56 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
57 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
58 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
59 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
60 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
61 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
62 oe_runconf
63}
64
65do_compile () {
66 oe_runmake all-host configure-target-libgcc
67 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
68}
69
70PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"
71
72FILES:${PN} = "\
73 ${exec_prefix}/bin/* \
74 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
75 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
76 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
77 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
78 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
80 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
81 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
82 ${libdir}/bfd-plugins/*.so \
83 ${includedir}/c++/${BINV} \
84 ${prefix}/${TARGET_SYS}/bin/* \
85 ${prefix}/${TARGET_SYS}/lib/* \
86 ${prefix}/${TARGET_SYS}${target_includedir}/* \
87"
88INSANE_SKIP:${PN} += "dev-so"
89
90FILES:${PN}-doc = "\
91 ${infodir} \
92 ${mandir} \
93 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
94"
95
96EXEEXT = ""
97
98# Compute how to get from libexecdir to bindir in python (easier than shell)
99BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
100# linker plugin path
101LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${libdir}/bfd-plugins"))}"
102
103do_install () {
104 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
105 oe_runmake 'DESTDIR=${D}' install-host
106
107 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
108 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
109 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
110 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
111
112 # We care about g++ not c++
113 rm -f ${D}${bindir}/*c++
114
115 # We don't care about the gcc-<version> copies
116 rm -f ${D}${bindir}/*gcc-${BINV}*
117
118 # Cleanup empty directories which are not shipped
119 # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
120 # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
121 local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
122 for i in $empty_dirs; do
123 [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
124 done
125
126 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
127 # found.
128 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
129 install -d $dest
130 suffix=${EXEEXT}
131 for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
132 if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
133 continue
134 fi
135
136 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
137 done
138
139 # libquadmath headers need to be available in the gcc libexec dir
140 install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
141 cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
142 cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
143
144 # install LTO linker plugins where binutils tools can find it
145 install -d ${D}${libdir}/bfd-plugins
146 ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
147
148 chown -R root:root ${D}
149
150 cross_canadian_bindirlinks
151
152 for i in linux ${CANADIANEXTRAOS}
153 do
154 for v in ${CANADIANEXTRAVENDOR}
155 do
156 d=${D}${bindir}/../${TARGET_ARCH}$v-$i
157 install -d $d
158 for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT}
159 do
160 p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
161 case $i in
162 *musl*)
163 rm -rf $d/$p
164 echo "#!/usr/bin/env sh" > $d/$p
165 echo "exec \`dirname \$0\`/../${TARGET_SYS}/$j -mmusl \$@" >> $d/$p
166 chmod 0755 $d/$p
167 ;;
168 *)
169 ;;
170 esac
171 done
172 done
173 done
174}
175
176ELFUTILS = "nativesdk-elfutils"
177DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib nativesdk-zstd"
178RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
179
180SYSTEMHEADERS = "${target_includedir}/"
181SYSTEMLIBS = "${target_base_libdir}/"
182SYSTEMLIBS1 = "${target_libdir}/"
183
184EXTRA_OECONF += "--enable-poison-system-directories"
185
186# gcc 4.7 needs -isystem
187export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb
new file mode 100644
index 00000000..bf53c5cd
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
3
4
5
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc
new file mode 100644
index 00000000..a540fb24
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc
@@ -0,0 +1,163 @@
1inherit cross
2
3INHIBIT_DEFAULT_DEPS = "1"
4EXTRADEPENDS = ""
5DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
6PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
7python () {
8 if d.getVar("TARGET_OS").startswith("linux"):
9 d.setVar("EXTRADEPENDS", "linux-libc-headers")
10}
11
12PN = "gcc-cross-${TARGET_ARCH}"
13
14# Ignore how TARGET_ARCH is computed.
15TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
16
17require gcc-configure-common.inc
18
19# While we want the 'gnu' hash style, we explicitly set it to sysv here to
20# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to
21# gnu) will hit a QA failure.
22LINKER_HASH_STYLE ?= "sysv"
23
24EXTRA_OECONF += "--enable-poison-system-directories=error"
25EXTRA_OECONF:append:sh4 = " \
26 --with-multilib-list= \
27 --enable-incomplete-targets \
28"
29
30EXTRA_OECONF += "\
31 --with-system-zlib \
32"
33
34EXTRA_OECONF:append:libc-baremetal = " --without-headers"
35EXTRA_OECONF:remove:libc-baremetal = "--enable-threads=posix"
36EXTRA_OECONF:remove:libc-newlib = "--enable-threads=posix"
37
38EXTRA_OECONF_PATHS = "\
39 --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
40 --with-sysroot=/not/exist \
41 --with-build-sysroot=${STAGING_DIR_TARGET} \
42"
43
44ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
45
46
47do_configure:prepend () {
48 install -d ${RECIPE_SYSROOT}${target_includedir}
49 touch ${RECIPE_SYSROOT}${target_includedir}/limits.h
50}
51
52do_compile () {
53 export CC="${BUILD_CC}"
54 export AR_FOR_TARGET="${TARGET_SYS}-ar"
55 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
56 export LD_FOR_TARGET="${TARGET_SYS}-ld"
57 export NM_FOR_TARGET="${TARGET_SYS}-nm"
58 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc"
59 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
60 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
61 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
62 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
63
64 # Prevent native/host sysroot path from being used in configargs.h header,
65 # as it will be rewritten when used by other sysroots preventing support
66 # for gcc plugins
67 oe_runmake configure-gcc
68 sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h
69 sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h
70
71 # Prevent sysroot/workdir paths from being used in checksum-options.
72 # checksum-options is used to generate a checksum which is embedded into
73 # the output binary.
74 oe_runmake TARGET-gcc=checksum-options all-gcc
75 sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
76 sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options
77
78 oe_runmake all-host configure-target-libgcc
79 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
80}
81
82INHIBIT_PACKAGE_STRIP = "1"
83
84# Compute how to get from libexecdir to bindir in python (easier than shell)
85BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
86# linker plugin path
87LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}"
88
89do_install () {
90 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
91 oe_runmake 'DESTDIR=${D}' install-host
92
93 install -d ${D}${target_base_libdir}
94 install -d ${D}${target_libdir}
95
96 # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
97 # gfortran is fully backwards compatible. This is a safe and practical solution.
98 if [ -n "${@d.getVar('FORTRAN')}" ]; then
99 ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
100 fortsymlinks="g77 gfortran"
101 fi
102
103 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
104 # found. These need to be relative paths so they work in different locations.
105 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
106 install -d $dest
107 for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do
108 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
109 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
110 done
111
112 # Remove things we don't need but keep share/java
113 for d in info man share/doc share/locale share/man share/info; do
114 rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
115 done
116
117 # libquadmath headers need to be available in the gcc libexec dir
118 install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
119 cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
120 cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
121
122 find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
123
124 # install LTO linker plugins where binutils tools can find it
125 install -d ${D}${libdir}/bfd-plugins
126 ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
127}
128
129do_package[noexec] = "1"
130do_packagedata[noexec] = "1"
131do_package_write_ipk[noexec] = "1"
132do_package_write_rpm[noexec] = "1"
133do_package_write_deb[noexec] = "1"
134
135inherit chrpath
136
137python gcc_stash_builddir_fixrpaths() {
138 # rewrite rpaths, breaking hardlinks as required
139 process_dir("/", d.getVar("BUILDDIRSTASH"), d, break_hardlinks = True)
140}
141
142BUILDDIRSTASH = "${WORKDIR}/stashed-builddir/build"
143do_gcc_stash_builddir[dirs] = "${B}"
144do_gcc_stash_builddir[cleandirs] = "${BUILDDIRSTASH}"
145do_gcc_stash_builddir[postfuncs] += "gcc_stash_builddir_fixrpaths"
146do_gcc_stash_builddir () {
147 dest=${BUILDDIRSTASH}
148 hardlinkdir . $dest
149 # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files
150 rm $dest/gcc/include/*.h
151 cp gcc/include/*.h $dest/gcc/include/
152 sysroot-relativelinks.py $dest
153}
154addtask do_gcc_stash_builddir after do_compile before do_install
155SSTATETASKS += "do_gcc_stash_builddir"
156do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}"
157do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
158do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
159
160python do_gcc_stash_builddir_setscene () {
161 sstate_setscene(d)
162}
163addtask do_gcc_stash_builddir_setscene
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb
new file mode 100644
index 00000000..b43cca0c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
new file mode 100644
index 00000000..bd65b1fe
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -0,0 +1,12 @@
1inherit crosssdk
2
3PN = "gcc-crosssdk-${SDK_SYS}"
4
5SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
6SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
7SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
8
9GCCMULTILIB = "--disable-multilib"
10
11DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
12PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb
new file mode 100644
index 00000000..40a6c4fe
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc
new file mode 100644
index 00000000..2dbbc23c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -0,0 +1,249 @@
1# following code modifies these definitions in the gcc config
2# MULTILIB_OPTIONS
3# MULTILIB_DIRNAMES
4# MULTILIB_OSDIRNAMES
5# GLIBC_DYNAMIC_LINKER32
6# GLIBC_DYNAMIC_LINKER64
7# GLIBC_DYNAMIC_LINKERX32
8# GLIBC_DYNAMIC_LINKERN32
9# For more information on use of these variables look at these files in the gcc source code
10# gcc/config/i386/t-linux64
11# gcc/config/mips/t-linux64
12# gcc/config/rs6000/t-linux64
13# gcc/config/i386/linux64.h
14# gcc/config/mips/linux64.h
15# gcc/config/rs6000/linux64.h
16
17MULTILIB_OPTION_WHITELIST ??= "-m32 -m64 -mx32 -mabi=n32 -mabi=32 -mabi=64"
18
19python gcc_multilib_setup() {
20 import re
21 import shutil
22 import glob
23
24 srcdir = d.getVar('S')
25 builddir = d.getVar('B')
26 src_conf_dir = '%s/gcc/config' % srcdir
27 build_conf_dir = '%s/gcc/config' % builddir
28
29 bb.utils.remove(build_conf_dir, True)
30 ml_globs = ('%s/*/t-linux64' % src_conf_dir,
31 '%s/*/linux64.h' % src_conf_dir,
32 '%s/aarch64/t-aarch64' % src_conf_dir,
33 '%s/aarch64/aarch64.h' % src_conf_dir,
34 '%s/aarch64/aarch64-linux.h' % src_conf_dir,
35 '%s/aarch64/aarch64-cores.def' % src_conf_dir,
36 '%s/arm/linux-eabi.h' % src_conf_dir,
37 '%s/*/linux.h' % src_conf_dir,
38 '%s/linux.h' % src_conf_dir)
39
40 # copy the target multilib config files to ${B}
41 for ml_glob in ml_globs:
42 for fn in glob.glob(ml_glob):
43 rel_path = os.path.relpath(fn, src_conf_dir)
44 parent_dir = os.path.dirname(rel_path)
45 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
46 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
47
48 pn = d.getVar('PN')
49 multilibs = (d.getVar('MULTILIB_VARIANTS') or '').split()
50 if not multilibs and pn != "nativesdk-gcc":
51 return
52
53 mlprefix = d.getVar('MLPREFIX')
54
55 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc":
56 return
57
58
59 def write_config(root, files, options, dirnames, osdirnames):
60 for ml_conf_file in files:
61 with open(root + '/' + ml_conf_file, 'r') as f:
62 filelines = f.readlines()
63 # recreate multilib configuration variables
64 substs = [
65 (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)),
66 (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''),
67 (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)),
68 (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''),
69 (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)),
70 (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''),
71 ]
72
73 for (i, line) in enumerate(filelines):
74 for subst in substs:
75 line = re.sub(subst[0], subst[1], line)
76 filelines[i] = line
77
78 with open(root + '/' + ml_conf_file, 'w') as f:
79 f.write(''.join(filelines))
80
81 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
82 def wrap_libdir(libdir):
83 if libdir.find('SYSTEMLIBS_DIR') != -1:
84 return '"%r"'
85 else:
86 return '"/%s/"' % libdir
87
88 for ml_conf_file in files:
89 fn = root + '/' + ml_conf_file
90 if not os.path.exists(fn):
91 continue
92 with open(fn, 'r') as f:
93 filelines = f.readlines()
94
95 # replace lines like
96 # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97 # by
98 # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
99 # this is needed to put the correct dynamic loader path in the generated binaries
100 substs = [
101 (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
102 r'\1' + wrap_libdir(libdir32) + r'\3'),
103 (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\"\S+\")$',
104 r'\1' + wrap_libdir(libdir64) + r'\3'),
105 (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$',
106 r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'),
107 (r'^(#define\s*GLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
108 r'\1' + wrap_libdir(libdir32) + r'\3'),
109 (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
110 r'\1' + wrap_libdir(libdirx32) + r'\3'),
111 (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
112 r'\1' + wrap_libdir(libdirn32) + r'\3'),
113 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
114 r'\1' + wrap_libdir(libdir32) + r'\3'),
115 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
116 r'\1' + wrap_libdir(libdir64) + r'\3'),
117 (r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
118 r'\1' + wrap_libdir(libdirn32) + r'\3'),
119 (r'^(#define\s*UCLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
120 r'\1' + wrap_libdir(libdirx32) + r'\3'),
121 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
122 r'\1' + wrap_libdir(libdir32) + r'\3'),
123 (r'^(#define\s*MUSL_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
124 r'\1' + wrap_libdir(libdir32) + r'\3'),
125 (r'^(#define\s*MUSL_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
126 r'\1' + wrap_libdir(libdir64) + r'\3'),
127 (r'^(#define\s*MUSL_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
128 r'\1' + wrap_libdir(libdirx32) + r'\3'),
129 (r'^(#define\s*MUSL_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
130 r'\1' + wrap_libdir(libdir32) + r'\3'),
131 ]
132
133 for (i, line) in enumerate(filelines):
134 for subst in substs:
135 line = re.sub(subst[0], subst[1], line)
136 filelines[i] = line
137
138 with open(root + '/' + ml_conf_file, 'w') as f:
139 f.write(''.join(filelines))
140
141
142 gcc_target_config_files = {
143 'x86_64' : ['gcc/config/i386/t-linux64'],
144 'i586' : ['gcc/config/i386/t-linux64'],
145 'i686' : ['gcc/config/i386/t-linux64'],
146 'mips' : ['gcc/config/mips/t-linux64'],
147 'mips64' : ['gcc/config/mips/t-linux64'],
148 'powerpc' : ['gcc/config/rs6000/t-linux64'],
149 'powerpc64' : ['gcc/config/rs6000/t-linux64'],
150 'aarch64' : ['gcc/config/aarch64/t-aarch64'],
151 'arm' : ['gcc/config/aarch64/t-aarch64'],
152 }
153
154 gcc_header_config_files = {
155 'x86_64' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
156 'i586' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
157 'i686' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
158 'mips' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
159 'mips64' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
160 'powerpc' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
161 'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
162 'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
163 'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
164 }
165
166 libdir32 = 'SYSTEMLIBS_DIR'
167 libdir64 = 'SYSTEMLIBS_DIR'
168 libdirx32 = 'SYSTEMLIBS_DIR'
169 libdirn32 = 'SYSTEMLIBS_DIR'
170
171
172 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix
173 else d.getVar('TARGET_ARCH'))
174 if pn == "nativesdk-gcc":
175 header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH")]
176 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
177 return
178
179 if target_arch not in gcc_target_config_files:
180 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
181 return
182
183 target_config_files = gcc_target_config_files[target_arch]
184 header_config_files = gcc_header_config_files[target_arch]
185
186 ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE']
187 mltunes = [('DEFAULTTUNE:virtclass-multilib-%s' % ml) for ml in multilibs]
188 if mlprefix:
189 mlindex = 0
190 for ml in multilibs:
191 if mlprefix == ml + '-':
192 break
193 mlindex += 1
194
195 ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
196 else:
197 ml_list.extend(mltunes)
198
199 options = []
200 dirnames = []
201 osdirnames = []
202 optsets = []
203
204 for ml in ml_list:
205 tune = d.getVar(ml)
206 if not tune:
207 bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
208 continue
209 tune_parameters = get_tune_parameters(tune, d)
210
211 tune_baselib = tune_parameters['baselib']
212 if not tune_baselib:
213 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
214 continue
215
216 if tune_baselib == 'lib64':
217 libdir64 = tune_baselib
218 elif tune_baselib == 'libx32':
219 libdirx32 = tune_baselib
220 elif tune_baselib == 'lib32':
221 libdirn32 = tune_baselib
222 elif tune_baselib == 'lib':
223 libdir32 = tune_baselib
224 else:
225 bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
226
227 # take out '-' mcpu='s and march='s from parameters
228 opts = []
229 whitelist = (d.getVar("MULTILIB_OPTION_WHITELIST") or "").split()
230 for i in d.expand(tune_parameters['ccargs']).split():
231 if i in whitelist:
232 # Need to strip '-' from option
233 opts.append(i[1:])
234 options.append(" ".join(opts))
235
236 if tune_baselib == 'lib':
237 dirnames.append('32') # /lib => 32bit lib
238 else:
239 dirnames.append(tune_baselib.replace('lib', ''))
240 osdirnames.append('../' + tune_baselib)
241
242 write_config(builddir, target_config_files, options, dirnames, osdirnames)
243 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
244}
245
246gcc_multilib_setup[cleandirs] = "${B}/gcc/config"
247gcc_multilib_setup[vardepsexclude] = "SDK_ARCH"
248
249EXTRACONFFUNCS += "gcc_multilib_setup"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
new file mode 100644
index 00000000..8bb58631
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
@@ -0,0 +1,310 @@
1require gcc-configure-common.inc
2
3SUMMARY = "Runtime libraries from GCC"
4
5# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
6# All gcc-runtime packages are now covered by the runtime exception.
7LICENSE = "GPL-3.0-with-GCC-exception"
8
9CXXFLAGS:remove = "-fvisibility-inlines-hidden"
10
11EXTRA_OECONF_PATHS = "\
12 --with-gxx-include-dir=${includedir}/c++/${BINV} \
13 --with-sysroot=/not/exist \
14 --with-build-sysroot=${STAGING_DIR_TARGET} \
15"
16
17EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
18EXTRA_OECONF:append = " --cache-file=${B}/config.cache"
19EXTRA_OECONF:append:libc-newlib = " --with-newlib --with-target-subdir"
20EXTRA_OECONF:append:libc-baremetal = " --with-target-subdir"
21
22# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
23EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
24EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no "
25
26DISABLE_STATIC:class-nativesdk ?= ""
27
28# Newlib does not support symbol versioning on libsdtcc++
29SYMVERS_CONF:libc-newlib = ""
30
31# Building with thumb enabled on armv6t fails
32ARM_INSTRUCTION_SET:armv6 = "arm"
33
34RUNTIMELIBITM = "libitm"
35RUNTIMELIBITM:arc = ""
36RUNTIMELIBITM:mipsarch = ""
37RUNTIMELIBITM:nios2 = ""
38RUNTIMELIBITM:microblaze = ""
39RUNTIMELIBITM:riscv32 = ""
40RUNTIMELIBITM:riscv64 = ""
41RUNTIMELIBITM:loongarch64 = ""
42RUNTIMELIBSSP ?= ""
43RUNTIMELIBSSP:mingw32 ?= "libssp"
44
45RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
46 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
47"
48# Only build libstdc++ for newlib
49RUNTIMETARGET:libc-newlib = "libstdc++-v3"
50
51# libiberty
52# libgfortran needs separate recipe due to libquadmath dependency
53
54do_configure () {
55 export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
56 # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
57 # tests. Create a dummy empty lib for the purposes of configure.
58 mkdir -p ${WORKDIR}/dummylib
59 ${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o
60 ${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o
61 for d in libgcc ${RUNTIMETARGET}; do
62 echo "Configuring $d"
63 rm -rf ${B}/${TARGET_SYS}/$d/
64 mkdir -p ${B}/${TARGET_SYS}/$d/
65 cd ${B}/${TARGET_SYS}/$d/
66 chmod a+x ${S}/$d/configure
67 ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
68 if [ "$d" = "libgcc" ]; then
69 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
70 fi
71 done
72}
73EXTRACONFFUNCS += "extract_stashed_builddir"
74do_configure[depends] += "${COMPILERDEP}"
75
76do_compile () {
77 for d in libgcc ${RUNTIMETARGET}; do
78 cd ${B}/${TARGET_SYS}/$d/
79 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/
80 done
81}
82
83do_install () {
84 for d in ${RUNTIMETARGET}; do
85 cd ${B}/${TARGET_SYS}/$d/
86 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
87 done
88 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
89 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
90 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
92 fi
93 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
94 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
95 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
96 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
97 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
98 fi
99 if [ -d ${D}${infodir} ]; then
100 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
101 fi
102}
103
104do_install:append:class-target () {
105 if [ "${TARGET_OS}" = "linux-gnuspe" ]; then
106 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
107 fi
108
109 if [ "${TARGET_OS}" = "linux-gnun32" ]; then
110 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
111 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
112 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32
113 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
114 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
115 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
116 else
117 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
118 fi
119 elif [ "${TARGET_OS}" = "linux-gnux32" ]; then
120 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
121 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
122 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32
123 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
124 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
125 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
126 else
127 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
128 fi
129 elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
130 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}
131 ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits
132 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
133 fi
134
135 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
137 fi
138
139 if [ "${TCLIBC}" != "glibc" ]; then
140 case "${TARGET_OS}" in
141 "linux-musl" | "linux-*spe") extra_target_os="linux";;
142 "linux-musleabi") extra_target_os="linux-gnueabi";;
143 *) extra_target_os="linux";;
144 esac
145 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
146 fi
147 chown -R root:root ${D}
148}
149
150INHIBIT_DEFAULT_DEPS = "1"
151DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
152PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
153
154#BBCLASSEXTEND = "nativesdk"
155
156PACKAGES = "\
157 ${PN}-dbg \
158 libstdc++ \
159 libstdc++-precompile-dev \
160 libstdc++-dev \
161 libstdc++-staticdev \
162 libg2c \
163 libg2c-dev \
164 libssp \
165 libssp-dev \
166 libssp-staticdev \
167 libquadmath \
168 libquadmath-dev \
169 libquadmath-staticdev \
170 libgomp \
171 libgomp-dev \
172 libgomp-staticdev \
173 libatomic \
174 libatomic-dev \
175 libatomic-staticdev \
176 libitm \
177 libitm-dev \
178 libitm-staticdev \
179"
180# The base package doesn't exist, so we clear the recommends.
181RRECOMMENDS:${PN}-dbg = ""
182
183# include python debugging scripts
184FILES:${PN}-dbg += "\
185 ${libdir}/libstdc++.*-gdb.py \
186 ${datadir}/gcc-${BINV}/python/libstdcxx \
187"
188
189FILES:libg2c = "${target_libdir}/libg2c.so.*"
190SUMMARY:libg2c = "Companion runtime library for g77"
191FILES:libg2c-dev = "\
192 ${libdir}/libg2c.so \
193 ${libdir}/libg2c.a \
194 ${libdir}/libfrtbegin.a \
195"
196SUMMARY:libg2c-dev = "Companion runtime library for g77 - development files"
197
198FILES:libstdc++ = "${libdir}/libstdc++.so.*"
199SUMMARY:libstdc++ = "GNU standard C++ library"
200FILES:libstdc++-dev = "\
201 ${includedir}/c++/ \
202 ${libdir}/libstdc++.so \
203 ${libdir}/libstdc++*.la \
204 ${libdir}/libsupc++.la \
205"
206SUMMARY:libstdc++-dev = "GNU standard C++ library - development files"
207FILES:libstdc++-staticdev = "\
208 ${libdir}/libstdc++*.a \
209 ${libdir}/libsupc++.a \
210"
211SUMMARY:libstdc++-staticdev = "GNU standard C++ library - static development files"
212
213FILES:libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
214SUMMARY:libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files"
215
216FILES:libssp = "${libdir}/libssp.so.*"
217SUMMARY:libssp = "GNU stack smashing protection library"
218FILES:libssp-dev = "\
219 ${libdir}/libssp*.so \
220 ${libdir}/libssp*_nonshared.a \
221 ${libdir}/libssp*.la \
222 ${libdir}/${TARGET_SYS}/${BINV}/include/ssp \
223"
224SUMMARY:libssp-dev = "GNU stack smashing protection library - development files"
225FILES:libssp-staticdev = "${libdir}/libssp*.a"
226SUMMARY:libssp-staticdev = "GNU stack smashing protection library - static development files"
227
228FILES:libquadmath = "${libdir}/libquadmath*.so.*"
229SUMMARY:libquadmath = "GNU quad-precision math library"
230FILES:libquadmath-dev = "\
231 ${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \
232 ${libdir}/libquadmath*.so \
233 ${libdir}/libquadmath.la \
234"
235SUMMARY:libquadmath-dev = "GNU quad-precision math library - development files"
236FILES:libquadmath-staticdev = "${libdir}/libquadmath.a"
237SUMMARY:libquadmath-staticdev = "GNU quad-precision math library - static development files"
238
239FILES:libgomp = "${libdir}/libgomp*${SOLIBS}"
240SUMMARY:libgomp = "GNU OpenMP parallel programming library"
241FILES:libgomp-dev = "\
242 ${libdir}/libgomp*${SOLIBSDEV} \
243 ${libdir}/libgomp*.la \
244 ${libdir}/libgomp.spec \
245 ${libdir}/${TARGET_SYS}/${BINV}/include/acc_prof.h \
246 ${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \
247 ${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \
248"
249SUMMARY:libgomp-dev = "GNU OpenMP parallel programming library - development files"
250FILES:libgomp-staticdev = "${libdir}/libgomp*.a"
251SUMMARY:libgomp-staticdev = "GNU OpenMP parallel programming library - static development files"
252
253FILES:libatomic = "${libdir}/libatomic.so.*"
254SUMMARY:libatomic = "GNU C++11 atomics support library"
255FILES:libatomic-dev = "\
256 ${libdir}/libatomic.so \
257 ${libdir}/libatomic.la \
258"
259SUMMARY:libatomic-dev = "GNU C++11 atomics support library - development files"
260FILES:libatomic-staticdev = "${libdir}/libatomic.a"
261SUMMARY:libatomic-staticdev = "GNU C++11 atomics support library - static development files"
262
263FILES:libitm = "${libdir}/libitm.so.*"
264SUMMARY:libitm = "GNU transactional memory support library"
265FILES:libitm-dev = "\
266 ${libdir}/libitm.so \
267 ${libdir}/libitm.la \
268 ${libdir}/libitm.spec \
269"
270SUMMARY:libitm-dev = "GNU transactional memory support library - development files"
271FILES:libitm-staticdev = "${libdir}/libitm.a"
272SUMMARY:libitm-staticdev = "GNU transactional memory support library - static development files"
273
274require gcc-testsuite.inc
275
276EXTRA_OEMAKE:prepend:task-check = "${PARALLEL_MAKE} "
277
278MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}"
279# prettyprinters and xmethods require gdb tooling
280MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp"
281MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'"
282
283# specific host and target dependencies required for test suite running
284do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot"
285do_check[depends] += "virtual/libc:do_populate_sysroot"
286# only depend on qemu if targeting linux user execution
287do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}"
288# extend the recipe sysroot to include the built libraries (for qemu usermode)
289do_check[prefuncs] += "extend_recipe_sysroot"
290do_check[prefuncs] += "check_prepare"
291do_check[dirs] = "${WORKDIR}/dejagnu ${B}"
292do_check[nostamp] = "1"
293do_check() {
294 export DEJAGNU="${WORKDIR}/dejagnu/site.exp"
295
296 # HACK: this works around the configure setting CXX with -nostd* args
297 sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1)
298
299 if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then
300 # qemu user has issues allocating large amounts of memory
301 export G_SLICE=always-malloc
302 # no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory
303 ulimit -m 4194304
304 ulimit -v 10485760
305 fi
306
307 oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}"
308}
309addtask check after do_compile do_populate_sysroot
310
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb
new file mode 100644
index 00000000..dd430b57
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
new file mode 100644
index 00000000..f6aa9c99
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -0,0 +1,120 @@
1require gcc-configure-common.inc
2
3LICENSE = "NCSA | MIT"
4
5LIC_FILES_CHKSUM = "\
6 file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \
7"
8
9EXTRA_OECONF_PATHS = "\
10 --with-sysroot=/not/exist \
11 --with-build-sysroot=${STAGING_DIR_TARGET} \
12"
13
14do_configure () {
15 rm -rf ${B}/${TARGET_SYS}/libsanitizer/
16 mkdir -p ${B}/${TARGET_SYS}/libsanitizer/
17 cd ${B}/${TARGET_SYS}/libsanitizer/
18 chmod a+x ${S}/libsanitizer/configure
19 relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")}
20 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
21 # Easiest way to stop bad RPATHs getting into the library since we have a
22 # broken libtool here
23 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool
24 # Link to the sysroot's libstdc++ instead of one gcc thinks it just built
25 sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile
26}
27EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
29
30do_compile () {
31 cd ${B}/${TARGET_SYS}/libsanitizer/
32 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/
33}
34
35do_install () {
36 cd ${B}/${TARGET_SYS}/libsanitizer/
37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install
38 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
39 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
40 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
41 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
42 fi
43 if [ -d ${D}${infodir} ]; then
44 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
45 fi
46 chown -R root:root ${D}
47}
48
49INHIBIT_DEFAULT_DEPS = "1"
50ALLOW_EMPTY:${PN} = "1"
51DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
52
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"
55
56#BBCLASSEXTEND = "nativesdk"
57
58PACKAGES = "${PN} ${PN}-dbg"
59PACKAGES += "libasan libubsan liblsan libtsan"
60PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
61PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
62
63RDEPENDS:libasan += "libstdc++"
64RDEPENDS:libubsan += "libstdc++"
65RDEPENDS:liblsan += "libstdc++"
66RDEPENDS:libtsan += "libstdc++"
67RDEPENDS:libasan-dev += "${PN}"
68RDEPENDS:libubsan-dev += "${PN}"
69RDEPENDS:liblsan-dev += "${PN}"
70RDEPENDS:libtsan-dev += "${PN}"
71RRECOMMENDS:${PN} += "libasan libubsan"
72RRECOMMENDS:${PN}:append:x86 = " liblsan"
73RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan"
74RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan"
75RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan"
76
77do_package_write_ipk[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"
80
81# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
83# musl is currently broken entirely
84COMPATIBLE_HOST:libc-musl = 'null'
85
86FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
87FILES:libasan-dev += "\
88 ${libdir}/libasan_preinit.o \
89 ${libdir}/libasan.so \
90 ${libdir}/libhwasan.so \
91 ${libdir}/libasan.la \
92"
93FILES:libasan-staticdev += "${libdir}/libasan.a \
94 ${libdir}/libhwasan.a \
95"
96
97FILES:libubsan += "${libdir}/libubsan.so.*"
98FILES:libubsan-dev += "\
99 ${libdir}/libubsan.so \
100 ${libdir}/libubsan.la \
101"
102FILES:libubsan-staticdev += "${libdir}/libubsan.a"
103
104FILES:liblsan += "${libdir}/liblsan.so.*"
105FILES:liblsan-dev += "\
106 ${libdir}/liblsan.so \
107 ${libdir}/liblsan.la \
108 ${libdir}/liblsan_preinit.o \
109"
110FILES:liblsan-staticdev += "${libdir}/liblsan.a"
111
112FILES:libtsan += "${libdir}/libtsan.so.*"
113FILES:libtsan-dev += "\
114 ${libdir}/libtsan.so \
115 ${libdir}/libtsan.la \
116 ${libdir}/libtsan_*.o \
117"
118FILES:libtsan-staticdev += "${libdir}/libtsan.a"
119
120FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
new file mode 100644
index 00000000..8bda2cca
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
@@ -0,0 +1,7 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
3
4# Building with thumb enabled on armv4t armv5t fails with
5# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
6ARM_INSTRUCTION_SET:armv4 = "arm"
7ARM_INSTRUCTION_SET:armv5 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc
new file mode 100644
index 00000000..03f520b0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc
@@ -0,0 +1,21 @@
1do_fetch() {
2 :
3}
4do_fetch[noexec] = "1"
5deltask do_unpack
6deltask do_patch
7
8SRC_URI = ""
9
10do_configure[depends] += "gcc-source-${PV}:do_preconfigure"
11do_populate_lic[depends] += "gcc-source-${PV}:do_unpack"
12do_deploy_source_date_epoch[depends] += "gcc-source-${PV}:do_deploy_source_date_epoch"
13
14# Copy the SDE from the shared workdir to the recipe workdir
15do_deploy_source_date_epoch () {
16 sde_file=${SDE_FILE}
17 sde_file=${sde_file#${WORKDIR}/}
18 mkdir -p ${SDE_DEPLOYDIR} $(dirname ${SDE_FILE})
19 cp -p $(dirname ${S})/$sde_file ${SDE_DEPLOYDIR}
20 cp -p $(dirname ${S})/$sde_file ${SDE_FILE}
21}
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc
new file mode 100644
index 00000000..265bcf4b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc
@@ -0,0 +1,45 @@
1deltask do_configure
2deltask do_compile
3deltask do_install
4deltask do_populate_sysroot
5deltask do_populate_lic
6RM_WORK_EXCLUDE += "${PN}"
7
8inherit nopackages
9
10PN = "gcc-source-${PV}"
11WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
12SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:"
13
14STAMP = "${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}"
15STAMPCLEAN = "${STAMPS_DIR}/work-shared/gcc-${PV}-*"
16
17INHIBIT_DEFAULT_DEPS = "1"
18DEPENDS = ""
19PACKAGES = ""
20TARGET_ARCH = "allarch"
21TARGET_AS_ARCH = "none"
22TARGET_CC_ARCH = "none"
23TARGET_LD_ARCH = "none"
24TARGET_OS = "linux"
25baselib = "lib"
26PACKAGE_ARCH = "all"
27
28B = "${WORKDIR}/build"
29
30# This needs to be Python to avoid lots of shell variables becoming dependencies.
31python do_preconfigure () {
32 import subprocess
33 cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
34 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
35 cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure")
36 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
37
38 # Easiest way to stop bad RPATHs getting into the library since we have a
39 # broken libtool here (breaks cross-canadian and target at least)
40 cmd = d.expand("sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure")
41 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
42}
43addtask do_preconfigure after do_patch
44do_preconfigure[depends] += "gnu-config-native:do_populate_sysroot autoconf-native:do_populate_sysroot"
45
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb
new file mode 100644
index 00000000..b890fa33
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb
@@ -0,0 +1,4 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require recipes-devtools/gcc/gcc-source.inc
3
4EXCLUDE_FROM_WORLD = "1"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-target.inc b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc
new file mode 100644
index 00000000..7dac3ef4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc
@@ -0,0 +1,259 @@
1GCCMULTILIB = "--enable-multilib"
2require gcc-configure-common.inc
3
4EXTRA_OECONF_PATHS = "\
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
9
10# Configure gcc running on the target to default to an architecture which will
11# be compatible with that of gcc-runtime (which is cross compiled to be target
12# specific). For example, for ARM, ARMv6+ adds atomic instructions that may
13# affect the ABI in the gcc-runtime libs. Since we can't rely on gcc on the
14# target to always be passed -march etc, its built-in default needs to be safe.
15
16ARMFPARCHEXT ?= ""
17
18EXTRA_OECONF:append:armv6:class-target = " --with-arch=armv6${ARMFPARCHEXT}"
19EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
20EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
21EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}"
22EXTRA_OECONF:append:x86-64:class-target = " ${@get_gcc_x86_64_arch_setting(bb, d)}"
23
24# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
25# set in subdir gcc, so subdir libcc1 can't use it, export it here to
26# fix the problem.
27export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
28
29EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
30
31PACKAGES = "\
32 ${PN} ${PN}-plugins ${PN}-symlinks \
33 g++ g++-symlinks \
34 cpp cpp-symlinks \
35 g77 g77-symlinks \
36 gfortran gfortran-symlinks \
37 gcov gcov-symlinks \
38 ${PN}-doc \
39 ${PN}-dev \
40 ${PN}-dbg \
41"
42
43FILES:${PN} = "\
44 ${bindir}/${TARGET_PREFIX}gcc* \
45 ${bindir}/${TARGET_PREFIX}lto* \
46 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
47 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/g++-mapper-server \
48 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
49 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
50 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
51 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
52 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
53 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
54 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
55 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
56 ${libdir}/bfd-plugins/*.so \
57"
58INSANE_SKIP:${PN} += "dev-so"
59RRECOMMENDS:${PN} += "\
60 libssp \
61 libssp-dev \
62"
63RDEPENDS:${PN} += "cpp"
64
65FILES:${PN}-dev = "\
66 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
67 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
68 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
69 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
70 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
71"
72FILES:${PN}-symlinks = "\
73 ${bindir}/cc \
74 ${bindir}/gcc \
75 ${bindir}/gccbug \
76"
77
78FILES:${PN}-plugins = "\
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
80"
81ALLOW_EMPTY:${PN}-plugins = "1"
82
83FILES:g77 = "\
84 ${bindir}/${TARGET_PREFIX}g77 \
85 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
86"
87FILES:g77-symlinks = "\
88 ${bindir}/g77 \
89 ${bindir}/f77 \
90"
91RRECOMMENDS:g77 = "\
92 libg2c \
93 libg2c-dev \
94"
95
96FILES:gfortran = "\
97 ${bindir}/${TARGET_PREFIX}gfortran \
98 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
99"
100RRECOMMENDS:gfortran = "\
101 libquadmath \
102 libquadmath-dev \
103"
104FILES:gfortran-symlinks = "\
105 ${bindir}/gfortran \
106 ${bindir}/f95"
107
108FILES:cpp = "\
109 ${bindir}/${TARGET_PREFIX}cpp* \
110 ${base_libdir}/cpp \
111 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
112FILES:cpp-symlinks = "${bindir}/cpp"
113
114FILES:gcov = "${bindir}/${TARGET_PREFIX}gcov* \
115 ${bindir}/${TARGET_PREFIX}gcov-tool* \
116"
117FILES:gcov-symlinks = "${bindir}/gcov \
118 ${bindir}/gcov-tool \
119"
120
121FILES:g++ = "\
122 ${bindir}/${TARGET_PREFIX}g++* \
123 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
124"
125FILES:g++-symlinks = "\
126 ${bindir}/c++ \
127 ${bindir}/g++ \
128"
129RRECOMMENDS:g++ = "\
130 libstdc++ \
131 libstdc++-dev \
132 libatomic \
133 libatomic-dev \
134"
135
136FILES:${PN}-doc = "\
137 ${infodir} \
138 ${mandir} \
139 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
140"
141
142do_compile () {
143 # Prevent full target sysroot path from being used in configargs.h header,
144 # as it will be rewritten when used by other sysroots preventing support
145 # for gcc plugins. Additionally the path is embeddeded into the output
146 # binary, this prevents building a reproducible binary.
147 oe_runmake configure-gcc
148 sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/configargs.h
149 sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h
150
151 # Prevent sysroot/workdir paths from being used in checksum-options.
152 # checksum-options is used to generate a checksum which is embedded into
153 # the output binary.
154 oe_runmake TARGET-gcc=checksum-options all-gcc
155 sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
156 sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/checksum-options
157
158 oe_runmake all-host
159}
160
161do_install () {
162 oe_runmake 'DESTDIR=${D}' install-host
163
164 # Add unwind.h, it comes from libgcc which we don't want to build again
165 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
166
167 # Info dir listing isn't interesting at this point so remove it if it exists.
168 if [ -e "${D}${infodir}/dir" ]; then
169 rm -f ${D}${infodir}/dir
170 fi
171
172 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
173 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
174 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
175 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
176 rmdir ${D}${includedir}
177 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
178
179 # Hack around specs file assumptions
180 test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
181
182 # Cleanup manpages..
183 rm -rf ${D}${mandir}/man7
184
185 # Don't package details about the build host
186 rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/auto-build.h
187 rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/bconfig.h
188
189 cd ${D}${bindir}
190
191 # We care about g++ not c++
192 rm -f *c++*
193
194 # We don't care about the gcc-<version> ones for this
195 rm -f *gcc-?*.?*
196
197 # Not sure why we end up with these but we don't want them...
198 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
199
200 # Symlinks so we can use these trivially on the target
201 if [ -e ${TARGET_PREFIX}g77 ]; then
202 ln -sf ${TARGET_PREFIX}g77 g77 || true
203 ln -sf g77 f77 || true
204 fi
205 if [ -e ${TARGET_PREFIX}gfortran ]; then
206 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
207 ln -sf gfortran f95 || true
208 fi
209 ln -sf ${TARGET_PREFIX}g++ g++
210 ln -sf ${TARGET_PREFIX}gcc gcc
211 ln -sf ${TARGET_PREFIX}cpp cpp
212 ln -sf ${TARGET_PREFIX}gcov gcov
213 ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool
214 install -d ${D}${base_libdir}
215 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
216 ln -sf g++ c++
217 ln -sf gcc cc
218 install -d ${D}${libdir}/bfd-plugins
219 ln -sf ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
220 chown -R root:root ${D}
221}
222
223do_install:append () {
224 #
225 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
226 # files and places the modified files into
227 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
228 # build not deterministic. The following code prunes all those headers
229 # except those under include-fixed/linux, *limits.h and README, yielding
230 # the same include-fixed folders no matter what sysroot
231
232 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
233 for f in $(find ${include_fixed} -type f); do
234 case $f in
235 */include-fixed/linux/*)
236 continue
237 ;;
238 */include-fixed/*limits.h)
239 continue
240 ;;
241 */include-fixed/README)
242 continue
243 ;;
244 *)
245 # remove file and directory if empty
246 bbdebug 2 "Pruning $f"
247 rm $f
248 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
249 ;;
250 esac
251 done
252}
253
254# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
255# and one from here. These can confuse gcc cross where includes use #include_next
256# and builds track file dependencies (e.g. perl and its makedepends code).
257# For determinism we don't install this ever and rely on the copy from gcc-cross.
258# [YOCTO #7287]
259SYSROOT_DIRS_IGNORE += "${libdir}/gcc"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
new file mode 100644
index 00000000..f68fec58
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
@@ -0,0 +1,107 @@
1inherit qemu
2
3TOOLCHAIN_TEST_TARGET ??= "user"
4TOOLCHAIN_TEST_HOST ??= "localhost"
5TOOLCHAIN_TEST_HOST_USER ??= "root"
6TOOLCHAIN_TEST_HOST_PORT ??= "2222"
7
8MAKE_CHECK_BOARDFLAGS ??= ""
9MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}"
10
11python () {
12 # Provide the targets compiler args via targets options. This allows dejagnu to
13 # correctly mark incompatible tests as UNSUPPORTED (e.g. needs soft-float
14 # but running on hard-float target).
15 #
16 # These options are called "multilib_flags" within the gcc test suite. Most
17 # architectures handle these options in a sensible way such that tests that
18 # are incompatible with the provided multilib are marked as UNSUPPORTED.
19 #
20 # Note: multilib flags are added to the compile command after the args
21 # provided by any test (through dg-options), CFLAGS_FOR_TARGET is always
22 # added to the compile command before any other args but is not interpted
23 # as options like multilib flags.
24 #
25 # i686, x86-64 and aarch64 are special, since most toolchains built for
26 # these targets don't do multilib the tests do not get correctly marked as
27 # UNSUPPORTED. More importantly the test suite itself does not handle
28 # overriding the multilib flags where it could (like other archs do). As
29 # such do not pass the target compiler args for these targets.
30 args = d.getVar("TUNE_CCARGS").split()
31 if d.getVar("TUNE_ARCH") in ["i686", "x86_64", "aarch64"]:
32 args = []
33 d.setVar("MAKE_CHECK_BOARDFLAGS", ("/" + "/".join(args)) if len(args) != 0 else "")
34}
35
36python check_prepare() {
37 def generate_qemu_linux_user_config(d):
38 content = []
39 content.append('load_generic_config "sim"')
40 content.append('load_base_board_description "basic-sim"')
41 content.append('process_multilib_options ""')
42
43 # qemu args
44 qemu_binary = qemu_target_binary(d)
45 if not qemu_binary:
46 bb.fatal("Missing target qemu linux-user binary")
47
48 args = []
49 # QEMU_OPTIONS is not always valid due to -cross recipe
50 args += ["-r", d.getVar("OLDEST_KERNEL")]
51 # enable all valid instructions, since the test suite itself does not
52 # limit itself to the target cpu options.
53 # - valid for x86*, powerpc, arm, arm64
54 if qemu_binary.lstrip("qemu-") in ["x86_64", "i386", "ppc", "arm", "aarch64"]:
55 args += ["-cpu", "max"]
56
57 sysroot = d.getVar("RECIPE_SYSROOT")
58 args += ["-L", sysroot]
59 # lib paths are static here instead of using $libdir since this is used by a -cross recipe
60 libpaths = [sysroot + "/usr/lib", sysroot + "/lib"]
61 args += ["-E", "LD_LIBRARY_PATH={0}".format(":".join(libpaths))]
62
63 content.append('set_board_info is_simulator 1')
64 content.append('set_board_info sim "{0}"'.format(qemu_binary))
65 content.append('set_board_info sim,options "{0}"'.format(" ".join(args)))
66
67 # target build/test config
68 content.append('set_board_info target_install {%s}' % d.getVar("TARGET_SYS"))
69 content.append('set_board_info ldscript ""')
70 #content.append('set_board_info needs_status_wrapper 1') # qemu-linux-user return codes work, and abort works fine
71 content.append('set_board_info gcc,stack_size 16834')
72 content.append('set_board_info gdb,nosignals 1')
73 content.append('set_board_info gcc,timeout 60')
74
75 return "\n".join(content)
76
77 def generate_remote_ssh_linux_config(d):
78 content = []
79 content.append('load_generic_config "unix"')
80 content.append('process_multilib_options ""')
81 content.append("set_board_info hostname {0}".format(d.getVar("TOOLCHAIN_TEST_HOST")))
82 content.append("set_board_info username {0}".format(d.getVar("TOOLCHAIN_TEST_HOST_USER")))
83
84 port = d.getVar("TOOLCHAIN_TEST_HOST_PORT")
85 content.append("set_board_info rsh_prog \"/usr/bin/ssh -p {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
86 content.append("set_board_info rcp_prog \"/usr/bin/scp -P {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
87
88 return "\n".join(content)
89
90 dejagnudir = d.expand("${WORKDIR}/dejagnu")
91 if not os.path.isdir(dejagnudir):
92 os.makedirs(dejagnudir)
93
94 # write out target qemu board config
95 with open(os.path.join(dejagnudir, "user.exp"), "w") as f:
96 f.write(generate_qemu_linux_user_config(d))
97
98 # write out target ssh board config
99 with open(os.path.join(dejagnudir, "ssh.exp"), "w") as f:
100 f.write(generate_remote_ssh_linux_config(d))
101
102 # generate site.exp to provide boards
103 with open(os.path.join(dejagnudir, "site.exp"), "w") as f:
104 f.write("lappend boards_dir {0}\n".format(dejagnudir))
105 f.write("set CFLAGS_FOR_TARGET \"{0}\"\n".format(d.getVar("TOOLCHAIN_OPTIONS")))
106}
107
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
new file mode 100644
index 00000000..66e582ca
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,39 @@
1From 31f94ef5b43a984a98f0eebd2dcf1b53aa1d7bce Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index 5dcaab14ae9..f76310a36bb 100755
16--- a/configure
17+++ b/configure
18@@ -10165,7 +10165,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index 85977482aee..8b9097c7a45 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3346,7 +3346,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
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
new file mode 100644
index 00000000..5aa635b3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
@@ -0,0 +1,239 @@
1From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 8 Mar 2021 16:04:20 -0800
4Subject: [PATCH] gcc: poison-system-directories
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
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".
13
14Upstream-Status: Pending
15Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 gcc/common.opt | 4 ++++
19 gcc/config.in | 10 ++++++++++
20 gcc/configure | 19 +++++++++++++++++++
21 gcc/configure.ac | 16 ++++++++++++++++
22 gcc/doc/invoke.texi | 9 +++++++++
23 gcc/gcc.cc | 15 ++++++++++++---
24 gcc/incpath.cc | 21 +++++++++++++++++++++
25 7 files changed, 91 insertions(+), 3 deletions(-)
26
27diff --git a/gcc/common.opt b/gcc/common.opt
28index 8a0dafc52..0357868e2 100644
29--- a/gcc/common.opt
30+++ b/gcc/common.opt
31@@ -710,6 +710,10 @@ Wreturn-local-addr
32 Common Var(warn_return_local_addr) Init(1) Warning
33 Warn about returning a pointer/reference to a local or temporary variable.
34
35+Wpoison-system-directories
36+Common Var(flag_poison_system_directories) Init(1) Warning
37+Warn for -I and -L options using system directories if cross compiling
38+
39 Wshadow
40 Common Var(warn_shadow) Warning
41 Warn when one variable shadows another. Same as -Wshadow=global.
42diff --git a/gcc/config.in b/gcc/config.in
43index 64c27c9cf..a693cb8a8 100644
44--- a/gcc/config.in
45+++ b/gcc/config.in
46@@ -230,6 +230,16 @@
47 #endif
48
49
50+/* Define to warn for use of native system header directories */
51+#ifndef USED_FOR_TARGET
52+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
53+#endif
54+/* Define to warn for use of native system header directories */
55+#ifndef USED_FOR_TARGET
56+#undef POISON_BY_DEFAULT
57+#endif
58+
59+
60 /* Define if you want all operations on RTL (the basic data structure of the
61 optimizer and back end) to be checked for dynamic type safety at runtime.
62 This is quite expensive. */
63diff --git a/gcc/configure b/gcc/configure
64index 2b83acfb0..8bb97578c 100755
65--- a/gcc/configure
66+++ b/gcc/configure
67@@ -1023,6 +1023,7 @@ enable_maintainer_mode
68 enable_link_mutex
69 enable_link_serialization
70 enable_version_specific_runtime_libs
71+enable_poison_system_directories
72 enable_plugin
73 enable_host_shared
74 enable_libquadmath_support
75@@ -1785,6 +1786,8 @@ Optional Features:
76 --enable-version-specific-runtime-libs
77 specify that runtime libraries should be installed
78 in a compiler-specific directory
79+ --enable-poison-system-directories
80+ warn for use of native system header directories
81 --enable-plugin enable plugin support
82 --enable-host-shared build host code as shared libraries
83 --disable-libquadmath-support
84@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
85 fi
86
87
88+# Check whether --enable-poison-system-directories was given.
89+if test "${enable_poison_system_directories+set}" = set; then :
90+ enableval=$enable_poison_system_directories;
91+else
92+ enable_poison_system_directories=no
93+fi
94+
95+if test "x${enable_poison_system_directories}" != "xno"; then
96+
97+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
98+if test "$enable_poison_system_directories" = "error"; then
99+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
100+fi
101+
102+fi
103+
104 # Substitute configuration variables
105
106
107diff --git a/gcc/configure.ac b/gcc/configure.ac
108index daf2a708c..6155b83a7 100644
109--- a/gcc/configure.ac
110+++ b/gcc/configure.ac
111@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
112 [specify that runtime libraries should be
113 installed in a compiler-specific directory])])
114
115+AC_ARG_ENABLE([poison-system-directories],
116+ AS_HELP_STRING([--enable-poison-system-directories],
117+ [warn for use of native system header directories (no/yes/error)]),,
118+ [enable_poison_system_directories=no])
119+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
120+if test "x${enable_poison_system_directories}" != "xno"; then
121+ AC_MSG_NOTICE([poisoned directories enabled])
122+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
123+ [1],
124+ [Define to warn for use of native system header directories])
125+ if test $enable_poison_system_directories = "error"; then
126+ AC_MSG_NOTICE([poisoned directories are fatal])
127+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
128+ fi
129+fi
130+
131 # Substitute configuration variables
132 AC_SUBST(subdirs)
133 AC_SUBST(srcdir)
134diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
135index ff6c338be..a8ebfa59a 100644
136--- a/gcc/doc/invoke.texi
137+++ b/gcc/doc/invoke.texi
138@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
139 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
140 -Wparentheses -Wno-pedantic-ms-format @gol
141 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
142+-Wno-poison-system-directories @gol
143 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
144 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
145 -Wno-scalar-storage-order -Wsequence-point @gol
146@@ -8029,6 +8030,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
148 made executable in order for the program to work properly.
149
150+@item -Wno-poison-system-directories
151+@opindex Wno-poison-system-directories
152+Do not warn for @option{-I} or @option{-L} options using system
153+directories such as @file{/usr/include} when cross compiling. This
154+option is intended for use in chroot environments when such
155+directories contain the correct headers and libraries for the target
156+system rather than the host.
157+
158 @item -Wfloat-equal
159 @opindex Wfloat-equal
160 @opindex Wno-float-equal
161diff --git a/gcc/gcc.cc b/gcc/gcc.cc
162index beefde7f6..4e6557b3c 100644
163--- a/gcc/gcc.cc
164+++ b/gcc/gcc.cc
165@@ -1162,6 +1162,8 @@ proper position among the other output files. */
166 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
167 "%X %{o*} %{e*} %{N} %{n} %{r}\
168 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
169+ %{Wno-poison-system-directories:--no-poison-system-directories} \
170+ %{Werror=poison-system-directories:--error-poison-system-directories} \
171 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
172 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
173 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
174@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
175 static const char *cpp_options =
176 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
177 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
178- %{!fno-working-directory:-fworking-directory}}} %{O*}\
179- %{undef} %{save-temps*:-fpch-preprocess}";
180+ %{!fno-working-directory:-fworking-directory}}} %{O*}"
181+#ifdef POISON_BY_DEFAULT
182+ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
183+#endif
184+ " %{undef} %{save-temps*:-fpch-preprocess}";
185
186 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
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
202index 622204a38..5ac03c086 100644
203--- a/gcc/incpath.cc
204+++ b/gcc/incpath.cc
205@@ -26,6 +26,7 @@
206 #include "intl.h"
207 #include "incpath.h"
208 #include "cppdefault.h"
209+#include "diagnostic-core.h"
210
211 /* Microsoft Windows does not natively support inodes.
212 VMS has non-numeric inodes. */
213@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
214 }
215 fprintf (stderr, _("End of search list.\n"));
216 }
217+
218+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
219+ if (flag_poison_system_directories)
220+ {
221+ struct cpp_dir *p;
222+
223+ for (p = heads[INC_QUOTE]; p; p = p->next)
224+ {
225+ if ((!strncmp (p->name, "/usr/include", 12))
226+ || (!strncmp (p->name, "/usr/local/include", 18))
227+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
228+ || (!strncmp (p->name, "/sw/include", 11))
229+ || (!strncmp (p->name, "/opt/include", 12)))
230+ warning (OPT_Wpoison_system_directories,
231+ "include location \"%s\" is unsafe for "
232+ "cross-compilation",
233+ p->name);
234+ }
235+ }
236+#endif
237 }
238
239 /* Use given -I paths for #include "..." but not #include <...>, and
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
new file mode 100644
index 00000000..e83f05b8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
@@ -0,0 +1,134 @@
1From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH] 64-bit multilib hack.
5
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
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22Do same for riscv64, aarch64 & arc
23
24RP 15/8/11
25
26Upstream-Status: Inappropriate [OE-Specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
30Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32---
33 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
34 gcc/config/arc/t-multilib-linux | 4 ++--
35 gcc/config/i386/t-linux64 | 6 ++----
36 gcc/config/mips/t-linux64 | 10 +++-------
37 gcc/config/riscv/t-linux | 6 ++++--
38 gcc/config/rs6000/t-linux64 | 5 ++---
39 6 files changed, 17 insertions(+), 22 deletions(-)
40
41diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
42index d0cd546002a..f4056d68372 100644
43--- a/gcc/config/aarch64/t-aarch64-linux
44+++ b/gcc/config/aarch64/t-aarch64-linux
45@@ -21,8 +21,8 @@
46 LIB1ASMSRC = aarch64/lib1funcs.asm
47 LIB1ASMFUNCS = _aarch64_sync_cache_range
48
49-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
50-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
51-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
52+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
53+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
54+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
55
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)
58diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
59index ecb9ae6859f..12a164028d4 100644
60--- a/gcc/config/arc/t-multilib-linux
61+++ b/gcc/config/arc/t-multilib-linux
62@@ -16,9 +16,9 @@
63 # along with GCC; see the file COPYING3. If not see
64 # <http://www.gnu.org/licenses/>.
65
66-MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
67+#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
68
69-MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
70+#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
71
72 # Aliases:
73 MULTILIB_MATCHES += mcpu?arc700=mA7
74diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
75index 5526ad0e6cc..fa51c88912b 100644
76--- a/gcc/config/i386/t-linux64
77+++ b/gcc/config/i386/t-linux64
78@@ -32,7 +32,5 @@
79 #
80 comma=,
81 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
82-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
83-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
84-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
85-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
86+MULTILIB_DIRNAMES = . .
87+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
88diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
89index 2fdd8e00407..04f2099250f 100644
90--- a/gcc/config/mips/t-linux64
91+++ b/gcc/config/mips/t-linux64
92@@ -17,10 +17,6 @@
93 # <http://www.gnu.org/licenses/>.
94
95 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
96-MULTILIB_DIRNAMES = n32 32 64
97-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-MULTILIB_OSDIRNAMES = \
100- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
101- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
102- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
103+MULTILIB_DIRNAMES = . . .
104+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
107index 216d2776a18..e4d817621fc 100644
108--- a/gcc/config/riscv/t-linux
109+++ b/gcc/config/riscv/t-linux
110@@ -1,3 +1,5 @@
111 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
112-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
113-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
114+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
115+MULTILIB_DIRNAMES := . .
116+#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
119index 47e0efd5764..05f5a3f188e 100644
120--- a/gcc/config/rs6000/t-linux64
121+++ b/gcc/config/rs6000/t-linux64
122@@ -26,10 +26,9 @@
123 # MULTILIB_OSDIRNAMES according to what is found on the target.
124
125 MULTILIB_OPTIONS := m64/m32
126-MULTILIB_DIRNAMES := 64 32
127+MULTILIB_DIRNAMES := . .
128 MULTILIB_EXTRA_OPTS :=
129-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
130-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
131+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
132
133 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
134 $(COMPILE) $<
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
new file mode 100644
index 00000000..e8f21634
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
@@ -0,0 +1,64 @@
1From 7f40f8321fb999e9b34d948724517d3fb0d26820 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 28 Oct 2021 11:33:40 +0100
4Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these
5 errors.
6
7If CXXFLAGS contains something unsupported by the build CXX, we see build failures (e.g. using -fmacro-prefix-map for the target).
8
92021-10-28 Richard Purdie <richard.purdie@linuxfoundation.org>
10
11ChangeLog:
12
13 * Makefile.in: Regenerate.
14 * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
15
16Upstream-Status: Pending [should be submittable]
17
18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 Makefile.in | 2 ++
22 Makefile.tpl | 2 ++
23 2 files changed, 4 insertions(+)
24
25diff --git a/Makefile.in b/Makefile.in
26index 593495e1650..1d9c83cc566 100644
27--- a/Makefile.in
28+++ b/Makefile.in
29@@ -176,6 +176,7 @@ BUILD_EXPORTS = \
30 # built for the build system to override those in BASE_FLAGS_TO_PASS.
31 EXTRA_BUILD_FLAGS = \
32 CFLAGS="$(CFLAGS_FOR_BUILD)" \
33+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
34 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
35
36 # This is the list of directories to built for the host system.
37@@ -207,6 +208,7 @@ HOST_EXPORTS = \
38 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
39 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
40 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
41+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
42 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
43 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
44 LD="$(LD)"; export LD; \
45diff --git a/Makefile.tpl b/Makefile.tpl
46index ef58fac2b9a..bab04f335c2 100644
47--- a/Makefile.tpl
48+++ b/Makefile.tpl
49@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
50 # built for the build system to override those in BASE_FLAGS_TO_PASS.
51 EXTRA_BUILD_FLAGS = \
52 CFLAGS="$(CFLAGS_FOR_BUILD)" \
53+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
54 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
55
56 # This is the list of directories to built for the host system.
57@@ -210,6 +211,7 @@ HOST_EXPORTS = \
58 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
59 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
60 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
61+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
62 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
63 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
64 LD="$(LD)"; export LD; \
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
new file mode 100644
index 00000000..e34eb2cf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,92 @@
1From 5455fc1de74897a27c1199dc5611ec02243e24af Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
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}
5
6Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
7the source can be shared between gcc-cross-initial,
8gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
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
15occasionally failure that test the existance of default.h doesn't
16work, the reason is tm_include_list='** defaults.h' rather than
17tm_include_list='** ./defaults.h'
18
19So we add the test condition for this situation.
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21---
22 gcc/Makefile.in | 2 +-
23 gcc/configure | 4 ++--
24 gcc/configure.ac | 4 ++--
25 gcc/mkconfig.sh | 4 ++--
26 4 files changed, 7 insertions(+), 7 deletions(-)
27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 31ff95500c9..a8277254696 100644
30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in
32@@ -553,7 +553,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
33 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
34
35 xmake_file=@xmake_file@
36-tmake_file=@tmake_file@
37+tmake_file=@tmake_file@ ./t-oe
38 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
41diff --git a/gcc/configure b/gcc/configure
42index dc2d59701ad..3fc0e2f5813 100755
43--- a/gcc/configure
44+++ b/gcc/configure
45@@ -13381,8 +13381,8 @@ for f in $tm_file; do
46 tm_include_list="${tm_include_list} $f"
47 ;;
48 defaults.h )
49- tm_file_list="${tm_file_list} \$(srcdir)/$f"
50- tm_include_list="${tm_include_list} $f"
51+ tm_file_list="${tm_file_list} ./$f"
52+ tm_include_list="${tm_include_list} ./$f"
53 ;;
54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56diff --git a/gcc/configure.ac b/gcc/configure.ac
57index 36ce78924de..46de496b256 100644
58--- a/gcc/configure.ac
59+++ b/gcc/configure.ac
60@@ -2332,8 +2332,8 @@ for f in $tm_file; do
61 tm_include_list="${tm_include_list} $f"
62 ;;
63 defaults.h )
64- tm_file_list="${tm_file_list} \$(srcdir)/$f"
65- tm_include_list="${tm_include_list} $f"
66+ tm_file_list="${tm_file_list} ./$f"
67+ tm_include_list="${tm_include_list} ./$f"
68 ;;
69 * )
70 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
71diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
72index 91cc43f69ff..8de33713cd8 100644
73--- a/gcc/mkconfig.sh
74+++ b/gcc/mkconfig.sh
75@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
76 if [ $# -ge 1 ]; then
77 echo '#ifdef IN_GCC' >> ${output}T
78 for file in "$@"; do
79- if test x"$file" = x"defaults.h"; then
80+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
81 postpone_defaults_h="yes"
82 else
83 echo "# include \"$file\"" >> ${output}T
84@@ -106,7 +106,7 @@ esac
85
86 # If we postponed including defaults.h, add the #include now.
87 if test x"$postpone_defaults_h" = x"yes"; then
88- echo "# include \"defaults.h\"" >> ${output}T
89+ echo "# include \"./defaults.h\"" >> ${output}T
90 fi
91
92 # Add multiple inclusion protection guard, part two.
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
new file mode 100644
index 00000000..b08aecc7
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
@@ -0,0 +1,53 @@
1From abc3b82ab24169277f2090e9df1ceac3573142be Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.cc | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index f35c9fab76b..19ddc98ce7f 100644
30--- a/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
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!E:%{!M:%{!MM:"
36- " cc1plus -fpreprocessed %i %(cc1_options) %2"
37+ " cc1plus -fpreprocessed %i %I %(cc1_options) %2"
38 " %{!fsyntax-only:"
39 " %{fmodule-only:%{!S:-o %g.s%V}}"
40 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
41diff --git a/gcc/gcc.cc b/gcc/gcc.cc
42index ce161d3c853..aa4cf92fb78 100644
43--- a/gcc/gcc.cc
44+++ b/gcc/gcc.cc
45@@ -1476,7 +1476,7 @@ static const struct compiler default_compilers[] =
46 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
47 {".i", "@cpp-output", 0, 0, 0},
48 {"@cpp-output",
49- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
50+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
51 {".s", "@assembler", 0, 0, 0},
52 {"@assembler",
53 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 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
new file mode 100644
index 00000000..b59eed57
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,403 @@
1From 4de00af67b57b5440bdf61ab364ad959ad0aeee7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/aarch64/aarch64-linux.h | 4 ++--
21 gcc/config/alpha/linux-elf.h | 4 ++--
22 gcc/config/arm/linux-eabi.h | 6 +++---
23 gcc/config/arm/linux-elf.h | 2 +-
24 gcc/config/i386/linux.h | 4 ++--
25 gcc/config/i386/linux64.h | 12 ++++++------
26 gcc/config/linux.h | 8 ++++----
27 gcc/config/loongarch/gnu-user.h | 4 ++--
28 gcc/config/microblaze/linux.h | 4 ++--
29 gcc/config/mips/linux.h | 18 +++++++++---------
30 gcc/config/nios2/linux.h | 4 ++--
31 gcc/config/riscv/linux.h | 4 ++--
32 gcc/config/rs6000/linux64.h | 15 +++++----------
33 gcc/config/rs6000/sysv4.h | 4 ++--
34 gcc/config/s390/linux.h | 8 ++++----
35 gcc/config/sh/linux.h | 4 ++--
36 gcc/config/sparc/linux.h | 2 +-
37 gcc/config/sparc/linux64.h | 4 ++--
38 18 files changed, 53 insertions(+), 58 deletions(-)
39
40diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
41index 5e4553d79f5..877e8841eb2 100644
42--- a/gcc/config/aarch64/aarch64-linux.h
43+++ b/gcc/config/aarch64/aarch64-linux.h
44@@ -21,10 +21,10 @@
45 #ifndef GCC_AARCH64_LINUX_H
46 #define GCC_AARCH64_LINUX_H
47
48-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
49+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
50
51 #undef MUSL_DYNAMIC_LINKER
52-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
53+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
54
55 #undef ASAN_CC1_SPEC
56 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
57diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
58index 17f16a55910..0a7be38fa63 100644
59--- a/gcc/config/alpha/linux-elf.h
60+++ b/gcc/config/alpha/linux-elf.h
61@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
62 #define EXTRA_SPECS \
63 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
64
65-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
66-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
67+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
68+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
69 #if DEFAULT_LIBC == LIBC_UCLIBC
70 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
71 #elif DEFAULT_LIBC == LIBC_GLIBC
72diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
73index 50cc0bc6d08..17c18b27145 100644
74--- a/gcc/config/arm/linux-eabi.h
75+++ b/gcc/config/arm/linux-eabi.h
76@@ -65,8 +65,8 @@
77 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
78
79 #undef GLIBC_DYNAMIC_LINKER
80-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
81-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
82+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
83+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
84 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
85
86 #define GLIBC_DYNAMIC_LINKER \
87@@ -89,7 +89,7 @@
88 #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
89 #endif
90 #define MUSL_DYNAMIC_LINKER \
91- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
92+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
93
94 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
95 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
97index df3da67c4f0..37456e9d5a4 100644
98--- a/gcc/config/arm/linux-elf.h
99+++ b/gcc/config/arm/linux-elf.h
100@@ -60,7 +60,7 @@
101
102 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
103
104-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
105+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
106
107 #define LINUX_TARGET_LINK_SPEC "%{h*} \
108 %{static:-Bstatic} \
109diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
110index 5d99ee56d5b..a76022c9ccc 100644
111--- a/gcc/config/i386/linux.h
112+++ b/gcc/config/i386/linux.h
113@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
114 <http://www.gnu.org/licenses/>. */
115
116 #define GNU_USER_LINK_EMULATION "elf_i386"
117-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
118+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
119
120 #undef MUSL_DYNAMIC_LINKER
121-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
122+#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
124index 8681e36f10d..ddce49b6b60 100644
125--- a/gcc/config/i386/linux64.h
126+++ b/gcc/config/i386/linux64.h
127@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
128 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
129 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
130
131-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
132-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
133-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
134+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
135+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
136+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
137
138 #undef MUSL_DYNAMIC_LINKER32
139-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
140+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
141 #undef MUSL_DYNAMIC_LINKER64
142-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
143+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
144 #undef MUSL_DYNAMIC_LINKERX32
145-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
146+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
147diff --git a/gcc/config/linux.h b/gcc/config/linux.h
148index 74f70793d90..4ce173384ef 100644
149--- a/gcc/config/linux.h
150+++ b/gcc/config/linux.h
151@@ -99,10 +99,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
153 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
154 supporting both 32-bit and 64-bit compilation. */
155-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
156-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
157-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
158-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
159+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
160+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
161+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
162+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
163 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
164 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
165 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
166diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
167index 664dc9206ad..082bd7cfc6f 100644
168--- a/gcc/config/loongarch/gnu-user.h
169+++ b/gcc/config/loongarch/gnu-user.h
170@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see
171
172 #undef GLIBC_DYNAMIC_LINKER
173 #define GLIBC_DYNAMIC_LINKER \
174- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
175+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1"
176
177 #undef MUSL_DYNAMIC_LINKER
178 #define MUSL_DYNAMIC_LINKER \
179- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
180+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1"
181
182 #undef GNU_USER_TARGET_LINK_SPEC
183 #define GNU_USER_TARGET_LINK_SPEC \
184diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h
185index 5b1a365eda4..2e63df1ae9c 100644
186--- a/gcc/config/microblaze/linux.h
187+++ b/gcc/config/microblaze/linux.h
188@@ -28,7 +28,7 @@
189 #undef TLS_NEEDS_GOT
190 #define TLS_NEEDS_GOT 1
191
192-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
193+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "/ld.so.1"
194 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
195
196 #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
197@@ -38,7 +38,7 @@
198 #endif
199
200 #undef MUSL_DYNAMIC_LINKER
201-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
202+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
203
204 #undef SUBTARGET_EXTRA_SPECS
205 #define SUBTARGET_EXTRA_SPECS \
206diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
207index 230b7789bb8..d96d134bfcf 100644
208--- a/gcc/config/mips/linux.h
209+++ b/gcc/config/mips/linux.h
210@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see
211 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
212
213 #define GLIBC_DYNAMIC_LINKER32 \
214- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
215+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
216 #define GLIBC_DYNAMIC_LINKER64 \
217- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
218+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
219 #define GLIBC_DYNAMIC_LINKERN32 \
220- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
221+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
222
223 #undef UCLIBC_DYNAMIC_LINKER32
224 #define UCLIBC_DYNAMIC_LINKER32 \
225- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
226+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
227 #undef UCLIBC_DYNAMIC_LINKER64
228 #define UCLIBC_DYNAMIC_LINKER64 \
229- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
230+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
231 #define UCLIBC_DYNAMIC_LINKERN32 \
232- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
233+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
234
235 #undef MUSL_DYNAMIC_LINKER32
236 #define MUSL_DYNAMIC_LINKER32 \
237- "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
238+ SYSTEMLIBS_DIR "ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
239 #undef MUSL_DYNAMIC_LINKER64
240 #define MUSL_DYNAMIC_LINKER64 \
241- "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
242+ SYSTEMLIBS_DIR "ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
243 #define MUSL_DYNAMIC_LINKERN32 \
244- "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
245+ SYSTEMLIBS_DIR "ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
246
247 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
248 #define GNU_USER_DYNAMIC_LINKERN32 \
249diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
250index f5dd813acad..7a13e1c9799 100644
251--- a/gcc/config/nios2/linux.h
252+++ b/gcc/config/nios2/linux.h
253@@ -29,8 +29,8 @@
254 #undef CPP_SPEC
255 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
256
257-#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"
260+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1"
261
262 #undef LINK_SPEC
263 #define LINK_SPEC LINK_SPEC_ENDIAN \
264diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
265index 38803723ba9..d5ef8a96a19 100644
266--- a/gcc/config/riscv/linux.h
267+++ b/gcc/config/riscv/linux.h
268@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
269 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
270 } while (0)
271
272-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
273+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
274
275 #define MUSL_ABI_SUFFIX \
276 "%{mabi=ilp32:-sf}" \
277@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
278 "%{mabi=lp64d:}"
279
280 #undef MUSL_DYNAMIC_LINKER
281-#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"
283
284 /* Because RISC-V only has word-sized atomics, it requries libatomic where
285 others do not. So link libatomic by default, as needed. */
286diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
287index b2a7afabc73..364c1a5b155 100644
288--- a/gcc/config/rs6000/linux64.h
289+++ b/gcc/config/rs6000/linux64.h
290@@ -339,24 +339,19 @@ extern int dot_symbols;
291 #undef LINK_OS_DEFAULT_SPEC
292 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
293
294-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
295-
296+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
297 #ifdef LINUX64_DEFAULT_ABI_ELFv2
298-#define GLIBC_DYNAMIC_LINKER64 \
299-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
300-":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
301+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
302 #else
303-#define GLIBC_DYNAMIC_LINKER64 \
304-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
305-":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
306+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
307 #endif
308
309 #undef MUSL_DYNAMIC_LINKER32
310 #define MUSL_DYNAMIC_LINKER32 \
311- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
312+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
313 #undef MUSL_DYNAMIC_LINKER64
314 #define MUSL_DYNAMIC_LINKER64 \
315- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
316+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
317
318 #undef DEFAULT_ASM_ENDIAN
319 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
320diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
321index 7e2519de5d4..a73954d9de5 100644
322--- a/gcc/config/rs6000/sysv4.h
323+++ b/gcc/config/rs6000/sysv4.h
324@@ -779,10 +779,10 @@ GNU_USER_TARGET_CC1_SPEC
325
326 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
327
328-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
329+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
330 #undef MUSL_DYNAMIC_LINKER
331 #define MUSL_DYNAMIC_LINKER \
332- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
333+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
334
335 #ifndef GNU_USER_DYNAMIC_LINKER
336 #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
337diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
338index d7b7e7a7b02..0139b4d06ca 100644
339--- a/gcc/config/s390/linux.h
340+++ b/gcc/config/s390/linux.h
341@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see
342 #define MULTILIB_DEFAULTS { "m31" }
343 #endif
344
345-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
346-#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
347+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
348+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
349
350 #undef MUSL_DYNAMIC_LINKER32
351-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
352+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-s390.so.1"
353 #undef MUSL_DYNAMIC_LINKER64
354-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
355+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-s390x.so.1"
356
357 #undef LINK_SPEC
358 #define LINK_SPEC \
359diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
360index d96d077c99e..7d27f9893ee 100644
361--- a/gcc/config/sh/linux.h
362+++ b/gcc/config/sh/linux.h
363@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see
364
365 #undef MUSL_DYNAMIC_LINKER
366 #define MUSL_DYNAMIC_LINKER \
367- "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
368+ SYSTEMLIBS_DIR "ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
369 "%{mfdpic:-fdpic}.so.1"
370
371-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
372+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
373
374 #undef SUBTARGET_LINK_EMUL_SUFFIX
375 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
376diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
377index 6a809e9092d..60603765ad6 100644
378--- a/gcc/config/sparc/linux.h
379+++ b/gcc/config/sparc/linux.h
380@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
381 When the -shared link option is used a final link is not being
382 done. */
383
384-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
385+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
386
387 #undef LINK_SPEC
388 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
389diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
390index d08a2ef96fe..e6955da0a5b 100644
391--- a/gcc/config/sparc/linux64.h
392+++ b/gcc/config/sparc/linux64.h
393@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see
394 When the -shared link option is used a final link is not being
395 done. */
396
397-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
398-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
399+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
400+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
401
402 #ifdef SPARC_BI_ARCH
403
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
new file mode 100644
index 00000000..c9bc38cc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
@@ -0,0 +1,39 @@
1From 5117519c1897a49b09fe7fff213b9c2ea15d37f5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index 70990740b6c..ee938056bef 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
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
new file mode 100644
index 00000000..dd67b115
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,40 @@
1From 32129f9682d0d27fc67af10f077ad2768935cbe6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index 17c18b27145..8eacb099317 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -91,10 +91,14 @@
26 #define MUSL_DYNAMIC_LINKER \
27 SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
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
new file mode 100644
index 00000000..45edc62e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,99 @@
1From bf85b8bbcb4b77725d4c22c1bb25a29f6ff21038 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH] Use the multilib config files from ${B} instead of using the
5 ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 3fc0e2f5813..2f0f0e057a9 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -13361,10 +13361,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
48
49@@ -13375,6 +13385,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 46de496b256..6155b83a732 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -2312,10 +2312,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
88
89@@ -2326,6 +2336,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
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
new file mode 100644
index 00000000..352c6eec
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,28 @@
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
new file mode 100644
index 00000000..f52e21ed
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
@@ -0,0 +1,55 @@
1From 710d1325474e708e6b34eebe09f3f130420af293 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 31 Jan 2023 22:03:38 -0800
4Subject: [PATCH] aarch64: Fix include paths when S != B
5
6aarch64.h gets copied into build directory when built out of tree, in
7this case build uses this file but does not find the includes inside it
8since they are not found in any of include paths specified in compiler
9cmdline.
10
11Fixes build errors like
12
13% g++ -c -isystem/mnt/b/yoe/master/build/tmp/work/x86_64-linux/gcc-cross-aarch64/13.0.1-r0/recipe-sysroot-native/usr/include -O2 -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/build -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../include -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../libcpp/include -o build/gencheck.o ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc
14In file included from ./tm.h:34,
15 from ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc:23:
16./config/aarch64/aarch64.h:164:10: fatal error: aarch64-option-extensions.def: No such file or directory
17 164 | #include "aarch64-option-extensions.def"
18 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19compilation terminated.
20
21See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105144
22
23Upstream-Status: Pending
24
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27 gcc/config/aarch64/aarch64.h | 8 ++++----
28 1 file changed, 4 insertions(+), 4 deletions(-)
29
30diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
31index 155cace6afe..07d68958908 100644
32--- a/gcc/config/aarch64/aarch64.h
33+++ b/gcc/config/aarch64/aarch64.h
34@@ -161,8 +161,8 @@
35 enum class aarch64_feature : unsigned char {
36 #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) IDENT,
37 #define AARCH64_ARCH(A, B, IDENT, D, E) IDENT,
38-#include "aarch64-option-extensions.def"
39-#include "aarch64-arches.def"
40+#include "config/aarch64/aarch64-option-extensions.def"
41+#include "config/aarch64/aarch64-arches.def"
42 };
43
44 /* Define unique flags for each of the above. */
45@@ -171,8 +171,8 @@ enum class aarch64_feature : unsigned char {
46 = aarch64_feature_flags (1) << int (aarch64_feature::IDENT);
47 #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) HANDLE (IDENT)
48 #define AARCH64_ARCH(A, B, IDENT, D, E) HANDLE (IDENT)
49-#include "aarch64-option-extensions.def"
50-#include "aarch64-arches.def"
51+#include "config/aarch64/aarch64-option-extensions.def"
52+#include "config/aarch64/aarch64-arches.def"
53 #undef HANDLE
54
55 #endif
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
new file mode 100644
index 00000000..b05be59c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,28 @@
1From e8e8a0ab572cfceb9758f99599c0db4c962e49c0 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/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
new file mode 100644
index 00000000..61e61ecc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
@@ -0,0 +1,113 @@
1From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000
4Subject: [PATCH] Ensure target gcc headers can be included
5
6There are a few headers installed as part of the OpenEmbedded
7gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
8built for the target architecture, these are within the target
9sysroot and not cross/nativesdk; thus they weren't able to be
10found by gcc with the existing search paths. Add support for
11picking up these headers under the sysroot supplied on the gcc
12command line in order to resolve this.
13
14Extend target gcc headers search to musl too
15
16Upstream-Status: Pending
17
18Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 gcc/Makefile.in | 2 ++
22 gcc/config/linux.h | 8 ++++++++
23 gcc/config/rs6000/sysv4.h | 8 ++++++++
24 gcc/cppdefault.cc | 4 ++++
25 4 files changed, 22 insertions(+)
26
27diff --git a/gcc/Makefile.in b/gcc/Makefile.in
28index a8277254696..07fa63b6640 100644
29--- a/gcc/Makefile.in
30+++ b/gcc/Makefile.in
31@@ -632,6 +632,7 @@ libexecdir = @libexecdir@
32
33 # Directory in which the compiler finds libraries etc.
34 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
35+libsubdir_target = $(target_noncanonical)/$(version)
36 # Directory in which the compiler finds executables
37 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
38 # Directory in which all plugin resources are installed
39@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
40
41 PREPROCESSOR_DEFINES = \
42 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
43+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
44 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
45 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
46 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
47diff --git a/gcc/config/linux.h b/gcc/config/linux.h
48index 4ce173384ef..8a3cd4f2d34 100644
49--- a/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
52 #define INCLUDE_DEFAULTS_MUSL_TOOL
53 #endif
54
55+#ifdef GCC_INCLUDE_SUBDIR_TARGET
56+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
57+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
58+#else
59+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
60+#endif
61+
62 #ifdef NATIVE_SYSTEM_HEADER_DIR
63 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
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
66 INCLUDE_DEFAULTS_MUSL_PREFIX \
67 INCLUDE_DEFAULTS_MUSL_CROSS \
68 INCLUDE_DEFAULTS_MUSL_TOOL \
69+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
70 INCLUDE_DEFAULTS_MUSL_NATIVE \
71 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
72 { 0, 0, 0, 0, 0, 0 } \
73diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
74index a73954d9de5..e5dd6538358 100644
75--- a/gcc/config/rs6000/sysv4.h
76+++ b/gcc/config/rs6000/sysv4.h
77@@ -994,6 +994,13 @@ ncrtn.o%s"
78 #define INCLUDE_DEFAULTS_MUSL_TOOL
79 #endif
80
81+#ifdef GCC_INCLUDE_SUBDIR_TARGET
82+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
83+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
84+#else
85+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
86+#endif
87+
88 #ifdef NATIVE_SYSTEM_HEADER_DIR
89 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
90 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
91@@ -1020,6 +1027,7 @@ ncrtn.o%s"
92 INCLUDE_DEFAULTS_MUSL_PREFIX \
93 INCLUDE_DEFAULTS_MUSL_CROSS \
94 INCLUDE_DEFAULTS_MUSL_TOOL \
95+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
96 INCLUDE_DEFAULTS_MUSL_NATIVE \
97 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
98 { 0, 0, 0, 0, 0, 0 } \
99diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
100index 7888300f277..52cf14e92f8 100644
101--- a/gcc/cppdefault.cc
102+++ b/gcc/cppdefault.cc
103@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
104 /* This is the dir for gcc's private headers. */
105 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
106 #endif
107+#ifdef GCC_INCLUDE_SUBDIR_TARGET
108+ /* This is the dir for gcc's private headers under the specified sysroot. */
109+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
110+#endif
111 #ifdef LOCAL_INCLUDE_DIR
112 /* /usr/local/include comes before the fixincluded header files. */
113 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
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
new file mode 100644
index 00000000..94308b2a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -0,0 +1,35 @@
1From 9ae49e7b88c208ab79ec9c2fc4a2fa8a3f1e85bb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Mar 2015 08:21:19 +0000
4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
5 is provided
6
7http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
8
9Upstream-Status: Submitted
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 ltmain.sh | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/ltmain.sh b/ltmain.sh
17index 9ebc7e3d1e0..7ea79fa8be6 100644
18--- a/ltmain.sh
19+++ b/ltmain.sh
20@@ -6004,12 +6004,13 @@ func_mode_link ()
21 fi
22 else
23 # We cannot seem to hardcode it, guess we'll fake it.
24+ # Default if $libdir is not relative to the prefix:
25 add_dir="-L$libdir"
26- # Try looking first in the location we're being installed to.
27+
28 if test -n "$inst_prefix_dir"; then
29 case $libdir in
30 [\\/]*)
31- add_dir="$add_dir -L$inst_prefix_dir$libdir"
32+ add_dir="-L$inst_prefix_dir$libdir"
33 ;;
34 esac
35 fi
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
new file mode 100644
index 00000000..ce9635ce
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -0,0 +1,51 @@
1From bf918db7117f41d3c04162095641165ca241707d Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 5 Jul 2015 20:25:18 -0700
4Subject: [PATCH] libcc1: fix libcc1's install path and rpath
5
6* Install libcc1.so and libcc1plugin.so into
7 $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
8 had done to lto-plugin.
9* Fix bad RPATH iussue:
10 gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file
11 /path/to/gcc/5.2.0-r0/packages-split/gcc-plugins/usr/lib64/gcc/x86_64-poky-linux/5.2.0/plugin/libcc1plugin.so.0.0.0
12 [rpaths]
13
14Upstream-Status: Inappropriate [OE configuration]
15
16Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
17---
18 libcc1/Makefile.am | 4 ++--
19 libcc1/Makefile.in | 4 ++--
20 2 files changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
23index 6e3a34ff7e2..3f3f6391aba 100644
24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am
26@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
27 $(Wc)$(libiberty_normal)))
28 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
29
30-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
31-cc1libdir = $(libdir)/$(libsuffix)
32+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
33+plugindir = $(cc1libdir)
34
35 if ENABLE_PLUGIN
36 plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
38index f8f590d71e9..56462492045 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -396,8 +396,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
42 $(Wc)$(libiberty_normal)))
43
44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
45-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
46-cc1libdir = $(libdir)/$(libsuffix)
47+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
48+plugindir = $(cc1libdir)
49 @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
50 @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
51 shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
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
new file mode 100644
index 00000000..3b547195
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -0,0 +1,510 @@
1From 4fbbd40d7db89cdbeaf93df1e1da692b1f80a5bc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:39:54 +0000
4Subject: [PATCH] handle sysroot support for nativesdk-gcc
5
6Being able to build a nativesdk gcc is useful, particularly in cases
7where the host compiler may be of an incompatible version (or a 32
8bit compiler is needed).
9
10Sadly, building nativesdk-gcc is not straight forward. We install
11nativesdk-gcc into a relocatable location and this means that its
12library locations can change. "Normal" sysroot support doesn't help
13in this case since the values of paths like "libdir" change, not just
14base root directory of the system.
15
16In order to handle this we do two things:
17
18a) Add %r into spec file markup which can be used for injected paths
19 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
20b) Add other paths which need relocation into a .gccrelocprefix section
21 which the relocation code will notice and adjust automatically.
22
23Upstream-Status: Inappropriate
24RP 2015/7/28
25
26Extend the gccrelocprefix support to musl config too, this ensures
27that gcc will get right bits in SDK installations
28
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30
31Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without
32these as part of the gccrelocprefix the system can't do runtime relocation
33if the executable is moved. (These paths were missed in the original
34implementation.)
35
36Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
37---
38 gcc/c-family/c-opts.cc | 4 +--
39 gcc/config/linux.h | 24 +++++++--------
40 gcc/config/rs6000/sysv4.h | 24 +++++++--------
41 gcc/cppdefault.cc | 63 ++++++++++++++++++++++++---------------
42 gcc/cppdefault.h | 13 ++++----
43 gcc/gcc.cc | 20 +++++++++----
44 gcc/incpath.cc | 12 ++++----
45 gcc/prefix.cc | 6 ++--
46 8 files changed, 94 insertions(+), 72 deletions(-)
47
48diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
49index a341a061758..83b0bef4dbb 100644
50--- a/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)
53 size_t prefix_len, suffix_len;
54
55 suffix_len = strlen (suffix);
56- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
57- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
58+ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR;
59+ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7;
60
61 path = (char *) xmalloc (prefix_len + suffix_len + 1);
62 memcpy (path, prefix, prefix_len);
63diff --git a/gcc/config/linux.h b/gcc/config/linux.h
64index 8a3cd4f2d34..58143dff731 100644
65--- a/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
68 * Unfortunately, this is mostly duplicated from cppdefault.cc */
69 #if DEFAULT_LIBC == LIBC_MUSL
70 #define INCLUDE_DEFAULTS_MUSL_GPP \
71- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
72+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
73 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
74- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
75+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
76 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
77- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
78+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
79 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
80
81 #ifdef LOCAL_INCLUDE_DIR
82 #define INCLUDE_DEFAULTS_MUSL_LOCAL \
83- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
84- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
85+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
86+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
87 #else
88 #define INCLUDE_DEFAULTS_MUSL_LOCAL
89 #endif
90
91 #ifdef PREFIX_INCLUDE_DIR
92 #define INCLUDE_DEFAULTS_MUSL_PREFIX \
93- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
94+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
95 #else
96 #define INCLUDE_DEFAULTS_MUSL_PREFIX
97 #endif
98
99 #ifdef CROSS_INCLUDE_DIR
100 #define INCLUDE_DEFAULTS_MUSL_CROSS \
101- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
102+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
103 #else
104 #define INCLUDE_DEFAULTS_MUSL_CROSS
105 #endif
106
107 #ifdef TOOL_INCLUDE_DIR
108 #define INCLUDE_DEFAULTS_MUSL_TOOL \
109- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
110+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
111 #else
112 #define INCLUDE_DEFAULTS_MUSL_TOOL
113 #endif
114
115 #ifdef GCC_INCLUDE_SUBDIR_TARGET
116 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
117- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
118+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
119 #else
120 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
121 #endif
122
123 #ifdef NATIVE_SYSTEM_HEADER_DIR
124 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
125- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
126- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
127+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
128+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
129 #else
130 #define INCLUDE_DEFAULTS_MUSL_NATIVE
131 #endif
132@@ -205,7 +205,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
133 INCLUDE_DEFAULTS_MUSL_TOOL \
134 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
135 INCLUDE_DEFAULTS_MUSL_NATIVE \
136- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
137+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
138 { 0, 0, 0, 0, 0, 0 } \
139 }
140 #endif
141diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
142index e5dd6538358..b496849b792 100644
143--- a/gcc/config/rs6000/sysv4.h
144+++ b/gcc/config/rs6000/sysv4.h
145@@ -958,53 +958,53 @@ ncrtn.o%s"
146 /* Include order changes for musl, same as in generic linux.h. */
147 #if DEFAULT_LIBC == LIBC_MUSL
148 #define INCLUDE_DEFAULTS_MUSL_GPP \
149- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
150+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
151 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
152- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
153+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
154 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
155- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
156+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
157 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
158
159 #ifdef LOCAL_INCLUDE_DIR
160 #define INCLUDE_DEFAULTS_MUSL_LOCAL \
161- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
162- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
163+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
164+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
165 #else
166 #define INCLUDE_DEFAULTS_MUSL_LOCAL
167 #endif
168
169 #ifdef PREFIX_INCLUDE_DIR
170 #define INCLUDE_DEFAULTS_MUSL_PREFIX \
171- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
172+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
173 #else
174 #define INCLUDE_DEFAULTS_MUSL_PREFIX
175 #endif
176
177 #ifdef CROSS_INCLUDE_DIR
178 #define INCLUDE_DEFAULTS_MUSL_CROSS \
179- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
180+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
181 #else
182 #define INCLUDE_DEFAULTS_MUSL_CROSS
183 #endif
184
185 #ifdef TOOL_INCLUDE_DIR
186 #define INCLUDE_DEFAULTS_MUSL_TOOL \
187- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
188+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
189 #else
190 #define INCLUDE_DEFAULTS_MUSL_TOOL
191 #endif
192
193 #ifdef GCC_INCLUDE_SUBDIR_TARGET
194 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
195- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
196+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
197 #else
198 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
199 #endif
200
201 #ifdef NATIVE_SYSTEM_HEADER_DIR
202 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
203- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
204- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
205+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
206+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
207 #else
208 #define INCLUDE_DEFAULTS_MUSL_NATIVE
209 #endif
210@@ -1029,7 +1029,7 @@ ncrtn.o%s"
211 INCLUDE_DEFAULTS_MUSL_TOOL \
212 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
213 INCLUDE_DEFAULTS_MUSL_NATIVE \
214- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
215+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
216 { 0, 0, 0, 0, 0, 0 } \
217 }
218 #endif
219diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
220index 52cf14e92f8..d8977afc05e 100644
221--- a/gcc/cppdefault.cc
222+++ b/gcc/cppdefault.cc
223@@ -35,6 +35,30 @@
224 # undef CROSS_INCLUDE_DIR
225 #endif
226
227+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
228+char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
229+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
230+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
231+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
232+#ifdef LOCAL_INCLUDE_DIR
233+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
234+#endif
235+#ifdef PREFIX_INCLUDE_DIR
236+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
237+#endif
238+#ifdef FIXED_INCLUDE_DIR
239+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
240+#endif
241+#ifdef CROSS_INCLUDE_DIR
242+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
243+#endif
244+#ifdef TOOL_INCLUDE_DIR
245+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
246+#endif
247+#ifdef NATIVE_SYSTEM_HEADER_DIR
248+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
249+#endif
250+
251 const struct default_include cpp_include_defaults[]
252 #ifdef INCLUDE_DEFAULTS
253 = INCLUDE_DEFAULTS;
254@@ -42,17 +66,17 @@ const struct default_include cpp_include_defaults[]
255 = {
256 #ifdef GPLUSPLUS_INCLUDE_DIR
257 /* Pick up GNU C++ generic include files. */
258- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
259+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
260 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
261 #endif
262 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
263 /* Pick up GNU C++ target-dependent include files. */
264- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
265+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
266 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
267 #endif
268 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
269 /* Pick up GNU C++ backward and deprecated include files. */
270- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
271+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
272 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
273 #endif
274 #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR
275@@ -62,23 +86,23 @@ const struct default_include cpp_include_defaults[]
276 #endif
277 #ifdef GCC_INCLUDE_DIR
278 /* This is the dir for gcc's private headers. */
279- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
280+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
281 #endif
282 #ifdef GCC_INCLUDE_SUBDIR_TARGET
283 /* This is the dir for gcc's private headers under the specified sysroot. */
284- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
285+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
286 #endif
287 #ifdef LOCAL_INCLUDE_DIR
288 /* /usr/local/include comes before the fixincluded header files. */
289- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
290- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
291+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
292+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
293 #endif
294 #ifdef PREFIX_INCLUDE_DIR
295- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
296+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
297 #endif
298 #ifdef FIXED_INCLUDE_DIR
299 /* This is the dir for fixincludes. */
300- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
301+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
302 /* A multilib suffix needs adding if different multilibs use
303 different headers. */
304 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
305@@ -90,33 +114,24 @@ const struct default_include cpp_include_defaults[]
306 #endif
307 #ifdef CROSS_INCLUDE_DIR
308 /* One place the target system's headers might be. */
309- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
310+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
311 #endif
312 #ifdef TOOL_INCLUDE_DIR
313 /* Another place the target system's headers might be. */
314- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
315+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
316 #endif
317 #ifdef NATIVE_SYSTEM_HEADER_DIR
318 /* /usr/include comes dead last. */
319- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
320- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
321+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
322+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
323 #endif
324 { 0, 0, 0, 0, 0, 0 }
325 };
326 #endif /* no INCLUDE_DEFAULTS */
327
328-#ifdef GCC_INCLUDE_DIR
329-const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
330-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
331-#else
332-const char cpp_GCC_INCLUDE_DIR[] = "";
333-const size_t cpp_GCC_INCLUDE_DIR_len = 0;
334-#endif
335-
336 /* The configured prefix. */
337-const char cpp_PREFIX[] = PREFIX;
338-const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
339-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
340+char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
341+char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
342
343 /* This value is set by cpp_relocated at runtime */
344 const char *gcc_exec_prefix;
345diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
346index fb97c0b5814..6267150facc 100644
347--- a/gcc/cppdefault.h
348+++ b/gcc/cppdefault.h
349@@ -33,7 +33,8 @@
350
351 struct default_include
352 {
353- const char *const fname; /* The name of the directory. */
354+ const char *fname; /* The name of the directory. */
355+
356 const char *const component; /* The component containing the directory
357 (see update_path in prefix.cc) */
358 const char cplusplus; /* When this is non-zero, we should only
359@@ -55,17 +56,13 @@ struct default_include
360 };
361
362 extern const struct default_include cpp_include_defaults[];
363-extern const char cpp_GCC_INCLUDE_DIR[];
364-extern const size_t cpp_GCC_INCLUDE_DIR_len;
365+extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix")));
366
367 /* The configure-time prefix, i.e., the value supplied as the argument
368 to --prefix=. */
369-extern const char cpp_PREFIX[];
370+extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
371 /* The length of the configure-time prefix. */
372-extern const size_t cpp_PREFIX_len;
373-/* The configure-time execution prefix. This is typically the lib/gcc
374- subdirectory of cpp_PREFIX. */
375-extern const char cpp_EXEC_PREFIX[];
376+extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
377 /* The run-time execution prefix. This is typically the lib/gcc
378 subdirectory of the actual installation. */
379 extern const char *gcc_exec_prefix;
380diff --git a/gcc/gcc.cc b/gcc/gcc.cc
381index aa4cf92fb78..5569a39a14a 100644
382--- a/gcc/gcc.cc
383+++ b/gcc/gcc.cc
384@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
385 #endif
386 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
387
388+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
389+
390 /* Nonzero means pass the updated target_system_root to the compiler. */
391
392 static int target_system_root_changed;
393@@ -575,6 +577,7 @@ or with constant text in a single argument.
394 %G process LIBGCC_SPEC as a spec.
395 %R Output the concatenation of target_system_root and
396 target_sysroot_suffix.
397+ %r Output the base path target_relocatable_prefix
398 %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.
400 %C process CPP_SPEC as a spec.
401@@ -1627,10 +1630,10 @@ static const char *gcc_libexec_prefix;
402 gcc_exec_prefix is set because, in that case, we know where the
403 compiler has been installed, and use paths relative to that
404 location instead. */
405-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
406-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
407-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
408-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
409+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
410+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
411+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
412+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
413
414 /* For native compilers, these are well-known paths containing
415 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;
417 static const char *md_exec_prefix = MD_EXEC_PREFIX;
418 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
419 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
420-static const char *const standard_startfile_prefix_1
421+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
422 = STANDARD_STARTFILE_PREFIX_1;
423-static const char *const standard_startfile_prefix_2
424+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
425 = STANDARD_STARTFILE_PREFIX_2;
426
427 /* 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)
429 }
430 break;
431
432+ case 'r':
433+ obstack_grow (&obstack, target_relocatable_prefix,
434+ strlen (target_relocatable_prefix));
435+ break;
436+
437 case 'S':
438 value = do_spec_1 (startfile_spec, 0, NULL);
439 if (value != 0)
440diff --git a/gcc/incpath.cc b/gcc/incpath.cc
441index c80f100f476..5ac03c08693 100644
442--- a/gcc/incpath.cc
443+++ b/gcc/incpath.cc
444@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
445 int relocated = cpp_relocated ();
446 size_t len;
447
448- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
449+ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0)
450 {
451 /* Look for directories that start with the standard prefix.
452 "Translate" them, i.e. replace /usr/local/lib/gcc... with
453@@ -150,7 +150,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
454 now. */
455 if (sysroot && p->add_sysroot)
456 continue;
457- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
458+ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len))
459 {
460 char *str = concat (iprefix, p->fname + len, NULL);
461 if (p->multilib == 1 && imultilib)
462@@ -191,7 +191,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
463 free (sysroot_no_trailing_dir_separator);
464 }
465 else if (!p->add_sysroot && relocated
466- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
467+ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR)))
468 {
469 static const char *relocated_prefix;
470 char *ostr;
471@@ -208,12 +208,12 @@ add_standard_paths (const char *sysroot, const char *iprefix,
472 dummy = concat (gcc_exec_prefix, "dummy", NULL);
473 relocated_prefix
474 = make_relative_prefix (dummy,
475- cpp_EXEC_PREFIX,
476- cpp_PREFIX);
477+ EXEC_PREFIXVAR,
478+ PREFIXVAR);
479 free (dummy);
480 }
481 ostr = concat (relocated_prefix,
482- p->fname + cpp_PREFIX_len,
483+ p->fname + strlen(PREFIXVAR),
484 NULL);
485 str = update_path (ostr, p->component);
486 free (ostr);
487diff --git a/gcc/prefix.cc b/gcc/prefix.cc
488index 096ed5afa3d..2526f0ecc39 100644
489--- a/gcc/prefix.cc
490+++ b/gcc/prefix.cc
491@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see
492 #include "prefix.h"
493 #include "common/common-target.h"
494
495-static const char *std_prefix = PREFIX;
496+char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
497+
498+static const char *std_prefix = PREFIXVAR1;
499
500 static const char *get_key_value (char *);
501 static char *translate_name (char *);
502@@ -212,7 +214,7 @@ translate_name (char *name)
503 prefix = getenv (key);
504
505 if (prefix == 0)
506- prefix = PREFIX;
507+ prefix = PREFIXVAR1;
508
509 /* We used to strip trailing DIR_SEPARATORs here, but that can
510 sometimes yield a result with no separator when one was coded
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
new file mode 100644
index 00000000..9b05da64
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -0,0 +1,99 @@
1From 33a1f07a4417247dc24819d4e583ca09f56d5a7b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:41:45 +0000
4Subject: [PATCH] Search target sysroot gcc version specific dirs with
5 multilib.
6
7We install the gcc libraries (such as crtbegin.p) into
8<sysroot><libdir>/<target-sys>/5.2.0/
9which is a default search path for GCC (aka multi_suffix in the
10code below). <target-sys> is 'machine' in gcc's terminology. We use
11these directories so that multiple gcc versions could in theory
12co-exist on target.
13
14We only want to build one gcc-cross-canadian per arch and have this work
15for all multilibs. <target-sys> can be handled by mapping the multilib
16<target-sys> to the one used by gcc-cross-canadian, e.g.
17mips64-polkmllib32-linux
18is symlinked to by mips64-poky-linux.
19
20The default gcc search path in the target sysroot for a "lib64" mutlilib
21is:
22
23<sysroot>/lib32/mips64-poky-linux/5.2.0/
24<sysroot>/lib32/../lib64/
25<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
26<sysroot>/usr/lib32/../lib64/
27<sysroot>/lib32/
28<sysroot>/usr/lib32/
29
30which means that the lib32 crtbegin.o will be found and the lib64 ones
31will not which leads to compiler failures.
32
33This patch injects a multilib version of that path first so the lib64
34binaries can be found first. With this change the search path becomes:
35
36<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
37<sysroot>/lib32/mips64-poky-linux/5.2.0/
38<sysroot>/lib32/../lib64/
39<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
40<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
41<sysroot>/usr/lib32/../lib64/
42<sysroot>/lib32/
43<sysroot>/usr/lib32/
44
45Upstream-Status: Pending
46RP 2015/7/31
47
48Signed-off-by: Khem Raj <raj.khem@gmail.com>
49---
50 gcc/gcc.cc | 29 ++++++++++++++++++++++++++++-
51 1 file changed, 28 insertions(+), 1 deletion(-)
52
53diff --git a/gcc/gcc.cc b/gcc/gcc.cc
54index 5569a39a14a..4598f6cd7c9 100644
55--- a/gcc/gcc.cc
56+++ b/gcc/gcc.cc
57@@ -2817,7 +2817,7 @@ for_each_path (const struct path_prefix *paths,
58 if (path == NULL)
59 {
60 len = paths->max_len + extra_space + 1;
61- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
62+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
63 path = XNEWVEC (char, len);
64 }
65
66@@ -2829,6 +2829,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir)
69 {
70+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
71+ {
72+ const char *this_multi;
73+ size_t this_multi_len;
74+
75+ if (pl->os_multilib)
76+ {
77+ this_multi = multi_os_dir;
78+ this_multi_len = multi_os_dir_len;
79+ }
80+ else
81+ {
82+ this_multi = multi_dir;
83+ this_multi_len = multi_dir_len;
84+ }
85+
86+ /* Look in multilib MACHINE/VERSION subdirectory first */
87+ if (this_multi_len)
88+ {
89+ memcpy (path + len, this_multi, this_multi_len + 1);
90+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
91+ ret = callback (path, callback_info);
92+ if (ret)
93+ break;
94+ }
95+ }
96+
97 memcpy (path + len, multi_suffix, suffix_len + 1);
98 ret = callback (path, callback_info);
99 if (ret)
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
new file mode 100644
index 00000000..56793e03
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -0,0 +1,84 @@
1From d7dc2861840e88a4592817a398a054a886c3f3ee Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
5
6when -fstack-protector options are enabled we need to
7link with ssp_shared on musl since it does not provide
8the __stack_chk_fail_local() so essentially it provides
9libssp but not libssp_nonshared something like
10TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
11 where-as for glibc the needed symbols
12are already present in libc_nonshared library therefore
13we do not need any library helper on glibc based systems
14but musl needs the libssp_noshared from gcc
15
16Upstream-Status: Pending
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/linux.h | 7 +++++++
21 gcc/config/rs6000/linux.h | 10 ++++++++++
22 gcc/config/rs6000/linux64.h | 10 ++++++++++
23 3 files changed, 27 insertions(+)
24
25diff --git a/gcc/config/linux.h b/gcc/config/linux.h
26index 58143dff731..d2409ccac26 100644
27--- a/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
30 { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
31 { 0, 0, 0, 0, 0, 0 } \
32 }
33+#ifdef TARGET_LIBC_PROVIDES_SSP
34+#undef LINK_SSP_SPEC
35+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
36+ "|fstack-protector-strong|fstack-protector-explicit" \
37+ ":-lssp_nonshared}"
38+#endif
39+
40 #endif
41
42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 8c9039ac1e5..259cd485973 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -99,6 +99,16 @@
48 " -m elf32ppclinux")
49 #endif
50
51+/* link libssp_nonshared.a with musl */
52+#if DEFAULT_LIBC == LIBC_MUSL
53+#ifdef TARGET_LIBC_PROVIDES_SSP
54+#undef LINK_SSP_SPEC
55+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
56+ "|fstack-protector-strong|fstack-protector-explicit" \
57+ ":-lssp_nonshared}"
58+#endif
59+#endif
60+
61 #undef LINK_OS_LINUX_SPEC
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{!static-pie: \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 364c1a5b155..e33d9ae98e0 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -372,6 +372,16 @@ extern int dot_symbols;
69 " -m elf64ppc")
70 #endif
71
72+/* link libssp_nonshared.a with musl */
73+#if DEFAULT_LIBC == LIBC_MUSL
74+#ifdef TARGET_LIBC_PROVIDES_SSP
75+#undef LINK_SSP_SPEC
76+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
77+ "|fstack-protector-strong|fstack-protector-explicit" \
78+ ":-lssp_nonshared}"
79+#endif
80+#endif
81+
82 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
83 %{!static-pie: \
84 %{rdynamic:-export-dynamic} \
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
new file mode 100644
index 00000000..bb1699be
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
@@ -0,0 +1,39 @@
1From bf0d7c463e1fab62804556099b56319fe94be1eb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 6 Jun 2018 12:10:22 -0700
4Subject: [PATCH] Re-introduce spe commandline options
5
6This should ensure that we keep accepting
7spe options
8
9Upstream-Status: Inappropriate [SPE port is removed from rs600 port]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gcc/config/rs6000/rs6000.opt | 13 +++++++++++++
14 1 file changed, 13 insertions(+)
15
16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
17index 4931d781c4e..3fb87b6f7d5 100644
18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -348,6 +348,19 @@ mdebug=
21 Target RejectNegative Joined
22 -mdebug= Enable debug output.
23
24+; PPC SPE ABI
25+mspe
26+Target Var(rs6000_spe) Save
27+Generate SPE SIMD instructions on E500.
28+
29+mabi=spe
30+Target RejectNegative Var(rs6000_spe_abi) Save
31+Use the SPE ABI extensions.
32+
33+mabi=no-spe
34+Target RejectNegative Var(rs6000_spe_abi, 0)
35+Do not use the SPE ABI extensions.
36+
37 ; Altivec ABI
38 mabi=altivec
39 Target RejectNegative Var(rs6000_altivec_abi) Save
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
new file mode 100644
index 00000000..f3709208
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -0,0 +1,83 @@
1From a32c75b37209d6836eaaa943dc6b1207acba5d27 Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
5 symver
6
7Adapter from
8
9https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
10
11This fix was debated but hasnt been applied gcc upstream since
12they expect musl to support '@' in symbol versioning which is
13a sun/gnu versioning extention. This patch however avoids the
14need for the '@' symbols at all
15
16libgcc/Changelog:
17
182015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
19
20 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
21 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
22
23 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
24
25gcc/Changelog:
26
272015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
28
29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Upstream-Status: Pending
33
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 gcc/config/i386/i386-expand.cc | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
39 3 files changed, 6 insertions(+), 6 deletions(-)
40
41diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
42index 68978ef8dc2..0c71f36b572 100644
43--- a/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,
46 {
47 case IX86_BUILTIN_CPU_INIT:
48 {
49- /* Make it call __cpu_indicator_init in libgcc. */
50+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
51 tree call_expr, fndecl, type;
52 type = build_function_type_list (integer_type_node, NULL_TREE);
53- fndecl = build_fn_decl ("__cpu_indicator_init", type);
54+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
55 call_expr = build_call_expr (fndecl, 0);
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index dab1d98060f..cf824b4114a 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
63 __cpu_features2);
64 }
65
66-#if defined SHARED && defined USE_ELF_SYMVER
67-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69+#ifndef SHARED
70+int __cpu_indicator_init_local (void)
71+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
72 #endif
73diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
74index 8506a635790..564296f788e 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,5 +3,5 @@
78 # t-slibgcc-elf-ver and t-linux
79 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
80
81-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
83 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
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
new file mode 100644
index 00000000..f5f04ae3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -0,0 +1,182 @@
1From 4efc42b99c96b026f560b0918de7e237ac3dc8d1 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 10 Mar 2020 08:26:53 -0700
4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
5 reproducibility
6
7Inserting line numbers into generated code means its not always reproducible wth
8differing versions of host gcc. Void the issue by not adding these.
9
10Upstream-Status: Inappropriate [OE Reproducibility specific]
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 gcc/gengtype.cc | 6 +++---
16 gcc/genmodes.cc | 32 ++++++++++++++++----------------
17 2 files changed, 19 insertions(+), 19 deletions(-)
18
19diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
20index 386ae1b0506..9762e914296 100644
21--- a/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,
24 /* Create a fake field with the given type and name. NEXT is the next
25 field in the chain. */
26 #define create_field(next,type,name) \
27- create_field_all (next,type,name, 0, this_file, __LINE__)
28+ create_field_all (next,type,name, 0, this_file, 0)
29
30 /* Like create_field, but the field is only valid when condition COND
31 is true. */
32@@ -1039,7 +1039,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
33 }
34
35 #define create_optional_field(next,type,name,cond) \
36- create_optional_field_(next,type,name,cond,__LINE__)
37+ create_optional_field_(next,type,name,cond,0)
38
39 /* Reverse a linked list of 'struct pair's in place. */
40 pair_p
41@@ -5238,7 +5238,7 @@ main (int argc, char **argv)
42 /* These types are set up with #define or else outside of where
43 we can see them. We should initialize them before calling
44 read_input_list. */
45-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
46+#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \
47 Call;} while (0)
48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
50diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
51index 59850bb070a..e187f8542a1 100644
52--- a/gcc/genmodes.cc
53+++ b/gcc/genmodes.cc
54@@ -440,7 +440,7 @@ complete_all_modes (void)
55 }
56
57 /* For each mode in class CLASS, construct a corresponding complex mode. */
58-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
59+#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0)
60 static void
61 make_complex_modes (enum mode_class cl,
62 const char *file, unsigned int line)
63@@ -499,7 +499,7 @@ make_complex_modes (enum mode_class cl,
64 having as many components as necessary. ORDER is the sorting order
65 of the mode, with smaller numbers indicating a higher priority. */
66 #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
67- make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__)
68+ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, 0)
69 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
70 static void ATTRIBUTE_UNUSED
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,
73 BYTESIZE bytes in total. */
74 #define VECTOR_BOOL_MODE(NAME, COUNT, COMPONENT, BYTESIZE) \
75 make_vector_bool_mode (#NAME, COUNT, #COMPONENT, BYTESIZE, \
76- __FILE__, __LINE__)
77+ __FILE__, 0)
78 static void ATTRIBUTE_UNUSED
79 make_vector_bool_mode (const char *name, unsigned int count,
80 const char *component, unsigned int bytesize,
81@@ -574,7 +574,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
82 /* Input. */
83
84 #define _SPECIAL_MODE(C, N) \
85- make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
86+ make_special_mode (MODE_##C, #N, __FILE__, 0)
87 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
88 #define CC_MODE(N) _SPECIAL_MODE (CC, N)
89
90@@ -587,7 +587,7 @@ make_special_mode (enum mode_class cl, const char *name,
91
92 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
93 #define FRACTIONAL_INT_MODE(N, B, Y) \
94- make_int_mode (#N, B, Y, __FILE__, __LINE__)
95+ make_int_mode (#N, B, Y, __FILE__, 0)
96
97 static void
98 make_int_mode (const char *name,
99@@ -628,16 +628,16 @@ make_opaque_mode (const char *name,
100 }
101
102 #define FRACT_MODE(N, Y, F) \
103- make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__)
104+ make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0)
105
106 #define UFRACT_MODE(N, Y, F) \
107- make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__)
108+ make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0)
109
110 #define ACCUM_MODE(N, Y, I, F) \
111- make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__)
112+ make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0)
113
114 #define UACCUM_MODE(N, Y, I, F) \
115- make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__)
116+ make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0)
117
118 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
119 FILE, and LINE. */
120@@ -658,7 +658,7 @@ make_fixed_point_mode (enum mode_class cl,
121
122 #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
123 #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
124- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
125+ make_float_mode (#N, B, Y, #F, __FILE__, 0)
126
127 static void
128 make_float_mode (const char *name,
129@@ -675,7 +675,7 @@ make_float_mode (const char *name,
130 #define DECIMAL_FLOAT_MODE(N, Y, F) \
131 FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
132 #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \
133- make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
134+ make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0)
135
136 static void
137 make_decimal_float_mode (const char *name,
138@@ -690,7 +690,7 @@ make_decimal_float_mode (const char *name,
139 }
140
141 #define RESET_FLOAT_FORMAT(N, F) \
142- reset_float_format (#N, #F, __FILE__, __LINE__)
143+ reset_float_format (#N, #F, __FILE__, 0)
144 static void ATTRIBUTE_UNUSED
145 reset_float_format (const char *name, const char *format,
146 const char *file, unsigned int line)
147@@ -711,7 +711,7 @@ reset_float_format (const char *name, const char *format,
148
149 /* __intN support. */
150 #define INT_N(M,PREC) \
151- make_int_n (#M, PREC, __FILE__, __LINE__)
152+ make_int_n (#M, PREC, __FILE__, 0)
153 static void ATTRIBUTE_UNUSED
154 make_int_n (const char *m, int bitsize,
155 const char *file, unsigned int line)
156@@ -740,7 +740,7 @@ make_int_n (const char *m, int bitsize,
157 /* Partial integer modes are specified by relation to a full integer
158 mode. */
159 #define PARTIAL_INT_MODE(M,PREC,NAME) \
160- make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__)
161+ make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0)
162 static void ATTRIBUTE_UNUSED
163 make_partial_integer_mode (const char *base, const char *name,
164 unsigned int precision,
165@@ -767,7 +767,7 @@ make_partial_integer_mode (const char *base, const char *name,
166 /* A single vector mode can be specified by naming its component
167 mode and the number of components. */
168 #define VECTOR_MODE_WITH_PREFIX(PREFIX, C, M, N, ORDER) \
169- make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, __LINE__);
170+ make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, 0);
171 #define VECTOR_MODE(C, M, N) VECTOR_MODE_WITH_PREFIX(V, C, M, N, 0);
172 static void ATTRIBUTE_UNUSED
173 make_vector_mode (enum mode_class bclass,
174@@ -814,7 +814,7 @@ make_vector_mode (enum mode_class bclass,
175
176 /* Adjustability. */
177 #define _ADD_ADJUST(A, M, X, C1, C2) \
178- new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
179+ new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0)
180
181 #define ADJUST_NUNITS(M, X) _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM)
182 #define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)
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
new file mode 100644
index 00000000..cb8969b1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -0,0 +1,42 @@
1From c3870d073eb9e5d82f9d3067d0fa15038b69713a 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 c6c8d81c56a..d959a5d040e 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 libatomic_la_SOURCES += atomic_16.S
30
31diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
32index a0fa3dfc8cc..e70d389874a 100644
33--- a/libatomic/Makefile.in
34+++ b/libatomic/Makefile.in
35@@ -447,7 +447,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_3) \
38 $(am__append_4) $(am__append_5)
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/0023-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
new file mode 100644
index 00000000..11f42c59
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
@@ -0,0 +1,31 @@
1From 7bd6e631e4a5273f5ecc41a5a48830a1342e5926 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 065ce7e9a5b..d4c723968aa 100644
21--- a/gcc/Makefile.in
22+++ b/gcc/Makefile.in
23@@ -3738,6 +3738,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/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
new file mode 100644
index 00000000..2f016598
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -0,0 +1,42 @@
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
new file mode 100644
index 00000000..ad826901
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
@@ -0,0 +1,28 @@
1From 4623d87d779853a2862ee92a15a41fded81eddb8 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Sat, 20 Aug 2022 09:04:14 -0700
4Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc
5
6Avoid encoding build paths into sources used for floating point on powerpc.
7(MACHINE=qemuppc bitbake libgcc).
8
9Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html]
10Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libgcc/config/rs6000/t-float128 | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
17index b09b5664af0..513e63748f1 100644
18--- a/libgcc/config/rs6000/t-float128
19+++ b/libgcc/config/rs6000/t-float128
20@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
21 $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
22 @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
23 echo "Create $@"; \
24- (echo "/* file created from $$src */"; \
25+ (echo "/* file created from `basename $$src` */"; \
26 echo; \
27 sed -f $(fp128_sed) < $$src) > $@
28
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
new file mode 100644
index 00000000..555be623
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch
@@ -0,0 +1,31 @@
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/0026-rust-recursion-limit.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
new file mode 100644
index 00000000..bbe2f18f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
@@ -0,0 +1,92 @@
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/hardcoded-paths.patch b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
new file mode 100644
index 00000000..f3485858
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
@@ -0,0 +1,19 @@
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
new file mode 100644
index 00000000..7f1a2dee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch
@@ -0,0 +1,63 @@
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_12.2.bb
new file mode 100644
index 00000000..c1996ab1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb
@@ -0,0 +1,14 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# Building with thumb enabled on armv4t armv5t fails with
5# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET:armv4 = "arm"
8ARM_INSTRUCTION_SET:armv5 = "arm"
9
10ARMFPARCHEXT:armv6 = "${@'+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 ''}"
13
14#BBCLASSEXTEND = "nativesdk"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
new file mode 100644
index 00000000..ac0a5a7b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
@@ -0,0 +1,163 @@
1BPN = "libgcc"
2
3require gcc-configure-common.inc
4
5INHIBIT_DEFAULT_DEPS = "1"
6
7do_configure () {
8 install -d ${D}${base_libdir} ${D}${libdir}
9 mkdir -p ${B}/${BPN}
10 mkdir -p ${B}/${TARGET_SYS}/${BPN}/
11 cd ${B}/${BPN}
12 chmod a+x ${S}/${BPN}/configure
13 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
14}
15EXTRACONFFUNCS += "extract_stashed_builddir"
16do_configure[depends] += "${COMPILERDEP}"
17
18do_compile () {
19 cd ${B}/${BPN}
20 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/
21}
22
23do_install () {
24 cd ${B}/${BPN}
25 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ install
26
27 # Move libgcc_s into /lib
28 mkdir -p ${D}${base_libdir}
29 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
30 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
31 else
32 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
33 fi
34
35 # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
36 # so that cross-gcc can find it in the sysroot
37
38 mv ${D}${libdir}/gcc/* ${D}${libdir}
39 rm -rf ${D}${libdir}/gcc/
40 # unwind.h is installed here which is shipped in gcc-cross
41 # as well as target gcc and they are identical so we dont
42 # ship one with libgcc here
43 rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
44}
45
46do_install:append:libc-baremetal () {
47 if [ "${base_libdir}" != "${libdir}" ]; then
48 rmdir ${D}${base_libdir}
49 fi
50}
51do_install:append:libc-newlib () {
52 if [ "${base_libdir}" != "${libdir}" ]; then
53 rmdir ${D}${base_libdir}
54 fi
55}
56
57# No rpm package is actually created but -dev depends on it, avoid dnf error
58DEV_PKG_DEPENDENCY:libc-baremetal = ""
59DEV_PKG_DEPENDENCY:libc-newlib = ""
60
61#BBCLASSEXTEND = "nativesdk"
62
63addtask multilib_install after do_install before do_package do_populate_sysroot
64# this makes multilib gcc files findable for target gcc
65# e.g.
66# /usr/lib/i586-pokymllib32-linux/4.7/
67# by creating this symlink to it
68# /usr/lib64/x86_64-poky-linux/4.7/32
69
70fakeroot python do_multilib_install() {
71 import re
72
73 multilibs = d.getVar('MULTILIB_VARIANTS')
74 if not multilibs or bb.data.inherits_class('nativesdk', d):
75 return
76
77 binv = d.getVar('BINV')
78
79 mlprefix = d.getVar('MLPREFIX')
80 if ('%slibgcc' % mlprefix) != d.getVar('PN'):
81 return
82
83 if mlprefix:
84 orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL')
85 orig_tune_params = get_tune_parameters(orig_tune, d)
86 orig_tune_baselib = orig_tune_params['baselib']
87 orig_tune_bitness = orig_tune_baselib.replace('lib', '')
88 if not orig_tune_bitness:
89 orig_tune_bitness = '32'
90
91 src = '../../../' + orig_tune_baselib + '/' + \
92 d.getVar('TARGET_SYS_MULTILIB_ORIGINAL') + '/' + binv + '/'
93
94 dest = d.getVar('D') + d.getVar('libdir') + '/' + \
95 d.getVar('TARGET_SYS') + '/' + binv + '/' + orig_tune_bitness
96
97 if os.path.lexists(dest):
98 os.unlink(dest)
99 os.symlink(src, dest)
100 return
101
102
103 for ml in multilibs.split():
104 tune = d.getVar('DEFAULTTUNE:virtclass-multilib-' + ml)
105 if not tune:
106 bb.warn('DEFAULTTUNE:virtclass-multilib-%s is not defined. Skipping...' % ml)
107 continue
108
109 tune_parameters = get_tune_parameters(tune, d)
110 tune_baselib = tune_parameters['baselib']
111 if not tune_baselib:
112 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
113 continue
114
115 tune_arch = tune_parameters['arch']
116 tune_bitness = tune_baselib.replace('lib', '')
117 if not tune_bitness:
118 tune_bitness = '32' # /lib => 32bit lib
119
120 tune_abiextension = tune_parameters['abiextension']
121 if tune_abiextension:
122 libcextension = '-gnu' + tune_abiextension
123 else:
124 libcextension = ''
125
126 src = '../../../' + tune_baselib + '/' + \
127 tune_arch + d.getVar('TARGET_VENDOR') + 'ml' + ml + \
128 '-' + d.getVar('TARGET_OS') + libcextension + '/' + binv + '/'
129
130 dest = d.getVar('D') + d.getVar('libdir') + '/' + \
131 d.getVar('TARGET_SYS') + '/' + binv + '/' + tune_bitness
132
133 if os.path.lexists(dest):
134 os.unlink(dest)
135 os.symlink(src, dest)
136}
137
138def get_original_os(d):
139 vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}')
140 for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]:
141 if suffix and vendoros.endswith(suffix):
142 vendoros = vendoros[:-len(suffix)]
143 # Arm must use linux-gnueabi not linux as only the former is accepted by gcc
144 if vendoros.startswith("arm-") and not vendoros.endswith("-gnueabi"):
145 vendoros = vendoros + "-gnueabi"
146 return vendoros
147
148ORIG_TARGET_VENDOR := "${TARGET_VENDOR}"
149BASETARGET_SYS = "${@get_original_os(d)}"
150
151addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
152fakeroot python do_extra_symlinks() {
153 if bb.data.inherits_class('nativesdk', d):
154 return
155
156 targetsys = d.getVar('BASETARGET_SYS')
157
158 if targetsys != d.getVar('TARGET_SYS'):
159 dest = d.getVar('D') + d.getVar('libdir') + '/' + targetsys
160 src = d.getVar('TARGET_SYS')
161 if not os.path.lexists(dest) and os.path.lexists(d.getVar('D') + d.getVar('libdir')):
162 os.symlink(src, dest)
163}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc
new file mode 100644
index 00000000..8251e3c2
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc
@@ -0,0 +1,58 @@
1#
2# Notes on the way the OE cross toolchain now works
3#
4# We need a libgcc to build glibc. Tranditionally we therefore built
5# a non-threaded and non-shared compiler (gcc-cross-initial), then use
6# that to build libgcc-initial which is used to build glibc which we can
7# then build gcc-cross and libgcc against.
8#
9# We were able to drop the glibc dependency from gcc-cross, with two tweaks:
10
11# a) specify the minimum glibc version to support in a configure option
12# b) create a dummy limits.h file so that later when glibc creates one,
13# the headers structure has support for it. We can do this with a simple
14# empty file
15#
16# Once gcc-cross is libc independent, we can use it to build both
17# libgcc-initial and then later libgcc.
18#
19# libgcc-initial is tricky as we need to imitate the non-threaded and
20# non-shared case. We can do that by hacking the threading mode back to
21# "single" even if gcc reports "posix" and disable libc presence for the
22# libgcc-intial build. We have to create the dummy limits.h to avoid
23# compiler errors from a missing header.
24#
25# glibc will fail to link with libgcc-initial due to a missing "exception
26# handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need
27# any exception handler, we can safely symlink to libgcc.a.
28#
29
30require libgcc-common.inc
31
32DEPENDS = "virtual/${TARGET_PREFIX}gcc"
33
34LICENSE = "GPL-3.0-with-GCC-exception"
35
36PACKAGES = ""
37
38EXTRA_OECONF += "--disable-shared"
39
40inherit nopackages
41
42# We really only want this built by things that need it, not any recrdeptask
43deltask do_build
44
45do_configure:prepend () {
46 install -d ${STAGING_INCDIR}
47 touch ${STAGING_INCDIR}/limits.h
48 sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
49 sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
50}
51
52do_configure:append () {
53 sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile
54}
55
56do_install:append () {
57 ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a
58}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb
new file mode 100644
index 00000000..a259082b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc-initial.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET:armv6 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc.inc b/meta-microblaze/recipes-devtools/gcc/libgcc.inc
new file mode 100644
index 00000000..84a2d930
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc.inc
@@ -0,0 +1,53 @@
1require libgcc-common.inc
2
3DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc"
4
5do_install:append:class-target () {
6 if [ "${TCLIBC}" != "glibc" ]; then
7 case "${TARGET_OS}" in
8 "linux-musl" | "linux-*spe") extra_target_os="linux";;
9 "linux-musleabi") extra_target_os="linux-gnueabi";;
10 *) extra_target_os="linux";;
11 esac
12 if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
13 ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
14 fi
15 fi
16 if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
17 case "${TARGET_OS}" in
18 "linux-musleabi") extra_target_os="linux-musleabihf";;
19 "linux-gnueabi") extra_target_os="linux-gnueabihf";;
20 esac
21 if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
22 ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
23 fi
24 fi
25}
26
27PACKAGES = "\
28 ${PN} \
29 ${PN}-dev \
30 ${PN}-dbg \
31"
32
33# All libgcc source is marked with the exception.
34#
35LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
36LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
37LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
38
39
40FILES:${PN}-dev = "\
41 ${base_libdir}/libgcc*.so \
42 ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
43 ${libdir}/${TARGET_SYS}/${BINV}* \
44 ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
45"
46
47do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
48do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
49do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
50do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
51
52INSANE_SKIP:${PN}-dev = "staticdev"
53
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb
new file mode 100644
index 00000000..f88963b0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET:armv6 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran.inc b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
new file mode 100644
index 00000000..99fdd89c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
@@ -0,0 +1,88 @@
1require gcc-configure-common.inc
2
3EXTRA_OECONF_PATHS = "\
4 --with-sysroot=/not/exist \
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8# An arm hard float target like raspberrypi4 won't build
9# as CFLAGS don't make it to the fortran compiler otherwise
10# (the configure script sets FC to $GFORTRAN unconditionally)
11export GFORTRAN = "${FC}"
12
13do_configure () {
14 for target in libbacktrace libgfortran
15 do
16 rm -rf ${B}/${TARGET_SYS}/$target/
17 mkdir -p ${B}/${TARGET_SYS}/$target/
18 cd ${B}/${TARGET_SYS}/$target/
19 chmod a+x ${S}/$target/configure
20 relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
21 ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
22 # Easiest way to stop bad RPATHs getting into the library since we have a
23 # broken libtool here
24 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
25 done
26}
27EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
29
30do_compile () {
31 for target in libbacktrace libgfortran
32 do
33 cd ${B}/${TARGET_SYS}/$target/
34 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
35 done
36}
37
38do_install () {
39 cd ${B}/${TARGET_SYS}/libgfortran/
40 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
41 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
42 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
43 fi
44 if [ -d ${D}${infodir} ]; then
45 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
46 fi
47 chown -R root:root ${D}
48}
49
50INHIBIT_DEFAULT_DEPS = "1"
51DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}"
52
53#BBCLASSEXTEND = "nativesdk"
54
55PACKAGES = "\
56 ${PN}-dbg \
57 libgfortran \
58 libgfortran-dev \
59 libgfortran-staticdev \
60"
61
62LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
63LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
64LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
65
66FILES:${PN} = "${libdir}/libgfortran.so.*"
67FILES:${PN}-dev = "\
68 ${libdir}/libgfortran*.so \
69 ${libdir}/libgfortran.spec \
70 ${libdir}/libgfortran.la \
71 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
72 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
73 ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
74 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
75"
76FILES:${PN}-staticdev = "${libdir}/libgfortran.a"
77
78INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev"
79
80do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
81do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
82do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
83
84python __anonymous () {
85 f = d.getVar("FORTRAN")
86 if "fortran" not in f:
87 raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
88}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb
new file mode 100644
index 00000000..71dd8b4b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgfortran.inc
3
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.%.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
new file mode 100644
index 00000000..67c40845
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
@@ -0,0 +1 @@
COMPATIBLE_HOST:microblaze = "^$"
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
new file mode 100644
index 00000000..925b0c2f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc
@@ -0,0 +1,66 @@
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 = "${WORKDIR}/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=${WORKDIR}/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
new file mode 100644
index 00000000..c463574b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc
@@ -0,0 +1,44 @@
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=${WORKDIR}/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 > ${WORKDIR}/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 ${WORKDIR}/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
new file mode 100644
index 00000000..4ab2b715
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_12.1.bb
@@ -0,0 +1,3 @@
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
new file mode 100644
index 00000000..b418f3a3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc
@@ -0,0 +1,31 @@
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
new file mode 100644
index 00000000..3b654a2f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross_12.1.bb
@@ -0,0 +1,2 @@
1require gdb-cross.inc
2require gdb.inc
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb.inc b/meta-microblaze/recipes-devtools/gdb/gdb.inc
new file mode 100644
index 00000000..a5dc5545
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb.inc
@@ -0,0 +1,20 @@
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.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
index a5f3acd2..050bdde5 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-Add-initial-port-of-linux-gdbserver.patch
@@ -17,6 +17,8 @@ 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
20Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 22Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
21Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 23Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 24Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
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
new file mode 100644
index 00000000..16d6cf19
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
@@ -0,0 +1,28 @@
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-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch
index a871b582..f7af2a62 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-Patch-MicroBlaze-Initial-port-of-core-reading-suppor.patch
@@ -6,6 +6,8 @@ Subject: [PATCH 2/8] [Patch,MicroBlaze]: Initial port of core reading support
6 PRSTATUS and PSINFO information for rebuilding ".reg" sections of core dumps 6 PRSTATUS and PSINFO information for rebuilding ".reg" sections of core dumps
7 at run time. 7 at run time.
8 8
9Upstream-Status: Pending
10
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> 11Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 12Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
11Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> 13Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
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
new file mode 100644
index 00000000..8d263de8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
@@ -0,0 +1,35 @@
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
index d2d06b54..d8ba6fca 100644
--- 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
@@ -3,6 +3,8 @@ From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000 3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 3/8] Fix debug message when register is unavailable 4Subject: [PATCH 3/8] Fix debug message when register is unavailable
5 5
6Upstream-Status: Pending
7
6Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> 8Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
7 9
8Conflicts: 10Conflicts:
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
new file mode 100644
index 00000000..7e09404b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
@@ -0,0 +1,52 @@
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
new file mode 100644
index 00000000..a1e85e91
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Dont-disable-libreadline.a-when-using-disable-static.patch
@@ -0,0 +1,50 @@
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-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch
index 90944525..08b0ae17 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Patch-MicroBlaze-MicroBlaze-native-gdb-port.patch
@@ -4,6 +4,10 @@ Date: Mon, 10 Oct 2022 18:53:46 +0530
4Subject: [PATCH 4/8] [Patch,MicroBlaze] : MicroBlaze native gdb port. 4Subject: [PATCH 4/8] [Patch,MicroBlaze] : 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--- 11---
8 gdb/Makefile.in | 2 + 12 gdb/Makefile.in | 2 +
9 gdb/configure.nat | 4 + 13 gdb/configure.nat | 4 +
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch
index caf20303..6eea28fe 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Patch-microblaze-Adding-64-bit-MB-support.patch
@@ -34,6 +34,10 @@ Conflicts:
34 gdb/regformats/microblaze-with-stack-protect.dat 34 gdb/regformats/microblaze-with-stack-protect.dat
35 gdbserver/linux-microblaze-low.c 35 gdbserver/linux-microblaze-low.c
36 include/elf/common.h 36 include/elf/common.h
37Upstream-Status: Pending
38
39Signed-off-by: Mark Hatle <mark.hatle@amd.com>
40
37--- 41---
38 bfd/Makefile.am | 2 + 42 bfd/Makefile.am | 2 +
39 bfd/Makefile.in | 3 + 43 bfd/Makefile.in | 3 +
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
new file mode 100644
index 00000000..242099b9
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-use-asm-sgidefs.h.patch
@@ -0,0 +1,36 @@
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-Change-order-of-CFLAGS.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch
new file mode 100644
index 00000000..58c9b1d0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Change-order-of-CFLAGS.patch
@@ -0,0 +1,30 @@
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/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
index 402d7fe1..9d12cc53 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-Patch-MicroBlaze-these-changes-will-make-64-bit-vect.patch
@@ -5,6 +5,10 @@ Subject: [PATCH 6/8] [Patch,MicroBlaze] : these changes will make 64 bit
5 vectors as default target types when we built gdb with microblaze 64 bit type 5 vectors as default target types when we built gdb with microblaze 64 bit type
6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64 6 targets,for instance microblaze-xilinx-elf64/microblazeel-xilinx-elf64
7 7
8Upstream-Status: Pending
9
10Signed-off-by: Mark Hatle <mark.hatle@amd.com>
11
8--- 12---
9 bfd/config.bfd | 8 ++++++++ 13 bfd/config.bfd | 8 ++++++++
10 1 file changed, 8 insertions(+) 14 1 file changed, 8 insertions(+)
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
index 59449bfa..ec11e7be 100644
--- 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
@@ -7,6 +7,10 @@ Subject: [PATCH 7/8] [Patch,MicroBlaze] : Added m64 abi for 64 bit target
7Conflicts: 7Conflicts:
8 gdb/microblaze-tdep.c 8 gdb/microblaze-tdep.c
9 gdb/microblaze-tdep.h 9 gdb/microblaze-tdep.h
10Upstream-Status: Pending
11
12Signed-off-by: Mark Hatle <mark.hatle@amd.com>
13
10--- 14---
11 gdb/features/microblaze64.xml | 1 + 15 gdb/features/microblaze64.xml | 1 +
12 gdb/microblaze-tdep.c | 159 ++++++++++++++++++++++++++++++++-- 16 gdb/microblaze-tdep.c | 159 ++++++++++++++++++++++++++++++++--
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
new file mode 100644
index 00000000..bbd1f0b2
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-resolve-restrict-keyword-conflict.patch
@@ -0,0 +1,48 @@
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/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
new file mode 100644
index 00000000..3e293276
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch
@@ -0,0 +1,55 @@
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
new file mode 100644
index 00000000..ed1310ce
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Fix-invalid-sigprocmask-call.patch
@@ -0,0 +1,49 @@
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/0008-Patch-MicroBlaze.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch
index 4c96fb49..941a3b9c 100644
--- a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Patch-MicroBlaze.patch
@@ -12,6 +12,10 @@ MIME-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
16
17Signed-off-by: Mark Hatle <mark.hatle@amd.com>
18
15--- 19---
16 gdb/microblaze-tdep.c | 14 +++----------- 20 gdb/microblaze-tdep.c | 14 +++-----------
17 1 file changed, 3 insertions(+), 11 deletions(-) 21 1 file changed, 3 insertions(+), 11 deletions(-)
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
new file mode 100644
index 00000000..f53d3bd1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-gdbserver-ctrl-c-handling.patch
@@ -0,0 +1,40 @@
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/readline-8.2.patch b/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch
new file mode 100644
index 00000000..c2db4c0d
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb/readline-8.2.patch
@@ -0,0 +1,39 @@
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
new file mode 100644
index 00000000..9c6db4ca
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gdb/gdb_12.1.bb
@@ -0,0 +1,39 @@
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 > ${WORKDIR}/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 ${WORKDIR}/python
37 fi
38}
39
diff --git a/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch b/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch
index b8b40fb8..2821e55f 100644
--- a/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch
+++ b/meta-microblaze/recipes-devtools/m4/files/m4-stack-direction-microblaze.patch
@@ -1,3 +1,9 @@
1Need a broader match for microblazeel.
2
3Upstream-Status: Pending
4
5Signed-off-by: Mark Hatle <mark.hatle@amd.com>
6
1--- m4-1.4.19/m4/stack-direction.m4.orig 2021-11-30 13:19:56.005640547 -0800 7--- m4-1.4.19/m4/stack-direction.m4.orig 2021-11-30 13:19:56.005640547 -0800
2+++ m4-1.4.19/m4/stack-direction.m4 2021-11-30 13:20:03.917640741 -0800 8+++ m4-1.4.19/m4/stack-direction.m4 2021-11-30 13:20:03.917640741 -0800
3@@ -35,7 +35,7 @@ 9@@ -35,7 +35,7 @@
diff --git a/meta-microblaze/recipes-devtools/python/python3_%.bbappend b/meta-microblaze/recipes-devtools/python/python3_%.bbappend
new file mode 100644
index 00000000..9ea0eac5
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/python/python3_%.bbappend
@@ -0,0 +1,3 @@
1# Microblaze's libpython seems to be named slightly differently
2# /usr/lib/python3.11/config-3.11/libpython3.11.a
3FILES:libpython3-staticdev:append:microblaze = " ${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}/libpython${PYTHON_MAJMIN}.a"
diff --git a/meta-microblaze/recipes-extended/grep/files/m4-stack-direction-microblaze.patch b/meta-microblaze/recipes-extended/grep/files/m4-stack-direction-microblaze.patch
deleted file mode 100644
index b8b40fb8..00000000
--- a/meta-microblaze/recipes-extended/grep/files/m4-stack-direction-microblaze.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- m4-1.4.19/m4/stack-direction.m4.orig 2021-11-30 13:19:56.005640547 -0800
2+++ m4-1.4.19/m4/stack-direction.m4 2021-11-30 13:20:03.917640741 -0800
3@@ -35,7 +35,7 @@
4 m68* | \
5 m88k | \
6 mcore | \
7- microblaze | \
8+ microblaze* | \
9 mips* | \
10 mmix | \
11 mn10200 | \
diff --git a/meta-microblaze/recipes-extended/grep/grep_%.bbappend b/meta-microblaze/recipes-extended/grep/grep_%.bbappend
deleted file mode 100644
index c0afc82d..00000000
--- a/meta-microblaze/recipes-extended/grep/grep_%.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
1FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files"
2SRC_URI:append:microblaze = " \
3 file://m4-stack-direction-microblaze.patch \
4"
diff --git a/meta-microblaze/recipes-extended/xz/xz_%.bbappend b/meta-microblaze/recipes-extended/xz/xz_%.bbappend
new file mode 100644
index 00000000..be8fffd8
--- /dev/null
+++ b/meta-microblaze/recipes-extended/xz/xz_%.bbappend
@@ -0,0 +1,5 @@
1# Microblaze doesn't support versioned symbols
2#
3# ../../../xz-5.4.1/src/liblzma/common/stream_encoder_mt.c:1283:1: error: symver is only supported on ELF platforms
4#
5EXTRA_OECONF:append:microblaze = " --disable-symbol-versions"
diff --git a/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend b/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend
new file mode 100644
index 00000000..7c80fb6c
--- /dev/null
+++ b/meta-microblaze/recipes-graphics/mesa/mesa_%.bbappend
@@ -0,0 +1,14 @@
1# mesa doesn't compile with microblaze compiler
2
3#
4# When building POKY, it's advised that the user set the following:
5#
6# POKY_DEFAULT_DISTRO_FEATURES:microblaze = "ptest"
7#
8# The original version is: POKY_DEFAULT_DISTRO_FEATURES = "opengl ptest multiarch wayland vulkan"
9#
10# opengl, wayland and vulkan are not supported, primarily due to mesa not compiling.
11#
12# multiarch is not something we have on microblaze, so can be left or removed
13#
14COMPATIBLE_MACHINE:microblaze = "none"